
20 changed files with 481 additions and 1750 deletions
@ -1,52 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file dac.h |
|||
* @brief This file contains all the function prototypes for |
|||
* the dac.c file |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 */ |
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __DAC_H__ |
|||
#define __DAC_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "main.h" |
|||
|
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
extern DAC_HandleTypeDef hdac_global; |
|||
|
|||
/* USER CODE BEGIN Private defines */ |
|||
|
|||
/* USER CODE END Private defines */ |
|||
|
|||
void MX_DAC_Init(void); |
|||
|
|||
/* USER CODE BEGIN Prototypes */ |
|||
|
|||
/* USER CODE END Prototypes */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __DAC_H__ */ |
|||
|
@ -1,52 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file dma.h |
|||
* @brief This file contains all the function prototypes for |
|||
* the dma.c file |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 */ |
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __DMA_H__ |
|||
#define __DMA_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "main.h" |
|||
|
|||
/* DMA memory to memory transfer handles -------------------------------------*/ |
|||
|
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
/* USER CODE BEGIN Private defines */ |
|||
|
|||
/* USER CODE END Private defines */ |
|||
|
|||
void MX_DMA_Init(void); |
|||
|
|||
/* USER CODE BEGIN Prototypes */ |
|||
|
|||
/* USER CODE END Prototypes */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __DMA_H__ */ |
|||
|
@ -1,49 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file gpio.h |
|||
* @brief This file contains all the function prototypes for |
|||
* the gpio.c file |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 */ |
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __GPIO_H__ |
|||
#define __GPIO_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "main.h" |
|||
|
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
/* USER CODE BEGIN Private defines */ |
|||
|
|||
/* USER CODE END Private defines */ |
|||
|
|||
void MX_GPIO_Init(void); |
|||
|
|||
/* USER CODE BEGIN Prototypes */ |
|||
|
|||
/* USER CODE END Prototypes */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
#endif /*__ GPIO_H__ */ |
|||
|
@ -1,52 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file rng.h |
|||
* @brief This file contains all the function prototypes for |
|||
* the rng.c file |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 */ |
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __RNG_H__ |
|||
#define __RNG_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "main.h" |
|||
|
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
extern RNG_HandleTypeDef hrng; |
|||
|
|||
/* USER CODE BEGIN Private defines */ |
|||
|
|||
/* USER CODE END Private defines */ |
|||
|
|||
void MX_RNG_Init(void); |
|||
|
|||
/* USER CODE BEGIN Prototypes */ |
|||
|
|||
/* USER CODE END Prototypes */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __RNG_H__ */ |
|||
|
@ -1,69 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file stm32f4xx_it.h |
|||
* @brief This file contains the headers of the interrupt handlers. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 */ |
|||
|
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __STM32F4xx_IT_H |
|||
#define __STM32F4xx_IT_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Private includes ----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
/* Exported types ------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN ET */ |
|||
|
|||
/* USER CODE END ET */ |
|||
|
|||
/* Exported constants --------------------------------------------------------*/ |
|||
/* USER CODE BEGIN EC */ |
|||
|
|||
/* USER CODE END EC */ |
|||
|
|||
/* Exported macro ------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN EM */ |
|||
|
|||
/* USER CODE END EM */ |
|||
|
|||
/* Exported functions prototypes ---------------------------------------------*/ |
|||
void NMI_Handler(void); |
|||
void HardFault_Handler(void); |
|||
void MemManage_Handler(void); |
|||
void BusFault_Handler(void); |
|||
void UsageFault_Handler(void); |
|||
void DebugMon_Handler(void); |
|||
void SysTick_Handler(void); |
|||
void EXTI0_IRQHandler(void); |
|||
void DMA1_Stream5_IRQHandler(void); |
|||
void TIM2_IRQHandler(void); |
|||
void TIM7_IRQHandler(void); |
|||
void OTG_FS_IRQHandler(void); |
|||
/* USER CODE BEGIN EFP */ |
|||
|
|||
/* USER CODE END EFP */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __STM32F4xx_IT_H */ |
@ -1,58 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file tim.h |
|||
* @brief This file contains all the function prototypes for |
|||
* the tim.c file |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 */ |
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __TIM_H__ |
|||
#define __TIM_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "main.h" |
|||
|
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
extern TIM_HandleTypeDef htim2; |
|||
|
|||
extern TIM_HandleTypeDef htim6; |
|||
|
|||
extern TIM_HandleTypeDef htim7; |
|||
|
|||
/* USER CODE BEGIN Private defines */ |
|||
|
|||
/* USER CODE END Private defines */ |
|||
|
|||
void MX_TIM2_Init(void); |
|||
void MX_TIM6_Init(void); |
|||
void MX_TIM7_Init(void); |
|||
|
|||
/* USER CODE BEGIN Prototypes */ |
|||
|
|||
/* USER CODE END Prototypes */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __TIM_H__ */ |
|||
|
@ -1,148 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file dac.c |
|||
* @brief This file provides code for the configuration |
|||
* of the DAC instances. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 "dac.h" |
|||
|
|||
/* USER CODE BEGIN 0 */ |
|||
|
|||
/* USER CODE END 0 */ |
|||
|
|||
DAC_HandleTypeDef hdac_global; |
|||
DMA_HandleTypeDef hdma_dac1; |
|||
|
|||
/* DAC init function */ |
|||
void MX_DAC_Init(void) |
|||
{ |
|||
|
|||
/* USER CODE BEGIN DAC_Init 0 */ |
|||
|
|||
/* USER CODE END DAC_Init 0 */ |
|||
|
|||
DAC_ChannelConfTypeDef sConfig = {0}; |
|||
|
|||
/* USER CODE BEGIN DAC_Init 1 */ |
|||
|
|||
/* USER CODE END DAC_Init 1 */ |
|||
|
|||
/** DAC Initialization
|
|||
*/ |
|||
hdac_global.Instance = DAC; |
|||
if (HAL_DAC_Init(&hdac_global) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
|
|||
/** DAC channel OUT1 config
|
|||
*/ |
|||
sConfig.DAC_Trigger = DAC_TRIGGER_T6_TRGO; |
|||
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE; |
|||
if (HAL_DAC_ConfigChannel(&hdac_global, &sConfig, DAC_CHANNEL_1) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
|
|||
/** DAC channel OUT2 config
|
|||
*/ |
|||
sConfig.DAC_Trigger = DAC_TRIGGER_NONE; |
|||
if (HAL_DAC_ConfigChannel(&hdac_global, &sConfig, DAC_CHANNEL_2) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
/* USER CODE BEGIN DAC_Init 2 */ |
|||
|
|||
/* USER CODE END DAC_Init 2 */ |
|||
|
|||
} |
|||
|
|||
void HAL_DAC_MspInit(DAC_HandleTypeDef* dacHandle) |
|||
{ |
|||
|
|||
GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|||
if(dacHandle->Instance==DAC) |
|||
{ |
|||
/* USER CODE BEGIN DAC_MspInit 0 */ |
|||
|
|||
/* USER CODE END DAC_MspInit 0 */ |
|||
/* DAC clock enable */ |
|||
__HAL_RCC_DAC_CLK_ENABLE(); |
|||
|
|||
__HAL_RCC_GPIOA_CLK_ENABLE(); |
|||
/**DAC GPIO Configuration
|
|||
PA4 ------> DAC_OUT1 |
|||
PA5 ------> DAC_OUT2 |
|||
*/ |
|||
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5; |
|||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
|||
GPIO_InitStruct.Pull = GPIO_NOPULL; |
|||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|||
|
|||
/* DAC DMA Init */ |
|||
/* DAC1 Init */ |
|||
hdma_dac1.Instance = DMA1_Stream5; |
|||
hdma_dac1.Init.Channel = DMA_CHANNEL_7; |
|||
hdma_dac1.Init.Direction = DMA_MEMORY_TO_PERIPH; |
|||
hdma_dac1.Init.PeriphInc = DMA_PINC_DISABLE; |
|||
hdma_dac1.Init.MemInc = DMA_MINC_ENABLE; |
|||
hdma_dac1.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; |
|||
hdma_dac1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; |
|||
hdma_dac1.Init.Mode = DMA_NORMAL; |
|||
hdma_dac1.Init.Priority = DMA_PRIORITY_LOW; |
|||
hdma_dac1.Init.FIFOMode = DMA_FIFOMODE_DISABLE; |
|||
if (HAL_DMA_Init(&hdma_dac1) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
|
|||
__HAL_LINKDMA(dacHandle,DMA_Handle1,hdma_dac1); |
|||
|
|||
/* USER CODE BEGIN DAC_MspInit 1 */ |
|||
|
|||
/* USER CODE END DAC_MspInit 1 */ |
|||
} |
|||
} |
|||
|
|||
void HAL_DAC_MspDeInit(DAC_HandleTypeDef* dacHandle) |
|||
{ |
|||
|
|||
if(dacHandle->Instance==DAC) |
|||
{ |
|||
/* USER CODE BEGIN DAC_MspDeInit 0 */ |
|||
|
|||
/* USER CODE END DAC_MspDeInit 0 */ |
|||
/* Peripheral clock disable */ |
|||
__HAL_RCC_DAC_CLK_DISABLE(); |
|||
|
|||
/**DAC GPIO Configuration
|
|||
PA4 ------> DAC_OUT1 |
|||
PA5 ------> DAC_OUT2 |
|||
*/ |
|||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5); |
|||
|
|||
/* DAC DMA DeInit */ |
|||
HAL_DMA_DeInit(dacHandle->DMA_Handle1); |
|||
/* USER CODE BEGIN DAC_MspDeInit 1 */ |
|||
|
|||
/* USER CODE END DAC_MspDeInit 1 */ |
|||
} |
|||
} |
|||
|
|||
/* USER CODE BEGIN 1 */ |
|||
|
|||
/* USER CODE END 1 */ |
@ -1,55 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file dma.c |
|||
* @brief This file provides code for the configuration |
|||
* of all the requested memory to memory DMA transfers. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 "dma.h" |
|||
|
|||
/* USER CODE BEGIN 0 */ |
|||
|
|||
/* USER CODE END 0 */ |
|||
|
|||
/*----------------------------------------------------------------------------*/ |
|||
/* Configure DMA */ |
|||
/*----------------------------------------------------------------------------*/ |
|||
|
|||
/* USER CODE BEGIN 1 */ |
|||
|
|||
/* USER CODE END 1 */ |
|||
|
|||
/**
|
|||
* Enable DMA controller clock |
|||
*/ |
|||
void MX_DMA_Init(void) |
|||
{ |
|||
|
|||
/* DMA controller clock enable */ |
|||
__HAL_RCC_DMA1_CLK_ENABLE(); |
|||
|
|||
/* DMA interrupt init */ |
|||
/* DMA1_Stream5_IRQn interrupt configuration */ |
|||
HAL_NVIC_SetPriority(DMA1_Stream5_IRQn, 5, 0); |
|||
HAL_NVIC_EnableIRQ(DMA1_Stream5_IRQn); |
|||
|
|||
} |
|||
|
|||
/* USER CODE BEGIN 2 */ |
|||
|
|||
/* USER CODE END 2 */ |
|||
|
@ -1,134 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* File Name : freertos.c |
|||
* Description : Code for freertos applications |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 "FreeRTOS.h" |
|||
#include "task.h" |
|||
#include "main.h" |
|||
#include "cmsis_os.h" |
|||
|
|||
/* Private includes ----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Includes */ |
|||
#include "cppmain.h" |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
/* Private typedef -----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN PTD */ |
|||
|
|||
/* USER CODE END PTD */ |
|||
|
|||
/* Private define ------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN PD */ |
|||
|
|||
/* USER CODE END PD */ |
|||
|
|||
/* Private macro -------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN PM */ |
|||
|
|||
/* USER CODE END PM */ |
|||
|
|||
/* Private variables ---------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Variables */ |
|||
|
|||
/* USER CODE END Variables */ |
|||
/* Definitions for defaultTask */ |
|||
osThreadId_t defaultTaskHandle; |
|||
const osThreadAttr_t defaultTask_attributes = { |
|||
.name = "defaultTask", |
|||
.stack_size = 128 * 4, |
|||
.priority = (osPriority_t) osPriorityNormal, |
|||
}; |
|||
|
|||
/* Private function prototypes -----------------------------------------------*/ |
|||
/* USER CODE BEGIN FunctionPrototypes */ |
|||
|
|||
/* USER CODE END FunctionPrototypes */ |
|||
|
|||
void StartDefaultTask(void *argument); |
|||
|
|||
extern void MX_USB_DEVICE_Init(void); |
|||
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */ |
|||
|
|||
/**
|
|||
* @brief FreeRTOS initialization |
|||
* @param None |
|||
* @retval None |
|||
*/ |
|||
void MX_FREERTOS_Init(void) { |
|||
/* USER CODE BEGIN Init */ |
|||
|
|||
/* USER CODE END Init */ |
|||
|
|||
/* USER CODE BEGIN RTOS_MUTEX */ |
|||
/* add mutexes, ... */ |
|||
/* USER CODE END RTOS_MUTEX */ |
|||
|
|||
/* USER CODE BEGIN RTOS_SEMAPHORES */ |
|||
/* add semaphores, ... */ |
|||
/* USER CODE END RTOS_SEMAPHORES */ |
|||
|
|||
/* USER CODE BEGIN RTOS_TIMERS */ |
|||
/* start timers, add new ones, ... */ |
|||
/* USER CODE END RTOS_TIMERS */ |
|||
|
|||
/* USER CODE BEGIN RTOS_QUEUES */ |
|||
/* add queues, ... */ |
|||
/* USER CODE END RTOS_QUEUES */ |
|||
|
|||
/* Create the thread(s) */ |
|||
/* creation of defaultTask */ |
|||
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes); |
|||
|
|||
/* USER CODE BEGIN RTOS_THREADS */ |
|||
/* add threads, ... */ |
|||
/* USER CODE END RTOS_THREADS */ |
|||
|
|||
/* USER CODE BEGIN RTOS_EVENTS */ |
|||
/* add events, ... */ |
|||
/* USER CODE END RTOS_EVENTS */ |
|||
|
|||
} |
|||
|
|||
/* USER CODE BEGIN Header_StartDefaultTask */ |
|||
/**
|
|||
* @brief Function implementing the defaultTask thread. |
|||
* @param argument: Not used |
|||
* @retval None |
|||
*/ |
|||
/* USER CODE END Header_StartDefaultTask */ |
|||
void StartDefaultTask(void *argument) |
|||
{ |
|||
/* init code for USB_DEVICE */ |
|||
MX_USB_DEVICE_Init(); |
|||
/* USER CODE BEGIN StartDefaultTask */ |
|||
/* Infinite loop */ |
|||
heck_cppmain(); |
|||
// for(;;)
|
|||
// {
|
|||
// osDelay(1);
|
|||
// }
|
|||
/* USER CODE END StartDefaultTask */ |
|||
} |
|||
|
|||
/* Private application code --------------------------------------------------*/ |
|||
/* USER CODE BEGIN Application */ |
|||
|
|||
/* USER CODE END Application */ |
|||
|
@ -1,77 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file gpio.c |
|||
* @brief This file provides code for the configuration |
|||
* of all used GPIO pins. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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_GPIOC_CLK_ENABLE(); |
|||
__HAL_RCC_GPIOH_CLK_ENABLE(); |
|||
__HAL_RCC_GPIOA_CLK_ENABLE(); |
|||
__HAL_RCC_GPIOD_CLK_ENABLE(); |
|||
|
|||
/*Configure GPIO pin Output Level */ |
|||
HAL_GPIO_WritePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin, GPIO_PIN_RESET); |
|||
|
|||
/*Configure GPIO pin : PtPin */ |
|||
GPIO_InitStruct.Pin = BUT_BLUE_Pin; |
|||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; |
|||
GPIO_InitStruct.Pull = GPIO_NOPULL; |
|||
HAL_GPIO_Init(BUT_BLUE_GPIO_Port, &GPIO_InitStruct); |
|||
|
|||
/*Configure GPIO pin : PtPin */ |
|||
GPIO_InitStruct.Pin = LED_GREEN_Pin; |
|||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
|||
GPIO_InitStruct.Pull = GPIO_NOPULL; |
|||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
|||
HAL_GPIO_Init(LED_GREEN_GPIO_Port, &GPIO_InitStruct); |
|||
|
|||
/* EXTI interrupt init*/ |
|||
HAL_NVIC_SetPriority(EXTI0_IRQn, 5, 0); |
|||
HAL_NVIC_EnableIRQ(EXTI0_IRQn); |
|||
|
|||
} |
|||
|
|||
/* USER CODE BEGIN 2 */ |
|||
|
|||
/* USER CODE END 2 */ |
@ -1,85 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file rng.c |
|||
* @brief This file provides code for the configuration |
|||
* of the RNG instances. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 "rng.h" |
|||
|
|||
/* USER CODE BEGIN 0 */ |
|||
|
|||
/* USER CODE END 0 */ |
|||
|
|||
RNG_HandleTypeDef hrng; |
|||
|
|||
/* RNG init function */ |
|||
void MX_RNG_Init(void) |
|||
{ |
|||
|
|||
/* USER CODE BEGIN RNG_Init 0 */ |
|||
|
|||
/* USER CODE END RNG_Init 0 */ |
|||
|
|||
/* USER CODE BEGIN RNG_Init 1 */ |
|||
|
|||
/* USER CODE END RNG_Init 1 */ |
|||
hrng.Instance = RNG; |
|||
if (HAL_RNG_Init(&hrng) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
/* USER CODE BEGIN RNG_Init 2 */ |
|||
|
|||
/* USER CODE END RNG_Init 2 */ |
|||
|
|||
} |
|||
|
|||
void HAL_RNG_MspInit(RNG_HandleTypeDef* rngHandle) |
|||
{ |
|||
|
|||
if(rngHandle->Instance==RNG) |
|||
{ |
|||
/* USER CODE BEGIN RNG_MspInit 0 */ |
|||
|
|||
/* USER CODE END RNG_MspInit 0 */ |
|||
/* RNG clock enable */ |
|||
__HAL_RCC_RNG_CLK_ENABLE(); |
|||
/* USER CODE BEGIN RNG_MspInit 1 */ |
|||
|
|||
/* USER CODE END RNG_MspInit 1 */ |
|||
} |
|||
} |
|||
|
|||
void HAL_RNG_MspDeInit(RNG_HandleTypeDef* rngHandle) |
|||
{ |
|||
|
|||
if(rngHandle->Instance==RNG) |
|||
{ |
|||
/* USER CODE BEGIN RNG_MspDeInit 0 */ |
|||
|
|||
/* USER CODE END RNG_MspDeInit 0 */ |
|||
/* Peripheral clock disable */ |
|||
__HAL_RCC_RNG_CLK_DISABLE(); |
|||
/* USER CODE BEGIN RNG_MspDeInit 1 */ |
|||
|
|||
/* USER CODE END RNG_MspDeInit 1 */ |
|||
} |
|||
} |
|||
|
|||
/* USER CODE BEGIN 1 */ |
|||
|
|||
/* USER CODE END 1 */ |
@ -1,83 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file stm32f4xx_hal_msp.c |
|||
* @brief This file provides code for the MSP Initialization |
|||
* and de-Initialization codes. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 "main.h" |
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
/* Private typedef -----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN TD */ |
|||
|
|||
/* USER CODE END TD */ |
|||
|
|||
/* Private define ------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Define */ |
|||
|
|||
/* USER CODE END Define */ |
|||
|
|||
/* Private macro -------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Macro */ |
|||
|
|||
/* USER CODE END Macro */ |
|||
|
|||
/* Private variables ---------------------------------------------------------*/ |
|||
/* USER CODE BEGIN PV */ |
|||
|
|||
/* USER CODE END PV */ |
|||
|
|||
/* Private function prototypes -----------------------------------------------*/ |
|||
/* USER CODE BEGIN PFP */ |
|||
|
|||
/* USER CODE END PFP */ |
|||
|
|||
/* External functions --------------------------------------------------------*/ |
|||
/* USER CODE BEGIN ExternalFunctions */ |
|||
|
|||
/* USER CODE END ExternalFunctions */ |
|||
|
|||
/* USER CODE BEGIN 0 */ |
|||
|
|||
/* USER CODE END 0 */ |
|||
/**
|
|||
* Initializes the Global MSP. |
|||
*/ |
|||
void HAL_MspInit(void) |
|||
{ |
|||
/* USER CODE BEGIN MspInit 0 */ |
|||
|
|||
/* USER CODE END MspInit 0 */ |
|||
|
|||
__HAL_RCC_SYSCFG_CLK_ENABLE(); |
|||
__HAL_RCC_PWR_CLK_ENABLE(); |
|||
|
|||
/* System interrupt init*/ |
|||
/* PendSV_IRQn interrupt configuration */ |
|||
HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0); |
|||
|
|||
/* USER CODE BEGIN MspInit 1 */ |
|||
|
|||
/* USER CODE END MspInit 1 */ |
|||
} |
|||
|
|||
/* USER CODE BEGIN 1 */ |
|||
|
|||
/* USER CODE END 1 */ |
@ -1,260 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file stm32f4xx_it.c |
|||
* @brief Interrupt Service Routines. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 "main.h" |
|||
#include "stm32f4xx_it.h" |
|||
#include "FreeRTOS.h" |
|||
#include "task.h" |
|||
/* Private includes ----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Includes */ |
|||
/* USER CODE END Includes */ |
|||
|
|||
/* Private typedef -----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN TD */ |
|||
|
|||
/* USER CODE END TD */ |
|||
|
|||
/* Private define ------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN PD */ |
|||
|
|||
/* USER CODE END PD */ |
|||
|
|||
/* Private macro -------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN PM */ |
|||
|
|||
/* USER CODE END PM */ |
|||
|
|||
/* Private variables ---------------------------------------------------------*/ |
|||
/* USER CODE BEGIN PV */ |
|||
|
|||
/* USER CODE END PV */ |
|||
|
|||
/* Private function prototypes -----------------------------------------------*/ |
|||
/* USER CODE BEGIN PFP */ |
|||
|
|||
/* USER CODE END PFP */ |
|||
|
|||
/* Private user code ---------------------------------------------------------*/ |
|||
/* USER CODE BEGIN 0 */ |
|||
|
|||
/* USER CODE END 0 */ |
|||
|
|||
/* External variables --------------------------------------------------------*/ |
|||
extern PCD_HandleTypeDef hpcd_USB_OTG_FS; |
|||
extern DMA_HandleTypeDef hdma_dac1; |
|||
extern TIM_HandleTypeDef htim2; |
|||
extern TIM_HandleTypeDef htim7; |
|||
/* USER CODE BEGIN EV */ |
|||
|
|||
/* USER CODE END EV */ |
|||
|
|||
/******************************************************************************/ |
|||
/* Cortex-M4 Processor Interruption and Exception Handlers */ |
|||
/******************************************************************************/ |
|||
/**
|
|||
* @brief This function handles Non maskable interrupt. |
|||
*/ |
|||
void NMI_Handler(void) |
|||
{ |
|||
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */ |
|||
|
|||
/* USER CODE END NonMaskableInt_IRQn 0 */ |
|||
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */ |
|||
while (1) |
|||
{ |
|||
} |
|||
/* USER CODE END NonMaskableInt_IRQn 1 */ |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles Hard fault interrupt. |
|||
*/ |
|||
void HardFault_Handler(void) |
|||
{ |
|||
/* USER CODE BEGIN HardFault_IRQn 0 */ |
|||
|
|||
/* USER CODE END HardFault_IRQn 0 */ |
|||
while (1) |
|||
{ |
|||
/* USER CODE BEGIN W1_HardFault_IRQn 0 */ |
|||
/* USER CODE END W1_HardFault_IRQn 0 */ |
|||
} |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles Memory management fault. |
|||
*/ |
|||
void MemManage_Handler(void) |
|||
{ |
|||
/* USER CODE BEGIN MemoryManagement_IRQn 0 */ |
|||
|
|||
/* USER CODE END MemoryManagement_IRQn 0 */ |
|||
while (1) |
|||
{ |
|||
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ |
|||
/* USER CODE END W1_MemoryManagement_IRQn 0 */ |
|||
} |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles Pre-fetch fault, memory access fault. |
|||
*/ |
|||
void BusFault_Handler(void) |
|||
{ |
|||
/* USER CODE BEGIN BusFault_IRQn 0 */ |
|||
|
|||
/* USER CODE END BusFault_IRQn 0 */ |
|||
while (1) |
|||
{ |
|||
/* USER CODE BEGIN W1_BusFault_IRQn 0 */ |
|||
/* USER CODE END W1_BusFault_IRQn 0 */ |
|||
} |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles Undefined instruction or illegal state. |
|||
*/ |
|||
void UsageFault_Handler(void) |
|||
{ |
|||
/* USER CODE BEGIN UsageFault_IRQn 0 */ |
|||
|
|||
/* USER CODE END UsageFault_IRQn 0 */ |
|||
while (1) |
|||
{ |
|||
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */ |
|||
/* USER CODE END W1_UsageFault_IRQn 0 */ |
|||
} |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles Debug monitor. |
|||
*/ |
|||
void DebugMon_Handler(void) |
|||
{ |
|||
/* USER CODE BEGIN DebugMonitor_IRQn 0 */ |
|||
|
|||
/* USER CODE END DebugMonitor_IRQn 0 */ |
|||
/* USER CODE BEGIN DebugMonitor_IRQn 1 */ |
|||
|
|||
/* USER CODE END DebugMonitor_IRQn 1 */ |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles System tick timer. |
|||
*/ |
|||
void SysTick_Handler(void) |
|||
{ |
|||
/* USER CODE BEGIN SysTick_IRQn 0 */ |
|||
|
|||
/* USER CODE END SysTick_IRQn 0 */ |
|||
HAL_IncTick(); |
|||
#if (INCLUDE_xTaskGetSchedulerState == 1 ) |
|||
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) |
|||
{ |
|||
#endif /* INCLUDE_xTaskGetSchedulerState */ |
|||
xPortSysTickHandler(); |
|||
#if (INCLUDE_xTaskGetSchedulerState == 1 ) |
|||
} |
|||
#endif /* INCLUDE_xTaskGetSchedulerState */ |
|||
/* USER CODE BEGIN SysTick_IRQn 1 */ |
|||
|
|||
/* USER CODE END SysTick_IRQn 1 */ |
|||
} |
|||
|
|||
/******************************************************************************/ |
|||
/* STM32F4xx Peripheral Interrupt Handlers */ |
|||
/* Add here the Interrupt Handlers for the used peripherals. */ |
|||
/* For the available peripheral interrupt handler names, */ |
|||
/* please refer to the startup file (startup_stm32f4xx.s). */ |
|||
/******************************************************************************/ |
|||
|
|||
/**
|
|||
* @brief This function handles EXTI line0 interrupt. |
|||
*/ |
|||
void EXTI0_IRQHandler(void) |
|||
{ |
|||
/* USER CODE BEGIN EXTI0_IRQn 0 */ |
|||
|
|||
/* USER CODE END EXTI0_IRQn 0 */ |
|||
HAL_GPIO_EXTI_IRQHandler(BUT_BLUE_Pin); |
|||
/* USER CODE BEGIN EXTI0_IRQn 1 */ |
|||
|
|||
/* USER CODE END EXTI0_IRQn 1 */ |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles DMA1 stream5 global interrupt. |
|||
*/ |
|||
void DMA1_Stream5_IRQHandler(void) |
|||
{ |
|||
/* USER CODE BEGIN DMA1_Stream5_IRQn 0 */ |
|||
|
|||
/* USER CODE END DMA1_Stream5_IRQn 0 */ |
|||
HAL_DMA_IRQHandler(&hdma_dac1); |
|||
/* USER CODE BEGIN DMA1_Stream5_IRQn 1 */ |
|||
|
|||
/* USER CODE END DMA1_Stream5_IRQn 1 */ |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles TIM2 global interrupt. |
|||
*/ |
|||
void TIM2_IRQHandler(void) |
|||
{ |
|||
/* USER CODE BEGIN TIM2_IRQn 0 */ |
|||
|
|||
/* USER CODE END TIM2_IRQn 0 */ |
|||
HAL_TIM_IRQHandler(&htim2); |
|||
/* USER CODE BEGIN TIM2_IRQn 1 */ |
|||
|
|||
/* USER CODE END TIM2_IRQn 1 */ |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles TIM7 global interrupt. |
|||
*/ |
|||
void TIM7_IRQHandler(void) |
|||
{ |
|||
/* USER CODE BEGIN TIM7_IRQn 0 */ |
|||
|
|||
/* USER CODE END TIM7_IRQn 0 */ |
|||
HAL_TIM_IRQHandler(&htim7); |
|||
/* USER CODE BEGIN TIM7_IRQn 1 */ |
|||
|
|||
/* USER CODE END TIM7_IRQn 1 */ |
|||
} |
|||
|
|||
/**
|
|||
* @brief This function handles USB On The Go FS global interrupt. |
|||
*/ |
|||
void OTG_FS_IRQHandler(void) |
|||
{ |
|||
/* USER CODE BEGIN OTG_FS_IRQn 0 */ |
|||
|
|||
/* USER CODE END OTG_FS_IRQn 0 */ |
|||
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS); |
|||
/* USER CODE BEGIN OTG_FS_IRQn 1 */ |
|||
|
|||
/* USER CODE END OTG_FS_IRQn 1 */ |
|||
} |
|||
|
|||
/* USER CODE BEGIN 1 */ |
|||
|
|||
/* USER CODE END 1 */ |
@ -1,230 +0,0 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/**
|
|||
****************************************************************************** |
|||
* @file tim.c |
|||
* @brief This file provides code for the configuration |
|||
* of the TIM instances. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 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 "tim.h" |
|||
|
|||
/* USER CODE BEGIN 0 */ |
|||
|
|||
/* USER CODE END 0 */ |
|||
|
|||
TIM_HandleTypeDef htim2; |
|||
TIM_HandleTypeDef htim6; |
|||
TIM_HandleTypeDef htim7; |
|||
|
|||
/* TIM2 init function */ |
|||
void MX_TIM2_Init(void) |
|||
{ |
|||
|
|||
/* USER CODE BEGIN TIM2_Init 0 */ |
|||
|
|||
/* USER CODE END TIM2_Init 0 */ |
|||
|
|||
TIM_ClockConfigTypeDef sClockSourceConfig = {0}; |
|||
TIM_MasterConfigTypeDef sMasterConfig = {0}; |
|||
|
|||
/* USER CODE BEGIN TIM2_Init 1 */ |
|||
|
|||
/* USER CODE END TIM2_Init 1 */ |
|||
htim2.Instance = TIM2; |
|||
htim2.Init.Prescaler = 0; |
|||
htim2.Init.CounterMode = TIM_COUNTERMODE_UP; |
|||
htim2.Init.Period = 429490000; |
|||
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; |
|||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; |
|||
if (HAL_TIM_Base_Init(&htim2) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; |
|||
if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; |
|||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; |
|||
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
/* USER CODE BEGIN TIM2_Init 2 */ |
|||
|
|||
/* USER CODE END TIM2_Init 2 */ |
|||
|
|||
} |
|||
/* TIM6 init function */ |
|||
void MX_TIM6_Init(void) |
|||
{ |
|||
|
|||
/* USER CODE BEGIN TIM6_Init 0 */ |
|||
|
|||
/* USER CODE END TIM6_Init 0 */ |
|||
|
|||
TIM_MasterConfigTypeDef sMasterConfig = {0}; |
|||
|
|||
/* USER CODE BEGIN TIM6_Init 1 */ |
|||
|
|||
/* USER CODE END TIM6_Init 1 */ |
|||
htim6.Instance = TIM6; |
|||
htim6.Init.Prescaler = 0; |
|||
htim6.Init.CounterMode = TIM_COUNTERMODE_UP; |
|||
htim6.Init.Period = 1904; |
|||
htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; |
|||
if (HAL_TIM_Base_Init(&htim6) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE; |
|||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; |
|||
if (HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
/* USER CODE BEGIN TIM6_Init 2 */ |
|||
|
|||
/* USER CODE END TIM6_Init 2 */ |
|||
|
|||
} |
|||
/* TIM7 init function */ |
|||
void MX_TIM7_Init(void) |
|||
{ |
|||
|
|||
/* USER CODE BEGIN TIM7_Init 0 */ |
|||
|
|||
/* USER CODE END TIM7_Init 0 */ |
|||
|
|||
TIM_MasterConfigTypeDef sMasterConfig = {0}; |
|||
|
|||
/* USER CODE BEGIN TIM7_Init 1 */ |
|||
|
|||
/* USER CODE END TIM7_Init 1 */ |
|||
htim7.Instance = TIM7; |
|||
htim7.Init.Prescaler = 10000; |
|||
htim7.Init.CounterMode = TIM_COUNTERMODE_UP; |
|||
htim7.Init.Period = 429490000; |
|||
htim7.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; |
|||
if (HAL_TIM_Base_Init(&htim7) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; |
|||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; |
|||
if (HAL_TIMEx_MasterConfigSynchronization(&htim7, &sMasterConfig) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
/* USER CODE BEGIN TIM7_Init 2 */ |
|||
|
|||
/* USER CODE END TIM7_Init 2 */ |
|||
|
|||
} |
|||
|
|||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle) |
|||
{ |
|||
|
|||
if(tim_baseHandle->Instance==TIM2) |
|||
{ |
|||
/* USER CODE BEGIN TIM2_MspInit 0 */ |
|||
|
|||
/* USER CODE END TIM2_MspInit 0 */ |
|||
/* TIM2 clock enable */ |
|||
__HAL_RCC_TIM2_CLK_ENABLE(); |
|||
|
|||
/* TIM2 interrupt Init */ |
|||
HAL_NVIC_SetPriority(TIM2_IRQn, 5, 0); |
|||
HAL_NVIC_EnableIRQ(TIM2_IRQn); |
|||
/* USER CODE BEGIN TIM2_MspInit 1 */ |
|||
|
|||
/* USER CODE END TIM2_MspInit 1 */ |
|||
} |
|||
else if(tim_baseHandle->Instance==TIM6) |
|||
{ |
|||
/* USER CODE BEGIN TIM6_MspInit 0 */ |
|||
|
|||
/* USER CODE END TIM6_MspInit 0 */ |
|||
/* TIM6 clock enable */ |
|||
__HAL_RCC_TIM6_CLK_ENABLE(); |
|||
/* USER CODE BEGIN TIM6_MspInit 1 */ |
|||
|
|||
/* USER CODE END TIM6_MspInit 1 */ |
|||
} |
|||
else if(tim_baseHandle->Instance==TIM7) |
|||
{ |
|||
/* USER CODE BEGIN TIM7_MspInit 0 */ |
|||
|
|||
/* USER CODE END TIM7_MspInit 0 */ |
|||
/* TIM7 clock enable */ |
|||
__HAL_RCC_TIM7_CLK_ENABLE(); |
|||
|
|||
/* TIM7 interrupt Init */ |
|||
HAL_NVIC_SetPriority(TIM7_IRQn, 5, 0); |
|||
HAL_NVIC_EnableIRQ(TIM7_IRQn); |
|||
/* USER CODE BEGIN TIM7_MspInit 1 */ |
|||
|
|||
/* USER CODE END TIM7_MspInit 1 */ |
|||
} |
|||
} |
|||
|
|||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle) |
|||
{ |
|||
|
|||
if(tim_baseHandle->Instance==TIM2) |
|||
{ |
|||
/* USER CODE BEGIN TIM2_MspDeInit 0 */ |
|||
|
|||
/* USER CODE END TIM2_MspDeInit 0 */ |
|||
/* Peripheral clock disable */ |
|||
__HAL_RCC_TIM2_CLK_DISABLE(); |
|||
|
|||
/* TIM2 interrupt Deinit */ |
|||
HAL_NVIC_DisableIRQ(TIM2_IRQn); |
|||
/* USER CODE BEGIN TIM2_MspDeInit 1 */ |
|||
|
|||
/* USER CODE END TIM2_MspDeInit 1 */ |
|||
} |
|||
else if(tim_baseHandle->Instance==TIM6) |
|||
{ |
|||
/* USER CODE BEGIN TIM6_MspDeInit 0 */ |
|||
|
|||
/* USER CODE END TIM6_MspDeInit 0 */ |
|||
/* Peripheral clock disable */ |
|||
__HAL_RCC_TIM6_CLK_DISABLE(); |
|||
/* USER CODE BEGIN TIM6_MspDeInit 1 */ |
|||
|
|||
/* USER CODE END TIM6_MspDeInit 1 */ |
|||
} |
|||
else if(tim_baseHandle->Instance==TIM7) |
|||
{ |
|||
/* USER CODE BEGIN TIM7_MspDeInit 0 */ |
|||
|
|||
/* USER CODE END TIM7_MspDeInit 0 */ |
|||
/* Peripheral clock disable */ |
|||
__HAL_RCC_TIM7_CLK_DISABLE(); |
|||
|
|||
/* TIM7 interrupt Deinit */ |
|||
HAL_NVIC_DisableIRQ(TIM7_IRQn); |
|||
/* USER CODE BEGIN TIM7_MspDeInit 1 */ |
|||
|
|||
/* USER CODE END TIM7_MspDeInit 1 */ |
|||
} |
|||
} |
|||
|
|||
/* USER CODE BEGIN 1 */ |
|||
|
|||
/* USER CODE END 1 */ |
Loading…
Reference in new issue