You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.3 KiB

WS2812-STM32

Introduction

Drive individually-addressable LEDs with DMA. Supports LED drivers in the WS281x and SK6812 families and similar. Intended to be used with STM32 devices with a SPI peripheral capable of DMA.

Library description

https://msalamon.pl/adresowalne-diody-ws2812b-na-stm32-cz-1/

https://msalamon.pl/adresowalne-diody-ws2812b-na-stm32-cz-2/

https://msalamon.pl/adresowalne-diody-ws2812b-na-stm32-cz-3/

The FX library is based od WS2812FX Arduino librarby by kitesurfer1404 - https://github.com/kitesurfer1404/WS2812FX

Usage

Clone this repository, or add it as a submodule, to your STM32 project under the Drivers/ directory.

Example: In main.c:

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "ws2812b.h"
#include "ws2812b_fx.h"
/* USER CODE END Includes */
...
int main(void)
{
	/* USER CODE BEGIN 2 */
	WS2812B_Init(&hspi1);
	WS2812BFX_Init(20);
	/* USER CODE END 2 */
}

In your interrupt service routines:

/* USER CODE BEGIN Includes */
#include "ws2812b.h"
#include "ws2812b_fx.h"
/* USER CODE END Includes */
...
void SysTick_Handler(void)
{
  /* USER CODE BEGIN SysTick_IRQn 0 */

  /* USER CODE END SysTick_IRQn 0 */
  HAL_IncTick();
  /* USER CODE BEGIN SysTick_IRQn 1 */
  WS2812BFX_SysTickCallback();
  /* USER CODE END SysTick_IRQn 1 */
}