forked from Archive/PX4-Autopilot
pwm.c: rename to pwm.cpp and add module documentation
use c++ so that raw string literals can be used
This commit is contained in:
parent
3f6769d41e
commit
647bdef855
|
@ -37,7 +37,7 @@ px4_add_module(
|
|||
COMPILE_FLAGS
|
||||
-Wno-array-bounds
|
||||
SRCS
|
||||
pwm.c
|
||||
pwm.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file pwm.c
|
||||
* @file pwm.cpp
|
||||
*
|
||||
* PWM servo output configuration and monitoring tool.
|
||||
*/
|
||||
|
@ -67,7 +67,9 @@
|
|||
#include "drivers/drv_pwm_output.h"
|
||||
|
||||
static void usage(const char *reason);
|
||||
__BEGIN_DECLS
|
||||
__EXPORT int pwm_main(int argc, char *argv[]);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
static void
|
||||
|
@ -77,6 +79,34 @@ usage(const char *reason)
|
|||
PX4_WARN("%s", reason);
|
||||
}
|
||||
|
||||
PRINT_MODULE_DESCRIPTION(
|
||||
R"DESCR_STR(
|
||||
### Description
|
||||
This command is used to configure PWM outputs for servo and ESC control.
|
||||
|
||||
The default device `/dev/pwm_output0` are the Main channels, AUX channels are on `/dev/pwm_output1` (`-d` parameter).
|
||||
|
||||
It is used in the startup script to make sure the PWM parameters (`PWM_*`) are applied (or the ones provided
|
||||
by the airframe config if specified). `pwm info` shows the current settings (the trim value is an offset
|
||||
and configured with `PWM_MAIN_TRIMx` and `PWM_AUX_TRIMx`).
|
||||
|
||||
The disarmed value should be set such that the motors don't spin (it's also used for the kill switch), at the
|
||||
minimum value they should spin.
|
||||
|
||||
Channels are assigned to a group. Due to hardware limitations, the update rate can only be set per group. Use
|
||||
`pwm info` to display the groups. If the `-c` argument is used, all channels of any included group must be included.
|
||||
|
||||
The parameters `-p` and `-r` can be set to a parameter instead of specifying an integer: use -p p:PWM_MIN for example.
|
||||
|
||||
### Examples
|
||||
Set the PWM rate for all channels to 400 Hz:
|
||||
$ pwm rate -a -r 400
|
||||
|
||||
Test the outputs of eg. channels 1 and 3, and set the PWM value to 1200 us:
|
||||
$ pwm arm
|
||||
$ pwm test -c 13 -p 1200
|
||||
|
||||
)DESCR_STR");
|
||||
|
||||
|
||||
PRINT_MODULE_USAGE_NAME("pwm", "command");
|
Loading…
Reference in New Issue