2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
debouncer.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <chrono>
8
10#include "units/time.h"
11
12namespace argos_lib {
13
14 class Debouncer {
15 public:
22 explicit Debouncer(const argos_lib::DebounceSettings debounceSettings, bool initialValue = false);
23
29 explicit Debouncer(const units::millisecond_t symmetricDebounceTime);
30
37 [[nodiscard]] bool operator()(bool newVal);
38
44 void Reset(bool newVal);
45
46 private:
50 std::chrono::time_point<std::chrono::steady_clock>
52 };
53
54} // namespace argos_lib
Definition debouncer.h:14
argos_lib::DebounceSettings m_debounceSettings
Configuration for asymmetric debouncer.
Definition debouncer.h:47
void Reset(bool newVal)
Resets debouncer to a known status like at construction.
Definition debouncer.cpp:44
bool m_rawStatus
Last raw value.
Definition debouncer.h:48
bool m_debouncedStatus
Current value after applying debounce.
Definition debouncer.h:49
bool operator()(bool newVal)
Update debouncer with new input and retreive latest debounced status.
Definition debouncer.cpp:18
std::chrono::time_point< std::chrono::steady_clock > m_debounceTransitionTime
Time when latest transition detected.
Definition debouncer.h:51
Definition swap_controllers_command.h:12
Definition debounce_settings.h:11