aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/px4fmu
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2014-01-20 16:20:43 +1100
committerLorenz Meier <lm@inf.ethz.ch>2014-01-23 21:41:07 +0100
commit4524fe3e4888d569f855d1e7a82c8d5116636a0a (patch)
tree6500cec71a627e078a769ca34b491e8a3c1fde83 /src/drivers/px4fmu
parentdda50c62bfd26463718f50d2f9c1cdbecc7de4ac (diff)
downloadpx4-firmware-4524fe3e4888d569f855d1e7a82c8d5116636a0a.tar.gz
px4-firmware-4524fe3e4888d569f855d1e7a82c8d5116636a0a.tar.bz2
px4-firmware-4524fe3e4888d569f855d1e7a82c8d5116636a0a.zip
px4fmu: added PWM_SERVO_SET_COUNT API
this allows the balance between PWM channels and GPIOs to be changed after the main flight code has started, which makes it possible to change the balance with a parameter in APM
Diffstat (limited to 'src/drivers/px4fmu')
-rw-r--r--src/drivers/px4fmu/fmu.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp
index 4b1b0ed0b..c067d363b 100644
--- a/src/drivers/px4fmu/fmu.cpp
+++ b/src/drivers/px4fmu/fmu.cpp
@@ -1006,6 +1006,40 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)
break;
+ case PWM_SERVO_SET_COUNT: {
+ /* change the number of outputs that are enabled for
+ * PWM. This is used to change the split between GPIO
+ * and PWM under control of the flight config
+ * parameters. Note that this does not allow for
+ * changing a set of pins to be used for serial on
+ * FMUv1
+ */
+ switch (arg) {
+ case 0:
+ set_mode(MODE_NONE);
+ break;
+
+ case 2:
+ set_mode(MODE_2PWM);
+ break;
+
+ case 4:
+ set_mode(MODE_4PWM);
+ break;
+
+#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
+ case 6:
+ set_mode(MODE_6PWM);
+ break;
+#endif
+
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ break;
+ }
+
case MIXERIOCRESET:
if (_mixers != nullptr) {
delete _mixers;
@@ -1443,7 +1477,6 @@ void
sensor_reset(int ms)
{
int fd;
- int ret;
fd = open(PX4FMU_DEVICE_PATH, O_RDWR);