Skip to content

Commit 1977aea

Browse files
committed
correct update digitalPinToPort/portOutputRegister
1 parent 2ebb5de commit 1977aea

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cores/nRF5/Arduino.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ uint32_t setLoopStacksize(void);
106106

107107
#define bit(b) (1UL << (b))
108108

109-
#define digitalPinToPort(P) ( &(NRF_GPIO[P]) )
110-
#define digitalPinToBitMask(P) ( 1 << g_ADigitalPinMap[P] )
109+
#define digitalPinToPort(P) ( NRF_P0 )
110+
#define digitalPinToBitMask(P) ( 1 << (P) )
111111
//#define analogInPinToBit(P) ( )
112-
#define portOutputRegister(port) ( &(NRF_GPIO->OUT) )
113-
#define portInputRegister(port) ( &(NRF_GPIO->IN) )
114-
#define portModeRegister(port) ( &(NRF_GPIO->DIRSET) )
112+
#define portOutputRegister(port) ( &(port->OUT) )
113+
#define portInputRegister(port) ( &(port->IN) )
114+
#define portModeRegister(port) ( &(port->DIR) )
115115
#define digitalPinHasPWM(P) ( (P) > 1 )
116116

117117
void rtos_idle_callback(void) ATTR_WEAK;

libraries/Bluefruit52Lib/examples/Peripheral/ancs_oled/ancs_oled.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ uint32_t readPressedButtons(void)
410410

411411
// Take current read and masked with BUTTONs
412412
// Note: Bitwise inverted since buttons are active (pressed) LOW
413-
uint32_t debounced = ~(*portInputRegister(0));
413+
uint32_t debounced = ~(*portInputRegister( digitalPinToPort(0) ));
414414
debounced &= (bit(BUTTON_A) | bit(BUTTON_B) | bit(BUTTON_C));
415415

416416
// Copy current state into array

0 commit comments

Comments
 (0)