aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-03-11 13:22:32 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-03-11 13:22:32 +0000
commit168a92a948eb6c1f942e386d9b14eb887d32d60e (patch)
treea79a47bcbaa24a851b185970f8064e39ce23e840
parentd97542b7b824570b0a372cb848ae02bf01d60039 (diff)
downloadChibiOS-168a92a948eb6c1f942e386d9b14eb887d32d60e.tar.gz
ChibiOS-168a92a948eb6c1f942e386d9b14eb887d32d60e.tar.bz2
ChibiOS-168a92a948eb6c1f942e386d9b14eb887d32d60e.zip
Driver pre-compile time settings aligned for all drivers.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11698 110e8d01-0319-4d1e-a829-52ad28d1bb01
-rw-r--r--os/ex/ST/hts221.h39
-rw-r--r--os/ex/ST/l3gd20.c8
-rw-r--r--os/ex/ST/l3gd20.h120
-rw-r--r--os/ex/ST/lis3dsh.h58
-rw-r--r--os/ex/ST/lps25h.h128
-rw-r--r--os/ex/ST/lsm303dlhc.h71
-rw-r--r--testex/STM32/STM32F3xx/SPI-L3GD20/Makefile2
-rw-r--r--testex/STM32/STM32F3xx/SPI-L3GD20/main.c2
-rw-r--r--testex/STM32/STM32F4xx/SPI-L3GD20/Makefile2
-rw-r--r--testex/STM32/STM32F4xx/SPI-L3GD20/main.c2
-rw-r--r--testex/STM32/STM32L4xx/SPI-L3GD20/Makefile2
-rw-r--r--testex/STM32/STM32L4xx/SPI-L3GD20/main.c2
12 files changed, 277 insertions, 159 deletions
diff --git a/os/ex/ST/hts221.h b/os/ex/ST/hts221.h
index 893f9f314..ae52e4b3b 100644
--- a/os/ex/ST/hts221.h
+++ b/os/ex/ST/hts221.h
@@ -185,6 +185,16 @@
#endif
/**
+ * @brief HTS221 shared SPI switch.
+ * @details If set to @p TRUE the device acquires SPI bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION
+ */
+#if !defined(HTS221_SHARED_SPI) || defined(__DOXYGEN__)
+#define HTS221_SHARED_SPI FALSE
+#endif
+
+/**
* @brief HTS221 I2C interface switch.
* @details If set to @p TRUE the support for I2C is included.
* @note The default is @p TRUE.
@@ -194,15 +204,6 @@
#endif
/**
- * @brief HTS221 advanced configurations switch.
- * @details If set to @p TRUE more configurations are available.
- * @note The default is @p FALSE.
- */
-#if !defined(HTS221_USE_ADVANCED) || defined(__DOXYGEN__)
-#define HTS221_USE_ADVANCED FALSE
-#endif
-
-/**
* @brief HTS221 shared I2C switch.
* @details If set to @p TRUE the device acquires I2C bus ownership
* on each transaction.
@@ -211,6 +212,15 @@
#if !defined(HTS221_SHARED_I2C) || defined(__DOXYGEN__)
#define HTS221_SHARED_I2C FALSE
#endif
+
+/**
+ * @brief HTS221 advanced configurations switch.
+ * @details If set to @p TRUE more configurations are available.
+ * @note The default is @p FALSE.
+ */
+#if !defined(HTS221_USE_ADVANCED) || defined(__DOXYGEN__)
+#define HTS221_USE_ADVANCED FALSE
+#endif
/** @} */
/*===========================================================================*/
@@ -225,8 +235,8 @@
#error "HTS221_USE_SPI requires HAL_USE_SPI"
#endif
-#if HTS221_USE_SPI
-#error "HTS221 over SPI still not supported"
+#if HTS221_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
+#error "HTS221_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
#endif
#if HTS221_USE_I2C && !HAL_USE_I2C
@@ -237,6 +247,13 @@
#error "HTS221_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
#endif
+/**
+ * @todo Add support for HTS221 over SPI.
+ */
+#if HTS221_USE_SPI
+#error "HTS221 over SPI still not supported."
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/ex/ST/l3gd20.c b/os/ex/ST/l3gd20.c
index 4313341e6..17100ca36 100644
--- a/os/ex/ST/l3gd20.c
+++ b/os/ex/ST/l3gd20.c
@@ -499,14 +499,14 @@ void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config) {
cr[0] = L3GD20_CTRL_REG1_XEN | L3GD20_CTRL_REG1_YEN |
L3GD20_CTRL_REG1_ZEN | L3GD20_CTRL_REG1_PD |
devp->config->gyrooutputdatarate;
-#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
+#if L3GD20_GYRO_USE_ADVANCED || defined(__DOXYGEN__)
cr[0] |= devp->config->gyrobandwidth;
#endif
}
/* Control register 2 configuration block.*/
{
-#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
+#if L3GD20_GYRO_USE_ADVANCED || defined(__DOXYGEN__)
if(devp->config->gyrohpmode != L3GD20_HPM_BYPASSED)
cr[1] = devp->config->gyrohpmode | devp->config->gyrohpconfiguration;
#endif
@@ -515,7 +515,7 @@ void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config) {
/* Control register 4 configuration block.*/
{
cr[3] = devp->config->gyrofullscale;
-#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
+#if L3GD20_GYRO_USE_ADVANCED || defined(__DOXYGEN__)
cr[3] |= devp->config->gyroblockdataupdate |
devp->config->gyroendianness;
#endif
@@ -523,7 +523,7 @@ void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config) {
/* Control register 5 configuration block.*/
{
-#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
+#if L3GD20_GYRO_USE_ADVANCED || defined(__DOXYGEN__)
if((devp->config->gyrohpmode != L3GD20_HPM_BYPASSED)) {
cr[4] = L3GD20_CTRL_REG5_HPEN;
if(devp->config->gyrolp2mode != L3GD20_LP2M_BYPASSED) {
diff --git a/os/ex/ST/l3gd20.h b/os/ex/ST/l3gd20.h
index c57615040..9c7bb0979 100644
--- a/os/ex/ST/l3gd20.h
+++ b/os/ex/ST/l3gd20.h
@@ -232,41 +232,52 @@
* @name Configuration options
* @{
*/
-/**
- * @brief L3GD20 SPI interface switch.
- * @details If set to @p TRUE the support for SPI is included.
- * @note The default is @p TRUE.
- */
-#if !defined(L3GD20_USE_SPI) || defined(__DOXYGEN__)
-#define L3GD20_USE_SPI TRUE
-#endif
-
-/**
- * @brief L3GD20 I2C interface switch.
- * @details If set to @p TRUE the support for I2C is included.
- * @note The default is @p FALSE.
- */
-#if !defined(L3GD20_USE_I2C) || defined(__DOXYGEN__)
-#define L3GD20_USE_I2C FALSE
-#endif
-
-/**
- * @brief L3GD20 advanced configurations switch.
- * @details If set to @p TRUE more configurations are available.
- * @note The default is @p FALSE.
- */
-#if !defined(L3GD20_USE_ADVANCED) || defined(__DOXYGEN__)
-#define L3GD20_USE_ADVANCED FALSE
-#endif
-
-/**
- * @brief L3GD20 shared SPI switch.
- * @details If set to @p TRUE the device acquires SPI bus ownership
- * on each transaction.
- * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION
- */
-#if !defined(L3GD20_SHARED_SPI) || defined(__DOXYGEN__)
-#define L3GD20_SHARED_SPI FALSE
+/**
+ * @brief L3GD20 SPI interface switch.
+ * @details If set to @p TRUE the support for SPI is included.
+ * @note The default is @p TRUE.
+ */
+#if !defined(L3GD20_USE_SPI) || defined(__DOXYGEN__)
+#define L3GD20_USE_SPI TRUE
+#endif
+
+/**
+ * @brief L3GD20 shared SPI switch.
+ * @details If set to @p TRUE the device acquires SPI bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
+ */
+#if !defined(L3GD20_SHARED_SPI) || defined(__DOXYGEN__)
+#define L3GD20_SHARED_SPI FALSE
+#endif
+
+/**
+ * @brief L3GD20 I2C interface switch.
+ * @details If set to @p TRUE the support for I2C is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(L3GD20_USE_I2C) || defined(__DOXYGEN__)
+#define L3GD20_USE_I2C FALSE
+#endif
+
+/**
+ * @brief L3GD20 shared I2C switch.
+ * @details If set to @p TRUE the device acquires I2C bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
+ */
+#if !defined(L3GD20_SHARED_I2C) || defined(__DOXYGEN__)
+#define L3GD20_SHARED_I2C FALSE
+#endif
+
+/**
+ * @brief L3GD20 accelerometer subsystem advanced configurations
+ * switch.
+ * @details If set to @p TRUE more configurations are available.
+ * @note The default is @p FALSE.
+ */
+#if !defined(L3GD20_GYRO_USE_ADVANCED) || defined(__DOXYGEN__)
+#define L3GD20_GYRO_USE_ADVANCED FALSE
#endif
/**
@@ -291,26 +302,33 @@
/* Derived constants and error checks. */
/*===========================================================================*/
-#if !(L3GD20_USE_SPI ^ L3GD20_USE_I2C)
-#error "L3GD20_USE_SPI and L3GD20_USE_I2C cannot be both true or both false"
-#endif
-
-#if L3GD20_USE_SPI && !HAL_USE_SPI
-#error "L3GD20_USE_SPI requires HAL_USE_SPI"
-#endif
+#if !(L3GD20_USE_SPI ^ L3GD20_USE_I2C)
+#error "L3GD20_USE_SPI and L3GD20_USE_I2C cannot be both true or both false"
+#endif
+
+#if L3GD20_USE_SPI && !HAL_USE_SPI
+#error "L3GD20_USE_SPI requires HAL_USE_SPI"
+#endif
+#if L3GD20_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
+#error "L3GD20_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
+#endif
+
+#if L3GD20_USE_I2C && !HAL_USE_I2C
+#error "L3GD20_USE_I2C requires HAL_USE_I2C"
+#endif
+
+#if L3GD20_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
+#error "L3GD20_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
+#endif
+
+/**
+ * @todo Add support for L3GD20 over I2C.
+ */
#if L3GD20_USE_I2C
#error "L3GD20 over I2C still not supported"
#endif
-#if L3GD20_USE_I2C && !HAL_USE_I2C
-#error "L3GD20_USE_I2C requires HAL_USE_I2C"
-#endif
-
-#if L3GD20_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
-#error "L3GD20_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
-#endif
-
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@@ -454,7 +472,7 @@ typedef struct {
* @brief L3GD20 gyroscope system output data rate selection.
*/
l3gd20_odr_t gyrooutputdatarate;
-#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
+#if L3GD20_GYRO_USE_ADVANCED || defined(__DOXYGEN__)
/**
* @brief L3GD20 gyroscope system block data update.
*/
diff --git a/os/ex/ST/lis3dsh.h b/os/ex/ST/lis3dsh.h
index 48ff544cd..eff9daa36 100644
--- a/os/ex/ST/lis3dsh.h
+++ b/os/ex/ST/lis3dsh.h
@@ -291,44 +291,55 @@
/*===========================================================================*/
/**
- * @name Configuration options.
+ * @name Configuration options
* @{
*/
/**
* @brief LIS3DSH SPI interface switch.
* @details If set to @p TRUE the support for SPI is included.
- * @note The default is @p TRUE.
+ * @note The default is @p FALSE.
*/
#if !defined(LIS3DSH_USE_SPI) || defined(__DOXYGEN__)
-#define LIS3DSH_USE_SPI TRUE
+#define LIS3DSH_USE_SPI FALSE
+#endif
+
+/**
+ * @brief LIS3DSH shared SPI switch.
+ * @details If set to @p TRUE the device acquires SPI bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
+ */
+#if !defined(LIS3DSH_SHARED_SPI) || defined(__DOXYGEN__)
+#define LIS3DSH_SHARED_SPI FALSE
#endif
/**
* @brief LIS3DSH I2C interface switch.
* @details If set to @p TRUE the support for I2C is included.
- * @note The default is @p FALSE.
+ * @note The default is @p TRUE.
*/
#if !defined(LIS3DSH_USE_I2C) || defined(__DOXYGEN__)
-#define LIS3DSH_USE_I2C FALSE
+#define LIS3DSH_USE_I2C TRUE
#endif
/**
- * @brief LIS3DSH accelerometer subsystem advanced configurations switch.
- * @details If set to @p TRUE more configurations are available.
- * @note The default is @p FALSE.
+ * @brief LIS3DSH shared I2C switch.
+ * @details If set to @p TRUE the device acquires I2C bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
*/
-#if !defined(LIS3DSH_ACC_USE_ADVANCED) || defined(__DOXYGEN__)
-#define LIS3DSH_ACC_USE_ADVANCED FALSE
+#if !defined(LIS3DSH_SHARED_I2C) || defined(__DOXYGEN__)
+#define LIS3DSH_SHARED_I2C FALSE
#endif
/**
- * @brief LIS3DSH shared SPI switch.
- * @details If set to @p TRUE the device acquires SPI bus ownership
- * on each transaction.
- * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
+ * @brief LIS3DSH accelerometer subsystem advanced configurations
+ * switch.
+ * @details If set to @p TRUE more configurations are available.
+ * @note The default is @p FALSE.
*/
-#if !defined(LIS3DSH_SHARED_SPI) || defined(__DOXYGEN__)
-#define LIS3DSH_SHARED_SPI FALSE
+#if !defined(LIS3DSH_ACC_USE_ADVANCED) || defined(__DOXYGEN__)
+#define LIS3DSH_ACC_USE_ADVANCED FALSE
#endif
/** @} */
@@ -344,16 +355,23 @@
#error "LIS3DSH_USE_SPI requires HAL_USE_SPI"
#endif
+#if LIS3DSH_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
+#error "LIS3DSH_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
+#endif
+
#if LIS3DSH_USE_I2C && !HAL_USE_I2C
#error "LIS3DSH_USE_I2C requires HAL_USE_I2C"
#endif
-#if LIS3DSH_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
-#error "LIS3DSH_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
+#if LIS3DSH_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
+#error "LIS3DSH_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
#endif
-#if LIS3DSH_USE_I2C
-#error "LIS3DSH's I2C support is not supported."
+/**
+ * @todo Add support for LIS3DSH over SPI.
+ */
+#if LIS3DSH_USE_SPI
+#error "LIS3DSH over SPI still not supported"
#endif
/*===========================================================================*/
diff --git a/os/ex/ST/lps25h.h b/os/ex/ST/lps25h.h
index 54d96635c..fc908e09d 100644
--- a/os/ex/ST/lps25h.h
+++ b/os/ex/ST/lps25h.h
@@ -206,71 +206,89 @@
/* Driver pre-compile time settings. */
/*===========================================================================*/
-/**
- * @name Configuration options
- * @{
- */
-/**
- * @brief LPS25H SPI interface switch.
- * @details If set to @p TRUE the support for SPI is included.
- * @note The default is @p FALSE.
- */
-#if !defined(LPS25H_USE_SPI) || defined(__DOXYGEN__)
-#define LPS25H_USE_SPI FALSE
-#endif
-
-/**
- * @brief LPS25H I2C interface switch.
- * @details If set to @p TRUE the support for I2C is included.
- * @note The default is @p TRUE.
- */
-#if !defined(LPS25H_USE_I2C) || defined(__DOXYGEN__)
-#define LPS25H_USE_I2C TRUE
-#endif
-
-/**
- * @brief LPS25H advanced configurations switch.
- * @details If set to @p TRUE more configurations are available.
- * @note The default is @p FALSE.
- */
-#if !defined(LPS25H_USE_ADVANCED) || defined(__DOXYGEN__)
-#define LPS25H_USE_ADVANCED FALSE
-#endif
-
-/**
- * @brief LPS25H shared I2C switch.
- * @details If set to @p TRUE the device acquires I2C bus ownership
- * on each transaction.
- * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION
- */
-#if !defined(LPS25H_SHARED_I2C) || defined(__DOXYGEN__)
-#define LPS25H_SHARED_I2C FALSE
-#endif
+/**
+ * @name Configuration options
+ * @{
+ */
+/**
+ * @brief LPS25H SPI interface switch.
+ * @details If set to @p TRUE the support for SPI is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(LPS25H_USE_SPI) || defined(__DOXYGEN__)
+#define LPS25H_USE_SPI FALSE
+#endif
+
+/**
+ * @brief LPS25H shared SPI switch.
+ * @details If set to @p TRUE the device acquires SPI bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
+ */
+#if !defined(LPS25H_SHARED_SPI) || defined(__DOXYGEN__)
+#define LPS25H_SHARED_SPI FALSE
+#endif
+
+/**
+ * @brief LPS25H I2C interface switch.
+ * @details If set to @p TRUE the support for I2C is included.
+ * @note The default is @p TRUE.
+ */
+#if !defined(LPS25H_USE_I2C) || defined(__DOXYGEN__)
+#define LPS25H_USE_I2C TRUE
+#endif
+
+/**
+ * @brief LPS25H shared I2C switch.
+ * @details If set to @p TRUE the device acquires I2C bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
+ */
+#if !defined(LPS25H_SHARED_I2C) || defined(__DOXYGEN__)
+#define LPS25H_SHARED_I2C FALSE
+#endif
+
+/**
+ * @brief LPS25H accelerometer subsystem advanced configurations
+ * switch.
+ * @details If set to @p TRUE more configurations are available.
+ * @note The default is @p FALSE.
+ */
+#if !defined(LPS25H_USE_ADVANCED) || defined(__DOXYGEN__)
+#define LPS25H_USE_ADVANCED FALSE
+#endif
/** @} */
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
-#if !(LPS25H_USE_SPI ^ LPS25H_USE_I2C)
-#error "LPS25H_USE_SPI and LPS25H_USE_I2C cannot be both true or both false"
-#endif
-
-#if LPS25H_USE_SPI && !HAL_USE_SPI
-#error "LPS25H_USE_SPI requires HAL_USE_SPI"
-#endif
+#if !(LPS25H_USE_SPI ^ LPS25H_USE_I2C)
+#error "LPS25H_USE_SPI and LPS25H_USE_I2C cannot be both true or both false"
+#endif
+#if LPS25H_USE_SPI && !HAL_USE_SPI
+#error "LPS25H_USE_SPI requires HAL_USE_SPI"
+#endif
+
+#if LPS25H_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
+#error "LPS25H_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
+#endif
+
+#if LPS25H_USE_I2C && !HAL_USE_I2C
+#error "LPS25H_USE_I2C requires HAL_USE_I2C"
+#endif
+
+#if LPS25H_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
+#error "LPS25H_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
+#endif
+
+/**
+ * @todo Add support for LPS25H over SPI.
+ */
#if LPS25H_USE_SPI
#error "LPS25H over SPI still not supported"
#endif
-
-#if LPS25H_USE_I2C && !HAL_USE_I2C
-#error "LPS25H_USE_I2C requires HAL_USE_I2C"
-#endif
-
-#if LPS25H_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
-#error "LPS25H_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
-#endif
/*===========================================================================*/
/* Driver data structures and types. */
diff --git a/os/ex/ST/lsm303dlhc.h b/os/ex/ST/lsm303dlhc.h
index b3700dfd1..b915176c3 100644
--- a/os/ex/ST/lsm303dlhc.h
+++ b/os/ex/ST/lsm303dlhc.h
@@ -305,6 +305,44 @@
* @{
*/
/**
+ * @brief LSM303DLHC SPI interface switch.
+ * @details If set to @p TRUE the support for SPI is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(LSM303DLHC_USE_SPI) || defined(__DOXYGEN__)
+#define LSM303DLHC_USE_SPI FALSE
+#endif
+
+/**
+ * @brief LSM303DLHC shared SPI switch.
+ * @details If set to @p TRUE the device acquires SPI bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
+ */
+#if !defined(LSM303DLHC_SHARED_SPI) || defined(__DOXYGEN__)
+#define LSM303DLHC_SHARED_SPI FALSE
+#endif
+
+/**
+ * @brief LSM303DLHC I2C interface switch.
+ * @details If set to @p TRUE the support for I2C is included.
+ * @note The default is @p TRUE.
+ */
+#if !defined(LSM303DLHC_USE_I2C) || defined(__DOXYGEN__)
+#define LSM303DLHC_USE_I2C TRUE
+#endif
+
+/**
+ * @brief LSM303DLHC shared I2C switch.
+ * @details If set to @p TRUE the device acquires I2C bus ownership
+ * on each transaction.
+ * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
+ */
+#if !defined(LSM303DLHC_SHARED_I2C) || defined(__DOXYGEN__)
+#define LSM303DLHC_SHARED_I2C FALSE
+#endif
+
+/**
* @brief LSM303DLHC accelerometer subsystem advanced configurations
* switch.
* @details If set to @p TRUE more configurations are available.
@@ -323,30 +361,39 @@
#if !defined(LSM303DLHC_COMP_USE_ADVANCED) || defined(__DOXYGEN__)
#define LSM303DLHC_COMP_USE_ADVANCED FALSE
#endif
-
-/**
- * @brief LSM303DLHC shared I2C switch.
- * @details If set to @p TRUE the device acquires I2C bus ownership
- * on each transaction.
- * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
- */
-#if !defined(LSM303DLHC_SHARED_I2C) || defined(__DOXYGEN__)
-#define LSM303DLHC_SHARED_I2C FALSE
-#endif
/** @} */
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
-#if !HAL_USE_I2C
-#error "LSM303DLHC requires HAL_USE_I2C"
+#if !(LSM303DLHC_USE_SPI ^ LSM303DLHC_USE_I2C)
+#error "LSM303DLHC_USE_SPI and LSM303DLHC_USE_I2C cannot be both true or both false"
+#endif
+
+#if LSM303DLHC_USE_SPI && !HAL_USE_SPI
+#error "LSM303DLHC_USE_SPI requires HAL_USE_SPI"
+#endif
+
+#if LSM303DLHC_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
+#error "LSM303DLHC_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
+#endif
+
+#if LSM303DLHC_USE_I2C && !HAL_USE_I2C
+#error "LSM303DLHC_USE_I2C requires HAL_USE_I2C"
#endif
#if LSM303DLHC_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
#error "LSM303DLHC_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
#endif
+/**
+ * @todo Add support for LSM303DLHC over SPI.
+ */
+#if LSM303DLHC_USE_SPI
+#error "LSM303DLHC over SPI still not supported"
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/testex/STM32/STM32F3xx/SPI-L3GD20/Makefile b/testex/STM32/STM32F3xx/SPI-L3GD20/Makefile
index 4fb007a36..a280ee768 100644
--- a/testex/STM32/STM32F3xx/SPI-L3GD20/Makefile
+++ b/testex/STM32/STM32F3xx/SPI-L3GD20/Makefile
@@ -193,7 +193,7 @@ CPPWARN = -Wall -Wextra -Wundef
# List all user C define here, like -D_DEBUG=1
UDEFS = -DCHPRINTF_USE_FLOAT=1 \
- -DL3GD20_USE_ADVANCED=0 -DL3GD20_SHARED_SPI=0
+ -DL3GD20_GYRO_USE_ADVANCED=0 -DL3GD20_SHARED_SPI=0
# Define ASM defines here
UADEFS =
diff --git a/testex/STM32/STM32F3xx/SPI-L3GD20/main.c b/testex/STM32/STM32F3xx/SPI-L3GD20/main.c
index 31379de73..79baaa44d 100644
--- a/testex/STM32/STM32F3xx/SPI-L3GD20/main.c
+++ b/testex/STM32/STM32F3xx/SPI-L3GD20/main.c
@@ -51,7 +51,7 @@ static L3GD20Config l3gd20cfg = {
NULL,
L3GD20_FS_250DPS,
L3GD20_ODR_760HZ,
-#if L3GD20_USE_ADVANCED
+#if L3GD20_GYRO_USE_ADVANCED
L3GD20_BDU_CONTINUOUS,
L3GD20_END_LITTLE,
L3GD20_BW3,
diff --git a/testex/STM32/STM32F4xx/SPI-L3GD20/Makefile b/testex/STM32/STM32F4xx/SPI-L3GD20/Makefile
index afb3b77ee..8a147e738 100644
--- a/testex/STM32/STM32F4xx/SPI-L3GD20/Makefile
+++ b/testex/STM32/STM32F4xx/SPI-L3GD20/Makefile
@@ -197,7 +197,7 @@ CPPWARN = -Wall -Wextra -Wundef
# List all user C define here, like -D_DEBUG=1
UDEFS = -DCHPRINTF_USE_FLOAT=1 \
- -DL3GD20_USE_ADVANCED=0 -DL3GD20_SHARED_SPI=0
+ -DL3GD20_GYRO_USE_ADVANCED=0 -DL3GD20_SHARED_SPI=0
# Define ASM defines here
UADEFS =
diff --git a/testex/STM32/STM32F4xx/SPI-L3GD20/main.c b/testex/STM32/STM32F4xx/SPI-L3GD20/main.c
index 08e0dadbb..c6860e828 100644
--- a/testex/STM32/STM32F4xx/SPI-L3GD20/main.c
+++ b/testex/STM32/STM32F4xx/SPI-L3GD20/main.c
@@ -52,7 +52,7 @@ static L3GD20Config l3gd20cfg = {
NULL,
L3GD20_FS_250DPS,
L3GD20_ODR_760HZ,
-#if L3GD20_USE_ADVANCED
+#if L3GD20_GYRO_USE_ADVANCED
L3GD20_BDU_CONTINUOUS,
L3GD20_END_LITTLE,
L3GD20_BW3,
diff --git a/testex/STM32/STM32L4xx/SPI-L3GD20/Makefile b/testex/STM32/STM32L4xx/SPI-L3GD20/Makefile
index c3da94e7f..958300775 100644
--- a/testex/STM32/STM32L4xx/SPI-L3GD20/Makefile
+++ b/testex/STM32/STM32L4xx/SPI-L3GD20/Makefile
@@ -193,7 +193,7 @@ CPPWARN = -Wall -Wextra -Wundef
# List all user C define here, like -D_DEBUG=1
UDEFS = -DCHPRINTF_USE_FLOAT=1 \
- -DL3GD20_USE_ADVANCED=0 -DL3GD20_SHARED_SPI=0
+ -DL3GD20_GYRO_USE_ADVANCED=0 -DL3GD20_SHARED_SPI=0
# Define ASM defines here
UADEFS =
diff --git a/testex/STM32/STM32L4xx/SPI-L3GD20/main.c b/testex/STM32/STM32L4xx/SPI-L3GD20/main.c
index 7a16de45f..693e0f0f7 100644
--- a/testex/STM32/STM32L4xx/SPI-L3GD20/main.c
+++ b/testex/STM32/STM32L4xx/SPI-L3GD20/main.c
@@ -51,7 +51,7 @@ static L3GD20Config l3gd20cfg = {
NULL,
L3GD20_FS_250DPS,
L3GD20_ODR_760HZ,
-#if L3GD20_USE_ADVANCED
+#if L3GD20_GYRO_USE_ADVANCED
L3GD20_BDU_CONTINUOUS,
L3GD20_END_LITTLE,
L3GD20_BW3,