mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-30 11:23:53 +00:00

* Fix type of nodeNum Type of nodeNum is NodeNum, not uint * typo fixed typo "resumeAdverising()" * fix missing #include "time.h" Missing include breaks compilation with gccnoneeabi 12.3.1 for nrf52 targets on windows hosts. * change type uint to unsigned int uint is not a standard type. Using uint breaks compilation with gccnoneeabi 12.3.1 for nRF52 targets on windows hosts. * fix type of channel_num Type of channel_num should be uint32_t (as this is the type of hash() and numChannels). Using uint non-standard type uint breaks compilation with gccnoneeabi 12.3.1 for nRF52 targets on windows hosts. * Update nrf52.ini Default build type should be "release" as this is the default of platformio. * Update GPS.cpp uint to unsigned int
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "InputBroker.h"
|
|
#include "concurrency/OSThread.h"
|
|
#include "mesh/NodeDB.h"
|
|
#include "time.h"
|
|
|
|
typedef struct _TouchEvent {
|
|
const char *source;
|
|
char touchEvent;
|
|
uint16_t x;
|
|
uint16_t y;
|
|
} TouchEvent;
|
|
|
|
class TouchScreenBase : public Observable<const InputEvent *>, public concurrency::OSThread
|
|
{
|
|
public:
|
|
explicit TouchScreenBase(const char *name, uint16_t width, uint16_t height);
|
|
void init(bool hasTouch);
|
|
|
|
protected:
|
|
enum TouchScreenBaseStateType { TOUCH_EVENT_OCCURRED, TOUCH_EVENT_CLEARED };
|
|
|
|
enum TouchScreenBaseEventType {
|
|
TOUCH_ACTION_NONE,
|
|
TOUCH_ACTION_UP,
|
|
TOUCH_ACTION_DOWN,
|
|
TOUCH_ACTION_LEFT,
|
|
TOUCH_ACTION_RIGHT,
|
|
TOUCH_ACTION_TAP,
|
|
TOUCH_ACTION_DOUBLE_TAP,
|
|
TOUCH_ACTION_LONG_PRESS
|
|
};
|
|
|
|
virtual int32_t runOnce() override;
|
|
|
|
virtual bool getTouch(int16_t &x, int16_t &y) = 0;
|
|
virtual void onEvent(const TouchEvent &event) = 0;
|
|
|
|
volatile TouchScreenBaseStateType _state = TOUCH_EVENT_CLEARED;
|
|
volatile TouchScreenBaseEventType _action = TOUCH_ACTION_NONE;
|
|
void hapticFeedback();
|
|
|
|
protected:
|
|
uint16_t _display_width;
|
|
uint16_t _display_height;
|
|
|
|
private:
|
|
bool _touchedOld = false; // previous touch state
|
|
int16_t _first_x, _last_x; // horizontal swipe direction
|
|
int16_t _first_y, _last_y; // vertical swipe direction
|
|
time_t _start; // for LONG_PRESS
|
|
bool _tapped; // for DOUBLE_TAP
|
|
|
|
const char *_originName;
|
|
};
|