29 lines
792 B
C++
29 lines
792 B
C++
#pragma once
|
|
#include "tft_handler.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;
|
|
CLICK_EVENT* _event;
|
|
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, CLICK_EVENT* event);
|
|
void update();
|
|
void draw_button();
|
|
};
|