a14011380e
Sync CubeMX regen output for the 6 newly assigned output pins:
KO5=PC15, KO4=PF5, KO_LED1=PF2, KO_LED2=PF3, KO_LED3=PE6,
KO_24V=PF4. All are push-pull, no-pull, low initial level in
MX_GPIO_Init. The BSP driver does not own these pins yet; the
drivable output count stays 4 (ioboard_do_write 4-bit mask).
netTask stack reduced from 1408 to 960 words, in both .ioc
FREERTOS.Tasks01 and freertos.c generated region. Rebuilt the
cubemx-survival baseline for the ioc-task-stacks drift (only that
one entry changed); --check now returns 0.
Keil full rebuild verified: 0 errors, 0 warnings. Refilled the
RAM budget ledger and memory snapshot from the authoritative map
along with the trend row and size attestation; --gate and --scan
both return 0. Regenerated the managed task tables in README and
AGENTS from freertos.c (netTask 960); task-table --check passes.
Doc sync and the 6-pin question were committed in 795ce970.
208 lines
7.4 KiB
C
208 lines
7.4 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) 2026 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
|
|
*/
|
|
void MX_GPIO_Init(void)
|
|
{
|
|
|
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
|
|
/* GPIO Ports Clock Enable */
|
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
|
__HAL_RCC_GPIOH_CLK_ENABLE();
|
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
|
__HAL_RCC_GPIOG_CLK_ENABLE();
|
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(KO_LED3_GPIO_Port, KO_LED3_Pin, GPIO_PIN_RESET);
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(GPIOC, KO6_Pin|KO5_Pin|HC165_CLK_Pin|TP_CONVST_Pin, GPIO_PIN_RESET);
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(GPIOF, TRIP_LED_Pin|ERT_LED_Pin|KO_LED1_Pin|KO_LED2_Pin
|
|
|KO_24V_Pin|KO4_Pin|CLZ_LED_Pin, GPIO_PIN_RESET);
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(GPIOC, HC165_LD_Pin|LED1_Pin|TP_RD_Pin, GPIO_PIN_SET);
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(GPIOB, LED2_Pin|LED3_Pin|LED4_Pin|CH395_SCS_Pin
|
|
|GD_WP_Pin, GPIO_PIN_SET);
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(GPIOF, LED5_Pin|LED6_Pin, GPIO_PIN_SET);
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(GPIOA, TP_OS2_Pin|TP_OS1_Pin|TP_OS0_Pin|ST_DIR4_Pin, GPIO_PIN_RESET);
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(GPIOE, GD_CS_Pin|GD_HOLD_Pin, GPIO_PIN_SET);
|
|
|
|
/*Configure GPIO pins : IN_D4_Pin HC165_IN2_Pin IN_E4_Pin CH395_INT_Pin */
|
|
GPIO_InitStruct.Pin = IN_D4_Pin|HC165_IN2_Pin|IN_E4_Pin|CH395_INT_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pin : KO_LED3_Pin */
|
|
GPIO_InitStruct.Pin = KO_LED3_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
HAL_GPIO_Init(KO_LED3_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : KO6_Pin KO5_Pin HC165_CLK_Pin */
|
|
GPIO_InitStruct.Pin = KO6_Pin|KO5_Pin|HC165_CLK_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : TRIP_LED_Pin ERT_LED_Pin KO_LED1_Pin KO_LED2_Pin
|
|
KO_24V_Pin KO4_Pin CLZ_LED_Pin */
|
|
GPIO_InitStruct.Pin = TRIP_LED_Pin|ERT_LED_Pin|KO_LED1_Pin|KO_LED2_Pin
|
|
|KO_24V_Pin|KO4_Pin|CLZ_LED_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : HC165_LD_Pin TP_RD_Pin TP_CONVST_Pin */
|
|
GPIO_InitStruct.Pin = HC165_LD_Pin|TP_RD_Pin|TP_CONVST_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pin : LED1_Pin */
|
|
GPIO_InitStruct.Pin = LED1_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
|
HAL_GPIO_Init(LED1_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : LED2_Pin CH395_SCS_Pin */
|
|
GPIO_InitStruct.Pin = LED2_Pin|CH395_SCS_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : LED3_Pin LED4_Pin */
|
|
GPIO_InitStruct.Pin = LED3_Pin|LED4_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : LED5_Pin LED6_Pin */
|
|
GPIO_InitStruct.Pin = LED5_Pin|LED6_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : DB0_Pin DB1_Pin DB2_Pin DB3_Pin
|
|
DB4_Pin DB5_Pin DB6_Pin DB7_Pin
|
|
DB8_Pin DB9_Pin DB10_Pin DB11_Pin
|
|
DB12_Pin DB13_Pin DB14_Pin DB15_Pin */
|
|
GPIO_InitStruct.Pin = DB0_Pin|DB1_Pin|DB2_Pin|DB3_Pin
|
|
|DB4_Pin|DB5_Pin|DB6_Pin|DB7_Pin
|
|
|DB8_Pin|DB9_Pin|DB10_Pin|DB11_Pin
|
|
|DB12_Pin|DB13_Pin|DB14_Pin|DB15_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pin : TP_FRSTDATA_Pin */
|
|
GPIO_InitStruct.Pin = TP_FRSTDATA_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
HAL_GPIO_Init(TP_FRSTDATA_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pin : TP_BUSY_Pin */
|
|
GPIO_InitStruct.Pin = TP_BUSY_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
HAL_GPIO_Init(TP_BUSY_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : TP_OS2_Pin TP_OS0_Pin */
|
|
GPIO_InitStruct.Pin = TP_OS2_Pin|TP_OS0_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : TP_OS1_Pin ST_DIR4_Pin */
|
|
GPIO_InitStruct.Pin = TP_OS1_Pin|ST_DIR4_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pin : GD_WP_Pin */
|
|
GPIO_InitStruct.Pin = GD_WP_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
|
HAL_GPIO_Init(GD_WP_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
/*Configure GPIO pins : GD_CS_Pin GD_HOLD_Pin */
|
|
GPIO_InitStruct.Pin = GD_CS_Pin|GD_HOLD_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
|
|
|
/* EXTI interrupt init*/
|
|
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 6, 0);
|
|
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
|
|
|
|
}
|
|
|
|
/* USER CODE BEGIN 2 */
|
|
|
|
/* USER CODE END 2 */
|