PocketPutr/Desktop_Test/input_manager.h

29 lines
818 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 int BUTTON_PINS[6] = {4, 5, 6, 7, 17, 16};
static constexpr short int NUM_BUTTONS = 6;
const unsigned long DEBOUNCE_DELAY = 25; // milliseconds
unsigned long lastDebounceTime[NUM_BUTTONS] = {0};
short int lastButtonState[NUM_BUTTONS] = {HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};
short int buttonState[NUM_BUTTONS] = {HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};
DISPLAY_STATE* _display_state;
TFT_Handler* _tf;
Mouse_Icon mi;
void handle_button_press(short int buttonIndex);
bool are_buttons_pressed(short int btn1, short int btn2);
public:
void init(DISPLAY_STATE* display_state, TFT_Handler* tf);
void update();
void draw_button();
};