Implementiere USB-MIDI-Controller für Arduino Pro Micro mit Hardware- und Software-Architektur, einschließlich Button- und LED-Steuerung, Multiplexer-Integration und MIDI-Kommunikation.
This commit is contained in:
25
include/button_handler.h
Normal file
25
include/button_handler.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef BUTTON_HANDLER_H
|
||||
#define BUTTON_HANDLER_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_MCP23X17.h>
|
||||
|
||||
class ButtonHandler {
|
||||
private:
|
||||
Adafruit_MCP23X17* mcp1;
|
||||
Adafruit_MCP23X17* mcp2;
|
||||
|
||||
bool buttonStates[20];
|
||||
bool lastButtonStates[20];
|
||||
unsigned long lastDebounceTime[20];
|
||||
|
||||
public:
|
||||
ButtonHandler(Adafruit_MCP23X17* mcp1, Adafruit_MCP23X17* mcp2);
|
||||
void init();
|
||||
void update();
|
||||
bool isPressed(uint8_t buttonIndex);
|
||||
bool wasPressed(uint8_t buttonIndex);
|
||||
bool wasReleased(uint8_t buttonIndex);
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user