48 #ifndef __DRV_EXT_LIGHT_H__
49 #define __DRV_EXT_LIGHT_H__
52 #include "app_error.h"
53 #include "drv_sx1509.h"
54 #include "sx150x_led_drv_regs.h"
55 #include "sx150x_led_drv_calc.h"
56 #include "app_timer.h"
58 #define DRV_EXT_LIGHT_INTENSITY_MAX ((uint8_t)(0xFF))
59 #define DRV_EXT_LIGHT_INTENSITY_OFF (0)
61 #define DRV_EXT_LIGHT_MAX_PIN_ID_ALLOWED 16
62 #define DRV_EXT_LIGHT_NUM_LIGHTS_MAX (((DRV_SX1509_HIGHINPMODE_PIN15_Pos + 1) < (16)) ? \
63 (DRV_SX1509_HIGHINPMODE_PIN15_Pos + 1) : (16))
64 #define DRV_EXT_LIGHT_IOEXT_CLKX_DIV_MAX (DRV_SX1509_MISC_CLKX_Msk >> DRV_SX1509_MISC_CLKX_Pos)
82 DRV_EXT_LIGHT_CLKX_DIV_1 = 1,
83 DRV_EXT_LIGHT_CLKX_DIV_2 ,
84 DRV_EXT_LIGHT_CLKX_DIV_4 ,
85 DRV_EXT_LIGHT_CLKX_DIV_8 ,
86 DRV_EXT_LIGHT_CLKX_DIV_16,
87 DRV_EXT_LIGHT_CLKX_DIV_32,
88 DRV_EXT_LIGHT_CLKX_DIV_64,
95 DRV_EXT_LIGHT_COLOR_NONE,
96 DRV_EXT_LIGHT_COLOR_RED,
97 DRV_EXT_LIGHT_COLOR_GREEN,
98 DRV_EXT_LIGHT_COLOR_YELLOW,
99 DRV_EXT_LIGHT_COLOR_BLUE,
100 DRV_EXT_LIGHT_COLOR_PURPLE,
101 DRV_EXT_LIGHT_COLOR_CYAN,
102 DRV_EXT_LIGHT_COLOR_WHITE
128 #define DRV_EXT_LIGHT_STATUS_INIT \
130 .active_time_ms = 0, \
131 .inactive_time_ms = 0, \
132 .colors = DRV_EXT_LIGHT_COLOR_NONE, \
133 .ioext_osc_status = EXTENDER_OSC_UNUSED \
146 #define DRV_EXT_LIGHT_DEF(light_id) \
147 static drv_ext_light_status_t light_id##_timings = DRV_EXT_LIGHT_STATUS_INIT; \
148 static app_timer_t light_id##_timer_data = { {0} }; \
149 static drv_ext_light_data_t light_id = {.p_status = &light_id##_timings, .timer = &light_id##_timer_data} \
207 #define SEQUENCE_REAL_VAL_INIT(PARAM) drv_ext_light_sequence_t PARAM = SEQUENCE_DEFAULT_VAL