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.
This commit is contained in:
David Sidrane 2017-08-11 17:58:16 -10:00 committed by Lorenz Meier
parent 5506588a31
commit 67e470b0e1
1 changed files with 7 additions and 7 deletions

View File

@ -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);
}