mcu_led.c File Reference

Controls for the microcontroller LEDs on satellite boards. More...

Go to the source code of this file.

Functions

void mcu_led_all_off (void)
void mcu_led_all_on (void)
void mcu_led_all_toggle (void)
void mcu_led_blue_blink (int time_ms)
 Turns on the blue led for the given amount of time.
void mcu_led_blue_off (void)
void mcu_led_blue_on (void)
void mcu_led_blue_toggle (void)
void mcu_led_green_blink (int time_ms)
 Turns on the green led for the given amount of time.
void mcu_led_green_off (void)
void mcu_led_green_on (void)
void mcu_led_green_toggle (void)
void mcu_led_init (void)
 Initializes the mcu_led module.
void mcu_led_red_blink (int time_ms)
 Turns on the red led for the given amount of time.
void mcu_led_red_off (void)
void mcu_led_red_on (void)
void mcu_led_red_toggle (void)
void mcu_led_update (void)
 Updates all of the leds.

Variables

static volatile signed int mcu_led_blue_count
 Curren count of the blue led timer.
static volatile signed int mcu_led_green_count
 Curren count of the green led timer.
static volatile signed int mcu_led_red_count
 Curren count of the red led timer.

Detailed Description

Controls for the microcontroller LEDs on satellite boards.

Requires SCHED_SPEED to be accurately defined in khz.

Example Hardware and Register setup for the LEDs:

  // ***********************************************
  // Heartbeat Init Section
  // ***********************************************
  //On-board LED initialization
  PINSEL2 &= ~(1<<3);   // set trace port for GPIO use (bit 3 = 0)
  FIO1DIR |= (1<<23);   // set P1.23 to be output (Green LED)
  FIO1DIR |= (1<<24);   // set P1.24 to be output (Red LED)
  FIO1DIR |= (1<<25);   // set P1.25 to be output (Blue LED)
  MCU_LED_ALL_OFF; 
Author:
Nicolas Williamson
Date:
January 2010

Definition in file mcu_led.c.


Function Documentation

void mcu_led_blue_blink ( int  time_ms  ) 

Turns on the blue led for the given amount of time.

Parameters:
time_ms The time the led should be on, in milliseconds.
Note:
If SCHED_SPEED is not defined, this function will not work properly.

Definition at line 69 of file mcu_led.c.

References mcu_led_blue_count.

00069                                     {
00070   mcu_led_blue_count = time_ms * SCHED_SPEED;
00071   mcu_led_blue_on();
00072 }

void mcu_led_green_blink ( int  time_ms  ) 

Turns on the green led for the given amount of time.

Parameters:
time_ms The time the led should be on, in milliseconds.
Note:
If SCHED_SPEED is not defined, this function will not work properly.

Definition at line 60 of file mcu_led.c.

References mcu_led_green_count.

00060                                      {
00061   mcu_led_green_count = time_ms * SCHED_SPEED;
00062   mcu_led_green_on();
00063 }

void mcu_led_init ( void   ) 

Initializes the mcu_led module.

Call this from software setup.

Definition at line 36 of file mcu_led.c.

References mcu_led_blue_count, mcu_led_green_count, and mcu_led_red_count.

00036                        {
00037   mcu_led_green_count = -1;
00038   mcu_led_red_count = -1;
00039   mcu_led_blue_count = -1;
00040 }

void mcu_led_red_blink ( int  time_ms  ) 

Turns on the red led for the given amount of time.

Parameters:
time_ms The time the led should be on, in milliseconds.
Note:
If SCHED_SPEED is not defined, this function will not work properly.

Definition at line 78 of file mcu_led.c.

References mcu_led_red_count.

00078                                    {
00079   mcu_led_red_count = time_ms * SCHED_SPEED;
00080   mcu_led_red_on();
00081 }

void mcu_led_update ( void   ) 

Updates all of the leds.

Call this from every row of the schedule.

Definition at line 46 of file mcu_led.c.

References mcu_led_blue_count, mcu_led_green_count, and mcu_led_red_count.

00046                          {
00047   if (mcu_led_green_count > -1){mcu_led_green_count--;} 
00048   if (mcu_led_green_count == 0) {mcu_led_green_off();}
00049   if (mcu_led_blue_count > -1){mcu_led_blue_count--;} 
00050   if (mcu_led_blue_count == 0) {mcu_led_blue_off();}
00051   if (mcu_led_red_count > -1){mcu_led_red_count--;} 
00052   if (mcu_led_red_count == 0) {mcu_led_red_off();}
00053 }


Variable Documentation

volatile signed int mcu_led_blue_count [static]

Curren count of the blue led timer.

Definition at line 30 of file mcu_led.c.

Referenced by mcu_led_blue_blink(), mcu_led_init(), and mcu_led_update().

volatile signed int mcu_led_green_count [static]

Curren count of the green led timer.

Definition at line 28 of file mcu_led.c.

Referenced by mcu_led_green_blink(), mcu_led_init(), and mcu_led_update().

volatile signed int mcu_led_red_count [static]

Curren count of the red led timer.

Definition at line 29 of file mcu_led.c.

Referenced by mcu_led_init(), mcu_led_red_blink(), and mcu_led_update().

Generated on Tue Jun 29 16:36:15 2010 by  doxygen 1.6.3