PocketPutr/Desktop_Test/input_manager.h
2026-01-14 20:33:45 +01:00

30 lines
830 B
C++

#pragma once
#include "tft_handler.h"
#include "event_manager.h"
#include "GLOBALS.h"
#include "icons.h"
#include <Arduino.h>
class InputManager {
private:
short BUTTON_PINS[6] = {4, 5, 6, 7, 17, 16};
static constexpr short NUM_BUTTONS = 6;
short lastButtonState[NUM_BUTTONS] = {HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};
short buttonState[NUM_BUTTONS] = {HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};
const unsigned long DEBOUNCE_DELAY = 25; // milliseconds
unsigned long lastDebounceTime[NUM_BUTTONS] = {0};
DISPLAY_STATE* _display_state;
TFT_Handler* _tf;
Mouse_Icon mi;
void handle_keyboard_input(char key);
void handle_button_press(short buttonIndex);
bool are_buttons_pressed(short btn1, short btn2);
public:
void init(DISPLAY_STATE* display_state, TFT_Handler* tf);
void update();
void draw_button();
};