|
|
|
@ -28,10 +28,10 @@ |
|
|
|
|
#define STROBE_TM 10 |
|
|
|
|
#define CLOCK_TM 9 |
|
|
|
|
#define DIO_TM 8 |
|
|
|
|
#define MIDI_CH_BIT3 3 |
|
|
|
|
#define MIDI_CH_BIT2 4 |
|
|
|
|
#define MIDI_CH_BIT1 5 |
|
|
|
|
#define MIDI_CH_BIT0 2 |
|
|
|
|
#define MIDI_CH_BIT3 4 |
|
|
|
|
#define MIDI_CH_BIT2 5 |
|
|
|
|
#define MIDI_CH_BIT1 6 |
|
|
|
|
#define MIDI_CH_BIT0 3 |
|
|
|
|
|
|
|
|
|
bool swap_nibbles = true; |
|
|
|
|
bool high_freq = false; |
|
|
|
@ -39,7 +39,7 @@ bool high_freq = false; |
|
|
|
|
#define BRIGHTNESS 6 |
|
|
|
|
#define INITIAL_MIDI_CHANNEL 1 |
|
|
|
|
#define BUTTON_DEBOUNCE_TIME_MS 200 |
|
|
|
|
#define BLINK_FREQUENCY_MS 500 |
|
|
|
|
#define BLINK_FREQUENCY_MS 200 |
|
|
|
|
#define EEPROM_ADDRESS 0x42 |
|
|
|
|
|
|
|
|
|
// Constructor object
|
|
|
|
@ -50,8 +50,16 @@ uint8_t actual_channel; |
|
|
|
|
uint8_t new_channel; |
|
|
|
|
|
|
|
|
|
void setup() { |
|
|
|
|
pinMode(MIDI_CH_BIT3, OUTPUT); |
|
|
|
|
pinMode(MIDI_CH_BIT2, OUTPUT); |
|
|
|
|
pinMode(MIDI_CH_BIT1, OUTPUT); |
|
|
|
|
pinMode(MIDI_CH_BIT0, OUTPUT); |
|
|
|
|
|
|
|
|
|
actual_channel = read_channel_from_eeprom(); |
|
|
|
|
SetMidiChannel(actual_channel); |
|
|
|
|
new_channel = actual_channel; |
|
|
|
|
|
|
|
|
|
Serial.begin(9600); |
|
|
|
|
delay(50); |
|
|
|
|
|
|
|
|
|
#if defined(DEBUG) |
|
|
|
|
Serial.println("<SETUP>"); |
|
|
|
@ -60,16 +68,6 @@ void setup() { |
|
|
|
|
tm.displayBegin(); |
|
|
|
|
tm.brightness(BRIGHTNESS); |
|
|
|
|
|
|
|
|
|
actual_channel=read_channel_from_eeprom(); |
|
|
|
|
new_channel = actual_channel; |
|
|
|
|
|
|
|
|
|
pinMode(MIDI_CH_BIT3, OUTPUT); |
|
|
|
|
pinMode(MIDI_CH_BIT2, OUTPUT); |
|
|
|
|
pinMode(MIDI_CH_BIT1, OUTPUT); |
|
|
|
|
pinMode(MIDI_CH_BIT0, OUTPUT); |
|
|
|
|
|
|
|
|
|
SetMidiChannel(INITIAL_MIDI_CHANNEL); |
|
|
|
|
|
|
|
|
|
tm.DisplayDecNum(actual_channel, 0, false, TMAlignTextRight); |
|
|
|
|
|
|
|
|
|
#if defined(DEBUG) |
|
|
|
@ -151,7 +149,7 @@ uint8_t read_channel_from_eeprom(void) { |
|
|
|
|
uint8_t channel; |
|
|
|
|
|
|
|
|
|
if (tmp_channel & 0xf0 != 0xf0) { |
|
|
|
|
channel = 1; |
|
|
|
|
channel = INITIAL_MIDI_CHANNEL; |
|
|
|
|
#if defined(DEBUG) |
|
|
|
|
Serial.println("Setting channel to 1"); |
|
|
|
|
#endif |
|
|
|
|