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
input.hpp
Go to the documentation of this file.
1// sbl/hw/hal/gate/input.hpp — Digital gate input convenience
2//
3// Composes GPIO driver reads with DigitalGateInput update in a single call.
4//
5// Usage:
6// #include <sbl/hw/hal/gate/input.hpp>
7//
8// sbl::gate::read<sbl::driver::Gpio>(gate, handle);
9
10#ifndef SBL_HW_HAL_GATE_INPUT_HPP_
11#define SBL_HW_HAL_GATE_INPUT_HPP_
12
13#include <sbl/types.hpp>
15
16namespace sbl::gate {
17
20
21/// Read GPIO pin and feed into DigitalGateInput (debounce + edge detection).
22///
23/// @tparam Driver GPIO driver type (e.g., sbl::driver::Gpio)
24/// @param gate DigitalGateInput instance to update
25/// @param handle GPIO handle for the gate pin
26///
27/// @note ISR-safe — single GPIO register read
28template<typename Driver>
29inline void read(DigitalGateInput& gate, const GpioHandle& handle) {
30 gate.update(Driver::read(handle));
31}
32
33} // namespace sbl::gate
34
35#endif // SBL_HW_HAL_GATE_INPUT_HPP_
Debounced digital gate input.
Gate input helpers.
Definition input.hpp:16
void read(DigitalGateInput &gate, const GpioHandle &handle)
Definition input.hpp:29
GPIO pin handle with port, pin number, and polarity.
Definition handle.hpp:29
Common types for SBL hardware abstraction.