Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1/**
2 * @file types.hpp
3 * @brief Common timing types and enumerations
4 * @ingroup hal
5 *
6 * Shared timing types used across timer and delay components.
7 * Simple data structures with no behavior - pure types only.
8 */
9
10#ifndef SBL_HAL_TIMING_TYPES_HPP_
11#define SBL_HAL_TIMING_TYPES_HPP_
12
13#include <cstdint>
14
15namespace sbl {
16namespace hal {
17namespace timing {
18
19/**
20 * @brief Timer operating modes
21 */
22enum class TimerMode : uint8_t {
23 OneShot, ///< Timer fires once then stops
24 Periodic ///< Timer fires repeatedly at interval
25};
26
27/**
28 * @brief Timer interrupt types
29 */
30enum class TimerEvent : uint8_t {
31 Overflow, ///< Timer overflow/update interrupt
32 Capture, ///< Input capture interrupt (if supported)
33 Compare ///< Output compare interrupt (if supported)
34};
35
36/**
37 * @brief Timer configuration structure
38 *
39 * Simple configuration for timer setup. Platform implementations
40 * can extend this or use it as-is based on hardware capabilities.
41 */
43 uint32_t frequency_hz; ///< Desired timer frequency in Hz
44 TimerMode mode; ///< Operating mode
45 bool enable_interrupt; ///< Enable overflow interrupt
46
47 constexpr TimerConfig(uint32_t freq, TimerMode m, bool irq = false)
48 : frequency_hz(freq), mode(m), enable_interrupt(irq) {}
49};
50
51} // namespace timing
52} // namespace hal
53} // namespace sbl
54
55#endif // SBL_HAL_TIMING_TYPES_HPP_
TimerMode
Timer operating modes.
Definition types.hpp:22
@ OneShot
Timer fires once then stops.
@ Periodic
Timer fires repeatedly at interval.
TimerEvent
Timer interrupt types.
Definition types.hpp:30
@ Overflow
Timer overflow/update interrupt.
@ Capture
Input capture interrupt (if supported)
@ Compare
Output compare interrupt (if supported)
Root namespace for all Sound Byte Libs functionality.
Definition aliases.hpp:24
Timer configuration structure.
Definition types.hpp:42
constexpr TimerConfig(uint32_t freq, TimerMode m, bool irq=false)
Definition types.hpp:47
uint32_t frequency_hz
Desired timer frequency in Hz.
Definition types.hpp:43
bool enable_interrupt
Enable overflow interrupt.
Definition types.hpp:45
TimerMode mode
Operating mode.
Definition types.hpp:44