led.c File Reference

Go to the source code of this file.

Functions

void InitLED (LEDEventT *led)
 Configures LED connection port.
void TimerCallback (HANDLE timer, void *arg)
 Callback function for LED blink and flash timer.
void sys_led (void *arg)
 Thread to control blinking and flashing of all registered LEDs.
void NutSetLed (HANDLE ledh, uint8_t tim, uint8_t fxin)
 sets state of a LED
int NutRegisterLed (HANDLE *ledh, int bank, int pin)
 register an LED for handling.

Variables

LEDEventT * first_led = NULL
HANDLE led_evt = NULL
HANDLE led_tmr = NULL


Function Documentation

void InitLED ( LEDEventT *  led  ) 

Configures LED connection port.

Note:
This is an internal function called by NutRegisterLED().

Definition at line 82 of file led.c.

References GPIO_CFG_OUTPUT, GpioPinConfigSet(), GpioPinSetHigh(), IOExpPinConfigSet(), IOExpSetBitHigh(), and IOXP_PORT0.

Referenced by NutRegisterLed().

void TimerCallback ( HANDLE  timer,
void *  arg 
)

Callback function for LED blink and flash timer.

Note:
This is an internal function of the led driver.

Definition at line 100 of file led.c.

References NutEventPostAsync().

void sys_led ( void *  arg  ) 

Thread to control blinking and flashing of all registered LEDs.

Note:
This is an internal function of the led driver.

Definition at line 112 of file led.c.

References first_led, LED_OFF, LED_ONESHOT, NUT_WAIT_INFINITE, NutEventWait(), NutSetLed(), and NutThreadSetPriority().

Referenced by NutSetLed().

void NutSetLed ( HANDLE  ledh,
uint8_t  tim,
uint8_t  fxin 
)

sets state of a LED

Parameters:
ledh the handle to the LED that should be controlled.
tim,: interval for blinking or time for oneshot.
fxin,: effect to set
LED_OFFswitch LED off
LED_ONswitch LED on
>LED_FLIPtoggle LED
>LED_BLINKlet LED blink
>LED_ONESHOTlet LED flash one time
Returns:
None.

Definition at line 153 of file led.c.

References GpioPinSet(), IOExpSetBit(), IOXP_PORT0, LED_BLINK, led_evt, LED_FLIP, LED_OFF, LED_ON, LED_ONESHOT, led_tmr, NutThreadCreate(), NutTimerStart(), sys_led(), and TimerCallback().

Referenced by sys_led().

int NutRegisterLed ( HANDLE ledh,
int  bank,
int  pin 
)

register an LED for handling.

Parameters:
ledh the led-handle for accessing the LED through NutSetLed().
bank,: Port of CPU or IO-Expander the LED is connected to.
pin,: Pin at the given port.
Returns:
-1 if registering failed, else 0.

Definition at line 199 of file led.c.

References first_led, InitLED(), malloc, and memset().


Variable Documentation

LEDEventT* first_led = NULL

Definition at line 72 of file led.c.

Referenced by NutRegisterLed(), and sys_led().

HANDLE led_evt = NULL

Definition at line 74 of file led.c.

Referenced by NutSetLed().

HANDLE led_tmr = NULL

Definition at line 75 of file led.c.

Referenced by NutSetLed().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/