summaryrefslogtreecommitdiff
path: root/software/rhmixxx
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-06-01 18:41:25 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-06-01 18:41:25 (GMT)
commita1586f0d7b3490ed3fa2e9c130adeb32b4d0f7d6 (patch)
tree79728d29b3ee7ed296f4e18dae2ece49a7e287c7 /software/rhmixxx
parent463de1da2390f5110cf65e70778aed5bd17d7b21 (diff)
improved midi commands for leds
7F is now a wildcard for all leds
Diffstat (limited to 'software/rhmixxx')
-rw-r--r--software/rhmixxx/keypad.c3
-rw-r--r--software/rhmixxx/rhmixxx.c18
2 files changed, 15 insertions, 6 deletions
diff --git a/software/rhmixxx/keypad.c b/software/rhmixxx/keypad.c
index 96bf7e2..7cda7b9 100644
--- a/software/rhmixxx/keypad.c
+++ b/software/rhmixxx/keypad.c
@@ -74,6 +74,7 @@ void keypad_led_on(uint8_t led)
case 13:
case 14:
case 15: PORTD |= (1 << (led - 12 + 4)); break;
+ case 127: PORTC = 0xFF; PORTB |= 0xF0; PORTD |= 0xF0; break;
}
}
@@ -96,6 +97,7 @@ void keypad_led_off(uint8_t led)
case 13:
case 14:
case 15: PORTD &= ~(1 << (led - 12 + 4)); break;
+ case 127: PORTC = 0x00; PORTB &= 0x0F; PORTD &= 0x0F; break;
}
}
@@ -118,6 +120,7 @@ void keypad_led_toggle(uint8_t led)
case 13:
case 14:
case 15: PORTD ^= (1 << (led - 12 + 4)); break;
+ case 127: PORTC ^= 0xFF; PORTB ^= 0xF0; PORTD ^= 0xF0; break;
}
}
diff --git a/software/rhmixxx/rhmixxx.c b/software/rhmixxx/rhmixxx.c
index fa39f66..79a3e48 100644
--- a/software/rhmixxx/rhmixxx.c
+++ b/software/rhmixxx/rhmixxx.c
@@ -89,7 +89,7 @@ int main(void)
MIDI_EventPacket_t MIDIEventOn = (MIDI_EventPacket_t)
{
- .CableNumber = 0,
+ .CableNumber = 0, // TODO: hardcoded value
.Command = (MIDI_COMMAND_NOTE_ON >> 4),
.Data1 = MIDI_COMMAND_NOTE_ON | 0,
.Data2 = 0,
@@ -97,7 +97,7 @@ int main(void)
};
MIDI_EventPacket_t MIDIEventOff = (MIDI_EventPacket_t)
{
- .CableNumber = 0,
+ .CableNumber = 0, // TODO: hardcoded value
.Command = (MIDI_COMMAND_NOTE_OFF >> 4),
.Data1 = MIDI_COMMAND_NOTE_OFF | 0,
.Data2 = 0,
@@ -107,10 +107,16 @@ int main(void)
for(;;) {
MIDI_EventPacket_t ReceivedMIDIEvent;
while(MIDI_Device_ReceiveEventPacket(&MIDI_Interface, &ReceivedMIDIEvent)) {
- if(ReceivedMIDIEvent.Data2 < 16) { // TODO: hardcoded value
- switch(ReceivedMIDIEvent.Data1 & 0xF0) {
- case MIDI_COMMAND_NOTE_ON: keypad_led_on(ReceivedMIDIEvent.Data2); break;
- case MIDI_COMMAND_NOTE_OFF: keypad_led_off(ReceivedMIDIEvent.Data2); break;
+ uint8_t cmd = ReceivedMIDIEvent.Data1 & 0xF0;
+ uint8_t note = ReceivedMIDIEvent.Data2;
+ uint8_t value = ReceivedMIDIEvent.Data3 & 0x7F;
+ if(note < 16 || note == 0x7F) { // TODO: hardcoded value
+ if(cmd == MIDI_COMMAND_NOTE_ON) {
+ switch(value) {
+ case 0: keypad_led_off(note); break;
+ case 1: keypad_led_on(note); break;
+ case 2: keypad_led_toggle(note); break;
+ }
}
}
}