SNAKE_STM32F3
Loading...
Searching...
No Matches
ws2812b.h File Reference

ws2812b diodes handling module based on SPI (STM32 HAL). More...

#include <stdint.h>
#include "main.h"
Include dependency graph for ws2812b.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LED_NUMBER   64
 Number of LEDs in the module.

Functions

void ws2812b_init (SPI_HandleTypeDef *spi_handler)
 Initializes ws2812b handling module by passing given SPI handler.
void ws2812b_set_rgb (uint16_t diode_id, uint8_t R, uint8_t G, uint8_t B)
 Sets chosen diode to specified RGB color.
void ws2812b_update (void)
 Transfers diode color values specified with ws2812b_set_rgb to physical display.

Detailed Description

ws2812b diodes handling module based on SPI (STM32 HAL).

Author
bslrd
Date
2026

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ LED_NUMBER

#define LED_NUMBER   64

Number of LEDs in the module.

Function Documentation

◆ ws2812b_init()

void ws2812b_init ( SPI_HandleTypeDef * spi_handler)

Initializes ws2812b handling module by passing given SPI handler.

Parameters
spi_handlerpointer to spi handler of choice.
Note
Should be called from main() before use of other ws2812b functions

◆ ws2812b_set_rgb()

void ws2812b_set_rgb ( uint16_t diode_id,
uint8_t R,
uint8_t G,
uint8_t B )

Sets chosen diode to specified RGB color.

Parameters
diode_idIndex of LED (0 to LED_NUMBER-1).
RR value of color (0 to 255)
GG value of color (0 to 255)
BB value of color (0 to 255)
Note
Stores RGB value in internal buffer (ws2812b_color); does not update physical LEDs.

◆ ws2812b_update()

void ws2812b_update ( void )

Transfers diode color values specified with ws2812b_set_rgb to physical display.