aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-04-06 22:46:50 -0700
committerpx4dev <px4@purgatory.org>2013-04-06 22:46:50 -0700
commit8eeefcce057012400d94ec855c9103d390b6365b (patch)
treec649215bbef591ba2b76066bc69810dbd0f4d18c /src
parentc355275669378c0d6f2e372afa370446525c66ee (diff)
downloadpx4-firmware-8eeefcce057012400d94ec855c9103d390b6365b.tar.gz
px4-firmware-8eeefcce057012400d94ec855c9103d390b6365b.tar.bz2
px4-firmware-8eeefcce057012400d94ec855c9103d390b6365b.zip
Add GPIO driver access to the power supply control/monitoring GPIOs for FMUv2
Diffstat (limited to 'src')
-rw-r--r--src/device/px4fmu/fmu.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/device/px4fmu/fmu.cpp b/src/device/px4fmu/fmu.cpp
index 7b8ca9bbe..d3865f053 100644
--- a/src/device/px4fmu/fmu.cpp
+++ b/src/device/px4fmu/fmu.cpp
@@ -175,6 +175,9 @@ const PX4FMU::GPIOConfig PX4FMU::_gpio_tab[] = {
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0},
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0},
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0},
+ {0, GPIO_VDD_5V_PERIPH_EN, 0},
+ {GPIO_5V_HIPOWER_OC, 0, 0},
+ {GPIO_5V_PERIPH_OC, 0, 0},
#endif
};
@@ -850,10 +853,16 @@ void
PX4FMU::gpio_reset(void)
{
/*
- * Setup default GPIO config - all pins as GPIOs.
+ * Setup default GPIO config - all pins as GPIOs, input if
+ * possible otherwise output if possible.
*/
- for (unsigned i = 0; i < _ngpio; i++)
- stm32_configgpio(_gpio_tab[i].input);
+ for (unsigned i = 0; i < _ngpio; i++) {
+ if (_gpio_tab[i].input != 0) {
+ stm32_configgpio(_gpio_tab[i].input);
+ } else if (_gpio_tab[i].output != 0) {
+ stm32_configgpio(_gpio_tab[i].output);
+ }
+ }
#if defined(CONFIG_ARCH_BOARD_PX4FMU)
/* if we have a GPIO direction control, set it to zero (input) */