From 0c60a2a6008c8839f240dac9b3d91236dce2b685 Mon Sep 17 00:00:00 2001 From: dylad Date: Sun, 5 Sep 2021 22:05:00 +0200 Subject: [PATCH] boards/nrf9160dk: add TWI and SPI configuration --- boards/nrf9160dk/Kconfig | 2 ++ boards/nrf9160dk/Makefile.features | 2 ++ boards/nrf9160dk/include/periph_conf.h | 31 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/boards/nrf9160dk/Kconfig b/boards/nrf9160dk/Kconfig index 055ce2813f..ac242952d2 100644 --- a/boards/nrf9160dk/Kconfig +++ b/boards/nrf9160dk/Kconfig @@ -11,5 +11,7 @@ config BOARD_NRF9160DK bool default y select CPU_MODEL_NRF9160 + select HAS_PERIPH_I2C + 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 614e821745..d26460513e 100644 --- a/boards/nrf9160dk/Makefile.features +++ b/boards/nrf9160dk/Makefile.features @@ -2,5 +2,7 @@ CPU_MODEL = nrf9160 CPU = nrf9160 # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_i2c +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 720988d9a8..af6381cf49 100644 --- a/boards/nrf9160dk/include/periph_conf.h +++ b/boards/nrf9160dk/include/periph_conf.h @@ -28,6 +28,37 @@ extern "C" { #endif +/** + * @name I2C configuration + * @{ + */ +static const i2c_conf_t i2c_config[] = { + { + .dev = NRF_TWIM3_S, + .scl = GPIO_PIN(0, 31), + .sda = GPIO_PIN(0, 30), + .speed = I2C_SPEED_NORMAL + } +}; +#define I2C_NUMOF ARRAY_SIZE(i2c_config) +/** @} */ + +/** + * @name SPI configuration + * @{ + */ +static const spi_conf_t spi_config[] = { + { + .dev = NRF_SPIM2_S, + .sclk = GPIO_PIN(0, 13), + .mosi = GPIO_PIN(0, 11), + .miso = GPIO_PIN(0, 12), + } +}; + +#define SPI_NUMOF ARRAY_SIZE(spi_config) +/** @} */ + /** * @name Timer configuration * @{