LibDriver WS2812B
Loading...
Searching...
No Matches
ws2812b base driver function

ws2812b base driver modules More...

Collaboration diagram for ws2812b base driver function:

Data Structures

struct  ws2812b_handle_s
 ws2812b handle structure definition More...
struct  ws2812b_info_s
 ws2812b information structure definition More...

Macros

#define WS2812B_EACH_RESET_BIT_FRAME_LEN   512
 ws2812b each reset bit frame length definition

Typedefs

typedef struct ws2812b_handle_s ws2812b_handle_t
 ws2812b handle structure definition
typedef struct ws2812b_info_s ws2812b_info_t
 ws2812b information structure definition

Functions

uint8_t ws2812b_info (ws2812b_info_t *info)
 get chip's information
uint8_t ws2812b_init (ws2812b_handle_t *handle)
 initialize the chip
uint8_t ws2812b_deinit (ws2812b_handle_t *handle)
 close the chip
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_write_only_reset (ws2812b_handle_t *handle, uint32_t len, uint8_t *temp, uint32_t temp_len)
 write the reset frame
uint8_t ws2812b_write_only_color (ws2812b_handle_t *handle, uint32_t *rgb, uint32_t len, uint8_t *temp, uint32_t temp_len)
 write the color frame
uint8_t ws2812b_set_reg (ws2812b_handle_t *handle, uint8_t *buf, uint16_t len)
 set the chip register

Detailed Description

ws2812b base driver modules

Macro Definition Documentation

◆ WS2812B_EACH_RESET_BIT_FRAME_LEN

#define WS2812B_EACH_RESET_BIT_FRAME_LEN   512

ws2812b each reset bit frame length definition

512

Definition at line 63 of file driver_ws2812b.h.

Typedef Documentation

◆ ws2812b_handle_t

ws2812b handle structure definition

◆ ws2812b_info_t

ws2812b information structure definition

Function Documentation

◆ ws2812b_deinit()

uint8_t ws2812b_deinit ( ws2812b_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a ws2812b handle structure
Returns
status code
  • 0 success
  • 1 spi deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 390 of file driver_ws2812b.c.

◆ ws2812b_info()

uint8_t ws2812b_info ( ws2812b_info_t * info)

get chip's information

Parameters
[out]*infopointer to a ws2812b info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 449 of file driver_ws2812b.c.

◆ ws2812b_init()

uint8_t ws2812b_init ( ws2812b_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a ws2812b handle structure
Returns
status code
  • 0 success
  • 1 spi initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 61 of file driver_ws2812b.c.

◆ ws2812b_set_reg()

uint8_t ws2812b_set_reg ( ws2812b_handle_t * handle,
uint8_t * buf,
uint16_t len )

set the chip register

Parameters
[in]*handlepointer to a ws2812b handle structure
[in]*bufpointer to a data buffer
[in]lendata length
Returns
status code
  • 0 success
  • 1 write failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 427 of file driver_ws2812b.c.

◆ ws2812b_write()

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

Parameters
[in]*handlepointer to a ws2812b handle structure
[in]*rgbpointer to a rgb color buffer
[in]lenrgb length
[in]*temppointer to a temp buffer
[in]temp_lentemp buffer length
Returns
status code
  • 0 success
  • 1 write command failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 rgb is null
  • 5 temp is null
  • 6 temp buffer is too small
Note
none

Definition at line 181 of file driver_ws2812b.c.

◆ ws2812b_write_only_color()

uint8_t ws2812b_write_only_color ( ws2812b_handle_t * handle,
uint32_t * rgb,
uint32_t len,
uint8_t * temp,
uint32_t temp_len )

write the color frame

Parameters
[in]*handlepointer to a ws2812b handle structure
[in]*rgbpointer to a rgb color buffer
[in]lenrgb length
[in]*temppointer to a temp buffer
[in]temp_lentemp buffer length
Returns
status code
  • 0 success
  • 1 write command failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 rgb is null
  • 5 temp is null
  • 6 temp buffer is too small
Note
none

Definition at line 329 of file driver_ws2812b.c.

◆ ws2812b_write_only_reset()

uint8_t ws2812b_write_only_reset ( ws2812b_handle_t * handle,
uint32_t len,
uint8_t * temp,
uint32_t temp_len )

write the reset frame

Parameters
[in]*handlepointer to a ws2812b handle structure
[in]lenrgb length
[in]*temppointer to a temp buffer
[in]temp_lentemp buffer length
Returns
status code
  • 0 success
  • 1 write command failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 temp is null
  • 5 temp buffer is too small
Note
none

Definition at line 267 of file driver_ws2812b.c.