mcu_led.c

Go to the documentation of this file.
00001 
00026 #include <includes.h>
00027 
00028 static volatile signed int mcu_led_green_count; 
00029 static volatile signed int mcu_led_red_count; 
00030 static volatile signed int mcu_led_blue_count; 
00036 void mcu_led_init(void){
00037   mcu_led_green_count = -1;
00038   mcu_led_red_count = -1;
00039   mcu_led_blue_count = -1;
00040 }
00041 
00046 void mcu_led_update(void){
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 }
00054 
00060 void mcu_led_green_blink(int time_ms){
00061   mcu_led_green_count = time_ms * SCHED_SPEED;
00062   mcu_led_green_on();
00063 }
00069 void mcu_led_blue_blink(int time_ms){
00070   mcu_led_blue_count = time_ms * SCHED_SPEED;
00071   mcu_led_blue_on();
00072 }
00078 void mcu_led_red_blink(int time_ms){
00079   mcu_led_red_count = time_ms * SCHED_SPEED;
00080   mcu_led_red_on();
00081 }
00082 
00083 void mcu_led_green_on(void){ FIO1CLR = (1<<23); }
00084 void mcu_led_green_off(void){ FIO1SET = (1<<23); }
00085 void mcu_led_green_toggle(void){ if(FIO1PIN & (1<<23)){mcu_led_green_on();} else{mcu_led_green_off();}}
00086 void mcu_led_red_on(void){ FIO1CLR = (1<<24); }
00087 void mcu_led_red_off(void){ FIO1SET = (1<<24); }
00088 void mcu_led_red_toggle(void){ if(FIO1PIN & (1<<24)){mcu_led_red_on();} else{mcu_led_red_off();}}
00089 void mcu_led_blue_on(void){ FIO1CLR = (1<<25); }
00090 void mcu_led_blue_off(void){ FIO1SET = (1<<25); }
00091 void mcu_led_blue_toggle(void){ if(FIO1PIN & (1<<25)){mcu_led_blue_on();} else{mcu_led_blue_off();}}
00092 void mcu_led_all_on(void){
00093   mcu_led_green_on();
00094   mcu_led_red_on();
00095   mcu_led_blue_on();
00096 }
00097 void mcu_led_all_off(void){
00098   mcu_led_green_off();
00099   mcu_led_red_off();
00100   mcu_led_blue_off();
00101 }
00102 void mcu_led_all_toggle(void){
00103   mcu_led_green_toggle();
00104   mcu_led_red_toggle();
00105   mcu_led_blue_toggle();
00106 }
00107 
Generated on Tue Jun 29 16:36:14 2010 by  doxygen 1.6.3