Skip to content

Commit 442ca6c

Browse files
committed
[GPIO] Add GPIOZ and ANA_x support for MP1
1 parent 2e858e8 commit 442ca6c

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

cores/arduino/stm32/PinNames.h

+26
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,24 @@ typedef enum {
207207
PK_13 = (PortK << 4) + 0x0D,
208208
PK_14 = (PortK << 4) + 0x0E,
209209
PK_15 = (PortK << 4) + 0x0F,
210+
#endif
211+
#if defined GPIOZ_BASE
212+
PZ_0 = (PortZ << 4) + 0x00,
213+
PZ_1 = (PortZ << 4) + 0x01,
214+
PZ_2 = (PortZ << 4) + 0x02,
215+
PZ_3 = (PortZ << 4) + 0x03,
216+
PZ_4 = (PortZ << 4) + 0x04,
217+
PZ_5 = (PortZ << 4) + 0x05,
218+
PZ_6 = (PortZ << 4) + 0x06,
219+
PZ_7 = (PortZ << 4) + 0x07,
220+
PZ_8 = (PortZ << 4) + 0x08,
221+
PZ_9 = (PortZ << 4) + 0x09,
222+
PZ_10 = (PortZ << 4) + 0x0A,
223+
PZ_11 = (PortZ << 4) + 0x0B,
224+
PZ_12 = (PortZ << 4) + 0x0C,
225+
PZ_13 = (PortZ << 4) + 0x0D,
226+
PZ_14 = (PortZ << 4) + 0x0E,
227+
PZ_15 = (PortZ << 4) + 0x0F,
210228
#endif
211229
// Specific pin name
212230
PADC_BASE = 0x100,
@@ -221,6 +239,14 @@ typedef enum {
221239
#endif
222240
#ifdef ADC_CHANNEL_VBAT
223241
PADC_VBAT,
242+
#endif
243+
ANA_START,
244+
// ANAx pins for STM32MP1 line, those pins are hard-wired to ADC directly.
245+
#ifdef SYSCFG_PMCSETR_ANA0_SEL_Pos
246+
ANA_0,
247+
#endif
248+
#ifdef SYSCFG_PMCSETR_ANA1_SEL_Pos
249+
ANA_1,
224250
#endif
225251
// Specific pin name define in the variant
226252
#if __has_include("PinNamesVar.h")

cores/arduino/stm32/PortNames.c

+9
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ GPIO_TypeDef *GPIOPort[MAX_NB_PORT] = {
5959
#if defined GPIOK_BASE
6060
, (GPIO_TypeDef *)GPIOK_BASE
6161
#endif
62+
#if defined GPIOZ_BASE
63+
, (GPIO_TypeDef *)GPIOZ_BASE
64+
#endif
6265
};
6366

6467
/* Enable GPIO clock and return GPIO base address */
@@ -132,6 +135,12 @@ GPIO_TypeDef *set_GPIO_Port_Clock(uint32_t port_idx)
132135
gpioPort = (GPIO_TypeDef *)GPIOK_BASE;
133136
__HAL_RCC_GPIOK_CLK_ENABLE();
134137
break;
138+
#endif
139+
#if defined GPIOZ_BASE
140+
case PortZ:
141+
gpioPort = (GPIO_TypeDef *)GPIOZ_BASE;
142+
__HAL_RCC_GPIOZ_CLK_ENABLE();
143+
break;
135144
#endif
136145
default:
137146
// wrong port number

cores/arduino/stm32/PortNames.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ typedef enum {
6969
#if defined GPIOK_BASE
7070
PortK,
7171
#endif
72+
#if defined GPIOZ_BASE
7273
PortZ,
73-
LastPort = PortZ - 1
74+
#endif
75+
PortEND,
76+
LastPort = PortEND - 1
7477
} PortName;
7578

7679
#define MAX_NB_PORT (LastPort-FirstPort+1)

0 commit comments

Comments
 (0)