uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
Functions | Variables
hmi.c File Reference

Implementation of the uMIDI-HMI module. More...

#include <stddef.h>
#include "encoder.h"
#include "gpio.h"
#include "hmi.h"
Include dependency graph for hmi.c:

Functions

void init_hmi_module (const struct hmi_config *const config)
 Initializes the HMI module according to the provided configuration. More...
 
void show_bar_graph (const enum hmi_bar_graph_percentage percentage)
 Uses the HMI's LEDs to display a nice "bar graph". More...
 
void show_led_pattern (const hmi_led_pattern_t pattern)
 Displays the specified pattern on the HMI's LEDs. More...
 
void set_hmi_led (const enum hmi_led led, const bool value)
 Turns a specific LED on or off. More...
 
void poll_hmi (void)
 Polls the HMI inputs and executes registered callbacks if an event occurred. More...
 

Variables

static const struct hmi_confighmi_config
 Global HMI config struct. More...
 
static struct encoder encoder1
 Internal reference to encoder 1. More...
 
static struct encoder encoder2
 Internal reference to encoder 2. More...
 

Detailed Description

Implementation of the uMIDI-HMI module.

Function Documentation

◆ init_hmi_module()

void init_hmi_module ( const struct hmi_config config)

Initializes the HMI module according to the provided configuration.

Registers event callbacks and configures GPIO ports used by the HMI module.

Parameters
configthe HMI module configuration

◆ poll_hmi()

void poll_hmi ( void  )

Polls the HMI inputs and executes registered callbacks if an event occurred.

This procedure must be called in a slow background task to be able to process input events from the HMI board.

◆ set_hmi_led()

void set_hmi_led ( enum hmi_led  led,
bool  value 
)

Turns a specific LED on or off.

Parameters
ledthe LED to control
valuetrue → LED on; false → LED off

◆ show_bar_graph()

void show_bar_graph ( enum hmi_bar_graph_percentage  percentage)

Uses the HMI's LEDs to display a nice "bar graph".

Parameters
percentagethe percentage to display

◆ show_led_pattern()

void show_led_pattern ( hmi_led_pattern_t  pattern)

Displays the specified pattern on the HMI's LEDs.

Parameters
patternthe pattern to show
See also
hmi_led_pattern_t

Variable Documentation

◆ encoder1

struct encoder encoder1
static
Initial value:
= {
.config = {
},
}
4-phase rotary encoder
Definition: encoder.h:51

Internal reference to encoder 1.

◆ encoder2

struct encoder encoder2
static
Initial value:
= {
.config = {
},
}
4-phase rotary encoder
Definition: encoder.h:51

Internal reference to encoder 2.

◆ hmi_config

const struct hmi_config* hmi_config
static

Global HMI config struct.

Holds pointers to used GPIO headers and callbacks.

See also
init_hmi_module