Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::components::cv::GateInput Class Reference

Gate input with Schmitt trigger hysteresis and edge detection. More...

#include <gate.hpp>

Collaboration diagram for sbl::components::cv::GateInput:

Public Member Functions

 GateInput (const GateConfig &config={})
 
void update (uint16_t raw)
 Feed a new raw ADC sample.
 
bool gate () const
 Current gate state (true = high)
 
bool rising ()
 True if gate just went high (rising edge)
 
bool falling ()
 True if gate just went low (falling edge)
 
void reset ()
 Reset all state.
 

Detailed Description

Gate input with Schmitt trigger hysteresis and edge detection.

Note
All public methods are ISR-safe — pure state machine with no hardware I/O.

Definition at line 29 of file gate.hpp.

Constructor & Destructor Documentation

◆ GateInput()

sbl::components::cv::GateInput::GateInput ( const GateConfig config = {})
inlineexplicit

Definition at line 31 of file gate.hpp.

Member Function Documentation

◆ falling()

bool sbl::components::cv::GateInput::falling ( )
inline

True if gate just went low (falling edge)

Consuming read — resets after first read. Call once per update cycle.

Definition at line 78 of file gate.hpp.

◆ gate()

bool sbl::components::cv::GateInput::gate ( ) const
inline

Current gate state (true = high)

Definition at line 60 of file gate.hpp.

◆ reset()

void sbl::components::cv::GateInput::reset ( )
inline

Reset all state.

Definition at line 85 of file gate.hpp.

◆ rising()

bool sbl::components::cv::GateInput::rising ( )
inline

True if gate just went high (rising edge)

Consuming read — resets after first read. Call once per update cycle.

Definition at line 67 of file gate.hpp.

◆ update()

void sbl::components::cv::GateInput::update ( uint16_t  raw)
inline

Feed a new raw ADC sample.

Schmitt trigger: gate turns ON when value >= threshold_high, turns OFF when value < threshold_low. The hysteresis band between the two thresholds prevents chatter.

Definition at line 43 of file gate.hpp.


The documentation for this class was generated from the following file: