afternoon / microgroove

8-track open-source hardware MIDI sequence generator
MIT License
13 stars 1 forks source link

Integrate the NeoKey 1x4 #25

Open afternoon opened 1 year ago

afternoon commented 1 year ago

Adafruit's NeoKey 1x4 is a PCB that holds 4 Cherry MX keys and 4 NeoPixels (RGB LEDs). Clicky keys are really nice (I love the Elektron ones), colourful LEDs are really nice.

The NeoKey talks Adafruit's Seesaw protocol over I2C. The button state can be read by writing a command and then doing a read. A short pause is needed between these. Adafruit suggest 250us.

There are a couple of Seesaw crates available, but both use longer delays. This leads to the device locking up, as the key state is read every few ms. The Seesaw protocol is pretty simple, so the way to go might be to just do I2C write and read calls directly in the RTIC tasks. E.g.:

fn task1() {
  send_get_key_state_command();
  task2::spawn_after(READ_DELAY_US);
}

fn task2 {
  read_response();
}
afternoon commented 1 year ago

Don't forget to update the docs when this is done!