Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::components::cv::GateInput Class Reference

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

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 30 of file gate.hpp.

#include <gate.hpp>

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.
 

Constructor & Destructor Documentation

◆ GateInput()

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

Definition at line 32 of file gate.hpp.

Member Function Documentation

◆ 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 44 of file gate.hpp.

◆ gate()

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

Current gate state (true = high)

Definition at line 61 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 68 of file gate.hpp.

◆ 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 79 of file gate.hpp.

◆ reset()

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

Reset all state.

Definition at line 86 of file gate.hpp.


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