42#define CHIP_NAME "Shiji Lighting APA102C"
43#define MANUFACTURER_NAME "Shiji Lighting"
44#define SUPPLY_VOLTAGE_MIN 5.0f
45#define SUPPLY_VOLTAGE_MAX 5.5f
46#define MAX_CURRENT 200.0f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 70.0f
49#define DRIVER_VERSION 1000
73 handle->
debug_print(
"apa102c: spi_init is null.\n");
79 handle->
debug_print(
"apa102c: spi_deinit is null.\n");
85 handle->
debug_print(
"apa102c: spi_write_cmd is null.\n");
91 handle->
debug_print(
"apa102c: delay_ms is null.\n");
150 byte_size = len * 4 + 8;
151 if (byte_size > temp_len)
153 handle->
debug_print(
"apa102c: temp buffer is too small.\n");
161 for (i = 0; i < len; i++)
163 temp[4 + i * 4 + 0] = (color[i] >> 24) & 0xFF;
164 temp[4 + i * 4 + 1] = (color[i] >> 16) & 0xFF;
165 temp[4 + i * 4 + 2] = (color[i] >> 8) & 0xFF;
166 temp[4 + i * 4 + 3] = (color[i] >> 0) & 0xFF;
168 temp[4 + len * 4 + 0] = 0xFF;
169 temp[4 + len * 4 + 1] = 0xFF;
170 temp[4 + len * 4 + 2] = 0xFF;
171 temp[4 + len * 4 + 3] = 0xFF;
175 handle->
debug_print(
"apa102c: write command failed.\n");
218 byte_size = len * 4 + 8;
219 if (byte_size > temp_len)
221 handle->
debug_print(
"apa102c: temp buffer is too small.\n");
229 for (i = 0; i < len; i++)
231 temp[4 + i * 4 + 0] = 0xE0;
232 temp[4 + i * 4 + 1] = 0x00;
233 temp[4 + i * 4 + 2] = 0x00;
234 temp[4 + i * 4 + 3] = 0x00;
236 temp[4 + len * 4 + 0] = 0xFF;
237 temp[4 + len * 4 + 1] = 0xFF;
238 temp[4 + len * 4 + 2] = 0xFF;
239 temp[4 + len * 4 + 3] = 0xFF;
243 handle->
debug_print(
"apa102c: write command failed.\n");
277 handle->
debug_print(
"apa102c: spi deinit failed.\n");
#define SUPPLY_VOLTAGE_MAX
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip register definition
driver apa102c header file
uint8_t apa102c_info(apa102c_info_t *info)
get chip's information
uint8_t apa102c_init(apa102c_handle_t *handle)
initialize the chip
uint8_t apa102c_deinit(apa102c_handle_t *handle)
close the chip
uint8_t apa102c_write(apa102c_handle_t *handle, uint32_t *color, uint32_t len, uint8_t *temp, uint32_t temp_len)
write color frame
uint8_t apa102c_write_off(apa102c_handle_t *handle, uint32_t len, uint8_t *temp, uint32_t temp_len)
write off frame
struct apa102c_info_s apa102c_info_t
apa102c information structure definition
struct apa102c_handle_s apa102c_handle_t
apa102c handle structure definition
uint8_t apa102c_set_reg(apa102c_handle_t *handle, uint8_t *buf, uint16_t len)
set the chip register
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* spi_deinit)(void)
uint8_t(* spi_write_cmd)(uint8_t *buf, uint16_t len)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v