60 #include "HL_system.h"
67 #define PWM_LOWER_THRESHOLD_PERM (1u)
70 #define PWM_UPPER_THRESHOLD_PERM (999u)
73 #define PWM_FULL_PERIOD_PERM (1000u)
84 .etpwmInitialized =
false,
108 etpwm_config_reg_t etPwmConfig = {0};
109 etpwm1GetConfigValue(&etPwmConfig, CurrentValue);
110 return etPwmConfig.CONFIG_TBPRD;
117 uint32_t counterValue = (((uint32_t)basePeriod * (uint32_t)dutyCycle_perm) /
PWM_FULL_PERIOD_PERM);
119 FAS_ASSERT(counterValue <= (uint16_t)UINT16_MAX);
120 return (uint16_t)counterValue;
150 FAS_ASSERT(dutyCycle_perm <= (uint16_t)INT16_MAX);
151 int16_t intermediateDutyCycle_perm = (int16_t)dutyCycle_perm +
pwm_kLinearOffset;
153 if (intermediateDutyCycle_perm < 0) {
154 intermediateDutyCycle_perm = 0;
156 uint16_t correctedDutyCycle_perm = (uint16_t)intermediateDutyCycle_perm;
183 if (capture3 != capture1) {
207 #ifdef UNITY_UNIT_TEST
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
math library for often used math functions
#define UNIT_CONVERSION_FACTOR_100_FLOAT
#define NULL_PTR
Null pointer.
Function to switch between user mode and privilege mode.
#define FSYS_SWITCH_TO_USER_MODE()
Switch back to user mode.
long FSYS_RaisePrivilege(void)
Raise privilege.
static PWM_INITIALIZATION_STATE_s pwm_state
void PWM_SetDutyCycle(uint16_t dutyCycle_perm)
Set the duty cycle of the PWM (currently only channel 1A)
void PWM_Initialize(void)
Initializes the ETPWM and the ECAP module.
void PWM_StopPwm(void)
Stop the PWM (stops all configured ePWM channels)
static uint16_t PWM_GetEtpwmTimePeriod(void)
#define PWM_UPPER_THRESHOLD_PERM
#define PWM_FULL_PERIOD_PERM
static uint16_t PWM_ComputeCounterValueFromDutyCycle(uint16_t dutyCycle_perm)
void PWM_StartPwm(void)
Start the PWM (starts all configured ePWM channels)
void ecapNotification(ecapBASE_t *ecap, uint16 flags)
PWM_SIGNAL_s PWM_GetPwmData(void)
Get dutycycle and frequency of input PWM signal.
static PWM_SIGNAL_s ecap_inputPwmSignal
bool PWM_IsEcapModuleInitialized(void)
Get initialization state of ecap module.
#define PWM_LOWER_THRESHOLD_PERM
int16_t TEST_PWM_GetLinearOffset(void)
static const int16_t pwm_kLinearOffset
PWM driver for the TMS570LC43xx.
uint32_t ecapGetCAP3(ecapBASE_t *ecap)
uint32_t ecapGetCAP1(ecapBASE_t *ecap)
uint32_t ecapGetCAP2(ecapBASE_t *ecap)