From 38dd509b2718c697dfd57632cf03f4ea67897d19 Mon Sep 17 00:00:00 2001 From: Eric Holland Date: Sat, 10 Oct 2020 16:12:07 -0400 Subject: [PATCH] [nrf][pca10040] fix platform incompatibilities When the nrf52xxx platform was changed to use the Nordic nrfx libraries the pca10040 target was broken due to differences in how the platform handled initialization. --- platform/nrf52xxx/init.c | 2 ++ target/nrf-pca10040/include/target/gpioconfig.h | 2 -- target/nrf-pca10040/init.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/platform/nrf52xxx/init.c b/platform/nrf52xxx/init.c index 1dabae9a0..d4f55c8c1 100644 --- a/platform/nrf52xxx/init.c +++ b/platform/nrf52xxx/init.c @@ -47,5 +47,7 @@ void platform_init(void) { // Note: i2c_init will only instantiate an i2c device if proper defines // are set. See comments at top of i2c_master.c for more info. +#if (NRFX_TWIM_ENABLED) i2c_init(); +#endif } diff --git a/target/nrf-pca10040/include/target/gpioconfig.h b/target/nrf-pca10040/include/target/gpioconfig.h index 8fc22c48e..074625869 100644 --- a/target/nrf-pca10040/include/target/gpioconfig.h +++ b/target/nrf-pca10040/include/target/gpioconfig.h @@ -8,8 +8,6 @@ #ifndef __TARGET_GPIOCONFIG_H #define __TARGET_GPIOCONFIG_H -#include - #define GPIO_LED1 17 #define GPIO_LED2 18 #define GPIO_LED3 19 diff --git a/target/nrf-pca10040/init.c b/target/nrf-pca10040/init.c index 6ff9f66bf..a5f60ed60 100644 --- a/target/nrf-pca10040/init.c +++ b/target/nrf-pca10040/init.c @@ -10,8 +10,7 @@ #include #include #include -#include -#include +#include #include void target_early_init(void) {