PocketPutr/Desktop_Test/input_manager.h
2025-12-15 19:06:44 +01:00

29 lines
776 B
C++

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