
126 Chapter 9: Putting It All Together
/*********************************************************************
*
* Function: main()
*
* Description: This function is responsible for starting the ADEOS
* scheduler only.
*
* Notes:
*
* Returns: This function will never return!
*
*********************************************************************/
void
main(void)
{
os.start();
// This point will never be reached.
} /* main() */
Flashing the LED
As I said earlier, one of two things this application does is blink the red LED. This
is done by the code shown below. Here the function flashRed is executed as a
task. However, ignoring that and the new function name, this is almost exactly the
same Blinking LED function we studied in Chapter 7, Peripherals. The only differ-
ences at this level are the new frequency (10 Hz) and LED color (red).
#include "led.h"
#include "timer.h"
/**********************************************************************
*
* Function: flashRed()
*
* Description: Blink the red LED ten times a second.
*
* Notes: This outer loop is hardware-independent. However, it
* calls the hardware-dependent function toggleLed().
*
* Returns: This routine contains an infinite loop.
*
**********************************************************************/
void
flashRed(void)
{
Timer timer;
timer.start(50, Periodic); // Start a periodic 50 ms timer.