|
|
|
@ -17,7 +17,6 @@
|
|
|
|
******************************************************************************
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
/* USER CODE END Header */
|
|
|
|
/* USER CODE END Header */
|
|
|
|
|
|
|
|
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
#include "main.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
|
|
|
|
@ -160,7 +159,6 @@ int main(void)
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END 1 */
|
|
|
|
/* USER CODE END 1 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* MCU Configuration--------------------------------------------------------*/
|
|
|
|
/* MCU Configuration--------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
@ -215,7 +213,8 @@ void SystemClock_Config(void)
|
|
|
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
|
|
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
|
|
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
|
|
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
|
|
|
|
|
|
|
|
|
|
|
/** Initializes the CPU, AHB and APB busses clocks
|
|
|
|
/** Initializes the RCC Oscillators according to the specified parameters
|
|
|
|
|
|
|
|
* in the RCC_OscInitTypeDef structure.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
|
|
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
|
|
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
|
|
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
|
|
|
@ -228,7 +227,7 @@ void SystemClock_Config(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Error_Handler();
|
|
|
|
Error_Handler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Initializes the CPU, AHB and APB busses clocks
|
|
|
|
/** Initializes the CPU, AHB and APB buses clocks
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
|
|
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
|
|
|
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
|
|
|
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
|
|
|
@ -298,7 +297,7 @@ static void MX_TIM2_Init(void)
|
|
|
|
htim2.Instance = TIM2;
|
|
|
|
htim2.Instance = TIM2;
|
|
|
|
htim2.Init.Prescaler = 0;
|
|
|
|
htim2.Init.Prescaler = 0;
|
|
|
|
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
|
|
|
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
|
|
|
htim2.Init.Period = 0;
|
|
|
|
htim2.Init.Period = 65535;
|
|
|
|
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
|
|
|
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
|
|
|
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
|
|
|
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
|
|
|
if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
|
|
|
|
if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
|
|
|
|
@ -347,7 +346,7 @@ static void MX_TIM3_Init(void)
|
|
|
|
htim3.Instance = TIM3;
|
|
|
|
htim3.Instance = TIM3;
|
|
|
|
htim3.Init.Prescaler = 0;
|
|
|
|
htim3.Init.Prescaler = 0;
|
|
|
|
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
|
|
|
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
|
|
|
htim3.Init.Period = 0;
|
|
|
|
htim3.Init.Period = 65535;
|
|
|
|
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
|
|
|
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
|
|
|
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
|
|
|
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
|
|
|
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK)
|
|
|
|
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK)
|
|
|
|
@ -444,18 +443,18 @@ static void MX_GPIO_Init(void)
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
|
|
|
HAL_GPIO_Init(BigButton_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
HAL_GPIO_Init(BigButton_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
|
|
|
|
|
|
|
|
/*Configure GPIO pins : PA4 PA5 PA6 PA8
|
|
|
|
/*Configure GPIO pins : PA4 PA5 PA6 PA8
|
|
|
|
PA11 PA12 PA15 */
|
|
|
|
PA11 PA12 PA15 */
|
|
|
|
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_8
|
|
|
|
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_8
|
|
|
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_15;
|
|
|
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_15;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
|
|
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
|
|
|
|
|
|
|
|
|
/*Configure GPIO pins : PB0 PB1 PB2 PB10
|
|
|
|
/*Configure GPIO pins : PB0 PB1 PB2 PB10
|
|
|
|
PB11 PB13 PB14 PB3
|
|
|
|
PB11 PB13 PB14 PB3
|
|
|
|
PB4 PB5 PB8 PB9 */
|
|
|
|
PB4 PB5 PB8 PB9 */
|
|
|
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10
|
|
|
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10
|
|
|
|
|GPIO_PIN_11|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_3
|
|
|
|
|GPIO_PIN_11|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_3
|
|
|
|
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_9;
|
|
|
|
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_9;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
|
|
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
@ -775,7 +774,7 @@ void Error_Handler(void)
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void assert_failed(uint8_t *file, uint32_t line)
|
|
|
|
void assert_failed(uint8_t *file, uint32_t line)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* USER CODE BEGIN 6 */
|
|
|
|
/* USER CODE BEGIN 6 */
|
|
|
|
/* User can add his own implementation to report the file name and line number,
|
|
|
|
/* User can add his own implementation to report the file name and line number,
|
|
|
|
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
|
|
|
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
|
|
|
|