修复ATOM_PWM最大占空比设置异常的问题
对eeprom例程进行修改
This commit is contained in:
SEEKFREE_Kang
2020-07-14 17:32:46 +08:00
parent 43d0dd1211
commit c300d21dd8
36 changed files with 184 additions and 40 deletions

View File

@@ -76,4 +76,7 @@ V1.1.0
V1.1.1
<09>޸<EFBFBD>uart_getchar<61><72><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>ס<EFBFBD><D7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
V1.1.2
<09>޸<EFBFBD>ATOM_PWM<57><4D><EFBFBD><EFBFBD>ռ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@@ -280,7 +280,6 @@ void gtm_pwm_init(ATOM_PIN_enum pwmch, uint32 freq, uint32 duty)
g_atomConfig.pin.outputPin = atom_channel;
g_atomConfig.synchronousUpdateEnabled = TRUE;
g_atomConfig.dutyCycle = (uint32)((uint64)duty * g_atomConfig.period / GTM_ATOM0_PWM_DUTY_MAX);
switch(atom_channel->atom)
{
case 0: g_atomConfig.dutyCycle = (uint32)((uint64)duty * g_atomConfig.period / GTM_ATOM0_PWM_DUTY_MAX); break;
@@ -309,6 +308,13 @@ void pwm_duty(ATOM_PIN_enum pwmch, uint32 duty)
atom_channel = gtm_atom_mux(pwmch);
period = IfxGtm_Atom_Ch_getCompareZero(&MODULE_GTM.ATOM[atom_channel->atom], atom_channel->channel);
duty = (uint32)((uint64)duty * period / GTM_ATOM0_PWM_DUTY_MAX);
switch(atom_channel->atom)
{
case 0: duty = (uint32)((uint64)duty * period / GTM_ATOM0_PWM_DUTY_MAX); break;
case 1: duty = (uint32)((uint64)duty * period / GTM_ATOM1_PWM_DUTY_MAX); break;
case 2: duty = (uint32)((uint64)duty * period / GTM_ATOM2_PWM_DUTY_MAX); break;
case 3: duty = (uint32)((uint64)duty * period / GTM_ATOM3_PWM_DUTY_MAX); break;
}
IfxGtm_Atom_Ch_setCompareOneShadow(&MODULE_GTM.ATOM[atom_channel->atom], atom_channel->channel, duty);
}