diff --git a/MIDI-Host-Adapter.ino b/MIDI-Host-Adapter.ino index d4370d2..164f256 100644 --- a/MIDI-Host-Adapter.ino +++ b/MIDI-Host-Adapter.ino @@ -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(""); @@ -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 @@ -163,7 +161,7 @@ uint8_t read_channel_from_eeprom(void) { #endif } - return(channel); + return (channel); } #if defined(DEBUG)