uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
Data Structures | Macros | Enumerations | Functions | Variables
leds.h File Reference

Handling of the on-board LEDs. More...

#include <stdbool.h>
#include <avr/io.h>
#include "gpio.h"
Include dependency graph for leds.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  led_state
 Internal state of an LED. More...
 
struct  led
 Enumeration for the on-board LEDs. More...
 

Macros

#define LED_GREEN   led_green
 TODO: This macro is only for compatibility and should be removed in the future. More...
 
#define LED_RED   led_red
 TODO: This macro is only for compatibility and should be removed in the future. More...
 

Enumerations

enum  led_mode { LED_STATIC, LED_FLASH, LED_BLINK }
 Enumeration for the LED mode. More...
 

Functions

void init_leds_module (void)
 Module initialization procedure. More...
 
void register_led (struct led *const)
 Add an LED to the cyclic processed LEDs. More...
 
void blink_led (struct led *led, uint8_t prescaler)
 Lets an LED blink in a fixed interval. More...
 
void flash_led (struct led *led)
 Briefly flashes an LED. More...
 
void flash_led_multiple (struct led *led, uint8_t count)
 Briefly flashes an LED. More...
 
void set_led (struct led *led, bool enable)
 Enables or disables an LED. More...
 
void toggle_led (struct led *led)
 Toggles an LED. More...
 
void update_leds (void)
 State machine task that updates the LEDs. More...
 

Variables

struct ledled_red
 The green onboard LED. More...
 
struct ledled_green
 The green onboard LED. More...
 

Detailed Description

Handling of the on-board LEDs.

Macro Definition Documentation

◆ LED_GREEN

#define LED_GREEN   led_green

TODO: This macro is only for compatibility and should be removed in the future.

◆ LED_RED

#define LED_RED   led_red

TODO: This macro is only for compatibility and should be removed in the future.

Enumeration Type Documentation

◆ led_mode

enum led_mode

Enumeration for the LED mode.

Depending on the mode, an LED can be turned on/off automatically or manually.

Enumerator
LED_STATIC 

The LED can be turned on/off manually.

LED_FLASH 

The LED flashes briefly and remains off.

LED_BLINK 

The LED blinks once per second.

Function Documentation

◆ blink_led()

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.

Parameters
ledthe LED that should blink
prescalercontrols the blinking frequency
See also
led
update_leds

◆ flash_led()

void flash_led ( struct led led)

Briefly flashes an LED.

Parameters
ledthe LED that should flash
See also
led

◆ flash_led_multiple()

void flash_led_multiple ( struct led led,
uint8_t  count 
)

Briefly flashes an LED.

Parameters
ledthe LED that should flash
countthe LED will flash this many times
See also
led

◆ init_leds_module()

void init_leds_module ( void  )

Module initialization procedure.

Writes relevant AVR GPIO configuration for the onboard LEDs

◆ register_led()

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

◆ set_led()

void set_led ( struct led led,
bool  enable 
)

Enables or disables an LED.

Parameters
ledthe LED that should be enabled/disabled
enabletrue switches the LED on; false swithes off
See also
led

◆ toggle_led()

void toggle_led ( struct led led)

Toggles an LED.

Parameters
ledthe LED that should be toggled
See also
led

◆ update_leds()

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.

See also
init_state_machine

Variable Documentation

◆ led_green

struct led* led_green

The green onboard LED.

◆ led_red

struct led* led_red

The green onboard LED.