From 87b41e6aee9b295a5dbd3b0baecd73bdb7bb001e Mon Sep 17 00:00:00 2001 From: chrysn Date: Wed, 30 Sep 2020 15:35:23 +0200 Subject: [PATCH] boards/c/particle-mesh: Enable PWM on the LED pins --- boards/common/particle-mesh/Kconfig | 1 + boards/common/particle-mesh/Makefile.features | 1 + .../particle-mesh/include/periph_conf_common.h | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/boards/common/particle-mesh/Kconfig b/boards/common/particle-mesh/Kconfig index 148c3d3754..dc0f1b20c5 100644 --- a/boards/common/particle-mesh/Kconfig +++ b/boards/common/particle-mesh/Kconfig @@ -9,6 +9,7 @@ config BOARD_COMMON_PARTICLE_MESH select BOARD_COMMON_NRF52 select CPU_MODEL_NRF52840XXAA select HAS_PERIPH_I2C + select HAS_PERIPH_PWM select HAS_PERIPH_SPI select HAS_PERIPH_UART select HAS_PERIPH_USBDEV diff --git a/boards/common/particle-mesh/Makefile.features b/boards/common/particle-mesh/Makefile.features index bb77f3ce1c..e0f14a2031 100644 --- a/boards/common/particle-mesh/Makefile.features +++ b/boards/common/particle-mesh/Makefile.features @@ -2,6 +2,7 @@ CPU_MODEL = nrf52840xxaa # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_uart FEATURES_PROVIDED += periph_usbdev diff --git a/boards/common/particle-mesh/include/periph_conf_common.h b/boards/common/particle-mesh/include/periph_conf_common.h index b91368e944..b1aa9b9325 100644 --- a/boards/common/particle-mesh/include/periph_conf_common.h +++ b/boards/common/particle-mesh/include/periph_conf_common.h @@ -26,6 +26,8 @@ #include "cfg_rtt_default.h" #include "cfg_timer_default.h" +#include "board.h" + #ifdef __cplusplus extern "C" { #endif @@ -46,6 +48,22 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF ARRAY_SIZE(spi_config) /** @} */ +/** + * @name PWM configuration + * + * A single PWM device is used to map the three channels of the on-board RGB + * LED + * + * @{ + */ + +static const pwm_conf_t pwm_config[] = { + { NRF_PWM0, { LED0_PIN, LED1_PIN, LED2_PIN, GPIO_UNDEF } } +}; +#define PWM_NUMOF ARRAY_SIZE(pwm_config) + +/** @} */ + #ifdef __cplusplus } #endif