mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2026-03-19 18:32:39 +01:00
borrwoed a lot code from https://github.com/foriequal0/devterm_keyboard in order to optimize the trackball
This commit is contained in:
34
Code/devterm_keyboard/state.h
Normal file
34
Code/devterm_keyboard/state.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef STATE_H
|
||||
#define STATE_H
|
||||
|
||||
#include <bitset>
|
||||
#include <array>
|
||||
#include <USBComposite.h>
|
||||
|
||||
#include "debouncer.h"
|
||||
|
||||
enum class TrackballMode : uint8_t {
|
||||
Wheel,
|
||||
Mouse,
|
||||
};
|
||||
|
||||
class State
|
||||
{
|
||||
public:
|
||||
static const uint16_t MIDDLE_CLICK_TIMEOUT_MS = 0;
|
||||
|
||||
State();
|
||||
|
||||
void tick(uint8_t delta);
|
||||
|
||||
bool fn;
|
||||
|
||||
void pressMiddleClick();
|
||||
bool releaseMiddleClick();
|
||||
TrackballMode moveTrackball();
|
||||
private:
|
||||
bool middleClick;
|
||||
Timeout<uint16_t, MIDDLE_CLICK_TIMEOUT_MS> middleClickTimeout;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user