CF2: Buzzer

This commit is contained in:
Dennis Shtatnov
2016-09-11 22:06:10 -04:00
committed by Lorenz Meier
parent c9a17fdd68
commit 83105fca95
3 changed files with 24 additions and 5 deletions
+12 -5
View File
@@ -934,12 +934,19 @@ then
fi fi
unset FEXTRAS unset FEXTRAS
# Run no SD alarm if ver hwcmp CRAZYFLIE
if [ $LOG_FILE == /dev/null ]
then then
# Play SOS # CF2 shouldn't have an sd card
tone_alarm error else
fi
# Run no SD alarm
if [ $LOG_FILE == /dev/null ]
then
# Play SOS
tone_alarm error
fi
else
# End of autostart # End of autostart
fi fi
@@ -126,6 +126,13 @@ __BEGIN_DECLS
#define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1)) #define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1))
#define ADC_AIRSPEED_VOLTAGE_CHANNEL ((uint8_t)(-1)) #define ADC_AIRSPEED_VOLTAGE_CHANNEL ((uint8_t)(-1))
/* Tone alarm output : These are only applicable when the buzzer deck is attached */
#define TONE_ALARM_TIMER 5 /* timer 5 */
#define TONE_ALARM_CHANNEL 3 /* channel 3 */
#define GPIO_TONE_ALARM_IDLE (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN2)
#define GPIO_TONE_ALARM (GPIO_ALT|GPIO_AF2|GPIO_SPEED_2MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN2)
#define GPIO_TONE_ALARM_NEG (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN3)
/* PWM /* PWM
* *
* Four PWM motor outputs are configured. * Four PWM motor outputs are configured.
@@ -441,6 +441,11 @@ ToneAlarm::init()
/* configure the GPIO to the idle state */ /* configure the GPIO to the idle state */
px4_arch_configgpio(GPIO_TONE_ALARM_IDLE); px4_arch_configgpio(GPIO_TONE_ALARM_IDLE);
#ifdef GPIO_TONE_ALARM_NEG
px4_arch_configgpio(GPIO_TONE_ALARM_NEG);
#endif
/* clock/power on our timer */ /* clock/power on our timer */
modifyreg32(TONE_ALARM_CLOCK_POWER_REG, 0, TONE_ALARM_CLOCK_ENABLE); modifyreg32(TONE_ALARM_CLOCK_POWER_REG, 0, TONE_ALARM_CLOCK_ENABLE);