Skip to content

Commit

Permalink
Extract HID Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sieren committed Feb 7, 2021
1 parent 0e53cd8 commit 91dbb3a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
10 changes: 10 additions & 0 deletions main/config/HID_Config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

// Constants for interacting with the interface
// Used by Touch- and Buttondriver
static const unsigned long MSBeforeLongPress = 500; // 1.5s before long press
static const unsigned long MSBeforeTap = 300; // 0.2s before tap
static const unsigned long MSBeforeInvalid = 1500; // 2s before invalidate presses

static const int ScreenWidth = 320;
static const int ScreenHeight = 240;
3 changes: 2 additions & 1 deletion main/touch/ButtonDriver.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <touch/ButtonDriver.h>
#include <config/Config.h>

#include <config/HID_Config.h>

// Specifically for M5Stack which uses Pull-Ups on buttons

Expand Down
2 changes: 2 additions & 0 deletions main/touch/ButtonTypes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <config/HID_Config.h>

namespace gfx
{
enum class PressState: int
Expand Down
1 change: 1 addition & 0 deletions main/touch/TouchDriver.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "TouchDriver.h"
#include "Arduino.h"
#include <config/HID_Config.h>
#include <tft/ScreenSaver.hpp>

namespace gfx
Expand Down
7 changes: 0 additions & 7 deletions main/touch/TouchTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

#include "ui/UIPosition.hpp"

static const unsigned long MSBeforeLongPress = 500; // 1.5s before long press
static const unsigned long MSBeforeTap = 300; // 0.2s before tap
static const unsigned long MSBeforeInvalid = 1500; // 2s before invalidate presses

static const int ScreenWidth = 320;
static const int ScreenHeight = 240;

namespace gfx
{
enum class TouchState: int
Expand Down

0 comments on commit 91dbb3a

Please sign in to comment.