From 6be4a70fc3b53bce41d9f4fcc1faaf34f95a86f0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 19 Oct 2015 13:24:36 +0200 Subject: [PATCH] FMUv1: Fix formatting --- src/drivers/boards/px4fmu-v1/px4fmu_init.c | 32 ++++++++++----------- src/drivers/boards/px4fmu-v1/px4fmu_led.c | 33 +++++++++++----------- src/drivers/boards/px4fmu-v1/px4fmu_spi.c | 4 +-- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_init.c b/src/drivers/boards/px4fmu-v1/px4fmu_init.c index b0e741017e..dea7678014 100644 --- a/src/drivers/boards/px4fmu-v1/px4fmu_init.c +++ b/src/drivers/boards/px4fmu-v1/px4fmu_init.c @@ -223,23 +223,23 @@ __EXPORT int nsh_archinitialize(void) * Keep the SPI2 init optional and conditionally initialize the ADC pins */ - #ifdef CONFIG_STM32_SPI2 - spi2 = up_spiinitialize(2); - /* Default SPI2 to 1MHz and de-assert the known chip selects. */ - SPI_SETFREQUENCY(spi2, 10000000); - SPI_SETBITS(spi2, 8); - SPI_SETMODE(spi2, SPIDEV_MODE3); - SPI_SELECT(spi2, PX4_SPIDEV_GYRO, false); - SPI_SELECT(spi2, PX4_SPIDEV_ACCEL_MAG, false); +#ifdef CONFIG_STM32_SPI2 + spi2 = up_spiinitialize(2); + /* Default SPI2 to 1MHz and de-assert the known chip selects. */ + SPI_SETFREQUENCY(spi2, 10000000); + SPI_SETBITS(spi2, 8); + SPI_SETMODE(spi2, SPIDEV_MODE3); + SPI_SELECT(spi2, PX4_SPIDEV_GYRO, false); + SPI_SELECT(spi2, PX4_SPIDEV_ACCEL_MAG, false); - message("[boot] Initialized SPI port2 (ADC IN12/13 blocked)\n"); - #else - spi2 = NULL; - message("[boot] Enabling IN12/13 instead of SPI2\n"); - /* no SPI2, use pins for ADC */ - stm32_configgpio(GPIO_ADC1_IN12); - stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards - #endif + message("[boot] Initialized SPI port2 (ADC IN12/13 blocked)\n"); +#else + spi2 = NULL; + message("[boot] Enabling IN12/13 instead of SPI2\n"); + /* no SPI2, use pins for ADC */ + stm32_configgpio(GPIO_ADC1_IN12); + stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards +#endif /* Get the SPI port for the microSD slot */ diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_led.c b/src/drivers/boards/px4fmu-v1/px4fmu_led.c index 888e4f551b..8a92cc6e3f 100644 --- a/src/drivers/boards/px4fmu-v1/px4fmu_led.c +++ b/src/drivers/boards/px4fmu-v1/px4fmu_led.c @@ -70,13 +70,12 @@ __EXPORT void led_init(void) __EXPORT void led_on(int led) { - if (led == 0) - { + if (led == 0) { /* Pull down to switch on */ stm32_gpiowrite(GPIO_LED1, false); } - if (led == 1) - { + + if (led == 1) { /* Pull down to switch on */ stm32_gpiowrite(GPIO_LED2, false); } @@ -84,13 +83,12 @@ __EXPORT void led_on(int led) __EXPORT void led_off(int led) { - if (led == 0) - { + if (led == 0) { /* Pull up to switch off */ stm32_gpiowrite(GPIO_LED1, true); } - if (led == 1) - { + + if (led == 1) { /* Pull up to switch off */ stm32_gpiowrite(GPIO_LED2, true); } @@ -98,18 +96,21 @@ __EXPORT void led_off(int led) __EXPORT void led_toggle(int led) { - if (led == 0) - { - if (stm32_gpioread(GPIO_LED1)) + if (led == 0) { + if (stm32_gpioread(GPIO_LED1)) { stm32_gpiowrite(GPIO_LED1, false); - else + + } else { stm32_gpiowrite(GPIO_LED1, true); + } } - if (led == 1) - { - if (stm32_gpioread(GPIO_LED2)) + + if (led == 1) { + if (stm32_gpioread(GPIO_LED2)) { stm32_gpiowrite(GPIO_LED2, false); - else + + } else { stm32_gpiowrite(GPIO_LED2, true); + } } } diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_spi.c b/src/drivers/boards/px4fmu-v1/px4fmu_spi.c index 2a444796ff..e877a6dff4 100644 --- a/src/drivers/boards/px4fmu-v1/px4fmu_spi.c +++ b/src/drivers/boards/px4fmu-v1/px4fmu_spi.c @@ -90,8 +90,8 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, switch (devid) { case PX4_SPIDEV_GYRO: - /* Making sure the other peripherals are not selected */ - stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected); + /* Making sure the other peripherals are not selected */ + stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected); stm32_gpiowrite(GPIO_SPI_CS_MPU, 1); stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1); break;