From c4841ca1c4124aace9e8aa918cba09f52cf7782b Mon Sep 17 00:00:00 2001 From: Dylan Laduranty Date: Fri, 30 Jun 2023 10:00:21 +0200 Subject: [PATCH] boards/nrf9160dk: enable PWM support on onboard LEDs Signed-off-by: Dylan Laduranty --- boards/nrf9160dk/Kconfig | 1 + boards/nrf9160dk/Makefile.features | 1 + boards/nrf9160dk/include/periph_conf.h | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/boards/nrf9160dk/Kconfig b/boards/nrf9160dk/Kconfig index 1760c57488fdb..b810c5bfdff09 100644 --- a/boards/nrf9160dk/Kconfig +++ b/boards/nrf9160dk/Kconfig @@ -12,6 +12,7 @@ config BOARD_NRF9160DK default y select CPU_MODEL_NRF9160 select HAS_PERIPH_I2C + select HAS_PERIPH_PWM select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART diff --git a/boards/nrf9160dk/Makefile.features b/boards/nrf9160dk/Makefile.features index a83af0f726c36..72b1f89b69483 100644 --- a/boards/nrf9160dk/Makefile.features +++ b/boards/nrf9160dk/Makefile.features @@ -3,6 +3,7 @@ CPU = nrf9160 # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart diff --git a/boards/nrf9160dk/include/periph_conf.h b/boards/nrf9160dk/include/periph_conf.h index af6381cf49097..46233e14c3f0b 100644 --- a/boards/nrf9160dk/include/periph_conf.h +++ b/boards/nrf9160dk/include/periph_conf.h @@ -114,7 +114,26 @@ static const uart_conf_t uart_config[] = { #define UART_0_ISR (isr_uarte0_spim0_spis0_twim0_twis0) /**< UART0_IRQ */ #define UART_1_ISR (isr_uarte1_spim1_spis1_twim1_twis1) /**< UART1_IRQ */ -#define UART_NUMOF ARRAY_SIZE(uart_config) /**< UART confgiguration NUMOF */ +#define UART_NUMOF ARRAY_SIZE(uart_config) /**< UART configuration NUMOF */ + +/** + * @name PWM configuration + * @{ + */ +static const pwm_conf_t pwm_config[] = { + { + .dev = NRF_PWM0_S, + .pin = { + LED0_PIN, + LED1_PIN, + LED2_PIN, + LED3_PIN + } + }, +}; + +#define PWM_NUMOF ARRAY_SIZE(pwm_config) +/** @} */ /** @} */ #ifdef __cplusplus