Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/nrf5x/periph/wdt: enable support for nRF53/nRF9160 #19789

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpu/nrf53/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ config CPU_FAM_NRF53
select HAS_PERIPH_GPIO_IRQ
select HAS_PERIPH_TIMER_PERIODIC
select HAS_PERIPH_UART_MODECFG
select HAS_PERIPH_WDT
select HAS_PERIPH_WDT_CB

## CPU Models
config CPU_MODEL_NRF5340_APP
Expand Down
2 changes: 1 addition & 1 deletion cpu/nrf5x_common/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_timer_periodic
FEATURES_PROVIDED += periph_uart_modecfg
FEATURES_PROVIDED += periph_wdt periph_wdt_cb

ifeq (,$(filter nrf5340_app,$(CPU_MODEL)))
FEATURES_PROVIDED += periph_flashpage
Expand All @@ -16,7 +17,6 @@ ifeq (,$(filter nrf9160 nrf5340_app,$(CPU_MODEL)))
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_rtt_overflow
FEATURES_PROVIDED += periph_temperature
FEATURES_PROVIDED += periph_wdt periph_wdt_cb

# Various other features (if any)
FEATURES_PROVIDED += ble_nimble
Expand Down
12 changes: 12 additions & 0 deletions cpu/nrf5x_common/periph/wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
#define NRF_WDT_HALT_MODE (WDT_CONFIG_HALT_Run)
#endif

/* Compatibility wrapper for nRF53/nRF9160 */
#ifdef NRF_WDT0_S
#define NRF_WDT NRF_WDT0_S
#elif defined(NRF_WDT_S)
#define NRF_WDT NRF_WDT_S
#endif

/* Wrapper around vendor files inconsistency */
#ifdef WDT_RUNSTATUS_RUNSTATUSWDT_Running
#define WDT_RUNSTATUS_RUNSTATUS_Running WDT_RUNSTATUS_RUNSTATUSWDT_Running
#endif

#ifdef MODULE_PERIPH_WDT_CB
static wdt_cb_t wdt_cb;
static void *wdt_arg;
Expand Down
2 changes: 2 additions & 0 deletions cpu/nrf9160/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ config CPU_FAM_NRF9160
select HAS_PERIPH_TIMER_PERIODIC
select HAS_PERIPH_UART_MODECFG
select HAS_PERIPH_SPI_GPIO_MODE
select HAS_PERIPH_WDT
select HAS_PERIPH_WDT_CB

## CPU Models
config CPU_MODEL_NRF9160
Expand Down