yangsong8-a1 opened a new pull request, #21847: URL: https://github.com/apache/nuttx/pull/21847
## Summary Add six optional methods to `pwm_ops_s` and the ioctls that call them: - `PWMIOC_SETOUTPUTIDLE`: force a channel to its idle level (`dcpol`). - `PWMIOC_GETOUTPUTSTATE`: read the output level of a channel. - `PWMIOC_ENABLENOTIFY` / `PWMIOC_DISABLENOTIFY`: edge notification. - `PWMIOC_GETPOWERSTATE` / `PWMIOC_SETPOWERSTATE`: power state. A lower half that leaves a method NULL returns `-ENOSYS`. The commands use `_PWMIOC(6)` to `_PWMIOC(11)`, after `PWMIOC_FAULTS_FETCH_AND_CLEAR`. The other commits fix the nxstyle errors in `pwm.c` and document the new commands. ## Impact No change for existing lower halves: the new members are at the end of `pwm_ops_s` and default to NULL. Unknown commands are still forwarded to the lower half `ioctl`. ## Testing Ubuntu 22.04, gcc 13.1, arm-none-eabi-gcc 10.3. | Config | Result | |---|---| | sim:nsh + PWM, test program with two fake lower halves (all new methods / none) | builds, 0 warnings; see the log below | | teensy-4.x:pwm-4.1, at32f437-mini:pwm | builds, no new warnings | ``` == /dev/pwmfull fd=3 lower set_output_idle(1) SETOUTPUTIDLE ret=0 lower get_output_state(2) -> 1 GETOUTPUTSTATE ret=0 state=1 GETOUTPUTSTATE(NULL) ret=-22 lower enable_notify(3, 2) ENABLENOTIFY ret=0 lower disable_notify(3) DISABLENOTIFY ret=0 lower set_power_state(5) SETPOWERSTATE ret=0 GETPOWERSTATE ret=0 state=5 lower ioctl: cmd=0xc05 FAULTS_FETCH_AND_CLEAR ret=-25 (lower ioctl) == /dev/pwmbasic fd=3 SETOUTPUTIDLE ret=-38 GETOUTPUTSTATE ret=-38 state=0 ENABLENOTIFY ret=-38 DISABLENOTIFY ret=-38 SETPOWERSTATE ret=-38 GETPOWERSTATE ret=-38 state=255 lower ioctl: cmd=0xc05 FAULTS_FETCH_AND_CLEAR ret=-25 (lower ioctl) ``` -- 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]
