From 168a92a948eb6c1f942e386d9b14eb887d32d60e Mon Sep 17 00:00:00 2001 From: Rocco Marco Guglielmi Date: Sun, 11 Mar 2018 13:22:32 +0000 Subject: 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 --- os/ex/ST/hts221.h | 39 ++++++++++----- os/ex/ST/l3gd20.c | 8 ++-- os/ex/ST/l3gd20.h | 120 ++++++++++++++++++++++++++-------------------- os/ex/ST/lis3dsh.h | 58 +++++++++++++++-------- os/ex/ST/lps25h.h | 128 ++++++++++++++++++++++++++++---------------------- os/ex/ST/lsm303dlhc.h | 71 +++++++++++++++++++++++----- 6 files changed, 271 insertions(+), 153 deletions(-) (limited to 'os') 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 @@ -184,6 +184,16 @@ #define HTS221_USE_SPI FALSE #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. @@ -193,15 +203,6 @@ #define HTS221_USE_I2C TRUE #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 @@ -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 @@ -304,6 +304,44 @@ * @name Configuration options * @{ */ +/** + * @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. @@ -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. */ /*===========================================================================*/ -- cgit v1.2.3