FMUv1: Fix formatting

This commit is contained in:
Lorenz Meier
2015-10-19 13:24:36 +02:00
parent caee7af9ae
commit 6be4a70fc3
3 changed files with 35 additions and 34 deletions
+16 -16
View File
@@ -223,23 +223,23 @@ __EXPORT int nsh_archinitialize(void)
* Keep the SPI2 init optional and conditionally initialize the ADC pins * Keep the SPI2 init optional and conditionally initialize the ADC pins
*/ */
#ifdef CONFIG_STM32_SPI2 #ifdef CONFIG_STM32_SPI2
spi2 = up_spiinitialize(2); spi2 = up_spiinitialize(2);
/* Default SPI2 to 1MHz and de-assert the known chip selects. */ /* Default SPI2 to 1MHz and de-assert the known chip selects. */
SPI_SETFREQUENCY(spi2, 10000000); SPI_SETFREQUENCY(spi2, 10000000);
SPI_SETBITS(spi2, 8); SPI_SETBITS(spi2, 8);
SPI_SETMODE(spi2, SPIDEV_MODE3); SPI_SETMODE(spi2, SPIDEV_MODE3);
SPI_SELECT(spi2, PX4_SPIDEV_GYRO, false); SPI_SELECT(spi2, PX4_SPIDEV_GYRO, false);
SPI_SELECT(spi2, PX4_SPIDEV_ACCEL_MAG, false); SPI_SELECT(spi2, PX4_SPIDEV_ACCEL_MAG, false);
message("[boot] Initialized SPI port2 (ADC IN12/13 blocked)\n"); message("[boot] Initialized SPI port2 (ADC IN12/13 blocked)\n");
#else #else
spi2 = NULL; spi2 = NULL;
message("[boot] Enabling IN12/13 instead of SPI2\n"); message("[boot] Enabling IN12/13 instead of SPI2\n");
/* no SPI2, use pins for ADC */ /* no SPI2, use pins for ADC */
stm32_configgpio(GPIO_ADC1_IN12); stm32_configgpio(GPIO_ADC1_IN12);
stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards
#endif #endif
/* Get the SPI port for the microSD slot */ /* Get the SPI port for the microSD slot */
+17 -16
View File
@@ -70,13 +70,12 @@ __EXPORT void led_init(void)
__EXPORT void led_on(int led) __EXPORT void led_on(int led)
{ {
if (led == 0) if (led == 0) {
{
/* Pull down to switch on */ /* Pull down to switch on */
stm32_gpiowrite(GPIO_LED1, false); stm32_gpiowrite(GPIO_LED1, false);
} }
if (led == 1)
{ if (led == 1) {
/* Pull down to switch on */ /* Pull down to switch on */
stm32_gpiowrite(GPIO_LED2, false); stm32_gpiowrite(GPIO_LED2, false);
} }
@@ -84,13 +83,12 @@ __EXPORT void led_on(int led)
__EXPORT void led_off(int led) __EXPORT void led_off(int led)
{ {
if (led == 0) if (led == 0) {
{
/* Pull up to switch off */ /* Pull up to switch off */
stm32_gpiowrite(GPIO_LED1, true); stm32_gpiowrite(GPIO_LED1, true);
} }
if (led == 1)
{ if (led == 1) {
/* Pull up to switch off */ /* Pull up to switch off */
stm32_gpiowrite(GPIO_LED2, true); stm32_gpiowrite(GPIO_LED2, true);
} }
@@ -98,18 +96,21 @@ __EXPORT void led_off(int led)
__EXPORT void led_toggle(int led) __EXPORT void led_toggle(int led)
{ {
if (led == 0) if (led == 0) {
{ if (stm32_gpioread(GPIO_LED1)) {
if (stm32_gpioread(GPIO_LED1))
stm32_gpiowrite(GPIO_LED1, false); stm32_gpiowrite(GPIO_LED1, false);
else
} else {
stm32_gpiowrite(GPIO_LED1, true); stm32_gpiowrite(GPIO_LED1, true);
}
} }
if (led == 1)
{ if (led == 1) {
if (stm32_gpioread(GPIO_LED2)) if (stm32_gpioread(GPIO_LED2)) {
stm32_gpiowrite(GPIO_LED2, false); stm32_gpiowrite(GPIO_LED2, false);
else
} else {
stm32_gpiowrite(GPIO_LED2, true); stm32_gpiowrite(GPIO_LED2, true);
}
} }
} }
+2 -2
View File
@@ -90,8 +90,8 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
switch (devid) { switch (devid) {
case PX4_SPIDEV_GYRO: case PX4_SPIDEV_GYRO:
/* Making sure the other peripherals are not selected */ /* Making sure the other peripherals are not selected */
stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected); stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected);
stm32_gpiowrite(GPIO_SPI_CS_MPU, 1); stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1); stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1);
break; break;