/* * File: CheckLightSensorTestHarnessmain.c * Author: COSMOS * * Created on July 25, 2018, 10:56 AM */#include <stdio.h>#include <stdlib.h>#include "serial.h"#include "BOARD.h"#include "roach.h"#include "timers.h"#include "CheckLightSensor.h"#define TIMER_A 0/* * */int main(int argc, char** argv) { TIMERS_Init(); SERIAL_Init(); BOARD_Init(); Roach_Init(); printf("Test...\r\n"); TIMERS_InitTimer(TIMER_A, 100); while(1){ while (TIMERS_IsTimerActive(TIMER_A)); TIMERS_InitTimer(TIMER_A, 100); CheckLightSensor(); } return (EXIT_SUCCESS);}/* ************************************************************************** *//** Descriptive File Name @Company Company Name @File Name filename.h @Summary Brief description of the file. @Description Describe the purpose of this file. *//* ************************************************************************** */#ifndef _EXAMPLE_FILE_NAME_H /* Guard against multiple inclusion */#define _EXAMPLE_FILE_NAME_H/*** @Function CheckLightSensor(void)* @param none* @return 0 if roach is in the darkness, 1 if the roach is in the light.* @brief This function reads the light level and updates the LED bar on the* roach to show a bar graph of this reading. It also returns a 0 or 1 to* indicate whether the roach is in light or shadow.* @author YOUR NAMES */char CheckLightSensor(void);/* ************************************************************************** *//* ************************************************************************** *//* Section: Included Files *//* ************************************************************************** *//* ************************************************************************** *//* This section lists the other files that are included in this file. *//* TODO: Include other files here if needed. *//* Provide C++ Compatibility */#ifdef __cplusplusextern "C" {#endif /* ************************************************************************** */ /* ************************************************************************** */ /* Section: Constants */ /* ************************************************************************** */ /* ************************************************************************** */ /* A brief description of a section can be given directly below the section banner. */ /* ************************************************************************** */ /** Descriptive Constant Name @Summary Brief one-line summary of the constant. @Description Full description, explaining the purpose and usage of the constant. <p> Additional description in consecutive paragraphs separated by HTML paragraph breaks, as necessary. <p> Type "JavaDoc" in the "How Do I?" IDE toolbar for more information on tags. @Remarks Any additional remarks */#define EXAMPLE_CONSTANT 0 // ***************************************************************************** // ***************************************************************************** // Section: Data Types // ***************************************************************************** // ***************************************************************************** /* A brief description of a section can be given directly below the section banner. */ // ***************************************************************************** /** Descriptive Data Type Name @Summary Brief one-line summary of the data type. @Description Full description, explaining the purpose and usage of the data type. <p> Additional description in consecutive paragraphs separated by HTML paragraph breaks, as necessary. <p> Type "JavaDoc" in the "How Do I?" IDE toolbar for more information on tags. @Remarks Any additional remarks <p> Describe enumeration elements and structure and union members above each element or member. */ typedef struct _example_struct_t { /* Describe structure member. */ int some_number; /* Describe structure member. */ // bool some_flag; } example_struct_t; // ***************************************************************************** // ***************************************************************************** // Section: Interface Functions // ***************************************************************************** // ***************************************************************************** /* A brief description of a section can be given directly below the section banner. */ // ***************************************************************************** /** @Function int ExampleFunctionName ( int param1, int param2 ) @Summary Brief one-line description of the function. @Description Full description, explaining the purpose and usage of the function. <p> Additional description in consecutive paragraphs separated by HTML paragraph breaks, as necessary. <p> Type "JavaDoc" in the "How Do I?" IDE toolbar for more information on tags. @Precondition List and describe any required preconditions. If there are no preconditions, enter "None." @Parameters @param param1 Describe the first parameter to the function. @param param2 Describe the second parameter to the function. @Returns List (if feasible) and describe the return values of the function. <ul> <li>1 Indicates an error occurred <li>0 Indicates an error did not occur </ul> @Remarks Describe any special behavior not described above. <p> Any additional remarks. @Example @code if(ExampleFunctionName(1, 2) == 0) { return 3; } */ int ExampleFunction(int param1, int param2); /* Provide C++ Compatibility */#ifdef __cplusplus}#endif#endif /* _EXAMPLE_FILE_NAME_H *//* ***************************************************************************** End of File *//* ************************************************************************** *//** Descriptive File Name @Company Company Name @File Name filename.c @Summary Brief description of the file. @Description Describe the purpose of this file. *//* ************************************************************************** *//* ************************************************************************** *//* ************************************************************************** *//* Section: Included Files *//* ************************************************************************** *//* ************************************************************************** *//* This section lists the other files that are included in this file. *//* TODO: Include other files here if needed. */#include <stdio.h>#include <stdlib.h>#include "serial.h"#include "BOARD.h"#include "roach.h"#include "timers.h"#include "CheckLightSensor.h"/* ************************************************************************** *//* ************************************************************************** *//* Section: File Scope or Global Data *//* ************************************************************************** *//* ************************************************************************** *//* A brief description of a section can be given directly below the section banner. *//* ************************************************************************** *//** Descriptive Data Item Name @Summary Brief one-line summary of the data item. @Description Full description, explaining the purpose and usage of data item. <p> Additional description in consecutive paragraphs separated by HTML paragraph breaks, as necessary. <p> Type "JavaDoc" in the "How Do I?" IDE toolbar for more information on tags. @Remarks Any additional remarks *//* ************************************************************************** *//* ************************************************************************** */// Section: Local Functions *//* ************************************************************************** *//* ************************************************************************** *//* A brief description of a section can be given directly below the section banner. *//* ************************************************************************** */char CheckLightSensor(void){ int light_level; light_level = Roach_LightLevel(); if (light_level < 512){ Roach_LEDSSet(0b111111111111); printf("ITS TOOOOO MUCH LIGHTTTTT!!!!\r\n"); return 1; } else { Roach_LEDSSet(0b000000000000); printf("TOO DARK!\r\n"); return 0; }}/** @Function int ExampleLocalFunctionName ( int param1, int param2 ) @Summary Brief one-line description of the function. @Description Full description, explaining the purpose and usage of the function. <p> Additional description in consecutive paragraphs separated by HTML paragraph breaks, as necessary. <p> Type "JavaDoc" in the "How Do I?" IDE toolbar for more information on tags. @Precondition List and describe any required preconditions. If there are no preconditions, enter "None." @Parameters @param param1 Describe the first parameter to the function. @param param2 Describe the second parameter to the function. @Returns List (if feasible) and describe the return values of the function. <ul> <li>1 Indicates an error occurred <li>0 Indicates an error did not occur </ul> @Remarks Describe any special behavior not described above. <p> Any additional remarks. @Example @code if(ExampleFunctionName(1, 2) == 0) { return 3; } *//* ************************************************************************** *//* ************************************************************************** */// Section: Interface Functions *//* ************************************************************************** *//* ************************************************************************** *//* A brief description of a section can be given directly below the section banner. */// *****************************************************************************/** @Function int ExampleInterfaceFunctionName ( int param1, int param2 ) @Summary Brief one-line description of the function. @Remarks Refer to the example_file.h interface header for function usage details. *//* ***************************************************************************** End of File */