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
timer_requirements.hpp File Reference

Timer driver requirements validator. More...

Detailed Description

Timer driver requirements validator.

Validates that Timer drivers provide required functionality using the method detection system.

Timer Driver Contract

Every Sound Byte Libs Timer driver MUST implement these methods:

  • busy_wait_ms(uint32_t) - Blocking millisecond delay
  • millis() -> uint32_t - Milliseconds since boot
  • micros() -> uint32_t - Microseconds since boot

Optional methods (validated if present):

  • init(uint32_t) - Initialize timer (STM32 needs it, RP2xxx don't)

Validation Usage

Add validation at the bottom of driver timer.hpp:

static_assert(sbl::validation::timer_driver_valid<sbl::driver::Timer>,
"Timer driver missing required methods");
Timer driver requirements validator.
See also
method_detection.hpp

Definition in file timer_requirements.hpp.

Go to the source code of this file.

Classes

class  sbl::validation::TimerDriverRequirements< TimerDriver >
 Timer driver requirements validator. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::validation
 Compile-time driver contracts.
 

Variables

template<typename TimerDriver >
constexpr bool sbl::validation::timer_driver_valid = TimerDriverRequirements<TimerDriver>::validate()
 Helper to validate a Timer driver implementation.