TIM1的CH1、CH1N、CH2、CH2N、CH3、CH3N、CH4基本配置输出PWM
tim.h
#ifndef __TIM_H
#define __TIM_H
#include "stm32f4xx_hal.h"
#include "led.h"
#include "sys.h"
/*
*
*TIM1
*
*/
extern u8 TIM1_flag1; //定时器标志位
void TIM1_Init(u16 arr,u16 psc);
void TIM1_PWM_Init(u16 arr,u16 psc); //TIM? PWM部分初始化
void TIM_SetTIM1Compare1(u32 compare); //设置TIM?通道?的占空比
void TIM_SetTIM1Compare2(u32 compare); //设置TIM?通道?的占空比
void TIM_SetTIM1Compare3(u32 compare); //设置TIM?通道?的占空比
void TIM_SetTIM1Compare4(u32 compare); //设置TIM?通道?的占空比
void TIM_SetTIM1Compare1N(u32 compare);//设置TIM?通道?的占空比
void TIM_SetTIM1Compare2N(u32 compare);//设置TIM?通道?的占空比
void TIM_SetTIM1Compare3N(u32 compare);//设置TIM?通道?的占空比
#endif
tim.c