electro-smith / libDaisy

Hardware Library for the Daisy Audio Platform
https://www.electro-smith.com/daisy
MIT License
312 stars 131 forks source link

default config fix for MidiUartTransport #556

Closed drum-computer closed 1 year ago

drum-computer commented 1 year ago

Hey this is my very first pull request ever :) I've been adding midi in port to daisy and somehow it wasn't working, so I've noticed in the midi.h that default configof MidiUartTransport wasn't referencing correct pin numbers. When I changed those numbers according to the daisy datasheet my midi input started working.

stephenhensley commented 1 year ago

Hi @drum-computer thanks for the PR! Excited to see that you're interested in contributing back to the Daisy libraries!

To clarify, the MIDIUartTransport::Config has the default pins set up for the pins exposed on the Daisy Seed and Patch SM pin-banks. These can be overridden when creating the config struct by manually setting:

MidiUartTransport:::Config midi_cfg;
midi_cfg.rx = Pin(kMyRxPin);
midi_cfg.tx = Pin(kMyTxPin);
// and then initialize
my_midi_object.Init(midi_cfg);

The pins that you configured to the defaults are valid pins for the USART1 peripheral, but all of the example hardware platforms with MIDI use the pins already set as defaults.

If you're using the Patch SM, what I've described above would work for your projects, but does not require an update to the library itself. You can also use PB8/PB9 via UART4 on the PatchSM.

Feel free to let me know if you have any questions!