Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/ws281x: Bit banging STM32 support #20302

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions drivers/include/ws281x.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
* The ESP32 implementation is frequency independent, as frequencies above 80MHz
* are high enough to support bit banging without assembly.
*
* ## STM32
*
* The STM32 implementation is frequency dependent and currently only supported
* for 84, 100 and 180 MHz MCUs of the STM32f4 family. Support for the STM32f7
* family is coming soon... The number of NOPs required was determined using a
* saleae logic analyzer.
*
* @warning Since this is bit banged an interrupt can destroy the timing.
*
* ## Native/VT100
*
* The native (VT100) implementation writes the LED state to the console.
Expand Down Expand Up @@ -70,6 +79,11 @@
* USEMODULE += ws281x_esp32
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* * the STM32 backend:
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Makefile
* USEMODULE += ws281x_stm32
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* * the native/VT100 backend:
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Makefile
* USEMODULE += ws281x_vt100
Expand Down
5 changes: 4 additions & 1 deletion drivers/ws281x/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Actually |(periph_timer_poll and periph_gpio_ll), but that's too complex for FEATURES_REQUIRED_ANY to express
FEATURES_REQUIRED_ANY += cpu_core_atmega|arch_esp32|arch_native|periph_timer_poll
FEATURES_REQUIRED_ANY += cpu_core_atmega|arch_esp32|arch_native|periph_timer_poll|cpu_stm32f4

ifeq (,$(filter ws281x_%,$(USEMODULE)))
ifneq (,$(filter cpu_core_atmega,$(FEATURES_USED)))
Expand All @@ -11,6 +11,9 @@ ifeq (,$(filter ws281x_%,$(USEMODULE)))
ifneq (,$(filter arch_esp32,$(FEATURES_USED)))
USEMODULE += ws281x_esp32
endif
ifneq (,$(filter cpu_stm32f4,$(FEATURES_USED)))
USEMODULE += ws281x_stm32
endif
# Not only looking for the used feature but also for the absence of any more specific driver
ifeq (-periph_timer_poll,$(filter ws281x_%,$(USEMODULE))-$(filter periph_timer_poll,$(FEATURES_USED)))
USEMODULE += ws281x_timer_gpio_ll
Expand Down
11 changes: 11 additions & 0 deletions drivers/ws281x/include/ws281x_backend.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Marian Buschsieweke
* 2024 Lennart Lutz
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
Expand All @@ -14,6 +15,7 @@
* @brief Backend configuration for WS2812/SK6812 RGB LEDs
*
* @author Marian Buschsieweke <[email protected]>
* @author Lennart Lutz <[email protected]>
*/

#ifndef WS281X_BACKEND_H
Expand Down Expand Up @@ -41,6 +43,15 @@ extern "C" {
#endif
/** @} */

/**
* @name Properties of the STM32 backend.
* @{
*/
#ifdef MODULE_WS281X_STM32
#define WS281X_HAVE_INIT (1)
#endif
/** @} */

/**
* @name Properties of the VT100 terminal backend.
* @{
Expand Down
Loading
Loading