2020-02-20 12:38:58 +08:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
2020-12-17 18:22:19 +08:00
|
|
|
* @file gpio.c
|
|
|
|
* @brief This file provides code for the configuration
|
|
|
|
* of all used GPIO pins.
|
2020-02-20 12:38:58 +08:00
|
|
|
******************************************************************************
|
|
|
|
* @attention
|
|
|
|
*
|
2021-01-06 12:25:02 +08:00
|
|
|
* <h2><center>© Copyright (c) 2021 STMicroelectronics.
|
2020-02-20 12:38:58 +08:00
|
|
|
* All rights reserved.</center></h2>
|
|
|
|
*
|
|
|
|
* This software component is licensed by ST under Ultimate Liberty license
|
|
|
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at:
|
|
|
|
* www.st.com/SLA0044
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
#include "gpio.h"
|
2020-12-17 18:22:19 +08:00
|
|
|
|
2020-02-20 12:38:58 +08:00
|
|
|
/* USER CODE BEGIN 0 */
|
|
|
|
|
2020-04-17 15:55:14 +08:00
|
|
|
extern NaviKit_t NaviKit;
|
2020-02-20 12:38:58 +08:00
|
|
|
/* USER CODE END 0 */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* Configure GPIO */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
|
|
|
|
/* USER CODE END 1 */
|
|
|
|
|
2020-12-16 12:02:47 +08:00
|
|
|
/** Configure pins as
|
|
|
|
* Analog
|
|
|
|
* Input
|
2020-02-20 12:38:58 +08:00
|
|
|
* Output
|
|
|
|
* EVENT_OUT
|
|
|
|
* EXTI
|
|
|
|
*/
|
|
|
|
void MX_GPIO_Init(void)
|
|
|
|
{
|
|
|
|
|
2020-04-02 22:18:11 +08:00
|
|
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
|
|
|
2020-02-20 12:38:58 +08:00
|
|
|
/* GPIO Ports Clock Enable */
|
2020-04-02 22:18:11 +08:00
|
|
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
2020-04-06 21:16:18 +08:00
|
|
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
2020-07-15 18:26:22 +08:00
|
|
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
2020-03-17 13:08:19 +08:00
|
|
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
2020-07-15 18:26:22 +08:00
|
|
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
2020-02-20 12:38:58 +08:00
|
|
|
|
2020-04-02 22:18:11 +08:00
|
|
|
/*Configure GPIO pin Output Level */
|
2020-07-15 18:26:22 +08:00
|
|
|
HAL_GPIO_WritePin(SYS_POWER_LED_CTL_GPIO_Port, SYS_POWER_LED_CTL_Pin, GPIO_PIN_SET);
|
2020-04-02 22:18:11 +08:00
|
|
|
|
|
|
|
/*Configure GPIO pin Output Level */
|
2020-07-15 18:26:22 +08:00
|
|
|
HAL_GPIO_WritePin(GPIOE, PMB_PS_ON_Pin|SYS_FAN_CTL_1_Pin|SYS_FAN_CTL_2_Pin|SYS_FAN_CTL_3_Pin, GPIO_PIN_RESET);
|
2020-04-02 22:18:11 +08:00
|
|
|
|
|
|
|
/*Configure GPIO pin Output Level */
|
2020-07-23 17:43:36 +08:00
|
|
|
HAL_GPIO_WritePin(GPIOC, PMB_CHRG_SHDN_Pin|SYS_BUZZ_CTL_Pin, GPIO_PIN_SET);
|
|
|
|
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
|
|
HAL_GPIO_WritePin(GPIOC, PMB_TEMP_SEN_EN_Pin|SYS_RUN_LED_CTL_Pin|SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_RESET);
|
2020-04-02 22:18:11 +08:00
|
|
|
|
2020-04-06 21:16:18 +08:00
|
|
|
/*Configure GPIO pin Output Level */
|
2020-12-16 12:02:47 +08:00
|
|
|
HAL_GPIO_WritePin(GPIOB, IIC2_SCL_Pin|IIC2_SDA_Pin|USB2_VBUS_CTL_1_Pin|USB2_VBUS_CTL_2_Pin
|
2021-01-07 19:01:08 +08:00
|
|
|
|USB2_VBUS_CTL_3_Pin|USB2_VBUS_CTL_4_Pin|SOM_SYS_RESET_Pin, GPIO_PIN_RESET);
|
2020-07-15 18:26:22 +08:00
|
|
|
|
|
|
|
/*Configure GPIO pin Output Level */
|
2020-12-16 12:02:47 +08:00
|
|
|
HAL_GPIO_WritePin(GPIOD, USB2_VBUS_CTL_5_Pin|USB2_VBUS_CTL_6_Pin|USB3_VBUS_CTL_5_Pin|USB3_VBUS_CTL_6_Pin
|
|
|
|
|USB3_VBUS_CTL_1_Pin|USB3_VBUS_CTL_2_Pin|USB3_VBUS_CTL_3_Pin|USB3_VBUS_CTL_4_Pin
|
|
|
|
|SOC_U3_HUB_PWR_CTL_Pin|SOC_U3_HOST_PWR_CTL_Pin|SOC_U3_GEC_PWR_CTL_Pin|SOC_GE_SW_PWR_CTL_Pin
|
2020-07-23 17:43:36 +08:00
|
|
|
|SOM_POWER_EN_Pin, GPIO_PIN_RESET);
|
2020-07-15 18:26:22 +08:00
|
|
|
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
|
|
HAL_GPIO_WritePin(USB2_FS_ENUM_CTL_GPIO_Port, USB2_FS_ENUM_CTL_Pin, GPIO_PIN_RESET);
|
|
|
|
|
2020-07-23 17:43:36 +08:00
|
|
|
/*Configure GPIO pin Output Level */
|
|
|
|
HAL_GPIO_WritePin(GPIOD, SOM_SLEEP_WAKE_Pin|SOM_FORCE_RECOVERY_Pin, GPIO_PIN_SET);
|
|
|
|
|
2020-12-16 12:02:47 +08:00
|
|
|
/*Configure GPIO pins : PEPin PEPin PEPin PEPin
|
2020-07-15 18:26:22 +08:00
|
|
|
PEPin */
|
2020-12-16 12:02:47 +08:00
|
|
|
GPIO_InitStruct.Pin = SYS_POWER_LED_CTL_Pin|PMB_PS_ON_Pin|SYS_FAN_CTL_1_Pin|SYS_FAN_CTL_2_Pin
|
2020-07-15 18:26:22 +08:00
|
|
|
|SYS_FAN_CTL_3_Pin;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
|
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
2020-04-06 21:16:18 +08:00
|
|
|
|
2020-04-17 15:55:14 +08:00
|
|
|
/*Configure GPIO pin : PtPin */
|
2020-07-15 18:26:22 +08:00
|
|
|
GPIO_InitStruct.Pin = SYS_CUSTOM_BTN_Pin;
|
2020-04-17 15:55:14 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
2020-07-15 18:26:22 +08:00
|
|
|
HAL_GPIO_Init(SYS_CUSTOM_BTN_GPIO_Port, &GPIO_InitStruct);
|
2020-04-02 22:18:11 +08:00
|
|
|
|
2020-07-15 18:26:22 +08:00
|
|
|
/*Configure GPIO pins : PEPin PEPin */
|
2020-12-25 10:24:25 +08:00
|
|
|
GPIO_InitStruct.Pin = PMB_CHRG_STAT2_Pin|PMB_CHRG_STAT1_Pin;
|
2020-07-15 18:26:22 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
|
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
|
|
|
|
2020-12-16 12:02:47 +08:00
|
|
|
/*Configure GPIO pins : PCPin PCPin PCPin PCPin
|
2020-07-15 18:26:22 +08:00
|
|
|
PCPin */
|
2020-12-16 12:02:47 +08:00
|
|
|
GPIO_InitStruct.Pin = PMB_CHRG_SHDN_Pin|PMB_TEMP_SEN_EN_Pin|SYS_RUN_LED_CTL_Pin|SYS_BUZZ_CTL_Pin
|
2020-07-15 18:26:22 +08:00
|
|
|
|SOC_U2_HUB_PWR_CTL_Pin;
|
2020-04-02 22:18:11 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
2020-07-15 18:26:22 +08:00
|
|
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
|
|
|
|
|
|
/*Configure GPIO pins : PCPin PCPin */
|
|
|
|
GPIO_InitStruct.Pin = PMB_TEMP_SEN_ALT_Pin|PMB_CLOULOMB_ALCC_Pin;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
2020-04-02 22:18:11 +08:00
|
|
|
|
|
|
|
/*Configure GPIO pin : PtPin */
|
2020-07-15 18:26:22 +08:00
|
|
|
GPIO_InitStruct.Pin = SYS_POWER_BTN_Pin;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
|
|
|
HAL_GPIO_Init(SYS_POWER_BTN_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
|
|
|
|
/*Configure GPIO pins : PEPin PEPin PEPin */
|
|
|
|
GPIO_InitStruct.Pin = SYS_FAN_SNS_1_Pin|SYS_FAN_SNS_2_Pin|SYS_FAN_SNS_3_Pin;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
|
|
|
|
2020-12-16 12:02:47 +08:00
|
|
|
/*Configure GPIO pins : PBPin PBPin PBPin PBPin
|
2021-01-06 12:25:02 +08:00
|
|
|
PBPin PBPin */
|
2020-12-16 12:02:47 +08:00
|
|
|
GPIO_InitStruct.Pin = IIC2_SCL_Pin|IIC2_SDA_Pin|USB2_VBUS_CTL_1_Pin|USB2_VBUS_CTL_2_Pin
|
2021-01-06 12:25:02 +08:00
|
|
|
|USB2_VBUS_CTL_3_Pin|USB2_VBUS_CTL_4_Pin;
|
2020-04-17 18:25:14 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
2020-04-02 22:18:11 +08:00
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
2020-07-15 18:26:22 +08:00
|
|
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
2020-04-02 22:18:11 +08:00
|
|
|
|
2020-12-16 12:02:47 +08:00
|
|
|
/*Configure GPIO pins : PDPin PDPin PDPin PDPin
|
|
|
|
PDPin PDPin PDPin PDPin
|
|
|
|
PDPin PDPin PDPin PDPin
|
2020-07-15 18:26:22 +08:00
|
|
|
PDPin PDPin PDPin */
|
2020-12-16 12:02:47 +08:00
|
|
|
GPIO_InitStruct.Pin = USB2_VBUS_CTL_5_Pin|USB2_VBUS_CTL_6_Pin|USB3_VBUS_CTL_5_Pin|USB3_VBUS_CTL_6_Pin
|
|
|
|
|USB3_VBUS_CTL_1_Pin|USB3_VBUS_CTL_2_Pin|USB3_VBUS_CTL_3_Pin|USB3_VBUS_CTL_4_Pin
|
|
|
|
|SOC_U3_HUB_PWR_CTL_Pin|SOC_U3_HOST_PWR_CTL_Pin|SOC_U3_GEC_PWR_CTL_Pin|SOC_GE_SW_PWR_CTL_Pin
|
2020-07-15 18:26:22 +08:00
|
|
|
|SOM_POWER_EN_Pin|SOM_SLEEP_WAKE_Pin|SOM_FORCE_RECOVERY_Pin;
|
2020-04-02 22:18:11 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
|
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
|
|
|
|
2020-08-24 11:36:08 +08:00
|
|
|
/*Configure GPIO pins : PCPin PCPin PCPin */
|
|
|
|
GPIO_InitStruct.Pin = SOC_U3_HOST_PWR_STA_Pin|SOC_U3_HUB_PWR_STA_Pin|SOC_U2_HUB_PWR_STA_Pin;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
|
|
|
2020-04-06 21:16:18 +08:00
|
|
|
/*Configure GPIO pin : PtPin */
|
2020-07-15 18:26:22 +08:00
|
|
|
GPIO_InitStruct.Pin = USB2_FS_ENUM_CTL_Pin;
|
2020-04-06 21:16:18 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
2020-07-15 18:26:22 +08:00
|
|
|
HAL_GPIO_Init(USB2_FS_ENUM_CTL_GPIO_Port, &GPIO_InitStruct);
|
2020-04-06 21:16:18 +08:00
|
|
|
|
2020-04-02 22:18:11 +08:00
|
|
|
/*Configure GPIO pin : PtPin */
|
2020-07-15 18:26:22 +08:00
|
|
|
GPIO_InitStruct.Pin = SOM_SHUTDOWN_REQ_Pin;
|
2020-09-01 18:38:53 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
2020-04-02 22:18:11 +08:00
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
2020-07-15 18:26:22 +08:00
|
|
|
HAL_GPIO_Init(SOM_SHUTDOWN_REQ_GPIO_Port, &GPIO_InitStruct);
|
2020-04-02 22:18:11 +08:00
|
|
|
|
2021-01-06 12:25:02 +08:00
|
|
|
/*Configure GPIO pin : PtPin */
|
2021-01-07 19:01:08 +08:00
|
|
|
GPIO_InitStruct.Pin = SOM_MOD_SLEEP_Pin;
|
2021-01-06 12:25:02 +08:00
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
2021-01-07 19:01:08 +08:00
|
|
|
HAL_GPIO_Init(SOM_MOD_SLEEP_GPIO_Port, &GPIO_InitStruct);
|
2021-01-06 12:25:02 +08:00
|
|
|
|
2020-04-17 15:55:14 +08:00
|
|
|
/*Configure GPIO pin : PtPin */
|
2021-01-07 19:01:08 +08:00
|
|
|
GPIO_InitStruct.Pin = SOM_SYS_RESET_Pin;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
|
|
HAL_GPIO_Init(SOM_SYS_RESET_GPIO_Port, &GPIO_InitStruct);
|
2020-04-17 15:55:14 +08:00
|
|
|
|
2020-02-20 12:38:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* USER CODE BEGIN 2 */
|
2020-04-17 15:55:14 +08:00
|
|
|
|
|
|
|
|
2020-02-20 12:38:58 +08:00
|
|
|
/* USER CODE END 2 */
|
|
|
|
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|