
Simple USB-MIDI foot controller
Dependencies: PinDetect USBDevice_STM32F103 mbed-STM32F103C8T6
midiswitch.h
- Committer:
- SpotlightKid
- Date:
- 2018-01-09
- Revision:
- 13:f9eb1f79cd0a
- Parent:
- 9:d5fa853818dd
File content as of revision 13:f9eb1f79cd0a:
#ifndef MIDISWITCH_H #define MIDISWITCH_H #include "mbed.h" #include "mbed_events.h" #include "PinDetect.h" #include "USBMIDI.h" typedef struct SwitchConfig { PinName pin; uint8_t type; uint8_t channel; uint8_t data1; int8_t on_value; int8_t off_value; } SwitchConfig; typedef void (*MIDI_CB)(MIDIMessage); class SwitchHandler { public: SwitchHandler(EventQueue * queue, MIDI_CB cb, SwitchConfig sw); void handle_pressed(void); void handle_released(void); void setConfig(SwitchConfig sw) { cfg = sw; }; private: bool make_message(bool onoff); EventQueue * queue; MIDI_CB write_cb; PinDetect btn; SwitchConfig cfg; MIDIMessage msg; }; #endif /* MIDISWITCH_H */