Sound Byte Libs 1ee2ca6
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 core {
17namespace hal {
18namespace timing {
19
20/**
21 * @brief Timer operating modes
22 */
23enum class TimerMode : uint8_t {
24 OneShot, ///< Timer fires once then stops
25 Periodic ///< Timer fires repeatedly at interval
26};
27
28/**
29 * @brief Timer interrupt types
30 */
31enum class TimerEvent : uint8_t {
32 Overflow, ///< Timer overflow/update interrupt
33 Capture, ///< Input capture interrupt (if supported)
34 Compare ///< Output compare interrupt (if supported)
35};
36
37/**
38 * @brief Timer configuration structure
39 *
40 * Simple configuration for timer setup. Platform implementations
41 * can extend this or use it as-is based on hardware capabilities.
42 */
44 uint32_t frequency_hz; ///< Desired timer frequency in Hz
45 TimerMode mode; ///< Operating mode
46 bool enable_interrupt; ///< Enable overflow interrupt
47
48 constexpr TimerConfig(uint32_t freq, TimerMode m, bool irq = false)
49 : frequency_hz(freq), mode(m), enable_interrupt(irq) {}
50};
51
52} // namespace timing
53} // namespace hal
54} // namespace core
55} // namespace sbl
56
57#endif // SBL_HAL_TIMING_TYPES_HPP_
TimerMode
Timer operating modes.
Definition types.hpp:23
@ OneShot
Timer fires once then stops.
@ Periodic
Timer fires repeatedly at interval.
TimerEvent
Timer interrupt types.
Definition types.hpp:31
@ 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:43
bool enable_interrupt
Enable overflow interrupt.
Definition types.hpp:46
uint32_t frequency_hz
Desired timer frequency in Hz.
Definition types.hpp:44
constexpr TimerConfig(uint32_t freq, TimerMode m, bool irq=false)
Definition types.hpp:48
TimerMode mode
Operating mode.
Definition types.hpp:45