Skip to content

Commit

Permalink
drivers/ws281x: added arm backend, leveraging the light_ws2812 package
Browse files Browse the repository at this point in the history
  • Loading branch information
david-vankampen committed Apr 17, 2024
1 parent 80f315f commit 2a6277a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
6 changes: 5 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|arch_arm

ifeq (,$(filter ws281x_%,$(USEMODULE)))
ifneq (,$(filter cpu_core_atmega,$(FEATURES_USED)))
Expand All @@ -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)))
Expand Down
37 changes: 37 additions & 0 deletions drivers/ws281x/arm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 <[email protected]>
*
* @}
*/
#include <assert.h>
#include <errno.h>
#include <stdint.h>
#include <string.h>

#include "ws281x.h"
#include "ws281x_params.h"
#include "ws281x_constants.h"

#include "light_ws2812_cortex.h"


Check warning on line 32 in drivers/ws281x/arm.c

View workflow job for this annotation

GitHub Actions / static-tests

too many consecutive empty lines
void ws281x_write_buffer(ws281x_t *dev, const void *buf, size_t size)
{
assert(dev);
ws2812_sendarray((uint8_t*)buf, size);
}
6 changes: 6 additions & 0 deletions drivers/ws281x/include/ws281x_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ extern "C" {
*/
#ifdef MODULE_WS281X_TIMER_GPIO_LL
#define WS281X_HAVE_INIT (1)

/**
* @name Properties of the ARM backend.
* @{
*/
#ifdef MODULE_WS281X_ARM
#endif
/** @} */

Expand Down

0 comments on commit 2a6277a

Please sign in to comment.