From b83052f8d1a934ca2433b9661bd900acf6a8cc99 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Sun, 8 Jan 2017 21:20:59 +0100 Subject: [PATCH] nrf5/hal: Refining if-defs to set up GPIO base pointers in mphalport.h --- nrf5/mphalport.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nrf5/mphalport.h b/nrf5/mphalport.h index a68ed8ed94..5c62754727 100644 --- a/nrf5/mphalport.h +++ b/nrf5/mphalport.h @@ -41,13 +41,17 @@ typedef enum #if NRF51 -#define POINTERS (const uint32_t[]){NRF_GPIO_BASE} -#elif NRF52 -#ifdef NRF52832_XXAA -#define POINTERS (const uint32_t[]){NRF_P0_BASE} -#elif NRF52840_XXAA -#define POINTERS (const uint32_t[]){NRF_P0_BASE, NRF_P1_BASE} + #define POINTERS (const uint32_t[]){NRF_GPIO_BASE} #endif + +#if NRF52 + #ifdef NRF52832_XXAA + #define POINTERS (const uint32_t[]){NRF_P0_BASE} + #endif + + #ifdef NRF52840_XXAA + #define POINTERS (const uint32_t[]){NRF_P0_BASE, NRF_P1_BASE} + #endif #endif #define GPIO_BASE(x) ((NRF_GPIO_Type *)POINTERS[x])