Closed apcountryman closed 1 year ago
Add single signal debouncer (::picolibrary::Debouce::Single_Signal_Debouncer).
::picolibrary::Debouce::Single_Signal_Debouncer
Single_Signal_Debouncer
include/picolibrary/debouce.h
source/picolibrary/debouce.cc
typename Samples
std::uint_fast8_t SAMPLES
constexpr Single_Signal_Debouncer( bool is_high ) noexcept;
constexpr Single_Signal_Debouncer( Single_Signal_Debouncer && source ) noexcept = default;
constexpr Single_Signal_Debouncer( Single_Signal_Debouncer const & source ) noexcept = default;
~Single_Signal_Debouncer() noexcept = default;
constexpr auto operator=( Single_Signal_Debouncer && expression ) noexcept -> Single_Signal_Debouncer & = default;
constexpr auto operator=( Single_Signal_Debouncer const & expression ) noexcept -> Single_Signal_Debouncer & = default;
void debounce( bool is_high ) noexcept;
auto is_high() const noexcept -> bool;
auto is_low() const noexcept -> bool;
Add single signal debouncer (
::picolibrary::Debouce::Single_Signal_Debouncer
).Single_Signal_Debouncer
class should be defined in theinclude/picolibrary/debouce.h
/source/picolibrary/debouce.cc
header/source file pairSingle_Signal_Debouncer
class should have automated testsSingle_Signal_Debouncer
class should have the following template arguments:typename Samples
: The unsigned integer type used to hold a signal sample streamstd::uint_fast8_t SAMPLES
: The number of signal samples to use to determine whether the signal state is stableSingle_Signal_Debouncer
class should support the following operations:constexpr Single_Signal_Debouncer( bool is_high ) noexcept;
constexpr Single_Signal_Debouncer( Single_Signal_Debouncer && source ) noexcept = default;
constexpr Single_Signal_Debouncer( Single_Signal_Debouncer const & source ) noexcept = default;
~Single_Signal_Debouncer() noexcept = default;
constexpr auto operator=( Single_Signal_Debouncer && expression ) noexcept -> Single_Signal_Debouncer & = default;
constexpr auto operator=( Single_Signal_Debouncer const & expression ) noexcept -> Single_Signal_Debouncer & = default;
void debounce( bool is_high ) noexcept;
: Update the debouncer with a new sampleauto is_high() const noexcept -> bool;
: Check if the debounced signal is in the high stateauto is_low() const noexcept -> bool;
: Check if the debounced signal is in the low state