booz_pwm is now a module

This commit is contained in:
Gautier Hattenberger
2011-01-13 16:01:13 +01:00
parent 685d0a25bd
commit 45df8092b6
6 changed files with 32 additions and 43 deletions
+14 -19
View File
@@ -1,19 +1,32 @@
<airframe name="Blender"> <airframe name="Blender">
<modules main_freq="512"> <modules main_freq="512">
<load name="booz_pwm.xml">
<define name="USE_PWM1"/>
</load>
<load name="booz_drop.xml"/> <load name="booz_drop.xml"/>
<load name="booz_cam.xml"/> <load name="booz_cam.xml"/>
<!--load name="sonar_maxbotix_booz.xml"/--> <!--load name="sonar_maxbotix_booz.xml"/-->
</modules> </modules>
<firmware name="rotorcraft"> <firmware name="rotorcraft">
<define name="USE_INS_NAV_INIT"/>
<define name="USE_ADAPT_HOVER"/>
<define name="NO_FUCKING_STARTUP_DELAY"/>
<!--define name="GUIDANCE_H_USE_REF"/-->
<target name="ap" board="booz_1.0"> <target name="ap" board="booz_1.0">
<define name="FAILSAFE_GROUND_DETECT"/> <define name="FAILSAFE_GROUND_DETECT"/>
<define name="USE_GPS_ACC4R"/> <define name="USE_GPS_ACC4R"/>
<define name="BOOZ_START_DELAY" value="3"/>
<!--define name="BOOZ_ACTUATORS_MAX_THRUST" value="160"/-->
<!--define name="BOOZ_THRUST_LOWPASS" value="17"/-->
</target> </target>
<target name="sim" board="pc"> <target name="sim" board="pc">
<subsystem name="fdm" type="nps"/> <subsystem name="fdm" type="nps"/>
<!--define name="NPS_NO_SUPERVISION"/-->
</target> </target>
<subsystem name="radio_control" type="ppm"/> <subsystem name="radio_control" type="ppm"/>
<subsystem name="actuators" type="asctec"/> <subsystem name="actuators" type="asctec"/>
<subsystem name="imu" type="b2_v1.1"/> <subsystem name="imu" type="b2_v1.1"/>
@@ -218,7 +231,7 @@
<define name="BOOZ_ANALOG_BARO_THRESHOLD" value="800"/> <define name="BOOZ_ANALOG_BARO_THRESHOLD" value="800"/>
<define name="FACE_REINJ_1" value="1024"/> <define name="FACE_REINJ_1" value="1024"/>
<define name="DEFAULT_CIRCLE_RADIUS" value="10."/> <define name="DEFAULT_CIRCLE_RADIUS" value="10."/>
<define name="BoozDropPwm(_v)" value="Booz2SetPwm1Value(_v)"/> <define name="BoozDropPwm(_v)" value="BoozSetPwm1Value(_v)"/>
<define name="IMU_MAG_OFFSET" value="-9."/> <define name="IMU_MAG_OFFSET" value="-9."/>
</section> </section>
@@ -228,22 +241,4 @@
<define name="ALT_SHIFT_MINUS" value="-1"/> <define name="ALT_SHIFT_MINUS" value="-1"/>
</section> </section>
<makefile location="after">
ap.CFLAGS += -DGUIDANCE_H_USE_REF
ap.CFLAGS += -DUSE_ADAPT_HOVER -DUSE_INS_NAV_INIT -DBOOZ_START_DELAY=3 -DUSE_PWM1
ap.CFLAGS += -DBOOZ_ACTUATORS_MAX_THRUST=160 -DBOOZ_THRUST_LOWPASS=17
ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c
sim.CFLAGS += -DBSM_PARAMS=\"booz_sensors_model_params_booz2_a2.h\"
sim.CFLAGS += -DNPS_NO_SUPERVISION
sim.CFLAGS += -DGUIDANCE_H_USE_REF
sim.CFLAGS += -DUSE_ADAPT_HOVER -DUSE_INS_NAV_INIT -DBOOZ_START_DELAY=3
sim.srcs += $(SRC_BOOZ_SIM)/booz2_pwm_hw.c
</makefile>
</airframe> </airframe>
@@ -1,7 +1,7 @@
/* /*
* $Id: $ * $Id: $
* *
* Copyright (C) 2007 ENAC * Copyright (C) 2011 ENAC
* *
* This file is part of paparazzi. * This file is part of paparazzi.
* *
@@ -22,12 +22,12 @@
* *
*/ */
#include "booz2_pwm_hw.h" #include "modules/core/booz_pwm_arch.h"
#define PWM_PERIOD SYS_TICS_OF_USEC(20000) #define PWM_PERIOD SYS_TICS_OF_USEC(20000)
#define PWM_DUTY SYS_TICS_OF_USEC(1500) #define PWM_DUTY SYS_TICS_OF_USEC(1500)
void booz2_pwm_init_hw( void ) { void booz_pwm_init_arch( void ) {
/* start PWM5 */ /* start PWM5 */
/* select P0.21 as PWM5 */ /* select P0.21 as PWM5 */
@@ -1,7 +1,7 @@
/* /*
* $Id: $ * $Id: $
* *
* Copyright (C) 2007 ENAC * Copyright (C) 2011 ENAC
* *
* This file is part of paparazzi. * This file is part of paparazzi.
* *
@@ -22,25 +22,25 @@
* *
*/ */
#ifndef BOOZ2_PWM_HW_H #ifndef BOOZ_PWM_ARCH_H
#define BOOZ2_PWM_HW_H #define BOOZ_PWM_ARCH_H
#include "std.h" #include "std.h"
#include "sys_time.h" #include "sys_time.h"
extern void booz2_pwm_init_hw(void); extern void booz_pwm_init_arch(void);
// Default PWM is PWM0 // Default PWM is PWM0
#define Booz2SetPwmValue(_v) Booz2SetPwm0Value(_v) #define BoozSetPwmValue(_v) BoozSetPwm0Value(_v)
#define Booz2SetPwm0Value(_v) { \ #define BoozSetPwm0Value(_v) { \
PWMMR5 = SYS_TICS_OF_USEC(_v); \ PWMMR5 = SYS_TICS_OF_USEC(_v); \
PWMLER = PWMLER_LATCH5; \ PWMLER = PWMLER_LATCH5; \
} }
#define Booz2SetPwm1Value(_v) { \ #define BoozSetPwm1Value(_v) { \
PWMMR2 = SYS_TICS_OF_USEC(_v); \ PWMMR2 = SYS_TICS_OF_USEC(_v); \
PWMLER = PWMLER_LATCH2; \ PWMLER = PWMLER_LATCH2; \
} }
#endif /* BOOZ2_PWM_HW_H */ #endif /* BOOZ_PWM_ARCH_H */
+2 -8
View File
@@ -55,10 +55,6 @@
#include "subsystems/ahrs.h" #include "subsystems/ahrs.h"
#include "subsystems/ins.h" #include "subsystems/ins.h"
#if defined USE_CAM || USE_DROP
#include "booz2_pwm_hw.h"
#endif
#include "firmwares/rotorcraft/main.h" #include "firmwares/rotorcraft/main.h"
#ifdef SITL #ifdef SITL
@@ -88,11 +84,13 @@ int main( void ) {
STATIC_INLINE void main_init( void ) { STATIC_INLINE void main_init( void ) {
#ifndef NO_FUCKING_STARTUP_DELAY
#ifndef RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT #ifndef RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT
/* IF THIS IS NEEDED SOME PERHIPHERAL THEN PLEASE MOVE IT THERE */ /* IF THIS IS NEEDED SOME PERHIPHERAL THEN PLEASE MOVE IT THERE */
for (uint32_t startup_counter=0; startup_counter<2000000; startup_counter++){ for (uint32_t startup_counter=0; startup_counter<2000000; startup_counter++){
__asm("nop"); __asm("nop");
} }
#endif
#endif #endif
mcu_init(); mcu_init();
@@ -105,10 +103,6 @@ STATIC_INLINE void main_init( void ) {
booz2_analog_init(); booz2_analog_init();
baro_init(); baro_init();
#if defined USE_CAM || USE_DROP
booz2_pwm_init_hw();
#endif
battery_init(); battery_init();
imu_init(); imu_init();
+2 -2
View File
@@ -23,7 +23,7 @@
*/ */
#include "cam_control/booz_cam.h" #include "cam_control/booz_cam.h"
#include "booz2_pwm_hw.h" #include "modules/core/booz_pwm_arch.h"
#include "subsystems/ahrs.h" #include "subsystems/ahrs.h"
#include "firmwares/rotorcraft/navigation.h" #include "firmwares/rotorcraft/navigation.h"
#include "subsystems/ins.h" #include "subsystems/ins.h"
@@ -64,7 +64,7 @@ int16_t booz_cam_pan;
// PWM definition // PWM definition
#ifndef BOOZ_CAM_SetPwm #ifndef BOOZ_CAM_SetPwm
#define BOOZ_CAM_SetPwm(_v) Booz2SetPwmValue(_v) #define BOOZ_CAM_SetPwm(_v) BoozSetPwmValue(_v)
#endif #endif
#ifndef BOOZ_CAM_DEFAULT_MODE #ifndef BOOZ_CAM_DEFAULT_MODE
+3 -3
View File
@@ -21,8 +21,8 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "booz_drop.h" #include "modules/drop/booz_drop.h"
#include "booz2_pwm_hw.h" #include "modules/core/booz_pwm_arch.h"
#include "generated/airframe.h" #include "generated/airframe.h"
bool_t booz_drop_ball; bool_t booz_drop_ball;
@@ -37,7 +37,7 @@ int16_t booz_drop_servo;
// PWM definition // PWM definition
#ifndef BoozDropPwm #ifndef BoozDropPwm
#define BoozDropPwm(_v) Booz2SetPwmValue(_v) #define BoozDropPwm(_v) BoozSetPwmValue(_v)
#endif #endif
void booz_drop_init(void) { void booz_drop_init(void) {