sys_led.h File Reference


Detailed Description

LED module C header file.

REVISION

Definition in file sys_led.h.

#include "stdio.h"
#include "stdlib.h"
#include "sys_cpld.h"

Include dependency graph for sys_led.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Enumerations

enum  LED_ID { HISI_LED, KBD_LED, ALL_LED, invalid_LED }
 LED ID definitions. More...
enum  LED_MODE { LED_ON, LED_OFF }
 LED on off mode definitions. More...

Functions

void SYS_blinkLEDs (LED_ID, int, int)
 Function blinks specified LED in given mode.
void SYS_onOffLEDs (LED_ID, LED_MODE)
 Funtion is to turn on or off the specified LED, write to port to turn on LED, read from port to turn off LED.


Enumeration Type Documentation

enum LED_ID
 

LED ID definitions.

Enumeration values:
HISI_LED  LED under HiSi button.
KBD_LED  The rest of the LEDs.
ALL_LED  All available LEDs.
invalid_LED  Invalid LED types.

Definition at line 34 of file sys_led.h.

00035 {
00038     HISI_LED,
00039     
00042     KBD_LED,
00043     
00046     ALL_LED,
00047     
00050     invalid_LED
00051 } LED_ID;

enum LED_MODE
 

LED on off mode definitions.

Enumeration values:
LED_ON  Turn ON LED.
LED_OFF  Turn OFF LED.

Definition at line 56 of file sys_led.h.

00057 {
00060     LED_ON,
00061 
00064     LED_OFF
00065 
00066 } LED_MODE;


Function Documentation

void SYS_blinkLEDs LED_ID  ledID,
int  iPeriod,
int  iCounter
 

Function blinks specified LED in given mode.

Parameters:
ledID LED ID specifier.
iPeriod blink period in mili-seconds.
iCounter number of blink times, if -1, blinks for ever.

Definition at line 38 of file SYS_led.c.

References LED_OFF, LED_ON, SYS_delayMicrosecond(), and SYS_onOffLEDs().

00039 {   
00040     unsigned long delay = iPeriod*1000; // Convert to micro seconds.  
00041     
00042     if(iCounter == -1) 
00043     {
00044         while(1)
00045         {
00046             SYS_onOffLEDs(ledID, LED_ON);
00047             
00048             SYS_delayMicrosecond(delay);
00049             
00050             SYS_onOffLEDs(ledID, LED_OFF);
00051             
00052             SYS_delayMicrosecond(delay);        
00053         }
00054     }
00055     
00056     while(iCounter--)
00057     {
00058         SYS_onOffLEDs(ledID, LED_ON);
00059     
00060         SYS_delayMicrosecond(delay);
00061             
00062         SYS_onOffLEDs(ledID, LED_OFF);
00063             
00064         SYS_delayMicrosecond(delay);        
00065     }
00066 }

Here is the call graph for this function:

void SYS_onOffLEDs LED_ID  ledID,
LED_MODE  onOff
 

Funtion is to turn on or off the specified LED, write to port to turn on LED, read from port to turn off LED.

Parameters:
ledID LED ID specifier.
onOff LED on/off mode.

Definition at line 79 of file SYS_led.c.

References ALL_LED, HISI_LED, and KBD_LED.

Referenced by SYS_blinkLEDs(), SYS_kickoff(), SYS_main(), SYS_SF_idle(), UI_MSF_backlight(), UI_PSF_null(), and UI_PSF_sleep().

00080 {
00081     int tmp;
00082 
00083     switch(ledID)
00084     {
00085         case HISI_LED: // HiSi LED.  
00086 
00087             if(onOff == LED_ON) LED_KBD_HISI = 0;
00088             else                tmp = LED_KBD_HISI;         
00089             
00090             break;
00091 
00092         case KBD_LED: // The rest of the LEDs.  
00093             
00094             if(onOff == LED_ON) LED_KBD_ALL = 0;
00095             else                tmp = LED_KBD_ALL;
00096     
00097             break;
00098 
00099         case ALL_LED: // All LEDs.  
00100         default:
00101             
00102             if(onOff == LED_ON)  
00103             {                    
00104                 LED_KBD_ALL = 0;
00105                 LED_KBD_HISI = 0;
00106             }
00107             
00108             else
00109             {
00110                 tmp = LED_KBD_ALL;
00111                 tmp = LED_KBD_HISI;         
00112             }
00113                         
00114             break;
00115     }
00116 }


Generated on Wed Jan 19 01:13:18 2005 for neuros-firmware by  doxygen 1.3.9.1