uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
|
Handling of the on-board LEDs. More...
Functions | |
static void | apply_led (struct led *const led, bool value) |
Enables or disables an LED by writing the corresponding GPIO output register. More... | |
static void | set_or_update_blinking_led_state (struct led_state *const state, uint8_t prescaler) |
Initializes or updates an LED's blinking mode. More... | |
void | init_leds_module (void) |
Module initialization procedure. More... | |
void | register_led (struct led *const led) |
Add an LED to the cyclic processed LEDs. More... | |
void | blink_led (struct led *const led, const uint8_t prescaler) |
Lets an LED blink in a fixed interval. More... | |
void | flash_led (struct led *const led) |
Briefly flashes an LED. More... | |
void | flash_led_multiple (struct led *const led, const uint8_t count) |
Briefly flashes an LED. More... | |
void | set_led (struct led *const led, const bool value) |
Enables or disables an LED. More... | |
void | toggle_led (struct led *const led) |
Toggles an LED. More... | |
static void | update_flashing_led (uint8_t index) |
void | update_leds (void) |
State machine task that updates the LEDs. More... | |
Variables | |
static struct led * | leds [32] = { 0, } |
Internal array of pointers to known leds. More... | |
static uint8_t | registered_leds_count = 0 |
Number of registered LEDs. More... | |
static const struct gpio_pin | green_led_pin |
The GPIO pin the green LED is connected to. More... | |
static struct led | green_led |
The green on-board LED. More... | |
static const struct gpio_pin | red_led_pin |
The GPIO pin the red LED is connected to. More... | |
static struct led | red_led |
The red on-board LED. More... | |
struct led * | led_green = &green_led |
The green onboard LED. More... | |
struct led * | led_red = &red_led |
The green onboard LED. More... | |
Handling of the on-board LEDs.
|
inlinestatic |
Enables or disables an LED by writing the corresponding GPIO output register.
led | the LED to enable / disable |
value | true enables the LED; false disables it |
void blink_led | ( | struct led * | led, |
uint8_t | prescaler | ||
) |
Lets an LED blink in a fixed interval.
The prescaler parameter controls the blinking frequency: Every prescaler
th time the update_leds procedure is called, the LED is toggled.
led | the LED that should blink |
prescaler | controls the blinking frequency |
void flash_led | ( | struct led * | led | ) |
void flash_led_multiple | ( | struct led * | led, |
uint8_t | count | ||
) |
Briefly flashes an LED.
led | the LED that should flash |
count | the LED will flash this many times |
void init_leds_module | ( | void | ) |
Module initialization procedure.
Writes relevant AVR GPIO configuration for the onboard LEDs
void register_led | ( | struct led * | const | ) |
Add an LED to the cyclic processed LEDs.
Writes relevant AVR GPIO configuration for the given LEDs and adds the given pointer that contains the corresponding gpio_pin
void set_led | ( | struct led * | led, |
bool | enable | ||
) |
Enables or disables an LED.
led | the LED that should be enabled/disabled |
enable | true switches the LED on; false swithes off |
|
static |
Initializes or updates an LED's blinking mode.
Aborts if neither mode nor prescaler have changed
state | state variable of the led |
prescaler | Prescaler for the blinking frequency |
void toggle_led | ( | struct led * | led | ) |
|
static |
void update_leds | ( | void | ) |
State machine task that updates the LEDs.
This task must be included in the state machine tasks for the blink and flash modes to work.
|
static |
The green on-board LED.
|
static |
The GPIO pin the green LED is connected to.
|
static |
Internal array of pointers to known leds.
|
static |
The red on-board LED.
|
static |
The GPIO pin the red LED is connected to.
|
static |
Number of registered LEDs.