You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.9 KiB
C

#ifndef __UI_H__
#define __UI_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "stdint.h"
#include "statemachine.h"
#ifndef ELEMCNT
#define ELEMCNT(x) (sizeof(x) / sizeof((x)[0]))
#endif
/***************************************************************************//**
* @brief Button codes
*******************************************************************************/
enum BTN_CODES {
BTN_INC1 = 0,
BTN_DEC1,
BTN_INC2,
BTN_DEC2,
BTN_CH_ON1,
BTN_CH_ON2,
BTN_MAX
};
enum UI_EVENTS {
EV_UI_TICK_10MS = EV_USER_FIRST,
EV_UI_TICK_100MS,
EV_UI_TICK_1S,
EV_UI_RX_MUTE_CH1_ON,
EV_UI_RX_MUTE_CH1_OFF,
EV_UI_RX_MUTE_CH2_ON,
EV_UI_RX_MUTE_CH2_OFF,
EV_UI_KEY_PRESS = 0x0100,
EV_UI_KEY_PRESS_MAX = 0x01FF,
EV_UI_KEY_REL = 0x0200,
EV_UI_KEY_REL_MAX = 0x02FF,
EV_NO_EVENT = 0xFFFF
};
/***************************************************************************//**
* @brief Unit for mute switch from Air mixer
*******************************************************************************/
struct MixerMuteState {
bool MuteMixer; /// state received from mixer
bool MuteLocal; /// local state (sent to mixer)
uint8_t MidiCtrlNr; /// assign MIDI CC number to MUTE switch of Air mixer
BTN_CODES UiButton; /// assigned button
uint16_t UiEventOn; /// event to send to UI statemachine
uint16_t UiEventOff; /// event to send to UI statemachine
TimedPin* Led;
MixerMuteState(uint8_t ctrl_nr, TimedPin* led, BTN_CODES button = BTN_MAX, uint16_t uieventon = EV_NO_EVENT, uint16_t uieventoff = EV_NO_EVENT) :
MuteMixer(false), MuteLocal(false), MidiCtrlNr(ctrl_nr), UiButton(button), UiEventOn(uieventon), UiEventOff(uieventoff), Led(led) { }
};
extern void UI_Init();
extern void UI_EventProc(uint16_t event);
extern void UI_EventSend(uint16_t event);
extern void UI_CheckEvent();
#ifdef __cplusplus
}
#endif
#endif