Skip to content

Commit

Permalink
added last timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan Donahue committed Feb 18, 2024
1 parent d57f1da commit 50d1ffe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
4 changes: 4 additions & 0 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,10 @@ static void MX_TIM1_Init(void)
{
Error_Handler();
}
if (HAL_TIM_PWM_ConfigChannel(&htim1, &sConfigOC, TIM_CHANNEL_3) != HAL_OK)
{
Error_Handler();
}
sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE;
sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE;
sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF;
Expand Down
25 changes: 3 additions & 22 deletions Core/Src/stm32f4xx_hal_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,26 +442,13 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
*/
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(htim_base->Instance==TIM1)
{
/* USER CODE BEGIN TIM1_MspInit 0 */

/* USER CODE END TIM1_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_TIM1_CLK_ENABLE();

__HAL_RCC_GPIOA_CLK_ENABLE();
/**TIM1 GPIO Configuration
PA10 ------> TIM1_CH3
*/
GPIO_InitStruct.Pin = Fan_PWMA10_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
HAL_GPIO_Init(Fan_PWMA10_GPIO_Port, &GPIO_InitStruct);

/* USER CODE BEGIN TIM1_MspInit 1 */

/* USER CODE END TIM1_MspInit 1 */
Expand Down Expand Up @@ -502,13 +489,14 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
__HAL_RCC_GPIOA_CLK_ENABLE();
/**TIM1 GPIO Configuration
PA8 ------> TIM1_CH1
PA10 ------> TIM1_CH3
*/
GPIO_InitStruct.Pin = Fan_PWMA8_Pin;
GPIO_InitStruct.Pin = Fan_PWMA8_Pin|Fan_PWMA10_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
HAL_GPIO_Init(Fan_PWMA8_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/* USER CODE BEGIN TIM1_MspPostInit 1 */

Expand Down Expand Up @@ -555,13 +543,6 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
/* USER CODE END TIM1_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM1_CLK_DISABLE();

/**TIM1 GPIO Configuration
PA8 ------> TIM1_CH1
PA10 ------> TIM1_CH3
*/
HAL_GPIO_DeInit(GPIOA, Fan_PWMA8_Pin|Fan_PWMA10_Pin);

/* USER CODE BEGIN TIM1_MspDeInit 1 */

/* USER CODE END TIM1_MspDeInit 1 */
Expand Down
7 changes: 4 additions & 3 deletions shepherd2.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_CAN1_Init-CAN1-false-HAL-true,4-MX_CAN2_Init-CAN2-false-HAL-true,5-MX_SPI1_Init-SPI1-false-HAL-true,6-MX_SPI2_Init-SPI2-false-HAL-true,7-MX_SPI3_Init-SPI3-false-HAL-true,8-MX_UART4_Init-UART4-false-HAL-true,9-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,10-MX_I2C1_Init-I2C1-false-HAL-true
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_CAN1_Init-CAN1-false-HAL-true,4-MX_CAN2_Init-CAN2-false-HAL-true,5-MX_SPI1_Init-SPI1-false-HAL-true,6-MX_SPI2_Init-SPI2-false-HAL-true,7-MX_SPI3_Init-SPI3-false-HAL-true,8-MX_UART4_Init-UART4-false-HAL-true,9-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,10-MX_I2C1_Init-I2C1-false-HAL-true,11-MX_TIM1_Init-TIM1-false-HAL-true,12-MX_TIM2_Init-TIM2-false-HAL-true,13-MX_TIM8_Init-TIM8-false-HAL-true
RCC.48MHZClocksFreq_Value=48000000
RCC.AHBFreq_Value=16000000
RCC.APB1Freq_Value=16000000
Expand All @@ -337,7 +337,7 @@ RCC.VCOOutputFreq_Value=240000000
RCC.VcooutputI2S=160000000
SH.S_TIM1_CH1.0=TIM1_CH1,PWM Generation1 CH1
SH.S_TIM1_CH1.ConfNb=1
SH.S_TIM1_CH3.0=TIM1_CH3
SH.S_TIM1_CH3.0=TIM1_CH3,PWM Generation3 CH3
SH.S_TIM1_CH3.ConfNb=1
SH.S_TIM8_CH1.0=TIM8_CH1,PWM Generation1 CH1
SH.S_TIM8_CH1.ConfNb=1
Expand Down Expand Up @@ -387,7 +387,8 @@ SPI3.NSS=SPI_NSS_SOFT
SPI3.TIMode=SPI_TIMODE_DISABLE
SPI3.VirtualType=VM_MASTER
TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM1.IPParameters=Channel-PWM Generation1 CH1
TIM1.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
TIM1.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation3 CH3
TIM8.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM8.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
TIM8.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
Expand Down

0 comments on commit 50d1ffe

Please sign in to comment.