1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/ws281x: added arm backend, leveraging the light_ws2812 package

This commit is contained in:
Dave VanKampen 2022-02-18 13:15:39 -05:00 committed by David VanKampen
parent 80f315f6d1
commit 1b6738e116
4 changed files with 51 additions and 3 deletions

View File

@ -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)))

36
drivers/ws281x/arm.c Normal file
View File

@ -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 <david.vankampen@bissell.com>
*
* @}
*/
#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);
}

View File

@ -56,7 +56,15 @@ extern "C" {
* @{
*/
#ifdef MODULE_WS281X_TIMER_GPIO_LL
#define WS281X_HAVE_INIT (1)
#define WS281X_HAVE_INIT (1)
#endif
/** @} */
/**
* @name Properties of the ARM backend.
* @{
*/
#ifdef MODULE_WS281X_ARM
#endif
/** @} */

View File

@ -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();
}