diff --git a/drivers/ws281x/Makefile.dep b/drivers/ws281x/Makefile.dep index 31f00f6c33f0e..e763af0a014e3 100644 --- a/drivers/ws281x/Makefile.dep +++ b/drivers/ws281x/Makefile.dep @@ -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|arch_arm ifeq (,$(filter ws281x_%,$(USEMODULE))) ifneq (,$(filter cpu_core_atmega,$(FEATURES_USED))) @@ -15,6 +15,10 @@ ifeq (,$(filter ws281x_%,$(USEMODULE))) ifeq (-periph_timer_poll,$(filter ws281x_%,$(USEMODULE))-$(filter periph_timer_poll,$(FEATURES_USED))) USEMODULE += ws281x_timer_gpio_ll endif + ifneq (,$(filter arch_arm,$(FEATURES_USED))) + USEMODULE += ws281x_arm + USEPKG += light_ws2812 + endif endif ifneq (,$(filter ws281x_atmega,$(USEMODULE))) diff --git a/drivers/ws281x/arm.c b/drivers/ws281x/arm.c new file mode 100644 index 0000000000000..2f13b765c2bb7 --- /dev/null +++ b/drivers/ws281x/arm.c @@ -0,0 +1,36 @@ +/* + * Copyright 2022 BISSELL Homecare, Inc. + * + * 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 + * directory for more details. + */ + +/** + * @ingroup drivers_ws281x + * + * @{ + * + * @file + * @brief Implementation of `ws281x_write_buffer()` for the ARM CPU + * + * @author David VanKampen + * + * @} + */ +#include +#include +#include +#include + +#include "ws281x.h" +#include "ws281x_params.h" +#include "ws281x_constants.h" + +#include "light_ws2812_cortex.h" + +void ws281x_write_buffer(ws281x_t *dev, const void *buf, size_t size) +{ + assert(dev); + ws2812_sendarray((uint8_t*)buf, size); +} diff --git a/drivers/ws281x/include/ws281x_backend.h b/drivers/ws281x/include/ws281x_backend.h index 01f74fb87789d..c48deb59ac6c9 100644 --- a/drivers/ws281x/include/ws281x_backend.h +++ b/drivers/ws281x/include/ws281x_backend.h @@ -56,7 +56,14 @@ extern "C" { * @{ */ #ifdef MODULE_WS281X_TIMER_GPIO_LL -#define WS281X_HAVE_INIT (1) +#define WS281X_HAVE_INIT (1) +/** @} */ + +/** + * @name Properties of the ARM backend. + * @{ + */ +#ifdef MODULE_WS281X_ARM #endif /** @} */ diff --git a/examples/light_ws2812/main.c b/examples/light_ws2812/main.c index 752a8380a4f59..fbec9b0630dbe 100644 --- a/examples/light_ws2812/main.c +++ b/examples/light_ws2812/main.c @@ -30,7 +30,7 @@ int main(void) { puts("Generated RIOT application: 'light_ws2812'"); random_init(SEED); - while(1) { + while (1) { for (uint8_t idx = 0; idx < NUM_LEDS; idx++) { leds[idx] = (uint8_t)random_uint32(); }