57 #include "MockHL_etpwm.h"
70 TEST_INCLUDE_PATH(
"../../src/app/driver/foxmath")
71 TEST_INCLUDE_PATH("../../src/app/driver/pwm")
101 etpwm_config_reg_t etPwmConfig = {0};
102 etPwmConfig.CONFIG_TBPRD = timeBasePeriod;
104 etpwm1GetConfigValue_Expect(
NULL_PTR, CurrentValue);
105 etpwm1GetConfigValue_IgnoreArg_config_reg();
106 etpwm1GetConfigValue_ReturnThruPtr_config_reg(&etPwmConfig);
108 etpwmSetCmpA_Expect(
NULL_PTR, dutyCycleOut);
109 etpwmSetCmpA_IgnoreArg_etpwm();
122 double correctedDutyCycle = ((double)dutyCycle + linearOffset);
123 if (correctedDutyCycle < 0) {
124 correctedDutyCycle = 0;
128 if (correctedDutyCycle < 1) {
129 correctedDutyCycle = 1;
131 if (correctedDutyCycle > 999) {
132 correctedDutyCycle = 999;
135 uint16_t counterSteps = (((double)timeBasePeriod * correctedDutyCycle) / 1000);
158 etpwmStartTBCLK_Expect();
170 etpwmStopTBCLK_Expect();
176 uint16_t timeBasePeriod = 999u;
177 for (uint16_t duty = 1u; duty <= 999; duty = duty + 10) {
181 timeBasePeriod = 4999;
184 for (uint16_t duty = 1u; duty <= 999; duty = duty + 10) {
#define NULL_PTR
Null pointer.
void PWM_SetDutyCycle(uint16_t dutyCycle_perm)
Set the duty cycle of the PWM (currently only channel 1A)
void PWM_StopPwm(void)
Stop the PWM (stops all configured ePWM channels)
void PWM_StartPwm(void)
Start the PWM (starts all configured ePWM channels)
int16_t TEST_PWM_GetLinearOffset(void)
PWM driver for the TMS570LC43xx.
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
void testPWM_SetDutyCycle(void)
void testPWM_StopPwm(void)
uint16_t calculateCounterValue(uint16_t timeBasePeriod, uint16_t dutyCycle)
uint32_t ecapGetCAP3(ecapBASE_t *ecap)
uint32_t ecapGetCAP1(ecapBASE_t *ecap)
void PWM_SetDutyCycle_Test(uint16_t timeBasePeriod, uint16_t dutyCycleIn, uint16_t dutyCycleOut)
uint32_t ecapGetCAP2(ecapBASE_t *ecap)
long FSYS_RaisePrivilege(void)
Raise privilege.
void testPWM_StartPwm(void)
static uint8_t fsysRaisePrivilegeReturnValue