correct update digitalPinToPort/portOutputRegister

This commit is contained in:
hathach committed 2018-07-12 16:19:27 +07:00
1 parent 2ebb5de830
commit 1977aea69e
2 files changed
+6 -6

No files matched your search

+5 -5
View File
@@ -106,12 +106,12 @@ uint32_t setLoopStacksize(void);
#define bit(b) (1UL << (b))
#define digitalPinToPort(P) ( &(NRF_GPIO[P]) )
#define digitalPinToBitMask(P) ( 1 << g_ADigitalPinMap[P] )
#define digitalPinToPort(P) ( NRF_P0 )
#define digitalPinToBitMask(P) ( 1 << (P) )
//#define analogInPinToBit(P) ( )
#define portOutputRegister(port) ( &(NRF_GPIO->OUT) )
#define portInputRegister(port) ( &(NRF_GPIO->IN) )
#define portModeRegister(port) ( &(NRF_GPIO->DIRSET) )
#define portOutputRegister(port) ( &(port->OUT) )
#define portInputRegister(port) ( &(port->IN) )
#define portModeRegister(port) ( &(port->DIR) )
#define digitalPinHasPWM(P) ( (P) > 1 )
void rtos_idle_callback(void) ATTR_WEAK;
@@ -410,7 +410,7 @@ uint32_t readPressedButtons(void)
// Take current read and masked with BUTTONs
// Note: Bitwise inverted since buttons are active (pressed) LOW
uint32_t debounced = ~(*portInputRegister(0));
uint32_t debounced = ~(*portInputRegister( digitalPinToPort(0) ));
debounced &= (bit(BUTTON_A) | bit(BUTTON_B) | bit(BUTTON_C));
// Copy current state into array