Modified 'Timebase Source' from TIM1 to TIM17, TIM1 now operates with 1 MHz input and 1 ms period, channel 1 is configured as PWM output mode and mapped to PA8 to drive a buzzer.
This commit is contained in:
+4
-2
@@ -20,6 +20,7 @@
|
||||
#include "main.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "dma.h"
|
||||
#include "tim.h"
|
||||
#include "usart.h"
|
||||
#include "gpio.h"
|
||||
|
||||
@@ -92,6 +93,7 @@ int main(void)
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_USART2_UART_Init();
|
||||
MX_TIM1_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
@@ -166,7 +168,7 @@ void SystemClock_Config(void)
|
||||
|
||||
/**
|
||||
* @brief Period elapsed callback in non blocking mode
|
||||
* @note This function is called when TIM1 interrupt took place, inside
|
||||
* @note This function is called when TIM17 interrupt took place, inside
|
||||
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
|
||||
* a global variable "uwTick" used as application time base.
|
||||
* @param htim : TIM handle
|
||||
@@ -177,7 +179,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||
/* USER CODE BEGIN Callback 0 */
|
||||
|
||||
/* USER CODE END Callback 0 */
|
||||
if (htim->Instance == TIM1)
|
||||
if (htim->Instance == TIM17)
|
||||
{
|
||||
HAL_IncTick();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user