From 6c4eeac2baa35a09771b899525c689c26011e252 Mon Sep 17 00:00:00 2001 From: microbuilder Date: Tue, 14 Feb 2017 01:38:46 +0100 Subject: [PATCH 1/3] Changed OUTSET to OUT --- cores/nRF5/Arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/nRF5/Arduino.h b/cores/nRF5/Arduino.h index 8b9567ce..b0e311d1 100644 --- a/cores/nRF5/Arduino.h +++ b/cores/nRF5/Arduino.h @@ -104,7 +104,7 @@ uint32_t setLoopStacksize(void); #define digitalPinToPort(P) ( &(NRF_GPIO[P]) ) #define digitalPinToBitMask(P) ( 1 << g_ADigitalPinMap[P] ) //#define analogInPinToBit(P) ( ) -#define portOutputRegister(port) ( &(port->OUTSET) ) +#define portOutputRegister(port) ( &(port->OUT) ) #define portInputRegister(port) ( &(port->IN) ) #define portModeRegister(port) ( &(port->DIRSET) ) #define digitalPinHasPWM(P) ( true ) From e938b724bf9cd9b90bb45e9297a246125b26b87f Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Tue, 14 Feb 2017 02:08:34 +0100 Subject: [PATCH 2/3] Changed digitalPinToPort to return NRF_GPIO The nRF52 only has a single 32-bit GPIO bank, and the OUT/OUTSET/OUTCLR/IN registers don't have a concept of 'port' --- cores/nRF5/Arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/nRF5/Arduino.h b/cores/nRF5/Arduino.h index b0e311d1..b0d527b3 100644 --- a/cores/nRF5/Arduino.h +++ b/cores/nRF5/Arduino.h @@ -101,7 +101,7 @@ uint32_t setLoopStacksize(void); #define bit(b) (1UL << (b)) -#define digitalPinToPort(P) ( &(NRF_GPIO[P]) ) +#define digitalPinToPort(P) ( &(NRF_GPIO) ) #define digitalPinToBitMask(P) ( 1 << g_ADigitalPinMap[P] ) //#define analogInPinToBit(P) ( ) #define portOutputRegister(port) ( &(port->OUT) ) From 99e0b384e85bac4eab236d469047cc37a137fa10 Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Tue, 14 Feb 2017 03:57:30 +0100 Subject: [PATCH 3/3] Revert NRF_GPIO update --- cores/nRF5/Arduino.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cores/nRF5/Arduino.h b/cores/nRF5/Arduino.h index b0d527b3..96c197e9 100644 --- a/cores/nRF5/Arduino.h +++ b/cores/nRF5/Arduino.h @@ -101,12 +101,12 @@ uint32_t setLoopStacksize(void); #define bit(b) (1UL << (b)) -#define digitalPinToPort(P) ( &(NRF_GPIO) ) +#define digitalPinToPort(P) ( &(NRF_GPIO[P]) ) #define digitalPinToBitMask(P) ( 1 << g_ADigitalPinMap[P] ) //#define analogInPinToBit(P) ( ) -#define portOutputRegister(port) ( &(port->OUT) ) -#define portInputRegister(port) ( &(port->IN) ) -#define portModeRegister(port) ( &(port->DIRSET) ) +#define portOutputRegister(port) ( &(NRF_GPIO->OUT) ) +#define portInputRegister(port) ( &(NRF_GPIO->IN) ) +#define portModeRegister(port) ( &(NRF_GPIO->DIRSET) ) #define digitalPinHasPWM(P) ( true ) /*