diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_heli.makefile b/conf/firmwares/subsystems/rotorcraft/actuators_heli.makefile
deleted file mode 100644
index e27dc150c5..0000000000
--- a/conf/firmwares/subsystems/rotorcraft/actuators_heli.makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-
-ap.srcs += $(SRC_FIRMWARE)/actuators/actuators_heli.c
-ap.srcs += $(SRC_ARCH)/subsystems/actuators/actuators_pwm_arch.c
diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_pwm_supervision.makefile b/conf/firmwares/subsystems/rotorcraft/actuators_pwm_supervision.makefile
deleted file mode 100644
index 04cae36bbd..0000000000
--- a/conf/firmwares/subsystems/rotorcraft/actuators_pwm_supervision.makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-
-ap.srcs += $(SRC_FIRMWARE)/actuators/supervision.c
-ap.srcs += $(SRC_FIRMWARE)/actuators/actuators_pwm_supervision.c
-ap.srcs += $(SRC_ARCH)/subsystems/actuators/actuators_pwm_arch.c
-
-# Simulator
-nps.srcs += $(SRC_FIRMWARE)/actuators/supervision.c
-nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_pwm_supervision.c
-nps.srcs += $(SRC_ARCH)/subsystems/actuators/actuators_pwm_arch.c
diff --git a/conf/firmwares/subsystems/shared/actuators_asctec.makefile b/conf/firmwares/subsystems/shared/actuators_asctec.makefile
index 38032aff04..189d90efb7 100644
--- a/conf/firmwares/subsystems/shared/actuators_asctec.makefile
+++ b/conf/firmwares/subsystems/shared/actuators_asctec.makefile
@@ -1,4 +1,5 @@
# asctec controllers
+$(TARGET).CFLAGS += -DACTUATORS
ap.srcs += subsystems/actuators/actuators_asctec.c
ifeq ($(ARCH), lpc21)
diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_asctec_v2.makefile b/conf/firmwares/subsystems/shared/actuators_asctec_v2.makefile
similarity index 75%
rename from conf/firmwares/subsystems/rotorcraft/actuators_asctec_v2.makefile
rename to conf/firmwares/subsystems/shared/actuators_asctec_v2.makefile
index eaa8e486c8..7c33e7794c 100644
--- a/conf/firmwares/subsystems/rotorcraft/actuators_asctec_v2.makefile
+++ b/conf/firmwares/subsystems/shared/actuators_asctec_v2.makefile
@@ -1,8 +1,6 @@
# asctec controllers v2
#
#
-#
-#
#
#
#
@@ -16,9 +14,10 @@
#
#
-ap.srcs += $(SRC_FIRMWARE)/actuators/supervision.c
+$(TARGET).CFLAGS += -DACTUATORS
+ap.srcs += subsystems/actuators/supervision.c
ap.CFLAGS += -DACTUATORS_ASCTEC_V2_PROTOCOL
-ap.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c
+ap.srcs += subsystems/actuators/actuators_asctec.c
ifeq ($(ARCH), lpc21)
ap.CFLAGS += -DACTUATORS_ASCTEC_DEVICE=i2c0
@@ -31,6 +30,6 @@ ap.CFLAGS += -DUSE_I2C1
endif
# Simulator
-nps.srcs += $(SRC_FIRMWARE)/actuators/supervision.c
-nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c
+nps.srcs += subsystems/actuators/supervision.c
+nps.srcs += subsystems/actuators/actuators_asctec.c
nps.CFLAGS += -DUSE_I2C0 -DACTUATORS_ASCTEC_DEVICE=i2c0
diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_mkk.makefile b/conf/firmwares/subsystems/shared/actuators_mkk.makefile
similarity index 84%
rename from conf/firmwares/subsystems/rotorcraft/actuators_mkk.makefile
rename to conf/firmwares/subsystems/shared/actuators_mkk.makefile
index 440c947fd8..c62298ca03 100644
--- a/conf/firmwares/subsystems/rotorcraft/actuators_mkk.makefile
+++ b/conf/firmwares/subsystems/shared/actuators_mkk.makefile
@@ -18,8 +18,6 @@
#
#
#
-#
-#
#
#
#
@@ -33,8 +31,9 @@
#
#
-ap.srcs += $(SRC_FIRMWARE)/actuators/supervision.c
-ap.srcs += $(SRC_FIRMWARE)/actuators/actuators_mkk.c
+$(TARGET).CFLAGS += -DACTUATORS
+ap.srcs += subsystems/actuators/supervision.c
+ap.srcs += subsystems/actuators/actuators_mkk.c
ifeq ($(ARCH), lpc21)
@@ -52,6 +51,6 @@ ap.CFLAGS += -DUSE_I2C1
endif
# Simulator
-nps.srcs += $(SRC_FIRMWARE)/actuators/supervision.c
-nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_mkk.c
+nps.srcs += subsystems/actuators/supervision.c
+nps.srcs += subsystems/actuators/actuators_mkk.c
nps.CFLAGS += -DUSE_I2C0 -DACTUATORS_MKK_DEVICE=i2c0
diff --git a/conf/firmwares/subsystems/shared/actuators_pwm_supervision.makefile b/conf/firmwares/subsystems/shared/actuators_pwm_supervision.makefile
new file mode 100644
index 0000000000..3e5ed13d89
--- /dev/null
+++ b/conf/firmwares/subsystems/shared/actuators_pwm_supervision.makefile
@@ -0,0 +1,6 @@
+
+$(TARGET).CFLAGS += -DACTUATORS -DUSE_SUPERVISION
+$(TARGET).srcs += subsystems/actuators/supervision.c
+$(TARGET).srcs += subsystems/actuators/actuators_pwm.c
+$(TARGET).srcs += $(SRC_ARCH)/subsystems/actuators/actuators_pwm_arch.c
+
diff --git a/conf/firmwares/subsystems/shared/actuators_skiron.makefile b/conf/firmwares/subsystems/shared/actuators_skiron.makefile
index 254152a481..7361869cfe 100644
--- a/conf/firmwares/subsystems/shared/actuators_skiron.makefile
+++ b/conf/firmwares/subsystems/shared/actuators_skiron.makefile
@@ -34,6 +34,7 @@ ifeq ($(SKIRON_I2C_SCL_TIME), )
SKIRON_I2C_SCL_TIME=150
endif
+$(TARGET).CFLAGS += -DACTUATORS
ap.srcs += subsystems/actuators/supervision.c
ap.srcs += subsystems/actuators/actuators_skiron.c
diff --git a/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.c b/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.c
index 61eca3c1e0..27b9c2a361 100644
--- a/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.c
+++ b/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.c
@@ -49,7 +49,7 @@ const uint8_t pwm_latch_value = 0
#endif
;
-void actuators_pwm_init ( void ) {
+void actuators_pwm_arch_init ( void ) {
/* configure pins for PWM */
#if defined PWM_SERVO_0
diff --git a/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.h b/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.h
index c8ba69b539..51ef2ac11e 100644
--- a/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.h
+++ b/sw/airborne/arch/lpc21/subsystems/actuators/actuators_pwm_arch.h
@@ -40,6 +40,7 @@ PWM6 PWM2 SSEL0 EINT2 P0.7
#endif
#define COMMAND_(i) SERVO_REG_ ## i
+/** Actuator set macro */
#define ActuatorPwmSet(_i, _v) { COMMAND_(_i) = SERVOS_TICS_OF_USEC(_v); }
#define PWM_PINSEL_MASK_VAL 3
@@ -88,11 +89,11 @@ PWM6 PWM2 SSEL0 EINT2 P0.7
extern const uint8_t pwm_latch_value;
+/** Actuator commit macro */
#define ActuatorsPwmCommit() { \
PWMLER = pwm_latch_value; \
}
-extern void actuators_pwm_init(void);
-#define ActuatorsPwmInit() actuators_pwm_init()
+extern void actuators_pwm_arch_init(void);
#endif /* ACTUATORS_PWM_ARCH_H */
diff --git a/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c b/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c
index 0af66ccff6..59a5722288 100644
--- a/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c
+++ b/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c
@@ -30,6 +30,8 @@
#include
#include
+int32_t actuators_pwm_values[ACTUATORS_PWM_NB];
+
#define PCLK 72000000
#define ONE_MHZ_CLK 1000000
#ifndef SERVO_HZ
diff --git a/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.h b/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.h
index c2f0e4227e..82d3164b4c 100644
--- a/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.h
+++ b/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.h
@@ -38,15 +38,19 @@
#define ACTUATORS_PWM_NB 6
#endif
-/* Needs to be included after ACTUATORS_PWM_NB is defined!
- * Otherwise ACTUATORS_PWM_NB is not declared in actuators_pwm.h
- */
-#include "subsystems/actuators/actuators_pwm.h"
+///* Needs to be included after ACTUATORS_PWM_NB is defined!
+// * Otherwise ACTUATORS_PWM_NB is not declared in actuators_pwm.h
+// */
+//#include "subsystems/actuators/actuators_pwm.h"
+
+extern int32_t actuators_pwm_values[ACTUATORS_PWM_NB];
extern void actuators_pwm_arch_init(void);
extern void actuators_pwm_commit(void);
#define SERVOS_TICS_OF_USEC(_v) (_v)
-#define ActuatorsCommit actuators_pwm_commit
+
+#define ActuatorPwmSet(_i, _v) { actuators_pwm_values[_i] = _v; }
+#define ActuatorsPwmCommit actuators_pwm_commit
#endif /* ACTUATORS_PWM_ARCH_H */
diff --git a/sw/airborne/subsystems/actuators/actuators_asctec.c b/sw/airborne/subsystems/actuators/actuators_asctec.c
index 920779e13b..667757296d 100644
--- a/sw/airborne/subsystems/actuators/actuators_asctec.c
+++ b/sw/airborne/subsystems/actuators/actuators_asctec.c
@@ -26,7 +26,6 @@
#include "subsystems/actuators.h"
#include "subsystems/actuators/actuators_asctec.h"
-#include "firmwares/rotorcraft/commands.h"
#include "mcu_periph/i2c.h"
#include "mcu_periph/sys_time.h"
@@ -98,10 +97,6 @@ void actuators_asctec_set(bool_t motors_on) {
actuators_asctec.cmds[YAW] = 0;
actuators_asctec.cmds[THRUST] = 0;
#else /* ! KILL_MOTORS */
-// actuators_asctec.cmds[PITCH] = ((commands[COMMAND_PITCH] + SUPERVISION_TRIM_E) * ASCTEC_MAX_CMD) / MAX_PPRZ;
-// actuators_asctec.cmds[ROLL] = ((commands[COMMAND_ROLL] + SUPERVISION_TRIM_A) * ASCTEC_MAX_CMD) / MAX_PPRZ;
-// actuators_asctec.cmds[YAW] = ((commands[COMMAND_YAW] + SUPERVISION_TRIM_R) * ASCTEC_MAX_CMD) / MAX_PPRZ;
-// actuators_asctec.cmds[THRUST] = (commands[COMMAND_THRUST] * ASCTEC_MAX_THROTTLE) / MAX_PPRZ;
Bound(actuators_asctec.cmds[PITCH],ASCTEC_MIN_CMD, ASCTEC_MAX_CMD);
Bound(actuators_asctec.cmds[ROLL], ASCTEC_MIN_CMD, ASCTEC_MAX_CMD);
Bound(actuators_asctec.cmds[YAW], ASCTEC_MIN_CMD, ASCTEC_MAX_CMD);
@@ -147,7 +142,7 @@ void actuators_asctec_set(bool_t motors_on) {
}
#else /* ! ACTUATORS_ASCTEC_V2_PROTOCOL */
-void actuators_set(bool_t motors_on) {
+void actuators_asctec_set(bool_t motors_on) {
#if defined ACTUATORS_START_DELAY && ! defined SITL
if (!actuators_delay_done) {
if (SysTimeTimer(actuators_delay_time) < USEC_OF_SEC(ACTUATORS_START_DELAY)) {
@@ -174,7 +169,6 @@ void actuators_set(bool_t motors_on) {
return;
}
- supervision_run(motors_on, FALSE, commands);
#ifdef KILL_MOTORS
actuators_asctec.i2c_trans.buf[0] = 0;
actuators_asctec.i2c_trans.buf[1] = 0;
@@ -182,10 +176,10 @@ void actuators_set(bool_t motors_on) {
actuators_asctec.i2c_trans.buf[3] = 0;
actuators_asctec.i2c_trans.buf[4] = 0xAA;
#else
- actuators_asctec.i2c_trans.buf[0] = supervision.commands[SERVO_FRONT];
- actuators_asctec.i2c_trans.buf[1] = supervision.commands[SERVO_BACK];
- actuators_asctec.i2c_trans.buf[2] = supervision.commands[SERVO_LEFT];
- actuators_asctec.i2c_trans.buf[3] = supervision.commands[SERVO_RIGHT];
+ actuators_asctec.i2c_trans.buf[0] = actuators_asctec.cmds[SERVO_FRONT];
+ actuators_asctec.i2c_trans.buf[1] = actuators_asctec.cmds[SERVO_BACK];
+ actuators_asctec.i2c_trans.buf[2] = actuators_asctec.cmds[SERVO_LEFT];
+ actuators_asctec.i2c_trans.buf[3] = actuators_asctec.cmds[SERVO_RIGHT];
actuators_asctec.i2c_trans.buf[4] = 0xAA + actuators_asctec.i2c_trans.buf[0] + actuators_asctec.i2c_trans.buf[1] +
actuators_asctec.i2c_trans.buf[2] + actuators_asctec.i2c_trans.buf[3];
#endif
diff --git a/sw/airborne/subsystems/actuators/actuators_heli.c b/sw/airborne/subsystems/actuators/actuators_heli.c
deleted file mode 100644
index 32a200b0d3..0000000000
--- a/sw/airborne/subsystems/actuators/actuators_heli.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2010 The Paparazzi Team
- *
- * This file is part of paparazzi.
- *
- * paparazzi is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * paparazzi is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with paparazzi; see the file COPYING. If not, write to
- * the Free Software Foundation, 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "generated/airframe.h"
-
-#include "firmwares/rotorcraft/actuators.h"
-#include "firmwares/rotorcraft/commands.h"
-#include "subsystems/actuators/actuators_pwm.h"
-
-
-#define ESC_STOPPED SERVOS_TICS_OF_USEC(0)
-
-#ifndef KILL_MOTORS
-#define ESC_HOVER SERVOS_TICS_OF_USEC(5500)
-#else
-#define ESC_HOVER SERVOS_TICS_OF_USEC(0)
-#endif
-
-int32_t actuators_pwm_values[ACTUATORS_PWM_NB];
-
-void actuators_init(void)
-{
- actuators_pwm_arch_init();
-}
-
-
-void actuators_set(bool_t motors_on)
-{
- SetActuatorsFromCommands(commands);
-}
-
diff --git a/sw/airborne/subsystems/actuators/actuators_mkk.c b/sw/airborne/subsystems/actuators/actuators_mkk.c
index 3a037eba0d..e968615882 100644
--- a/sw/airborne/subsystems/actuators/actuators_mkk.c
+++ b/sw/airborne/subsystems/actuators/actuators_mkk.c
@@ -23,10 +23,9 @@
* Actuators driver for Mikrokopter motor controllers.
*/
-#include "firmwares/rotorcraft/actuators.h"
-#include "firmwares/rotorcraft/actuators/actuators_mkk.h"
+#include "subsystems/actuators.h"
+#include "subsystems/actuators/actuators_mkk.h"
-#include "firmwares/rotorcraft/commands.h"
#include "mcu_periph/i2c.h"
#include "mcu_periph/sys_time.h"
@@ -37,7 +36,7 @@ struct ActuatorsMkk actuators_mkk;
uint32_t actuators_delay_time;
bool_t actuators_delay_done;
-void actuators_init(void) {
+void actuators_mkk_init(void) {
supervision_init();
const uint8_t actuators_addr[ACTUATORS_MKK_NB] = ACTUATORS_MKK_ADDR;
@@ -59,7 +58,7 @@ void actuators_init(void) {
}
-void actuators_set(bool_t motors_on) {
+void actuators_mkk_set(void) {
#if defined ACTUATORS_START_DELAY && ! defined SITL
if (!actuators_delay_done) {
if (SysTimeTimer(actuators_delay_time) < USEC_OF_SEC(ACTUATORS_START_DELAY)) return;
@@ -67,12 +66,9 @@ void actuators_set(bool_t motors_on) {
}
#endif
- supervision_run(motors_on, FALSE, commands);
for (uint8_t i=0; i