添加flash

This commit is contained in:
2025-03-06 16:33:34 +08:00
parent 8648025432
commit 8603e73b45
94 changed files with 800 additions and 40308 deletions

View File

@ -7,7 +7,7 @@
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
@ -35,7 +35,6 @@
/** Configure pins
PH0-OSC_IN (PH0) ------> RCC_OSC_IN
PH1-OSC_OUT (PH1) ------> RCC_OSC_OUT
PB14 ------> S_TIM12_CH1
*/
void MX_GPIO_Init(void)
{
@ -52,18 +51,10 @@ void MX_GPIO_Init(void)
/*Configure GPIO pin : PA0 */
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : PB14 */
GPIO_InitStruct.Pin = GPIO_PIN_14;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM12;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin : PB9 */
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
@ -74,6 +65,7 @@ void MX_GPIO_Init(void)
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
}
/* USER CODE BEGIN 2 */

View File

@ -6,7 +6,7 @@
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
@ -75,7 +75,7 @@ int main(void)
HAL_Init();
/* USER CODE BEGIN Init */
HAL_Delay(2000);
/* USER CODE END Init */
/* Configure the system clock */
@ -87,10 +87,10 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_DMA_Init();
MX_USART2_UART_Init();
MX_TIM5_Init();
MX_USART1_UART_Init();
MX_USART2_UART_Init();
MX_DMA_Init();
/* USER CODE BEGIN 2 */
mymain();
/* USER CODE END 2 */

View File

@ -7,7 +7,7 @@
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file

View File

@ -6,7 +6,7 @@
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file

View File

@ -7,7 +7,7 @@
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
@ -69,7 +69,6 @@ void MX_USART1_UART_Init(void)
}
/* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */
}
@ -261,24 +260,5 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
}
/* USER CODE BEGIN 1 */
//int fputc(int ch, FILE *f)
//{
// USART1->TDR = ch;
// while((USART1->ISR & USART_ISR_TC) == 0)
// {}
// return ch;
//}
int _write (int fd, char *pBuffer, int size)
{
for (int i = 0; i < size; i++)
{
USART1->TDR = (unsigned char) *(pBuffer+i);
while((USART1->ISR & USART_ISR_TC) == 0)
{}
}
return size;
}
/* USER CODE END 1 */