yangsong8-a1 opened a new pull request, #21846: URL: https://github.com/apache/nuttx/pull/21846
## Summary Add `CONFIG_PWM_FREQUENCY_FIXED`. With it, `pwm_info_s.frequency` is a `ub32_t` (Hz in 32.32 fixed point) instead of a `uint32_t`, so a lower half can be asked for frequencies below 1 Hz. The new `pwm_freq_t` type names the field type in both modes. The first commit only adds the missing blank lines that nxstyle reports in `pwm.c`. ## Impact None unless `CONFIG_PWM_FREQUENCY_FIXED=y` (default n). With it enabled, a lower half must read the frequency as `ub32_t`; the existing lower halves still expect Hz. ## Testing Ubuntu 22.04, gcc 13.1, arm-none-eabi-gcc 10.3. | Config | Result | |---|---| | sim:nsh + PWM + PWM_FREQUENCY_FIXED + DEBUG_PWM_INFO, test program with a fake lower half | builds, 0 warnings; see the log below | | sim:nsh + PWM, same test (option off) | lower half gets `frequency=1000 Hz`, same as master | | teensy-4.x:pwm-4.1, at32f437-mini:pwm | builds, no new warnings | | teensy-4.x:pwm-4.1 + PWM_FREQUENCY_FIXED | nuttx builds; apps `examples/pwm` prints the frequency with `%lu` and gets a `-Wformat` warning | sim with `CONFIG_PWM_FREQUENCY_FIXED=y`, the test sets 0.5 Hz (`b32HALF`): ``` pwm_dump: PWMIOC_SETCHARACTERISTICS: frequency: 0000000080000000 pwm_dump: channel: 1 duty: 00008000 lower start: frequency=0x0000000080000000 (0.500 Hz) duty=0x8000 GETCHARACTERISTICS ret=0 frequency=0x80000000 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
