Implement fan PWM
This commit is contained in:
15
Core/Inc/FanControl.h
Normal file
15
Core/Inc/FanControl.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef INC_FAN_CONTROL_H
|
||||
#define INC_FAN_CONTROL_H
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "stm32f4xx_hal_def.h"
|
||||
#include "stm32f4xx_hal_tim.h"
|
||||
|
||||
HAL_StatusTypeDef fan_ctrl_init(TIM_HandleTypeDef* handle, uint32_t channel);
|
||||
|
||||
/**
|
||||
* @brief Set the power of the fan (0 -> off, 100 -> full power).
|
||||
*/
|
||||
void fan_ctrl_set_power(uint32_t percent);
|
||||
|
||||
#endif // INC_FAN_CONTROL_H
|
||||
@ -48,6 +48,8 @@ extern "C" {
|
||||
#define MAIN_LOOP_PERIOD 100 /* ms */
|
||||
/* USER CODE END EM */
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim);
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
/* #define HAL_SD_MODULE_ENABLED */
|
||||
/* #define HAL_MMC_MODULE_ENABLED */
|
||||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
/* #define HAL_TIM_MODULE_ENABLED */
|
||||
#define HAL_TIM_MODULE_ENABLED
|
||||
#define HAL_UART_MODULE_ENABLED
|
||||
/* #define HAL_USART_MODULE_ENABLED */
|
||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
Reference in New Issue
Block a user