#include <io.h>
Defines | |
#define | BTN_LED_INFINITE 0xFF |
#define | BTN_LED_MAX_PATTERN_QUEUE 5 |
LED Patterns | |
Several patterns can be queued up. During a pattern-flashing all LED activities (setting and clearing) will be stored and shown after the pattern is over. | |
#define | BTN_LED_PATTERN_DOWN 6 |
#define | BTN_LED_PATTERN_HALF 8 |
#define | BTN_LED_PATTERN_KNIGHT 7 |
#define | BTN_LED_PATTERN_NON 0 |
#define | BTN_LED_PATTERN_OFF_ON 3 |
#define | BTN_LED_PATTERN_OFF_ON_OFF 4 |
#define | BTN_LED_PATTERN_ON 1 |
#define | BTN_LED_PATTERN_ON_OFF 2 |
#define | BTN_LED_PATTERN_UP 5 |
Functions | |
void | btn_led_add_pattern (u_char pattern, u_char arg, u_char speed, u_char nr) |
Different patterns can be shown! With different speed and reiterations. | |
void | btn_led_clear (u_char nr) |
Turns off LED 0-3. | |
void | btn_led_clear_pattern_queue (void) |
To clear the pattern queue. | |
void | btn_led_heartbeat (u_char pause, u_char bit_pattern, u_char duration) |
Sets the heartbeat pause and the bit_pattern that will be shown instead of a heartbeat with given duration. | |
void | btn_led_init (u_char thread_on) |
Hardware setup for LED access. | |
void | btn_led_set (u_char nr) |
Turns on LED 0-3. | |
Variables | |
u_char | _btn_led_pattern_enabled |
If 0 then the led pattern queue remains cleared. Thus only btn_led_set and btn_led_clear is effective. |
#define BTN_LED_INFINITE 0xFF |
defines infinite time for showing a pattern
#define BTN_LED_MAX_PATTERN_QUEUE 5 |
Max number of pattern that can be stored at once
#define BTN_LED_PATTERN_DOWN 6 |
each led flashing once going down
#define BTN_LED_PATTERN_HALF 8 |
lower two leds flashing, later upper two leds
#define BTN_LED_PATTERN_KNIGHT 7 |
knight-rider effect
#define BTN_LED_PATTERN_NON 0 |
No pattern, only heartbeat or other user settings
#define BTN_LED_PATTERN_OFF_ON 3 |
inverse of BTN_LED_PATTERN_ON_OFF
#define BTN_LED_PATTERN_OFF_ON_OFF 4 |
smimilar of BTN_LED_PATTERN_ON_OFF
#define BTN_LED_PATTERN_ON 1 |
flashing the selected leds once (arg 0-8 for led selection)
#define BTN_LED_PATTERN_ON_OFF 2 |
flashing the selected leds once, after all off for same time (arg 0-8 for led selection)
#define BTN_LED_PATTERN_UP 5 |
each led flashing once going up
Different patterns can be shown! With different speed and reiterations.
This function adds the pattern if a pattern is already showing!
Use btn_led_clear_pattern_queue() to delete the pattern queue!
Nr can be BTN_LED_INFINITE (0xFF) to display pattern infinitely till btn_led_clear_pattern_queue() is called!
pattern | One of the pattern described above. | |
arg | Some patterns need an argument to select the LEDs | |
speed | Speed of the pattern in 100ms (0 not valid) | |
nr | Number of repetition of this pattern (can be BTN_LED_INFINITE) |
void btn_led_clear | ( | u_char | nr | ) |
Turns off LED 0-3.
nr | The LED-Number (0-3) |
Sets the heartbeat pause and the bit_pattern that will be shown instead of a heartbeat with given duration.
If this function is not called, a heatbeat with pattern 1 (LED 0) will be shown, only if no LED is turned on (to indicate that power is still o.k.)
pause | Quite-Time of heartbeat measured in 100ms | |
bit_pattern | 8-bit pattern that will flash as heartbeat | |
duration | Flash-duration measured in 100ms |
void btn_led_init | ( | u_char | thread_on | ) |
Hardware setup for LED access.
Call this function to use the on-board LEDs. If thread_on is set to 1 a new thread called "LED" will be started to display heartbeat and pattern. Passing 0 to the patterns and heartbeat won't work!
thread_on | Pass 1 to start the LED-thread to use heartbeat and patterns |
void btn_led_set | ( | u_char | nr | ) |
Turns on LED 0-3.
nr | The LED-Number (0-3) |