Add physical and USB pairing management
This commit is contained in:
parent
74a62f035b
commit
41c7021813
22 changed files with 1263 additions and 72 deletions
|
|
@ -7,17 +7,26 @@ enum class BootselPairingButtonSample : uint8_t {
|
|||
kReleased,
|
||||
kPressed,
|
||||
};
|
||||
enum class BootselPairingButtonEvent : uint8_t {
|
||||
kNone,
|
||||
kOpenPairing,
|
||||
kClearPairings,
|
||||
};
|
||||
|
||||
|
||||
class BootselPairingButtonHoldFsm {
|
||||
public:
|
||||
static constexpr uint8_t kHoldSamples = 20;
|
||||
static constexpr uint8_t kPairingHoldSamples = 20;
|
||||
static constexpr uint8_t kClearHoldSamples = 100;
|
||||
|
||||
bool update(BootselPairingButtonSample sample);
|
||||
BootselPairingButtonEvent update(BootselPairingButtonSample sample);
|
||||
|
||||
private:
|
||||
uint8_t pressed_samples_ = 0;
|
||||
bool hold_reported_ = false;
|
||||
bool pairing_reported_ = false;
|
||||
bool clear_reported_ = false;
|
||||
};
|
||||
|
||||
// Polls BOOTSEL at 10 Hz. Returns true once when a 20-sample hold completes.
|
||||
bool bootsel_pairing_button_task();
|
||||
// Polls BOOTSEL at 10 Hz. Reports pairing at 2 seconds and clearing at
|
||||
// 10 seconds; each event fires once per continuous hold.
|
||||
BootselPairingButtonEvent bootsel_pairing_button_task();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue