diff options
Diffstat (limited to 'os/ex/ST/l3gd20.h')
-rw-r--r-- | os/ex/ST/l3gd20.h | 120 |
1 files changed, 69 insertions, 51 deletions
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. */ |