Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
647bdef8
Commit
647bdef8
authored
7 years ago
by
Beat Küng
Browse files
Options
Downloads
Patches
Plain Diff
pwm.c: rename to pwm.cpp and add module documentation
use c++ so that raw string literals can be used
parent
3f6769d4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/systemcmds/pwm/CMakeLists.txt
+1
-1
1 addition, 1 deletion
src/systemcmds/pwm/CMakeLists.txt
src/systemcmds/pwm/pwm.cpp
+31
-1
31 additions, 1 deletion
src/systemcmds/pwm/pwm.cpp
with
32 additions
and
2 deletions
src/systemcmds/pwm/CMakeLists.txt
+
1
−
1
View file @
647bdef8
...
@@ -37,7 +37,7 @@ px4_add_module(
...
@@ -37,7 +37,7 @@ px4_add_module(
COMPILE_FLAGS
COMPILE_FLAGS
-Wno-array-bounds
-Wno-array-bounds
SRCS
SRCS
pwm.c
pwm.c
pp
DEPENDS
DEPENDS
platforms__common
platforms__common
)
)
...
...
This diff is collapsed.
Click to expand it.
src/systemcmds/pwm/pwm.c
→
src/systemcmds/pwm/pwm.c
pp
+
31
−
1
View file @
647bdef8
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
****************************************************************************/
****************************************************************************/
/**
/**
* @file pwm.c
* @file pwm.c
pp
*
*
* PWM servo output configuration and monitoring tool.
* PWM servo output configuration and monitoring tool.
*/
*/
...
@@ -67,7 +67,9 @@
...
@@ -67,7 +67,9 @@
#include
"drivers/drv_pwm_output.h"
#include
"drivers/drv_pwm_output.h"
static
void
usage
(
const
char
*
reason
);
static
void
usage
(
const
char
*
reason
);
__BEGIN_DECLS
__EXPORT
int
pwm_main
(
int
argc
,
char
*
argv
[]);
__EXPORT
int
pwm_main
(
int
argc
,
char
*
argv
[]);
__END_DECLS
static
void
static
void
...
@@ -77,6 +79,34 @@ usage(const char *reason)
...
@@ -77,6 +79,34 @@ usage(const char *reason)
PX4_WARN
(
"%s"
,
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"
);
PRINT_MODULE_USAGE_NAME
(
"pwm"
,
"command"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment