Gate controller pairing behind BOOTSEL
This commit is contained in:
parent
fac919a798
commit
4a73680bd2
24 changed files with 934 additions and 145 deletions
23
bootsel_pairing_button.h
Normal file
23
bootsel_pairing_button.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class BootselPairingButtonSample : uint8_t {
|
||||
kUnread,
|
||||
kReleased,
|
||||
kPressed,
|
||||
};
|
||||
|
||||
class BootselPairingButtonHoldFsm {
|
||||
public:
|
||||
static constexpr uint8_t kHoldSamples = 20;
|
||||
|
||||
bool update(BootselPairingButtonSample sample);
|
||||
|
||||
private:
|
||||
uint8_t pressed_samples_ = 0;
|
||||
bool hold_reported_ = false;
|
||||
};
|
||||
|
||||
// Polls BOOTSEL at 10 Hz. Returns true once when a 20-sample hold completes.
|
||||
bool bootsel_pairing_button_task();
|
||||
Loading…
Add table
Add a link
Reference in a new issue