You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
5.0 KiB
C
153 lines
5.0 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file gpio.c
|
|
* @brief This file provides code for the configuration
|
|
* of all used GPIO pins.
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2025 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "gpio.h"
|
|
|
|
/* USER CODE BEGIN 0 */
|
|
|
|
/* USER CODE END 0 */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* Configure GPIO */
|
|
/*----------------------------------------------------------------------------*/
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
/* USER CODE END 1 */
|
|
|
|
/** Configure pins as
|
|
* Analog
|
|
* Input
|
|
* Output
|
|
* EVENT_OUT
|
|
* EXTI
|
|
PA10 ------> I2S2_ext_SD
|
|
PA15 ------> I2S3_WS
|
|
PB4 ------> I2S3_ext_SD
|
|
PB5 ------> I2S3_SD
|
|
PB6 ------> I2C1_SCL
|
|
*/
|
|
void MX_GPIO_Init(void)
|
|
{
|
|
|
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
|
|
/* GPIO Ports Clock Enable */
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOF);
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOD);
|
|
|
|
/**/
|
|
LL_GPIO_ResetOutputPin(GPIOC, SHR_CLK_Pin|SHR_STR_Pin);
|
|
|
|
/**/
|
|
LL_GPIO_ResetOutputPin(GPIOA, HWRESET_Pin|LL_GPIO_PIN_5);
|
|
|
|
/**/
|
|
LL_GPIO_ResetOutputPin(SHR_DOUT_DISP_GPIO_Port, SHR_DOUT_DISP_Pin);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = KBDA2_RIGHT_Pin|KBDA1_LEFT_Pin|KBDA1_RIGHT_Pin|KBDA1_UP_Pin
|
|
|KBDA1_DOWN_Pin|KBDA2_LEFT_Pin|KBDB2_UP_Pin;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = SHR_CLK_Pin|SHR_STR_Pin;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = HWRESET_Pin|LL_GPIO_PIN_5;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = KBDA2_DOWN_Pin|KBDB1_LEFT_Pin|KBDB2_DOWN_Pin|KBDB1_RIGHT_Pin
|
|
|KBDB2_RIGHT_Pin;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = KBDB1_UP_Pin|KBDB1_DOWN_Pin|KBDB2_LEFT_Pin|SHR_DIN_KBD_Pin;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = I2S2_SDIN_Pin;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
|
|
LL_GPIO_Init(I2S2_SDIN_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_15;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
|
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_4|LL_GPIO_PIN_5;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
|
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
|
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
/**/
|
|
GPIO_InitStruct.Pin = SHR_DOUT_DISP_Pin;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
LL_GPIO_Init(SHR_DOUT_DISP_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
}
|
|
|
|
/* USER CODE BEGIN 2 */
|
|
|
|
/* USER CODE END 2 */
|