mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-10 23:15:18 +00:00
Use macros from fixedmath.h for manipulating duty cycle
This avoids magic shift logic in code, and has no change to behavior.
This commit is contained in:
parent
28c133a503
commit
2e773bcdc6
1 changed files with 3 additions and 4 deletions
|
|
@ -523,8 +523,7 @@ int main(int argc, FAR char *argv[])
|
|||
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
|
||||
{
|
||||
info.channels[i].channel = g_pwmstate.channels[i];
|
||||
info.channels[i].duty = ((uint32_t)g_pwmstate.duties[i]
|
||||
<< 16) / 100;
|
||||
info.channels[i].duty = b16divi(uitoub16(g_pwmstate.duties[i]), 100);
|
||||
printf(" channel: %d duty: %08" PRIx32,
|
||||
info.channels[i].channel, info.channels[i].duty);
|
||||
}
|
||||
|
|
@ -532,9 +531,9 @@ int main(int argc, FAR char *argv[])
|
|||
printf("\n");
|
||||
|
||||
#else
|
||||
info.duty = ((uint32_t)g_pwmstate.duty << 16) / 100;
|
||||
info.duty = b16divi(uitoub16(g_pwmstate.duty), 100);
|
||||
# ifdef CONFIG_PWM_PULSECOUNT
|
||||
info.count = g_pwmstate.count;
|
||||
info.count = g_pwmstate.count;
|
||||
|
||||
printf("pwm_main: starting output "
|
||||
"with frequency: %" PRIu32 " duty: %08" PRIx32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue