Skip to content

[New variant] STM32MP157_DK #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 15, 2019
Prev Previous commit
Next Next commit
[MP1] Add GPIOZ and ANA_x support
  • Loading branch information
kbumsik committed Nov 15, 2019
commit e11d5f816de7c760da4fa87847e4477016a93d76
26 changes: 26 additions & 0 deletions cores/arduino/stm32/PinNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,24 @@ typedef enum {
PK_13 = (PortK << 4) + 0x0D,
PK_14 = (PortK << 4) + 0x0E,
PK_15 = (PortK << 4) + 0x0F,
#endif
#if defined GPIOZ_BASE
PZ_0 = (PortZ << 4) + 0x00,
PZ_1 = (PortZ << 4) + 0x01,
PZ_2 = (PortZ << 4) + 0x02,
PZ_3 = (PortZ << 4) + 0x03,
PZ_4 = (PortZ << 4) + 0x04,
PZ_5 = (PortZ << 4) + 0x05,
PZ_6 = (PortZ << 4) + 0x06,
PZ_7 = (PortZ << 4) + 0x07,
PZ_8 = (PortZ << 4) + 0x08,
PZ_9 = (PortZ << 4) + 0x09,
PZ_10 = (PortZ << 4) + 0x0A,
PZ_11 = (PortZ << 4) + 0x0B,
PZ_12 = (PortZ << 4) + 0x0C,
PZ_13 = (PortZ << 4) + 0x0D,
PZ_14 = (PortZ << 4) + 0x0E,
PZ_15 = (PortZ << 4) + 0x0F,
#endif
// Specific pin name
PADC_BASE = 0x100,
Expand All @@ -221,6 +239,14 @@ typedef enum {
#endif
#ifdef ADC_CHANNEL_VBAT
PADC_VBAT,
#endif
ANA_START,
// ANAx pins for STM32MP1 line, those pins are hard-wired to ADC directly.
#ifdef SYSCFG_PMCSETR_ANA0_SEL_Pos
ANA_0,
#endif
#ifdef SYSCFG_PMCSETR_ANA1_SEL_Pos
ANA_1,
#endif
// Specific pin name define in the variant
#if __has_include("PinNamesVar.h")
Expand Down
9 changes: 9 additions & 0 deletions cores/arduino/stm32/PortNames.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ GPIO_TypeDef *GPIOPort[MAX_NB_PORT] = {
#if defined GPIOK_BASE
, (GPIO_TypeDef *)GPIOK_BASE
#endif
#if defined GPIOZ_BASE
, (GPIO_TypeDef *)GPIOZ_BASE
#endif
};

/* Enable GPIO clock and return GPIO base address */
Expand Down Expand Up @@ -132,6 +135,12 @@ GPIO_TypeDef *set_GPIO_Port_Clock(uint32_t port_idx)
gpioPort = (GPIO_TypeDef *)GPIOK_BASE;
__HAL_RCC_GPIOK_CLK_ENABLE();
break;
#endif
#if defined GPIOZ_BASE
case PortZ:
gpioPort = (GPIO_TypeDef *)GPIOZ_BASE;
__HAL_RCC_GPIOZ_CLK_ENABLE();
break;
#endif
default:
// wrong port number
Expand Down
5 changes: 4 additions & 1 deletion cores/arduino/stm32/PortNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ typedef enum {
#if defined GPIOK_BASE
PortK,
#endif
#if defined GPIOZ_BASE
PortZ,
LastPort = PortZ - 1
#endif
PortEND,
LastPort = PortEND - 1
} PortName;

#define MAX_NB_PORT (LastPort-FirstPort+1)
Expand Down