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 Feb 18, 2022
1 parent 4dfdd1e commit 8914991
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
7 changes: 6 additions & 1 deletion drivers/ws281x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

config MODULE_WS281X
bool "WS2812/SK6812 RGB LED (NeoPixel)"
depends on HAS_CPU_CORE_ATMEGA || HAS_ARCH_ESP32 || HAS_ARCH_NATIVE
depends on HAS_CPU_CORE_ATMEGA || HAS_ARCH_ESP32 || HAS_ARCH_NATIVE || HAS_ARCH_ARM
depends on TEST_KCONFIG
select MODULE_XTIMER
select MODULE_WS281X_ATMEGA if HAS_CPU_CORE_ATMEGA
select MODULE_WS281X_VT100 if HAS_ARCH_NATIVE
select MODULE_WS281X_ESP32 if HAS_ARCH_ESP32
select MODULE_WS281X_ARM if HAS_ARCH_ARM

config MODULE_WS281X_ATMEGA
bool
Expand All @@ -25,3 +26,7 @@ config MODULE_WS281X_VT100
config MODULE_WS281X_ESP32
bool
depends on HAS_ARCH_ESP32

config MODULE_WS281X_ARM
bool
depends on HAS_ARCH_ARM
6 changes: 5 additions & 1 deletion drivers/ws281x/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FEATURES_REQUIRED_ANY += cpu_core_atmega|arch_esp32|arch_native
FEATURES_REQUIRED_ANY += cpu_core_atmega|arch_esp32|arch_native|arch_arm

ifeq (,$(filter ws281x_%,$(USEMODULE)))
ifneq (,$(filter cpu_core_atmega,$(FEATURES_USED)))
Expand All @@ -10,6 +10,10 @@ ifeq (,$(filter ws281x_%,$(USEMODULE)))
ifneq (,$(filter arch_esp32,$(FEATURES_USED)))
USEMODULE += ws281x_esp32
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"


void ws281x_write_buffer(ws281x_t *dev, const void *buf, size_t size)
{
assert(dev);
ws2812_sendarray((uint8_t*)buf, size);
}
9 changes: 9 additions & 0 deletions drivers/ws281x/include/ws281x_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ extern "C" {
#endif
/** @} */


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

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 8914991

Please sign in to comment.