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

boards/nrf52840dongle: Use LEDs in SAUL as PWM rather than GPIO

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
This commit is contained in:
chrysn 2020-09-29 20:25:18 +02:00
parent d196c7c4a6
commit 84414e701f
3 changed files with 58 additions and 24 deletions

View File

@ -1,5 +1,6 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
USEMODULE += saul_pwm
endif
ifeq (,$(filter-out stdio_cdc_acm,$(filter stdio_% slipdev_stdio,$(USEMODULE))))

View File

@ -31,30 +31,6 @@ extern "C" {
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LD 1",
.pin = LED0_PIN,
.mode = GPIO_OUT,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
{
.name = "LD 2 Red",
.pin = LED1_PIN,
.mode = GPIO_OUT,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
{
.name = "LD 2 Green",
.pin = LED2_PIN,
.mode = GPIO_OUT,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
{
.name = "LD 2 Blue",
.pin = LED3_PIN,
.mode = GPIO_OUT,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
{
.name = "SW 1",
.pin = BTN0_PIN,

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2020 Christian Amsüss <chrysn@fsfe.org>
*
* 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 boards_nrf52840dongle
* @{
*
* @file
* @brief Configuration of SAUL mapped PWM channels
*
* @author Christian Amsüss <chrysn@fsfe.org>
*/
#ifndef PWM_PARAMS_H
#define PWM_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief The single LED exposed via SAUL
*/
static const saul_pwm_dimmer_params_t saul_pwm_dimmer_params[] =
{
{
.name = "LD 1",
.channel = { PWM_DEV(0), 0, SAUL_PWM_INVERTED },
}
};
static const saul_pwm_rgb_params_t saul_pwm_rgb_params[] =
{
{
.name = "LD 2",
.channels = {
{ PWM_DEV(0), 1, SAUL_PWM_INVERTED },
{ PWM_DEV(0), 2, SAUL_PWM_INVERTED },
{ PWM_DEV(0), 3, SAUL_PWM_INVERTED }
}
}
};
#ifdef __cplusplus
}
#endif
#endif /* PWM_PARAMS_H */
/** @} */