Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
button_classifier.h
Go to the documentation of this file.
1
9
#pragma once
10
11
#include <cstdint>
12
13
namespace
aiming
14
{
15
enum class
ButtonEvent : uint8_t {
None
, Short, Long };
16
17
struct
ButtonConfig
{
18
uint32_t debounce_ms = 50;
19
uint32_t long_ms = 1500;
20
};
21
22
class
ButtonClassifier
23
{
24
public
:
25
explicit
ButtonClassifier
(
const
ButtonConfig
& config =
ButtonConfig
{}) : config_(config) {}
26
ButtonEvent update(
bool
pressed_raw, uint32_t now_ms);
27
28
private
:
29
ButtonConfig
config_;
30
bool
raw_ =
false
;
31
uint32_t raw_since_ms_ = 0;
32
bool
stable_ =
false
;
33
uint32_t pressed_at_ms_ = 0;
34
bool
long_fired_ =
false
;
35
};
36
}
// namespace aiming
aiming::ButtonClassifier
Definition
button_classifier.h:23
MoveXValue::None
@ None
aiming::ButtonConfig
Definition
button_classifier.h:17
lib
aiming
include
button_classifier.h
Generated by
1.12.0