38 #ifndef LIGHT_LIGHTNESS_UTILS_H__ 39 #define LIGHT_LIGHTNESS_UTILS_H__ 43 #include "generic_level_common.h" 62 return CEIL_DIV((uint32_t)ll_actual * ll_actual, UINT16_MAX);
76 return uint_sqrt((uint32_t)ll_linear * UINT16_MAX);
118 return (ll_actual == 0 ? 0 : 1);
136 return ll_actual != 0 ? MIN(MAX(ll_actual, range_min), range_max) : 0;
static uint16_t light_lightness_utils_linear_to_actual(uint16_t ll_linear)
Convert the Light Lightness Linear state to the Light Lightness Actual state.
static uint16_t light_lightness_utils_actual_to_linear(uint16_t ll_actual)
Converts the Light Lightness Actual state to the Light Lightness Linear state.
static uint8_t light_lightness_utils_actual_to_generic_onoff(uint16_t ll_actual)
Convert the Light Lightness Actual state to the Generic OnOff state.
#define GENERIC_LEVEL_MIN
Generic Level state minimum value.
static uint16_t light_lightness_utils_actual_to_range_restrict(uint16_t ll_actual, uint16_t range_min, uint16_t range_max)
Convert the Light Lightness Actual state to the Generic OnOff state.
static uint16_t light_lightness_utils_generic_level_to_actual(int16_t level)
Convert the Generic Level state to the Light Lightness Actual state.
static int16_t light_lightness_utils_actual_to_generic_level(uint16_t ll_actual)
Convert the Light Lightness Actual state to the Generic Level state.