aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-11-12 10:46:43 +0100
committerDavid Sidrane <david_s5@nscdg.com>2015-04-07 06:07:30 -1000
commitc93386a6aee5a79fd2b7d3aec379d188b73756ee (patch)
tree533ee1ad28e565418f6dfefab9c630aeb68954f6
parent8edf8055287ddc49356df7aeccab50aa5c3eb972 (diff)
downloadpx4-firmware-c93386a6aee5a79fd2b7d3aec379d188b73756ee.tar.gz
px4-firmware-c93386a6aee5a79fd2b7d3aec379d188b73756ee.tar.bz2
px4-firmware-c93386a6aee5a79fd2b7d3aec379d188b73756ee.zip
FMUv1: Update driver API
-rw-r--r--src/drivers/boards/px4fmu-v1/px4fmu_init.c57
-rw-r--r--src/drivers/boards/px4fmu-v1/px4fmu_spi.c2
2 files changed, 16 insertions, 43 deletions
diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_init.c b/src/drivers/boards/px4fmu-v1/px4fmu_init.c
index 293021f8b..0e331a139 100644
--- a/src/drivers/boards/px4fmu-v1/px4fmu_init.c
+++ b/src/drivers/boards/px4fmu-v1/px4fmu_init.c
@@ -53,7 +53,7 @@
#include <errno.h>
#include <nuttx/arch.h>
-#include <nuttx/spi.h>
+#include <nuttx/spi/spi.h>
#include <nuttx/i2c.h>
#include <nuttx/mmcsd.h>
#include <nuttx/analog/adc.h>
@@ -77,33 +77,6 @@
/* Debug ********************************************************************/
-#ifdef CONFIG_CPP_HAVE_VARARGS
-# ifdef CONFIG_DEBUG
-# define message(...) lowsyslog(__VA_ARGS__)
-# else
-# define message(...) printf(__VA_ARGS__)
-# endif
-#else
-# ifdef CONFIG_DEBUG
-# define message lowsyslog
-# else
-# define message printf
-# endif
-#endif
-
-/*
- * Ideally we'd be able to get these from up_internal.h,
- * but since we want to be able to disable the NuttX use
- * of leds for system indication at will and there is no
- * separate switch, we need to build independent of the
- * CONFIG_ARCH_LEDS configuration switch.
- */
-__BEGIN_DECLS
-extern void led_init(void);
-extern void led_on(int led);
-extern void led_off(int led);
-__END_DECLS
-
/****************************************************************************
* Protected Functions
****************************************************************************/
@@ -127,8 +100,8 @@ __EXPORT void stm32_boardinitialize(void)
/* configure SPI interfaces */
stm32_spiinitialize();
- /* configure LEDs (empty call to NuttX' ledinit) */
- up_ledinit();
+ /* configure LEDs */
+ board_led_initialize();
}
/****************************************************************************
@@ -202,8 +175,8 @@ __EXPORT int nsh_archinitialize(void)
spi1 = up_spiinitialize(1);
if (!spi1) {
- message("[boot] FAILED to initialize SPI port 1\r\n");
- up_ledon(LED_AMBER);
+ syslog(LOG_ERR, "[boot] FAILED to initialize SPI port 1\r\n");
+ board_led_on(LED_AMBER);
return -ENODEV;
}
@@ -216,7 +189,7 @@ __EXPORT int nsh_archinitialize(void)
SPI_SELECT(spi1, PX4_SPIDEV_MPU, false);
up_udelay(20);
- message("[boot] Successfully initialized SPI port 1\r\n");
+ syslog(LOG_INFO, "[boot] Successfully initialized SPI port 1\r\n");
/*
* If SPI2 is enabled in the defconfig, we loose some ADC pins as chip selects.
@@ -232,10 +205,10 @@ __EXPORT int nsh_archinitialize(void)
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");
+ syslog(LOG_INFO, "[boot] Initialized SPI port2 (ADC IN12/13 blocked)\n");
#else
spi2 = NULL;
- message("[boot] Enabling IN12/13 instead of SPI2\n");
+ syslog(LOG_INFO, "[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
@@ -243,27 +216,27 @@ __EXPORT int nsh_archinitialize(void)
/* Get the SPI port for the microSD slot */
- message("[boot] Initializing SPI port 3\n");
+ syslog(LOG_INFO, "[boot] Initializing SPI port 3\n");
spi3 = up_spiinitialize(3);
if (!spi3) {
- message("[boot] FAILED to initialize SPI port 3\n");
- up_ledon(LED_AMBER);
+ syslog(LOG_ERR, "[boot] FAILED to initialize SPI port 3\n");
+ board_led_on(LED_AMBER);
return -ENODEV;
}
- message("[boot] Successfully initialized SPI port 3\n");
+ syslog(LOG_INFO, "[boot] Successfully initialized SPI port 3\n");
/* Now bind the SPI interface to the MMCSD driver */
result = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi3);
if (result != OK) {
- message("[boot] FAILED to bind SPI port 3 to the MMCSD driver\n");
- up_ledon(LED_AMBER);
+ syslog(LOG_ERR, "[boot] FAILED to bind SPI port 3 to the MMCSD driver\n");
+ board_led_on(LED_AMBER);
return -ENODEV;
}
- message("[boot] Successfully bound SPI port 3 to the MMCSD driver\n");
+ syslog(LOG_INFO, "[boot] Successfully bound SPI port 3 to the MMCSD driver\n");
return OK;
}
diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_spi.c b/src/drivers/boards/px4fmu-v1/px4fmu_spi.c
index 16f94a9f2..fffaa3ec4 100644
--- a/src/drivers/boards/px4fmu-v1/px4fmu_spi.c
+++ b/src/drivers/boards/px4fmu-v1/px4fmu_spi.c
@@ -47,7 +47,7 @@
#include <stdbool.h>
#include <debug.h>
-#include <nuttx/spi.h>
+#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "up_arch.h"