File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 9999#define bit (b ) (1UL << (b))
100100#define _BV (b ) (1UL << (b))
101101
102- #define digitalPinToPort (pin ) (((pin)>31 )?1 :0 )
103- #define digitalPinToBitMask (pin ) (1UL << (((pin)>31 )?((pin)-32 ):(pin)))
104102#define digitalPinToTimer (pin ) (0 )
105103#define analogInPinToBit (P ) (P)
104+ #if SOC_GPIO_PIN_COUNT <= 32
105+ #define digitalPinToPort (pin ) (0 )
106+ #define digitalPinToBitMask (pin ) (1UL << (pin))
107+ #define portOutputRegister (port ) ((volatile uint32_t *)GPIO_OUT_REG)
108+ #define portInputRegister (port ) ((volatile uint32_t *)GPIO_IN_REG)
109+ #define portModeRegister (port ) ((volatile uint32_t *)GPIO_ENABLE_REG)
110+ #elif SOC_GPIO_PIN_COUNT <= 64
111+ #define digitalPinToPort (pin ) (((pin)>31 )?1 :0 )
112+ #define digitalPinToBitMask (pin ) (1UL << (((pin)>31 )?((pin)-32 ):(pin)))
106113#define portOutputRegister (port ) ((volatile uint32_t *)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
107114#define portInputRegister (port ) ((volatile uint32_t *)((port)?GPIO_IN1_REG:GPIO_IN_REG))
108115#define portModeRegister (port ) ((volatile uint32_t *)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
116+ #else
117+ #error SOC_GPIO_PIN_COUNT > 64 not implemented
118+ #endif
109119
110120#define NOT_A_PIN -1
111121#define NOT_A_PORT -1
You can’t perform that action at this time.
0 commit comments