Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
board_requirements.hpp File Reference

Board role contracts: what a generated Board calls on each role. More...

Detailed Description

Board role contracts: what a generated Board calls on each role.

A board role is a component type a hardware manifest can declare (pot, cv_input, button, encoder, rgb_led). The generated Board reads the HAL and hands each role a sample; what the role does with it (smoothing, debounce, calibration) is the implementation's. SBL's implementations are the default bindings; a device, app or target can bind any type that meets the role's contract.

Role Contracts

  • pot: update(uint16_t raw)
  • cv_input: update(uint16_t raw); set_electrical(const sbl::hal::adc::Electrical&), called once from Board::init() with the jack's manifest electrics
  • button: update(bool level, uint32_t elapsed_ticks), the ticks the app's control clock counted since the update before, as the app handed them to the Board's update
  • encoder: update(bool a, bool b)
  • rgb_led: state() returning a value with r, g, b duty as uint8_t

Validation Usage

The generated Board asserts each role it uses:

static_assert(sbl::validation::board_button_valid<MyButton>, "button role");

Definition in file board_requirements.hpp.

#include <cstdint>
#include <type_traits>
#include <utility>
#include <sbl/hw/hal/adc/electrical.hpp>

Go to the source code of this file.

Classes

class  sbl::validation::PotRoleRequirements< T >
 pot role: update(uint16_t raw) More...
 
class  sbl::validation::CvInputRoleRequirements< T >
 cv_input role: update(uint16_t raw), set_electrical(const Electrical&) More...
 
class  sbl::validation::ButtonRoleRequirements< T >
 button role: update(bool level, uint32_t elapsed_ticks) More...
 
class  sbl::validation::EncoderRoleRequirements< T >
 encoder role: update(bool a, bool b) More...
 
class  sbl::validation::RgbLedRoleRequirements< T >
 rgb_led role: state() with r, g, b duty More...
 

Namespaces

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

Variables

template<typename T >
constexpr bool sbl::validation::board_pot_valid = PotRoleRequirements<T>::validate()
 
template<typename T >
constexpr bool sbl::validation::board_cv_input_valid = CvInputRoleRequirements<T>::validate()
 
template<typename T >
constexpr bool sbl::validation::board_button_valid = ButtonRoleRequirements<T>::validate()
 
template<typename T >
constexpr bool sbl::validation::board_encoder_valid = EncoderRoleRequirements<T>::validate()
 
template<typename T >
constexpr bool sbl::validation::board_rgb_led_valid = RgbLedRoleRequirements<T>::validate()