File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 99
99
#define bit (b ) (1UL << (b))
100
100
#define _BV (b ) (1UL << (b))
101
101
102
- #define digitalPinToPort (pin ) (((pin)>31 )?1 :0 )
103
- #define digitalPinToBitMask (pin ) (1UL << (((pin)>31 )?((pin)-32 ):(pin)))
104
102
#define digitalPinToTimer (pin ) (0 )
105
103
#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)))
106
113
#define portOutputRegister (port ) ((volatile uint32_t *)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
107
114
#define portInputRegister (port ) ((volatile uint32_t *)((port)?GPIO_IN1_REG:GPIO_IN_REG))
108
115
#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
109
119
110
120
#define NOT_A_PIN -1
111
121
#define NOT_A_PORT -1
You can’t perform that action at this time.
0 commit comments