Classes | Macros | Typedefs | Enumerations | Functions
ws2811.h File Reference
#include <stdint.h>
#include "rpihw.h"
#include "pwm.h"
Include dependency graph for ws2811.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ws2811_channel_t
 
struct  ws2811_t
 

Macros

#define SK6812_SHIFT_WMASK   0xf0000000
 
#define SK6812_STRIP   WS2811_STRIP_GRB
 
#define SK6812_STRIP_BGRW   0x18000810
 
#define SK6812_STRIP_BRGW   0x18001008
 
#define SK6812_STRIP_GBRW   0x18080010
 
#define SK6812_STRIP_GRBW   0x18081000
 
#define SK6812_STRIP_RBGW   0x18100008
 
#define SK6812_STRIP_RGBW   0x18100800
 
#define SK6812W_STRIP   SK6812_STRIP_GRBW
 
#define WS2811_RETURN_STATES(X)
 
#define WS2811_RETURN_STATES_ENUM(state, name, str)   name = state
 
#define WS2811_RETURN_STATES_STRING(state, name, str)   str
 
#define WS2811_STRIP_BGR   0x00000810
 
#define WS2811_STRIP_BRG   0x00001008
 
#define WS2811_STRIP_GBR   0x00080010
 
#define WS2811_STRIP_GRB   0x00081000
 
#define WS2811_STRIP_RBG   0x00100008
 
#define WS2811_STRIP_RGB   0x00100800
 
#define WS2811_TARGET_FREQ   800000
 
#define WS2812_STRIP   WS2811_STRIP_GRB
 

Typedefs

typedef struct ws2811_channel_t ws2811_channel_t
 
typedef uint32_t ws2811_led_t
 
typedef struct ws2811_t ws2811_t
 

Enumerations

enum  ws2811_return_t { WS2811_RETURN_STATES =(WS2811_RETURN_STATES_ENUM), WS2811_RETURN_STATE_COUNT, WS2811_RETURN_STATES =(WS2811_RETURN_STATES_ENUM), WS2811_RETURN_STATE_COUNT }
 

Functions

void ws2811_fini (ws2811_t *ws2811)
 
const char * ws2811_get_return_t_str (const ws2811_return_t state)
 
ws2811_return_t ws2811_init (ws2811_t *ws2811)
 
ws2811_return_t ws2811_render (ws2811_t *ws2811)
 
void ws2811_set_custom_gamma_factor (ws2811_t *ws2811, double gamma_factor)
 
ws2811_return_t ws2811_wait (ws2811_t *ws2811)
 

Macro Definition Documentation

◆ SK6812_SHIFT_WMASK

#define SK6812_SHIFT_WMASK   0xf0000000

Definition at line 53 of file ws2811.h.

◆ SK6812_STRIP

#define SK6812_STRIP   WS2811_STRIP_GRB

Definition at line 65 of file ws2811.h.

◆ SK6812_STRIP_BGRW

#define SK6812_STRIP_BGRW   0x18000810

Definition at line 52 of file ws2811.h.

◆ SK6812_STRIP_BRGW

#define SK6812_STRIP_BRGW   0x18001008

Definition at line 51 of file ws2811.h.

◆ SK6812_STRIP_GBRW

#define SK6812_STRIP_GBRW   0x18080010

Definition at line 50 of file ws2811.h.

◆ SK6812_STRIP_GRBW

#define SK6812_STRIP_GRBW   0x18081000

Definition at line 49 of file ws2811.h.

◆ SK6812_STRIP_RBGW

#define SK6812_STRIP_RBGW   0x18100008

Definition at line 48 of file ws2811.h.

◆ SK6812_STRIP_RGBW

#define SK6812_STRIP_RGBW   0x18100800

Definition at line 47 of file ws2811.h.

◆ SK6812W_STRIP

#define SK6812W_STRIP   SK6812_STRIP_GRBW

Definition at line 66 of file ws2811.h.

◆ WS2811_RETURN_STATES

#define WS2811_RETURN_STATES (   X)
Value:
X(0, WS2811_SUCCESS, "Success"), \
X(-1, WS2811_ERROR_GENERIC, "Generic failure"), \
X(-2, WS2811_ERROR_OUT_OF_MEMORY, "Out of memory"), \
X(-3, WS2811_ERROR_HW_NOT_SUPPORTED, "Hardware revision is not supported"), \
X(-4, WS2811_ERROR_MEM_LOCK, "Memory lock failed"), \
X(-5, WS2811_ERROR_MMAP, "mmap() failed"), \
X(-6, WS2811_ERROR_MAP_REGISTERS, "Unable to map registers into userspace"), \
X(-7, WS2811_ERROR_GPIO_INIT, "Unable to initialize GPIO"), \
X(-8, WS2811_ERROR_PWM_SETUP, "Unable to initialize PWM"), \
X(-9, WS2811_ERROR_MAILBOX_DEVICE, "Failed to create mailbox device"), \
X(-10, WS2811_ERROR_DMA, "DMA error"), \
X(-11, WS2811_ERROR_ILLEGAL_GPIO, "Selected GPIO not possible"), \
X(-12, WS2811_ERROR_PCM_SETUP, "Unable to initialize PCM"), \
X(-13, WS2811_ERROR_SPI_SETUP, "Unable to initialize SPI"), \
X(-14, WS2811_ERROR_SPI_TRANSFER, "SPI transfer error") \

Definition at line 96 of file ws2811.h.

◆ WS2811_RETURN_STATES_ENUM

#define WS2811_RETURN_STATES_ENUM (   state,
  name,
  str 
)    name = state

Definition at line 113 of file ws2811.h.

◆ WS2811_RETURN_STATES_STRING

#define WS2811_RETURN_STATES_STRING (   state,
  name,
  str 
)    str

Definition at line 114 of file ws2811.h.

◆ WS2811_STRIP_BGR

#define WS2811_STRIP_BGR   0x00000810

Definition at line 61 of file ws2811.h.

◆ WS2811_STRIP_BRG

#define WS2811_STRIP_BRG   0x00001008

Definition at line 60 of file ws2811.h.

◆ WS2811_STRIP_GBR

#define WS2811_STRIP_GBR   0x00080010

Definition at line 59 of file ws2811.h.

◆ WS2811_STRIP_GRB

#define WS2811_STRIP_GRB   0x00081000

Definition at line 58 of file ws2811.h.

◆ WS2811_STRIP_RBG

#define WS2811_STRIP_RBG   0x00100008

Definition at line 57 of file ws2811.h.

◆ WS2811_STRIP_RGB

#define WS2811_STRIP_RGB   0x00100800

Definition at line 56 of file ws2811.h.

◆ WS2811_TARGET_FREQ

#define WS2811_TARGET_FREQ   800000

Definition at line 44 of file ws2811.h.

◆ WS2812_STRIP

#define WS2812_STRIP   WS2811_STRIP_GRB

Definition at line 64 of file ws2811.h.

Typedef Documentation

◆ ws2811_channel_t

◆ ws2811_led_t

typedef uint32_t ws2811_led_t

Definition at line 68 of file ws2811.h.

◆ ws2811_t

typedef struct ws2811_t ws2811_t

Enumeration Type Documentation

◆ ws2811_return_t

Enumerator
WS2811_RETURN_STATES 
WS2811_RETURN_STATE_COUNT 
WS2811_RETURN_STATES 
WS2811_RETURN_STATE_COUNT 

Definition at line 116 of file ws2811.h.

Function Documentation

◆ ws2811_fini()

void ws2811_fini ( ws2811_t ws2811)

Shut down DMA, PWM, and cleanup memory.

Parameters
ws2811ws2811 instance pointer.
Returns
None

Definition at line 1079 of file ws2811.c.

◆ ws2811_get_return_t_str()

const char* ws2811_get_return_t_str ( const ws2811_return_t  state)

Definition at line 1273 of file ws2811.c.

◆ ws2811_init()

ws2811_return_t ws2811_init ( ws2811_t ws2811)

Allocate and initialize memory, buffers, pages, PWM, DMA, and GPIO.

Parameters
ws2811ws2811 instance pointer.
Returns
0 on success, -1 otherwise.

Definition at line 894 of file ws2811.c.

◆ ws2811_render()

ws2811_return_t ws2811_render ( ws2811_t ws2811)

Render the DMA buffer from the user supplied LED arrays and start the DMA controller. This will update all LEDs on both PWM channels.

Parameters
ws2811ws2811 instance pointer.
Returns
None

Definition at line 1138 of file ws2811.c.

◆ ws2811_set_custom_gamma_factor()

void ws2811_set_custom_gamma_factor ( ws2811_t ws2811,
double  gamma_factor 
)

Definition at line 1287 of file ws2811.c.

◆ ws2811_wait()

ws2811_return_t ws2811_wait ( ws2811_t ws2811)

Wait for any executing DMA operation to complete before returning.

Parameters
ws2811ws2811 instance pointer.
Returns
0 on success, -1 on DMA competion error

Definition at line 1106 of file ws2811.c.



ws281x
Author(s): Alexey Rogachevskiy , Oleg Kalachev
autogenerated on Wed Jun 15 2022 02:46:00