diff options
Diffstat (limited to 'software/rhmixxx/gpio.c')
-rw-r--r-- | software/rhmixxx/gpio.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/software/rhmixxx/gpio.c b/software/rhmixxx/gpio.c index 4b3171a..bd4906a 100644 --- a/software/rhmixxx/gpio.c +++ b/software/rhmixxx/gpio.c @@ -26,8 +26,6 @@ #define GPIO_PIN PINE #define GPIO_PORT PORTE #define GPIO_DDR DDRE -#define GPIO_NUM_INPUTS 4 -#define GPIO_NUM_OUTPUTS 4 uint8_t input_last_sent[GPIO_NUM_INPUTS]; @@ -45,18 +43,24 @@ void gpio_out_on(uint8_t num) { if(num < GPIO_NUM_OUTPUTS) GPIO_PORT |= (1 << num); + else + GPIO_PORT |= 0x0F; } void gpio_out_off(uint8_t num) { if(num < GPIO_NUM_OUTPUTS) GPIO_PORT &= ~(1 << num); + else + GPIO_PORT &= 0xF0; } void gpio_out_toggle(uint8_t num) { if(num < GPIO_NUM_OUTPUTS) GPIO_PORT ^= (1 << num); + else + GPIO_PORT ^= 0x0F; } void gpio_task(void) @@ -66,7 +70,7 @@ void gpio_task(void) uint8_t current_state = GPIO_PIN & (1<<(i+4)); if(current_state != input_last_sent[i]) { input_last_sent[i] = current_state; - eventqueue_push(i + 64, ((current_state) ? 0 : 1)); // TODO: offset should be defined somewhere + eventqueue_push(i + GPIO_MIDI_NOTE_OFFSET, ((current_state) ? 0 : 1)); } } } |