Skip to content

Commit

Permalink
cpu/nrf53: enable I2C/SPI support
Browse files Browse the repository at this point in the history
Signed-off-by: Dylan Laduranty <[email protected]>
  • Loading branch information
dylad committed Jul 7, 2023
1 parent 529ed19 commit d87e386
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions boards/nrf5340dk-app/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ CPU_MODEL = nrf5340_app
CPU = nrf53

# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_uart_hw_fc
16 changes: 16 additions & 0 deletions boards/nrf5340dk-app/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_config) /**< UART configuration NUMOF */
/** @} */

/**
* @name SPI configuration
* @{
*/
static const spi_conf_t spi_config[] = {
{
.dev = NRF_SPIM1_S,
.sclk = GPIO_PIN(0, 17),
.mosi = GPIO_PIN(0, 13),
.miso = GPIO_PIN(0, 14),
}
};

#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions cpu/nrf53/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ config CPU_FAM_NRF53
select HAS_PERIPH_FLASHPAGE_PAGEWISE
select HAS_PERIPH_GPIO
select HAS_PERIPH_GPIO_IRQ
select HAS_PERIPH_I2C
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER_PERIODIC
select HAS_PERIPH_UART_MODECFG
select HAS_PERIPH_WDT
Expand Down
4 changes: 4 additions & 0 deletions cpu/nrf53/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
USEMODULE += nrf53_vectors
USEMODULE += nrf_shared_serial_irq

ifneq (,$(filter periph_spi,$(USEMODULE)))
USEMODULE += periph_spi_gpio_mode
endif

include $(RIOTCPU)/nrf5x_common/Makefile.dep
include $(RIOTCPU)/cortexm_common/Makefile.dep
2 changes: 2 additions & 0 deletions cpu/nrf53/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
CPU_CORE = cortex-m33
CPU_FAM = nrf53

FEATURES_PROVIDED += periph_spi_gpio_mode

include $(RIOTCPU)/nrf5x_common/Makefile.features
4 changes: 2 additions & 2 deletions cpu/nrf5x_common/periph/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ MODULE = nrf5x_common_periph

# Select the specific implementation for `periph_i2c`
ifneq (,$(filter periph_i2c,$(USEMODULE)))
ifneq (,$(filter $(CPU_FAM),nrf52 nrf9160))
ifneq (,$(filter $(CPU_FAM),nrf52 nrf53 nrf9160))
SRC += i2c_nrf52_nrf9160.c
endif
endif

# Select the specific implementation for `periph_spi`
ifneq (,$(filter periph_spi,$(USEMODULE)))
ifneq (,$(filter $(CPU_FAM),nrf52 nrf9160))
ifneq (,$(filter $(CPU_FAM),nrf52 nrf53 nrf9160))
SRC += spi_nrf52_nrf9160.c
endif
endif
Expand Down

0 comments on commit d87e386

Please sign in to comment.