update digitalPinToPort/portOutputRegister etc... to support P1 for nrf52840
This commit is contained in:
1 parent
41b1cdeb97
commit
ab7adf419f
4 files changed
+13
-9
No files matched your search
@@ -66,6 +66,10 @@ uint32_t setLoopStacksize(void);
|
||||
#include "utility/utilities.h"
|
||||
#include "utility/AdaCallback.h"
|
||||
|
||||
#ifdef NRF52840_XXAA
|
||||
//#include "tusb.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "Uart.h"
|
||||
#endif
|
||||
@@ -106,12 +110,12 @@ uint32_t setLoopStacksize(void);
|
||||
|
||||
#define bit(b) (1UL << (b))
|
||||
|
||||
#define digitalPinToPort(P) ( &(NRF_GPIO[P]) )
|
||||
#define digitalPinToPort(P) ( ((P) < 32) ? NRF_P0 : NRF_P1 )
|
||||
#define digitalPinToBitMask(P) ( 1 << g_ADigitalPinMap[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;
|
||||
|
||||
@@ -420,7 +420,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
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VARIANT_FEATHER52_
|
||||
#define _VARIANT_FEATHER52_
|
||||
#ifndef _VARIANT_FEATHER52832_
|
||||
#define _VARIANT_FEATHER52832_
|
||||
|
||||
/** Master clock frequency */
|
||||
#define VARIANT_MCK (64000000ul)
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VARIANT_FEATHER52_
|
||||
#define _VARIANT_FEATHER52_
|
||||
#ifndef _VARIANT_FEATHER52840_
|
||||
#define _VARIANT_FEATHER52840_
|
||||
|
||||
/** Master clock frequency */
|
||||
#define VARIANT_MCK (64000000ul)
|
||||
|
||||
Reference in new issue
Block a user