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
>
14
#include <
sbl/hw/components/input/digital_gate.hpp
>
15
16
namespace
sbl::gate
{
17
18
using
DigitalGateInput
=
sbl::components::input::DigitalGateInput
;
19
using
DigitalGateConfig
=
sbl::components::input::DigitalGateConfig
;
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
28
template
<
typename
Driver>
29
inline
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_
sbl::components::input::DigitalGateInput
Definition
digital_gate.hpp:31
sbl::components::input::DigitalGateInput::update
void update(bool logical_state)
Definition
digital_gate.hpp:39
digital_gate.hpp
Debounced digital gate input.
sbl::gate
Gate input helpers.
Definition
input.hpp:16
sbl::gate::read
void read(DigitalGateInput &gate, const GpioHandle &handle)
Definition
input.hpp:29
sbl::GpioHandle
GPIO pin handle with port, pin number, and polarity.
Definition
handle.hpp:29
sbl::components::input::DigitalGateConfig
Definition
digital_gate.hpp:23
types.hpp
Common types for SBL hardware abstraction.
src
sbl
hw
hal
gate
input.hpp
Generated by
1.9.8