From 67e470b0e145566e83f3d006825cbb3a3c42dc36 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 11 Aug 2017 17:58:16 -1000 Subject: [PATCH] px4fmu-v5:Use arch/polarity agnostic Power control macros Use the board supplied Power control macros, in the the board_peripheral_reset. This abstacts the polarity from the code. Therefore changes in signal sense can be made, just in the board config. --- src/drivers/boards/px4fmu-v5/px4fmu_init.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/drivers/boards/px4fmu-v5/px4fmu_init.c b/src/drivers/boards/px4fmu-v5/px4fmu_init.c index 85089665b5..81d390c2a8 100644 --- a/src/drivers/boards/px4fmu-v5/px4fmu_init.c +++ b/src/drivers/boards/px4fmu-v5/px4fmu_init.c @@ -157,12 +157,12 @@ __EXPORT void board_peripheral_reset(int ms) { /* set the peripheral rails off */ - stm32_gpiowrite(GPIO_nVDD_5V_PERIPH_EN, 1); - stm32_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, 0); + VDD_5V_PERIPH_EN(false); + VDD_3V3_SENSORS_EN(false); - bool last = stm32_gpioread(GPIO_VDD_3V3_SPEKTRUM_POWER_EN); + bool last = READ_VDD_3V3_SPEKTRUM_POWER_EN(); /* Keep Spektum on to discharge rail*/ - stm32_gpiowrite(GPIO_VDD_3V3_SPEKTRUM_POWER_EN, 1); + VDD_3V3_SPEKTRUM_POWER_EN(false); /* wait for the peripheral rail to reach GND */ usleep(ms * 1000); @@ -171,9 +171,9 @@ __EXPORT void board_peripheral_reset(int ms) /* re-enable power */ /* switch the peripheral rail back on */ - stm32_gpiowrite(GPIO_VDD_3V3_SPEKTRUM_POWER_EN, last); - stm32_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, 1); - stm32_gpiowrite(GPIO_nVDD_5V_PERIPH_EN, 0); + VDD_3V3_SPEKTRUM_POWER_EN(last); + VDD_3V3_SENSORS_EN(true); + VDD_5V_PERIPH_EN(true); }