|
void | LedInit (void) |
| Initialize LED driver. Must be called before LedSet() or LedCounting() can be called.
|
|
void | LedSet (uint32_t Leds, uint32_t Function) |
| Sets LED(s) function (on/off/flash). More...
|
|
static void | LedCounting (uint32_t Leds, const struct led_counting_t *Function) |
| Sets LED(s) to counting function. More...
|
|
Totally 32 LEDs can be updated. Functionality included if LED_ENABLED is set true:
- Initialization of led function
- Setting of LEDs, off, on or flashing. (several flashing pattern can be defined).
- Led counting (number of count and timing is selectable).
if flashing functions are wanted LED_FLASHING_ENABLED must be set true and the number of flashing pattern must be defined by NUMBER_OF_FLASHING_PATTERN. Each flashing pattern must be defined in table "struct led_flash_t LedFlashing[]" in Board.c. if counting function is wanted LED_COUNTING_ENABLED must be set true.
Output function for setting each led is based of the inline code UpdateLeds().
Indexes of the Time array in the struct led_counting_t
Enumerator |
---|
COUNTING_ON |
Time in processor ticks LED(s) is on.
|
COUNTING_OFF |
Time in processor ticks LED(s) is off.
|
COUNTING_PAUSE |
Pause time in processor ticks between flashing series.
|
NUMBER_OF_COUNTING_TIMES |
Gives array size.
|
Definition at line 67 of file led.h.
Input parameters for LedSet() function
Enumerator |
---|
LED_OFF |
Set LED(s) off.
|
LED_ON |
Set LED(s) on.
|
LED_FLASHING |
Set LED(s) to constant flashing.
|
LED_INVERT_FLASHING |
Set LED(s) to constant invert flashing.
|
Definition at line 90 of file led.h.
void LedSet |
( |
uint32_t |
Leds, |
|
|
uint32_t |
Function |
|
) |
| |
Sets LED(s) function (on/off/flash).
- Parameters
-
Leds | Each bit position (0-31) represent a LED. New function can be set for several Leds in one function call. If no LEDs are already flashing, the flashing sequence is restarted. |
Function | Select LED functionality: LED_OFF LED_ON LED_FLASHING + type of LED flashing pattern (0 to max 99)
- optional LED_INVERT_FLASHING if inverted flashing pattern is wanted
|
Referenced by LedCounting().
static void LedCounting |
( |
uint32_t |
Leds, |
|
|
const struct led_counting_t * |
Function |
|
) |
| |
|
inlinestatic |
Sets LED(s) to counting function.
- Parameters
-
Leds | Each bit position (0-31) represent a LED. New function can be set for several Leds in one function call. The counting sequence is stopped by LedSet(LED_OFF) |
Function | Select LED funtionality: .Count - number of counts (0-255) .Invert - true is invert, else false .Time[COUNTING_ON] - counting pulse on time, .Time[COUNTING_OFF] - counting pulse off time .Time[COUNTING_PAUSE]- pause between counting sequences, set to 0 if only one counting sequence is wanted .Time[] is 1/1.024 ms resolution, use MWORK_MSEC(). |
Definition at line 145 of file led.h.
References LedSet().
static void UpdateLeds |
( |
uint32_t |
BitLedOn | ) |
|
|
static |
User supplied function to update LEDs.
The function must be provided to LED driver in board.h and allows application to use for example GPIO expanders instead of processor' GPIO to drive LEDs.
LED bit positions are abstract and application can map them to physical GPIO if required. So for example if application requests to turn LED #2 on, then the driver calls this UpdateLeds() callback with bit #2 settled.
- Parameters
-
BitLedOn | Bit values (on/off) for all 32 LEDs |