Pwm_Flagchip_FC7240/Inc/PwmFlagchip.h

46 lines
921 B
C

//
// Created by cfif on 17.11.22.
//
#ifndef PWM_FLAGCHIP_H
#define PWM_FLAGCHIP_H
#include "PwmIO.h"
#include "cmsis_os2.h"
#include "fc7xxx_driver_tpu.h"
#include "interrupt_manager.h"
typedef struct {
TPU_InterruptCfgType etpu_Int_config_tbl;
TPU_PwmCfgType etpu_pwmconfig_tbl;
uint8_t TPU_PWM_CHANNEL;
} tPwmFlagchip;
tPwmFlagchip PWM_Initial(
uint32_t PeriodTime,
uint32_t ActiveTime,
uint8_t TPU_PWM_CHANNEL,
uint8 TPU0_CH_PRIORITY,
TPU_EventCallbackType Bsp_Tpu_PwmCallback,
TPU_TCR1OverflowCallbackType Bsp_Tpu_OverflowCallBack);
tPwmIO vPwmGetIo(tPwmFlagchip *env);
// Частота шины
#define BUS_CLK 120000000U
// Делитель выходной частоты
#define SCG_CLK_DIV 4U
#define TPU_FREQ (BUS_CLK / SCG_CLK_DIV)
#define PWM_FREQ 25000 // 25 kHz
#define PERIOD_TICKS (TPU_FREQ / PWM_FREQ)
#endif //PWM_FLAGCHIP_H