31#ifndef SBL_HW_VALIDATION_BOARD_REQUIREMENTS_HPP_
32#define SBL_HW_VALIDATION_BOARD_REQUIREMENTS_HPP_
45template<
typename T,
typename =
void>
46struct updates_from_counts : std::false_type {};
48struct updates_from_counts<T, std::void_t<decltype(std::declval<T&>().update(std::declval<uint16_t>()))>>
51template<
typename T,
typename =
void>
52struct takes_electrical : std::false_type {};
54struct takes_electrical<
55 T, std::void_t<decltype(std::declval<T&>().set_electrical(std::declval<const sbl::hal::adc::Electrical&>()))>>
58template<
typename T,
typename =
void>
59struct updates_from_level : std::false_type {};
61struct updates_from_level<
62 T, std::void_t<decltype(std::declval<T&>().update(std::declval<bool>(), std::declval<uint32_t>()))>>
65template<
typename T,
typename =
void>
66struct updates_from_quadrature : std::false_type {};
68struct updates_from_quadrature<
69 T, std::void_t<decltype(std::declval<T&>().update(std::declval<bool>(), std::declval<bool>()))>> : std::true_type {
72template<
typename T,
typename =
void>
73struct has_rgb_state : std::false_type {};
76 T, std::void_t<decltype(std::declval<const T&>().state().r), decltype(std::declval<const T&>().state().g),
77 decltype(std::declval<const T&>().state().b)>>
78 : std::integral_constant<bool, std::is_convertible_v<decltype(std::declval<const T&>().state().r), uint8_t> &&
79 std::is_convertible_v<decltype(std::declval<const T&>().state().g), uint8_t> &&
80 std::is_convertible_v<decltype(std::declval<const T&>().state().b), uint8_t>> {};
88 static constexpr bool validate() {
89 static_assert(detail::updates_from_counts<T>::value,
"SBL ERROR: pot role type missing update().\n"
90 "Required: void update(uint16_t raw)");
103 static constexpr bool validate() {
104 static_assert(detail::updates_from_counts<T>::value,
"SBL ERROR: cv_input role type missing update().\n"
105 "Required: void update(uint16_t raw)");
107 static_assert(detail::takes_electrical<T>::value,
108 "SBL ERROR: cv_input role type missing set_electrical().\n"
109 "Required: void set_electrical(const sbl::hal::adc::Electrical&)");
122 static constexpr bool validate() {
123 static_assert(detail::updates_from_level<T>::value,
124 "SBL ERROR: button role type missing update().\n"
125 "Required: void update(bool level, uint32_t elapsed_ticks)");
138 static constexpr bool validate() {
139 static_assert(detail::updates_from_quadrature<T>::value,
"SBL ERROR: encoder role type missing update().\n"
140 "Required: void update(bool a, bool b)");
153 static constexpr bool validate() {
154 static_assert(detail::has_rgb_state<T>::value,
"SBL ERROR: rgb_led role type missing state().\n"
155 "Required: state() returning r, g, b convertible to uint8_t");
encoder role: update(bool a, bool b)
pot role: update(uint16_t raw)
rgb_led role: state() with r, g, b duty
Electrical description of an analog port - the jack-to-converter circuit.
Root namespace for all Sound Byte Libs code.