LibDriver WS2812B
Loading...
Searching...
No Matches
driver_ws2812b_basic.c
Go to the documentation of this file.
1
36
38
39static ws2812b_handle_t gs_handle;
40
48uint8_t ws2812b_basic_init(void)
49{
50 uint8_t res;
51
52 /* link interface function */
59
60 /* ws2812b initialization */
61 res = ws2812b_init(&gs_handle);
62 if (res != 0)
63 {
64 ws2812b_interface_debug_print("ws2812b: init failed.\n");
65
66 return 1;
67 }
68
69 return 0;
70}
71
83uint8_t ws2812b_basic_write(uint32_t *rgb, uint32_t len, uint8_t *temp, uint32_t temp_len)
84{
85 if (ws2812b_write(&gs_handle, rgb, len, temp, temp_len) != 0)
86 {
87 return 1;
88 }
89 else
90 {
91 return 0;
92 }
93}
94
103{
104 if (ws2812b_deinit(&gs_handle) != 0)
105 {
106 return 1;
107 }
108 else
109 {
110 return 0;
111 }
112}
driver ws2812b basic header file
uint8_t ws2812b_write(ws2812b_handle_t *handle, uint32_t *rgb, uint32_t len, uint8_t *temp, uint32_t temp_len)
write reset and color frame
uint8_t ws2812b_deinit(ws2812b_handle_t *handle)
close the chip
struct ws2812b_handle_s ws2812b_handle_t
ws2812b handle structure definition
uint8_t ws2812b_init(ws2812b_handle_t *handle)
initialize the chip
uint8_t ws2812b_basic_write(uint32_t *rgb, uint32_t len, uint8_t *temp, uint32_t temp_len)
basic example write
uint8_t ws2812b_basic_deinit(void)
basic example deinit
uint8_t ws2812b_basic_init(void)
basic example init
void ws2812b_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t ws2812b_interface_spi_write_cmd(uint8_t *buf, uint16_t len)
interface spi bus write command
uint8_t ws2812b_interface_spi_10mhz_init(void)
interface spi 10mhz bus init
uint8_t ws2812b_interface_spi_deinit(void)
interface spi bus deinit
void ws2812b_interface_delay_ms(uint32_t ms)
interface delay ms