From f0d2c1e61be6dc43357d468cd56ad5bc3cda39cd Mon Sep 17 00:00:00 2001 From: Alexis Lockwood Date: Wed, 26 Oct 2022 19:32:57 -0500 Subject: [PATCH] latest bullshit --- board.cpp | 8 +++++++- main.cpp | 2 -- midix.cpp | 8 -------- sysex.cpp | 9 +++++++++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/board.cpp b/board.cpp index a6e6cf8..2717eb7 100644 --- a/board.cpp +++ b/board.cpp @@ -22,12 +22,17 @@ void board_pins_init() PORTA.PINCONFIG = PORT_ISC_INPUT_DISABLE_gc; // Mirrored to all PORTx PORTA.PINCTRLUPD = 0xFF; - PORTB.PINCTRLUPD = 0xFF; + PORTB.PINCTRLUPD = 0; // This is PORT_ADDR PORTC.PINCTRLUPD = 0xFF; PORTD.PINCTRLUPD = 0xFF; PORTE.PINCTRLUPD = 0xFF; PORTF.PINCTRLUPD = 0xFF; PORTG.PINCTRLUPD = 0xFF; + PINCTRL_FOR(PIN_GATE_IN) = 0; + PINCTRL_FOR(PIN_INTMIDI_RX) = 0; + PINCTRL_FOR(PIN_USBMIDI_RX) = 0; + PINCTRL_FOR(PIN_MIDI_RX) = 0; + PIN_DRIVE_TO(PIN_DEBUG0, 0); PIN_DRIVE_TO(PIN_DEBUG1, 0); PIN_DRIVE_TO(PIN_DEBUG2, 0); @@ -46,6 +51,7 @@ void board_pins_init() PIN_DRIVE_TO(PIN_COPI, 0); PIN_DRIVE_TO(PIN_SCK, 0); PINCTRL_FOR(PIN_CIPO) = PORT_PULLUPEN_bm; + PINCTRL_FOR(PIN_SD_CIPO) = PORT_PULLUPEN_bm; // Set the alternates and inversions (we invert usbmidi.rx to allow // detection of cable disconnects - because the opto is ON by default, diff --git a/main.cpp b/main.cpp index 3415a34..d13ccb9 100644 --- a/main.cpp +++ b/main.cpp @@ -46,10 +46,8 @@ int main(void) if (cmd == MIDI_ICMD_SYSEX) { - PIN_SET(PIN_DEBUG0); sysex_handle(&m); m.source->sysex_release_buffer(m.content); - PIN_CLR(PIN_DEBUG0); } else { diff --git a/midix.cpp b/midix.cpp index 0549949..201a0f1 100644 --- a/midix.cpp +++ b/midix.cpp @@ -16,14 +16,6 @@ void midix::rxc() { int c = m_serport.recv(); - PIN_SET(PIN_DEBUG2); - PIN_CLR(PIN_DEBUG2); - - if (c >= 0) - { - PIN_SET(PIN_DEBUG1); - PIN_CLR(PIN_DEBUG1); - } if (c < 0) { diff --git a/sysex.cpp b/sysex.cpp index ae7c887..4a1e2ce 100644 --- a/sysex.cpp +++ b/sysex.cpp @@ -3,6 +3,7 @@ #include "sysex.hpp" #include "midix.hpp" #include "stor.hpp" +#include "board.hpp" extern "C" { #include "base64.h" @@ -41,7 +42,15 @@ static size_t _convert_message_data(uint8_t * dest, size_t dest_len, void sysex_handle(struct midi_message const * msg) { + PIN_SET(PIN_DEBUG0); + size_t len = strlen((char const *) msg->content); + PIN_SET(PIN_DEBUG1); + + // XXX + msg->source->send_sysex((const uint8_t *) "Hello"); + PIN_SET(PIN_DEBUG2); + PIN_CLR(PIN_DEBUG0 | PIN_DEBUG1 | PIN_DEBUG2); if (msg->content[0] != MIDI_MANUF_ID) // Not for us - return