diff --git a/conf/airframes/ENAC/quadrotor/mini.xml b/conf/airframes/ENAC/quadrotor/mini.xml index 5887f6ad82..f5a539f7d5 100644 --- a/conf/airframes/ENAC/quadrotor/mini.xml +++ b/conf/airframes/ENAC/quadrotor/mini.xml @@ -1,4 +1,10 @@ - + + + + + + + @@ -173,13 +179,14 @@
- - - - + + + + +
@@ -187,6 +194,7 @@ + @@ -218,9 +226,9 @@ ap.CFLAGS += -DUSE_GPS_ACC4R ap.CFLAGS += -DB2_GUIDANCE_H_USE_REF -ap.CFLAGS += -DUSE_ADAPT_HOVER -DUSE_INS_NAV_INIT -DBOOZ_START_DELAY=3 +ap.CFLAGS += -DUSE_ADAPT_HOVER -DUSE_INS_NAV_INIT -DBOOZ_START_DELAY=3 -DUSE_PWM1 -#ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c +ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c ap.CFLAGS += -DUSE_MODULES diff --git a/conf/modules/booz_drop.xml b/conf/modules/booz_drop.xml index 139cbc78ef..168936049f 100644 --- a/conf/modules/booz_drop.xml +++ b/conf/modules/booz_drop.xml @@ -9,8 +9,8 @@ - - + + diff --git a/conf/settings/booz_cam.xml b/conf/settings/booz_cam.xml index 4cc8b7dd9e..0c4e168f95 100644 --- a/conf/settings/booz_cam.xml +++ b/conf/settings/booz_cam.xml @@ -10,8 +10,8 @@ - - + + diff --git a/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.c b/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.c index f7b7bc85cb..bc11c7224d 100644 --- a/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.c +++ b/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.c @@ -31,7 +31,7 @@ void booz2_pwm_init_hw( void ) { /* start PWM5 */ /* select P0.21 as PWM5 */ - PWM_PINSEL |= PWM_PINSEL_VAL << PWM_PINSEL_BIT; + PWM0_PINSEL |= PWM0_PINSEL_VAL << PWM0_PINSEL_BIT; /* select pwm period */ PWMMR0 = PWM_PERIOD; /* select pwm value to 50% at init (1500 us) */ @@ -45,6 +45,18 @@ void booz2_pwm_init_hw( void ) { /* enable PWM5 */ PWMPCR = PWMPCR_ENA5; +#ifdef USE_PWM1 + /* start PWM2 */ + PWM1_PINSEL |= PWM1_PINSEL_VAL << PWM1_PINSEL_BIT; + /* select pwm value to 50% at init (1500 us) */ + PWMMR2 = PWM_DUTY; + /* commit values */ + PWMLER = PWMLER_LATCH2; + /* enable PWM2 */ + PWMPCR |= PWMPCR_ENA2; +#endif + + } diff --git a/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.h b/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.h index 360a4e4904..f7da657db9 100644 --- a/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.h +++ b/sw/airborne/booz/arch/lpc21/booz2_pwm_hw.h @@ -30,9 +30,17 @@ extern void booz2_pwm_init_hw(void); -#define Booz2SetPwmValue(_v) { \ +// Default PWM is PWM0 +#define Booz2SetPwmValue(_v) Booz2SetPwm0Value(_v) + +#define Booz2SetPwm0Value(_v) { \ PWMMR5 = SYS_TICS_OF_USEC(_v); \ PWMLER = PWMLER_LATCH5; \ } +#define Booz2SetPwm1Value(_v) { \ + PWMMR2 = SYS_TICS_OF_USEC(_v); \ + PWMLER = PWMLER_LATCH2; \ +} + #endif /* BOOZ2_PWM_HW_H */ diff --git a/sw/airborne/modules/drop/booz_drop.c b/sw/airborne/modules/drop/booz_drop.c index 1d9623e0e9..005601b627 100644 --- a/sw/airborne/modules/drop/booz_drop.c +++ b/sw/airborne/modules/drop/booz_drop.c @@ -23,7 +23,7 @@ #include "booz_drop.h" #include "booz2_pwm_hw.h" - +#include "airframe.h" bool_t booz_drop_ball; int16_t booz_drop_servo; @@ -35,6 +35,11 @@ int16_t booz_drop_servo; #define DROP_SERVO_CLOSED 900 #endif +// PWM definition +#ifndef BoozDropPwm +#define BoozDropPwm(_v) Booz2SetPwmValue(_v) +#endif + void booz_drop_init(void) { booz_drop_ball = FALSE; booz_drop_periodic(); @@ -45,5 +50,5 @@ void booz_drop_periodic(void) { booz_drop_servo = DROP_SERVO_OPEN; else booz_drop_servo = DROP_SERVO_CLOSED; - Booz2SetPwmValue(booz_drop_servo); + BoozDropPwm(booz_drop_servo); } diff --git a/sw/airborne/modules/vision/booz_cam.c b/sw/airborne/modules/vision/booz_cam.c index e537413a34..41efd5224c 100644 --- a/sw/airborne/modules/vision/booz_cam.c +++ b/sw/airborne/modules/vision/booz_cam.c @@ -62,17 +62,23 @@ int16_t booz_cam_pan; #define BOOZ_CAM_USE_TILT_ANGLES 1 #endif +// PWM definition +#ifndef BOOZ_CAM_SetPwm +#define BOOZ_CAM_SetPwm(_v) Booz2SetPwmValue(_v) +#endif + void booz_cam_init(void) { booz_cam_mode = BOOZ_CAM_MODE_NONE; #ifdef BOOZ_CAM_USE_TILT booz_cam_tilt_pwm = BOOZ_CAM_TILT_NEUTRAL; - Booz2SetPwmValue(booz_cam_tilt_pwm); + BOOZ_CAM_SetPwm(booz_cam_tilt_pwm); booz_cam_tilt = 0; #endif #ifdef BOOZ_CAM_USE_PAN booz_cam_pan = BOOZ_CAM_PAN_NEUTRAL; #endif LED_ON(CAM_SWITCH_LED); // CAM OFF + LED_OFF(CAM_SWITCH_LED); // CAM ON } void booz_cam_periodic(void) { @@ -124,7 +130,7 @@ void booz_cam_periodic(void) { break; } #ifdef BOOZ_CAM_USE_TILT - Booz2SetPwmValue(booz_cam_tilt_pwm); + BOOZ_CAM_SetPwm(booz_cam_tilt_pwm); #endif }