|
|
|
@ -38,30 +38,46 @@ Tmr Tmr1s = { .Period = 1000 };
|
|
|
|
|
* @brief Button - port assignment
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
const uint8_t pinBtnChOn1 = 2;
|
|
|
|
|
const uint8_t pinBtnChOn2 = 3;
|
|
|
|
|
const uint8_t pinLedChOn1 = 3;
|
|
|
|
|
|
|
|
|
|
const uint8_t pinBtnInc1 = 8;
|
|
|
|
|
const uint8_t pinBtnDec1 = 9;
|
|
|
|
|
const uint8_t pinBtnInc2 = 10;
|
|
|
|
|
const uint8_t pinBtnDec2 = 11;
|
|
|
|
|
const uint8_t pinBtnChOn2 = 4;
|
|
|
|
|
const uint8_t pinLedChOn2 = 5;
|
|
|
|
|
|
|
|
|
|
const uint8_t pinBtnInc1 = 6;
|
|
|
|
|
const uint8_t pinLedInc1 = 7;
|
|
|
|
|
const uint8_t pinBtnDec1 = 8;
|
|
|
|
|
const uint8_t pinLedDec1 = 9;
|
|
|
|
|
|
|
|
|
|
const uint8_t pinBtnInc2 = A0;
|
|
|
|
|
const uint8_t pinLedInc2 = A1;
|
|
|
|
|
const uint8_t pinBtnDec2 = A2;
|
|
|
|
|
const uint8_t pinLedDec2 = A3;
|
|
|
|
|
|
|
|
|
|
/***************************************************************************//**
|
|
|
|
|
* @brief LED
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
TimedPin LedBoard(LED_BUILTIN);
|
|
|
|
|
TimedPin LedChOn1(A0, true);
|
|
|
|
|
TimedPin LedChOn2(A1, true);
|
|
|
|
|
TimedPin LedChOn1(pinLedChOn1, true);
|
|
|
|
|
TimedPin LedChOn2(pinLedChOn2, true);
|
|
|
|
|
TimedPin LedInc1(pinLedInc1, true);
|
|
|
|
|
TimedPin LedDec1(pinLedDec1, true);
|
|
|
|
|
TimedPin LedInc2(pinLedInc2, true);
|
|
|
|
|
TimedPin LedDec2(pinLedDec2, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MidiCfgTxOnly; /// duplex or only tx configuration (without MIDI rx line)
|
|
|
|
|
|
|
|
|
|
MixerMuteState AirMutes[2] = {
|
|
|
|
|
//MixerMuteState(23, &LedBoard),
|
|
|
|
|
MixerMuteState(21, &LedChOn1, BTN_CH_ON1, EV_UI_RX_MUTE_CH1_ON, EV_UI_RX_MUTE_CH1_OFF),
|
|
|
|
|
MixerMuteState(22, &LedChOn2, BTN_CH_ON2, EV_UI_RX_MUTE_CH2_ON, EV_UI_RX_MUTE_CH2_OFF)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MixerFaderState AirFaders[2] = {
|
|
|
|
|
MixerFaderState(0, 90, 100, 110, &LedInc1, &LedDec1, BTN_INC1, BTN_DEC1),
|
|
|
|
|
MixerFaderState(1, 90, 100, 110, &LedInc2, &LedDec2, BTN_INC2, BTN_DEC2)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/***************************************************************************//**
|
|
|
|
|
* @brief MIDI instance (serial port)
|
|
|
|
|
*******************************************************************************/
|
|
|
|
@ -69,6 +85,15 @@ MIDI_CREATE_DEFAULT_INSTANCE();
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
void MidiCCHandler(byte channel, byte ctrl_no, byte val) {
|
|
|
|
|
if (channel == 1) { // Faders: ch=1
|
|
|
|
|
for (uint_fast8_t i=0; i<ELEMCNT(AirFaders); i++) {
|
|
|
|
|
MixerFaderState& fader = AirFaders[i];
|
|
|
|
|
if (ctrl_no == fader.MidiCtrlNr) {
|
|
|
|
|
fader.VolumeReceived(val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (channel == 2) { // Mutes: ch=2
|
|
|
|
|
for (uint_fast8_t i=0; i<ELEMCNT(AirMutes); i++) {
|
|
|
|
|
MixerMuteState& mute = AirMutes[i];
|
|
|
|
@ -97,6 +122,10 @@ void setup() {
|
|
|
|
|
LedBoard.begin();
|
|
|
|
|
LedChOn1.begin();
|
|
|
|
|
LedChOn2.begin();
|
|
|
|
|
LedInc1.begin();
|
|
|
|
|
LedDec1.begin();
|
|
|
|
|
LedInc2.begin();
|
|
|
|
|
LedDec2.begin();
|
|
|
|
|
|
|
|
|
|
MIDI.setHandleControlChange(MidiCCHandler);
|
|
|
|
|
MIDI.begin(MIDI_CHANNEL_OMNI); // Initiate MIDI communications, listen to all channels
|
|
|
|
@ -154,6 +183,10 @@ void loop() {
|
|
|
|
|
LedBoard.loop();
|
|
|
|
|
LedChOn1.loop();
|
|
|
|
|
LedChOn2.loop();
|
|
|
|
|
LedInc1.loop();
|
|
|
|
|
LedDec1.loop();
|
|
|
|
|
LedInc2.loop();
|
|
|
|
|
LedDec2.loop();
|
|
|
|
|
}
|
|
|
|
|
// execute every 100ms ******************************************************
|
|
|
|
|
if (Tmr100ms.Check(t)) {
|
|
|
|
|