From 96e36995d3ec02db7d8a31b48ebd16f05b8b8fd7 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 27 Apr 2021 11:35:37 +0200 Subject: [PATCH 1/3] boards/nrf52840dongle: PWM config: fix formatting --- boards/nrf52840dongle/include/periph_conf.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/boards/nrf52840dongle/include/periph_conf.h b/boards/nrf52840dongle/include/periph_conf.h index 2289bafc79..4cebc638a5 100644 --- a/boards/nrf52840dongle/include/periph_conf.h +++ b/boards/nrf52840dongle/include/periph_conf.h @@ -67,7 +67,15 @@ static const uart_conf_t uart_config[] = { * @{ */ static const pwm_conf_t pwm_config[] = { - { NRF_PWM0, { GPIO_PIN(0, 6), GPIO_PIN(0, 8), GPIO_PIN(1, 9), GPIO_PIN(0, 12) } } + { + NRF_PWM0, + { + GPIO_PIN(0, 6), + GPIO_PIN(0, 8), + GPIO_PIN(1, 9), + GPIO_PIN(0, 12), + }, + }, }; #define PWM_NUMOF ARRAY_SIZE(pwm_config) /** @} */ From 729387e0904eaa50c3ec100260bec833e01478f8 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 27 Apr 2021 11:38:29 +0200 Subject: [PATCH 2/3] boards/nrf52840: fix SPI pin configuration --- boards/nrf52840dongle/include/periph_conf.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/boards/nrf52840dongle/include/periph_conf.h b/boards/nrf52840dongle/include/periph_conf.h index 4cebc638a5..508ab9414c 100644 --- a/boards/nrf52840dongle/include/periph_conf.h +++ b/boards/nrf52840dongle/include/periph_conf.h @@ -24,7 +24,6 @@ #include "cfg_clock_32_1.h" #include "cfg_rtt_default.h" #include "cfg_timer_default.h" -#include "cfg_spi_default.h" #ifdef __cplusplus extern "C" { @@ -80,6 +79,22 @@ static const pwm_conf_t pwm_config[] = { #define PWM_NUMOF ARRAY_SIZE(pwm_config) /** @} */ +/** + * @name SPI configuration + * @{ + */ +static const spi_conf_t spi_config[] = { + { + .dev = NRF_SPIM0, + .sclk = GPIO_PIN(0, 20), + .mosi = GPIO_PIN(0, 22), + .miso = GPIO_PIN(0, 24), + } +}; + +#define SPI_NUMOF ARRAY_SIZE(spi_config) +/** @} */ + #ifdef __cplusplus } #endif From 674d6521c5197ee0528dc058b0c687ad726e9641 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 27 Apr 2021 11:39:04 +0200 Subject: [PATCH 3/3] boards/nrf52840dongle: add I2C pin configuration --- boards/nrf52840dongle/Kconfig | 1 + boards/nrf52840dongle/Makefile.features | 1 + boards/nrf52840dongle/include/periph_conf.h | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/boards/nrf52840dongle/Kconfig b/boards/nrf52840dongle/Kconfig index a1252a996f..068de77552 100644 --- a/boards/nrf52840dongle/Kconfig +++ b/boards/nrf52840dongle/Kconfig @@ -12,6 +12,7 @@ config BOARD_NRF52840DONGLE default y select BOARD_COMMON_NRF52 select CPU_MODEL_NRF52840XXAA + select HAS_PERIPH_I2C select HAS_PERIPH_PWM select HAS_PERIPH_UART select HAS_PERIPH_SPI diff --git a/boards/nrf52840dongle/Makefile.features b/boards/nrf52840dongle/Makefile.features index 22f0a1bed4..c50288397a 100644 --- a/boards/nrf52840dongle/Makefile.features +++ b/boards/nrf52840dongle/Makefile.features @@ -1,6 +1,7 @@ CPU_MODEL = nrf52840xxaa # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_uart FEATURES_PROVIDED += periph_usbdev diff --git a/boards/nrf52840dongle/include/periph_conf.h b/boards/nrf52840dongle/include/periph_conf.h index 508ab9414c..63c45c0d49 100644 --- a/boards/nrf52840dongle/include/periph_conf.h +++ b/boards/nrf52840dongle/include/periph_conf.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2019 Christian Amsüss + * 2021 Freie Universität Berlin * * 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 @@ -14,6 +15,7 @@ * @brief Peripheral configuration for the nRF52840-Dongle * * @author Christian Amsüss + * @author Hauke Petersen * */ @@ -95,6 +97,21 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF ARRAY_SIZE(spi_config) /** @} */ +/** + * @name I2C configuration + * @{ + */ +static const i2c_conf_t i2c_config[] = { + { + .dev = NRF_TWIM1, + .scl = GPIO_PIN(0, 29), + .sda = GPIO_PIN(0, 31), + .speed = I2C_SPEED_NORMAL + } +}; +#define I2C_NUMOF ARRAY_SIZE(i2c_config) +/** @} */ + #ifdef __cplusplus } #endif