aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-04-06 15:47:34 -0700
committerpx4dev <px4@purgatory.org>2013-04-06 15:47:34 -0700
commite7e35616c01119eae7a436c260d88cdc6fec6ce5 (patch)
treee7c54e5d86f7714647599c4c1da821a6a93b8ffe /apps
parentd8e8e6cd209e688de51a800123e513f4885655cd (diff)
downloadpx4-firmware-e7e35616c01119eae7a436c260d88cdc6fec6ce5.tar.gz
px4-firmware-e7e35616c01119eae7a436c260d88cdc6fec6ce5.tar.bz2
px4-firmware-e7e35616c01119eae7a436c260d88cdc6fec6ce5.zip
Fix the way that tone_alarm idles the GPIO and make it idle safely for v2 boards.
Diffstat (limited to 'apps')
-rw-r--r--apps/drivers/stm32/tone_alarm/tone_alarm.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/drivers/stm32/tone_alarm/tone_alarm.cpp b/apps/drivers/stm32/tone_alarm/tone_alarm.cpp
index baa652d8a..ac5511e60 100644
--- a/apps/drivers/stm32/tone_alarm/tone_alarm.cpp
+++ b/apps/drivers/stm32/tone_alarm/tone_alarm.cpp
@@ -494,7 +494,7 @@ ToneAlarm::init()
return ret;
/* configure the GPIO to the idle state */
- stm32_configgpio(GPIO_TONE_ALARM);
+ stm32_configgpio(GPIO_TONE_ALARM_IDLE);
/* clock/power on our timer */
modifyreg32(STM32_RCC_APB1ENR, 0, TONE_ALARM_CLOCK_ENABLE);
@@ -606,6 +606,8 @@ ToneAlarm::start_note(unsigned note)
rEGR = GTIM_EGR_UG; // force a reload of the period
rCCER |= TONE_CCER; // enable the output
+ // configure the GPIO to enable timer output
+ stm32_configgpio(GPIO_TONE_ALARM);
}
void
@@ -616,10 +618,8 @@ ToneAlarm::stop_note()
/*
* Make sure the GPIO is not driving the speaker.
- *
- * XXX this presumes PX4FMU and the onboard speaker driver FET.
*/
- stm32_gpiowrite(GPIO_TONE_ALARM, 0);
+ stm32_configgpio(GPIO_TONE_ALARM_IDLE);
}
void