Simple USB-MIDI foot controller
Dependencies: PinDetect USBDevice_STM32F103 mbed-STM32F103C8T6
Diff: midiswitch.h
- Revision:
- 8:75c5ec68765e
- Parent:
- 6:2f804d29cbb0
- Child:
- 9:d5fa853818dd
--- a/midiswitch.h Fri Aug 04 04:20:37 2017 +0200 +++ b/midiswitch.h Fri Aug 04 05:22:22 2017 +0200 @@ -9,24 +9,27 @@ typedef struct SwitchConfig { PinName pin; + uint8_t type; uint8_t channel; - uint8_t control; - uint8_t on_value; - uint8_t off_value; + 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); + SwitchHandler(EventQueue * queue, MIDI_CB cb, SwitchConfig sw); void handle_pressed(void); void handle_released(void); private: + bool make_message(bool onoff); EventQueue * queue; MIDI_CB write_cb; PinDetect btn; - uint8_t control, channel, on_value, off_value; + SwitchConfig cfg; + MIDIMessage msg; }; #endif /* MIDISWITCH_H */