uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
hmi.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright 2016 Sebastian Neuser
12  *
13  * This file is part of the uMIDI firmware.
14  *
15  * the uMIDI firmware is free software: you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation, either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * The uMIDI firmware is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with the uMIDI firmware. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
29 #ifndef _HMI_H
30 #define _HMI_H
31 
32 
33 //---------------- includes ----------------//
34 #include <stdbool.h>
35 #include <stdint.h>
36 
37 #include "gpio.h"
38 
39 
40 //---------------- constants ----------------//
41 
42 
43 //---------------- data types ----------------//
46 typedef uint8_t hmi_led_pattern_t;
47 
54 enum hmi_led
55 {
56  HMI_LED1 = 1,
57  HMI_LED2 = 3,
58  HMI_LED3 = 5,
59  HMI_LED4 = 7,
60  HMI_LED5 = 6,
61  HMI_LED6 = 4,
62  HMI_LED7 = 2,
63  HMI_LED8 = 0
64 };
65 
68 {
78 };
79 
81 struct hmi_config
82 {
83  const struct gpio_header* input_header;
84  const struct gpio_header* output_header;
85  void (* button1_handler)(void);
86  void (* button2_handler)(void);
87  void (* encoder1cw_handler)(void);
88  void (* encoder1ccw_handler)(void);
89  void (* encoder1push_handler)(void);
90  void (* encoder2cw_handler)(void);
91  void (* encoder2ccw_handler)(void);
92  void (* encoder2push_handler)(void);
93 };
94 
95 
96 //---------------- functions and procedures ----------------//
97 
102 void init_hmi_module(const struct hmi_config* config);
103 
107 void show_bar_graph(enum hmi_bar_graph_percentage percentage);
108 
113 void show_led_pattern(hmi_led_pattern_t pattern);
114 
120 void set_hmi_led(enum hmi_led led, bool value);
121 
125 void poll_hmi(void);
126 
127 
128 //---------------- EOF ----------------//
129 #endif // _HMI_H
LED6.
Definition: hmi.h:61
void(* encoder1push_handler)(void)
this handler is called when the switch in encoder 1 is pressed
Definition: hmi.h:89
GPIO configuration and service functions.
const struct gpio_header * input_header
the pin header that is connected to the HMI board&#39;s X2 header
Definition: hmi.h:83
the bar graph shows 7/8
Definition: hmi.h:76
void(* encoder2ccw_handler)(void)
this handler is called when encoder 2 is rotated counter-clockwise
Definition: hmi.h:91
Configuration structure for the HMI module.
Definition: hmi.h:81
Configurations of the GPIO pins contained in one 10-pin header.
Definition: gpio.h:73
the bar graph is full
Definition: hmi.h:77
void set_hmi_led(enum hmi_led led, bool value)
Turns a specific LED on or off.
Definition: hmi.c:113
uint8_t hmi_led_pattern_t
A bitmask that specifies an LED pattern to display.
Definition: hmi.h:46
void(* encoder1cw_handler)(void)
this handler is called when encoder 1 is rotated clockwise
Definition: hmi.h:87
LED4.
Definition: hmi.h:59
LED8.
Definition: hmi.h:63
void(* button1_handler)(void)
this handler is called when button 1 is pressed
Definition: hmi.h:85
the bar graph shows 6/8
Definition: hmi.h:75
hmi_led
Enumeration for the available LEDs on the HMI board.
Definition: hmi.h:54
hmi_bar_graph_percentage
Enumeration for possible percentages to display.
Definition: hmi.h:67
the bar graph shows 2/8
Definition: hmi.h:71
LED2.
Definition: hmi.h:57
the bar graph shows 4/8
Definition: hmi.h:73
void show_bar_graph(enum hmi_bar_graph_percentage percentage)
Uses the HMI&#39;s LEDs to display a nice "bar graph".
Definition: hmi.c:94
void(* encoder2push_handler)(void)
this handler is called when the switch in encoder 2 is pressed
Definition: hmi.h:92
Enumeration for the on-board LEDs.
Definition: leds.h:72
void show_led_pattern(hmi_led_pattern_t pattern)
Displays the specified pattern on the HMI&#39;s LEDs.
Definition: hmi.c:101
void poll_hmi(void)
Polls the HMI inputs and executes registered callbacks if an event occurred.
Definition: hmi.c:119
the bar graph is empty
Definition: hmi.h:69
void(* encoder1ccw_handler)(void)
this handler is called when encoder 1 is rotated counter-clockwise
Definition: hmi.h:88
the bar graph shows 3/8
Definition: hmi.h:72
void(* encoder2cw_handler)(void)
this handler is called when encoder 2 is rotated clockwise
Definition: hmi.h:90
LED7.
Definition: hmi.h:62
void init_hmi_module(const struct hmi_config *config)
Initializes the HMI module according to the provided configuration.
Definition: hmi.c:59
LED1.
Definition: hmi.h:56
the bar graph shows 1/8
Definition: hmi.h:70
LED5.
Definition: hmi.h:60
void(* button2_handler)(void)
this handler is called when button 2 is pressed
Definition: hmi.h:86
LED3.
Definition: hmi.h:58
const struct gpio_header * output_header
the pin header that is connected to the HMI board&#39;s X1 header
Definition: hmi.h:84
the bar graph shows 5/8
Definition: hmi.h:74