From 895024bc756a8c68a41d90358a51e2b890b08bdc Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 25 Mar 2022 17:23:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E7=84=8A=E6=8E=A5=E5=AE=8C?= =?UTF-8?q?=E6=88=90=EF=BC=8C=E5=BC=80=E5=A7=8B=E8=B0=83=E8=AF=95=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=20Signed-off-by:=20kevin=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stm32F030F4_code/.mxproject | 16 ++-- .../.settings/language.settings.xml | 4 +- stm32F030F4_code/Core/Inc/main.h | 6 -- .../Core/Inc/stm32f0xx_hal_conf.h | 14 ++-- stm32F030F4_code/Core/Inc/stm32f0xx_it.h | 2 - stm32F030F4_code/Core/Src/main.c | 17 ++-- stm32F030F4_code/Core/Src/stm32f0xx_hal_msp.c | 2 - stm32F030F4_code/Core/Src/stm32f0xx_it.c | 1 - .../stm32F030F4_code Debug.launch | 80 +++++++++++++++++++ stm32F030F4_code/stm32F030F4_code.ioc | 17 ++-- 10 files changed, 114 insertions(+), 45 deletions(-) create mode 100644 stm32F030F4_code/stm32F030F4_code Debug.launch diff --git a/stm32F030F4_code/.mxproject b/stm32F030F4_code/.mxproject index e72ea4c..1948a8d 100644 --- a/stm32F030F4_code/.mxproject +++ b/stm32F030F4_code/.mxproject @@ -9,17 +9,17 @@ CDefines=USE_HAL_DRIVER;STM32F030x6;USE_HAL_DRIVER;USE_HAL_DRIVER; [PreviousGenFiles] AdvancedFolderStructure=true HeaderFileListSize=3 -HeaderFiles#0=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Inc/stm32f0xx_it.h -HeaderFiles#1=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Inc/stm32f0xx_hal_conf.h -HeaderFiles#2=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Inc/main.h +HeaderFiles#0=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Inc/stm32f0xx_it.h +HeaderFiles#1=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Inc/stm32f0xx_hal_conf.h +HeaderFiles#2=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Inc/main.h HeaderFolderListSize=1 -HeaderPath#0=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Inc +HeaderPath#0=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Inc HeaderFiles=; SourceFileListSize=3 -SourceFiles#0=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Src/stm32f0xx_it.c -SourceFiles#1=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Src/stm32f0xx_hal_msp.c -SourceFiles#2=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Src/main.c +SourceFiles#0=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Src/stm32f0xx_it.c +SourceFiles#1=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Src/stm32f0xx_hal_msp.c +SourceFiles#2=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Src/main.c SourceFolderListSize=1 -SourcePath#0=C:/Users/wuwen/Desktop/Morse_code_trainer/stm32F030F4_code/Core/Src +SourcePath#0=C:/Users/wuwen/Desktop/morse_code_trainer/stm32F030F4_code/Core/Src SourceFiles=; diff --git a/stm32F030F4_code/.settings/language.settings.xml b/stm32F030F4_code/.settings/language.settings.xml index 90a581c..295ab90 100644 --- a/stm32F030F4_code/.settings/language.settings.xml +++ b/stm32F030F4_code/.settings/language.settings.xml @@ -6,7 +6,7 @@ - + @@ -18,7 +18,7 @@ - + diff --git a/stm32F030F4_code/Core/Inc/main.h b/stm32F030F4_code/Core/Inc/main.h index dfd528e..3bb7f02 100644 --- a/stm32F030F4_code/Core/Inc/main.h +++ b/stm32F030F4_code/Core/Inc/main.h @@ -74,10 +74,6 @@ void Error_Handler(void); #define SW_B_GPIO_Port GPIOA #define SW_C_Pin GPIO_PIN_1 #define SW_C_GPIO_Port GPIOB -#define PWR_EN_Pin GPIO_PIN_13 -#define PWR_EN_GPIO_Port GPIOA -#define RUN_LED_Pin GPIO_PIN_14 -#define RUN_LED_GPIO_Port GPIOA /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ @@ -87,5 +83,3 @@ void Error_Handler(void); #endif #endif /* __MAIN_H */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/stm32F030F4_code/Core/Inc/stm32f0xx_hal_conf.h b/stm32F030F4_code/Core/Inc/stm32f0xx_hal_conf.h index f3e9189..18bbef7 100644 --- a/stm32F030F4_code/Core/Inc/stm32f0xx_hal_conf.h +++ b/stm32F030F4_code/Core/Inc/stm32f0xx_hal_conf.h @@ -1,3 +1,4 @@ +/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file stm32f0xx_hal_conf.h @@ -5,16 +6,16 @@ ****************************************************************************** * @attention * - *

© Copyright (c) 2016 STMicroelectronics. - * All rights reserved.

+ * Copyright (c) 2016 STMicroelectronics. + * All rights reserved. * - * This software component is licensed by ST under BSD 3-Clause license, - * the "License"; You may not use this file except in compliance with the - * License. You may obtain a copy of the License at: - * opensource.org/licenses/BSD-3-Clause + * 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 */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F0xx_HAL_CONF_H @@ -319,4 +320,3 @@ #endif /* __STM32F0xx_HAL_CONF_H */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/stm32F030F4_code/Core/Inc/stm32f0xx_it.h b/stm32F030F4_code/Core/Inc/stm32f0xx_it.h index 8685b56..876378c 100644 --- a/stm32F030F4_code/Core/Inc/stm32f0xx_it.h +++ b/stm32F030F4_code/Core/Inc/stm32f0xx_it.h @@ -61,5 +61,3 @@ void SysTick_Handler(void); #endif #endif /* __STM32F0xx_IT_H */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/stm32F030F4_code/Core/Src/main.c b/stm32F030F4_code/Core/Src/main.c index 6d8b484..bc65712 100644 --- a/stm32F030F4_code/Core/Src/main.c +++ b/stm32F030F4_code/Core/Src/main.c @@ -40,7 +40,7 @@ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ -ADC_HandleTypeDef hadc; + ADC_HandleTypeDef hadc; I2C_HandleTypeDef hi2c1; @@ -141,6 +141,7 @@ void SystemClock_Config(void) { Error_Handler(); } + /** Initializes the CPU, AHB and APB buses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK @@ -179,6 +180,7 @@ static void MX_ADC_Init(void) /* USER CODE BEGIN ADC_Init 1 */ /* USER CODE END ADC_Init 1 */ + /** Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion) */ hadc.Instance = ADC1; @@ -199,6 +201,7 @@ static void MX_ADC_Init(void) { Error_Handler(); } + /** Configure for the selected ADC regular channel to be converted. */ sConfig.Channel = ADC_CHANNEL_0; @@ -242,12 +245,14 @@ static void MX_I2C1_Init(void) { Error_Handler(); } + /** Configure Analogue filter */ if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK) { Error_Handler(); } + /** Configure Digital filter */ if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK) @@ -356,7 +361,7 @@ static void MX_GPIO_Init(void) __HAL_RCC_GPIOB_CLK_ENABLE(); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOA, buzzer_mute_Pin|PWR_EN_Pin|RUN_LED_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(buzzer_mute_GPIO_Port, buzzer_mute_Pin, GPIO_PIN_RESET); /*Configure GPIO pins : tack_A_Pin tack_B_Pin */ GPIO_InitStruct.Pin = tack_A_Pin|tack_B_Pin; @@ -370,12 +375,12 @@ static void MX_GPIO_Init(void) GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(charge_det_GPIO_Port, &GPIO_InitStruct); - /*Configure GPIO pins : buzzer_mute_Pin PWR_EN_Pin RUN_LED_Pin */ - GPIO_InitStruct.Pin = buzzer_mute_Pin|PWR_EN_Pin|RUN_LED_Pin; + /*Configure GPIO pin : buzzer_mute_Pin */ + GPIO_InitStruct.Pin = buzzer_mute_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); + HAL_GPIO_Init(buzzer_mute_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pins : SW_A_Pin SW_B_Pin */ GPIO_InitStruct.Pin = SW_A_Pin|SW_B_Pin; @@ -426,5 +431,3 @@ void assert_failed(uint8_t *file, uint32_t line) /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/stm32F030F4_code/Core/Src/stm32f0xx_hal_msp.c b/stm32F030F4_code/Core/Src/stm32f0xx_hal_msp.c index 9744f41..8e2fabc 100644 --- a/stm32F030F4_code/Core/Src/stm32f0xx_hal_msp.c +++ b/stm32F030F4_code/Core/Src/stm32f0xx_hal_msp.c @@ -345,5 +345,3 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/stm32F030F4_code/Core/Src/stm32f0xx_it.c b/stm32F030F4_code/Core/Src/stm32f0xx_it.c index 46e041c..50b143b 100644 --- a/stm32F030F4_code/Core/Src/stm32f0xx_it.c +++ b/stm32F030F4_code/Core/Src/stm32f0xx_it.c @@ -144,4 +144,3 @@ void SysTick_Handler(void) /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/stm32F030F4_code/stm32F030F4_code Debug.launch b/stm32F030F4_code/stm32F030F4_code Debug.launch new file mode 100644 index 0000000..da8292a --- /dev/null +++ b/stm32F030F4_code/stm32F030F4_code Debug.launch @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stm32F030F4_code/stm32F030F4_code.ioc b/stm32F030F4_code/stm32F030F4_code.ioc index df9b70e..2db31e4 100644 --- a/stm32F030F4_code/stm32F030F4_code.ioc +++ b/stm32F030F4_code/stm32F030F4_code.ioc @@ -35,8 +35,8 @@ Mcu.PinsNb=17 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F030F4Px -MxCube.Version=6.3.0 -MxDb.Version=DB.6.0.30 +MxCube.Version=6.5.0 +MxDb.Version=DB.6.0.50 NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true @@ -51,14 +51,10 @@ PA1.Locked=true PA1.Signal=GPIO_Input PA10.Mode=I2C PA10.Signal=I2C1_SDA -PA13.GPIOParameters=GPIO_Label -PA13.GPIO_Label=PWR_EN -PA13.Locked=true -PA13.Signal=GPIO_Output -PA14.GPIOParameters=GPIO_Label -PA14.GPIO_Label=RUN_LED -PA14.Locked=true -PA14.Signal=GPIO_Output +PA13.Mode=Serial_Wire +PA13.Signal=SYS_SWDIO +PA14.Mode=Serial_Wire +PA14.Signal=SYS_SWCLK PA2.Mode=Asynchronous PA2.Signal=USART1_TX PA3.Mode=Asynchronous @@ -150,3 +146,4 @@ VP_SYS_VS_Systick.Signal=SYS_VS_Systick VP_TIM14_VS_ClockSourceINT.Mode=Enable_Timer VP_TIM14_VS_ClockSourceINT.Signal=TIM14_VS_ClockSourceINT board=custom +isbadioc=false