/*
 * pwm_init.h
 *
 *  Created on: 21 авг. 2023 г.
 *      Author: seklyuts
 */
#include "f28x_project.h"

#ifndef SRC_PWM_INIT_H_
#define SRC_PWM_INIT_H_

#define SYS_PWM_FREQUENCY   100000000.0 //Hz


#define FREQUENCY_BRAKE     200000.0 //Hz
#define FREQUENCY_MOTOR     10000.0 //Hz
#define EPWM_DB_mkS         3.0 //mkS

#define PERIOD_BRAKE        (SYS_PWM_FREQUENCY/2/FREQUENCY_BRAKE) //Tic
#define PERIOD_MOTOR        (SYS_PWM_FREQUENCY/2/FREQUENCY_MOTOR) //Tic

#define EPWM_DB             (EPWM_DB_mkS*SYS_PWM_FREQUENCY/1000000)

#define SDFM_DELAY_mkS      70.0 //mkS
#define SDFM_DELAY          (SDFM_DELAY_mkS*SYS_PWM_FREQUENCY/1000000)

#define PERIOD_2        (PERIOD_MOTOR/2)
#define PWM_MAX         (PERIOD_MOTOR - EPWM_DB)
#define PWM_MIN         EPWM_DB*2
#define INDEPENDED      1
#define COMPLIMENTARY   0


void PWMInit(uint16_t Num, uint16_t Period, uint16_t Independed);
void PWMGpioInit(void);
void PWMInitEnable(void);
void PWMInitInterruptEn(void);
void PWMAllInit(void);
void PWM_ABC_StopAllClose(void);
void PWM_ABC_StartOut(void);


void InitEPwm1Example(void);
void InitEPwm2Example(void);
void InitEPwm3Example(void);
void InitEPwm4Example(void);
void InitEPwm5Example(void);
void InitEPwm6Example(void);




#endif /* SRC_PWM_INIT_H_ */
