mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Added forward declarations of structures to fix header inclusion
order bugs. Removed an unused variable. Added debug asserts to check for invalid I2C addresses.
This commit is contained in:
@@ -41,10 +41,6 @@
|
||||
********************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/i2c.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#if defined(CONFIG_SENSORS_ADXL345)
|
||||
@@ -329,6 +325,9 @@ struct adxl345_config_s
|
||||
|
||||
typedef FAR void *ADXL345_HANDLE;
|
||||
|
||||
struct i2c_dev_s;
|
||||
struct spi_dev_s;
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/i2c.h>
|
||||
#include <nuttx/sensors/qencoder.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_QENCODER) && defined(CONFIG_AS5048B)
|
||||
@@ -97,6 +95,12 @@
|
||||
#define AS5048B_DIAG_COMPLOW (1 << 2) /* High Magnetic Field */
|
||||
#define AS5048B_DIAG_COMPHIGH (1 << 3) /* Low Magnetic Field */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct i2c_dev_s;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#ifndef __DRIVERS_SENSORS_BMP180_H
|
||||
#define __DRIVERS_SENSORS_BMP180_H
|
||||
|
||||
#if defined(CONFIG_BMP180)
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_BMP180)
|
||||
|
||||
/********************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@@ -53,6 +55,12 @@
|
||||
* Enable very low register-level debug output. Requires CONFIG_DEBUG.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct i2c_dev_s;
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************************/
|
||||
@@ -88,5 +96,5 @@ int bmp180_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_BMP180 */
|
||||
#endif /* CONFIG_I2C && CONFIG_BMP180 */
|
||||
#endif /* __DRIVERS_BMP180_H */
|
||||
|
||||
@@ -38,9 +38,11 @@
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_LIS331DL_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_LIS331DL_H
|
||||
|
||||
#include <nuttx/i2c.h>
|
||||
#include <nuttx/config.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_TRANSFER) && defined(CONFIG_LIS331DL)
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-Processor Declarations
|
||||
************************************************************************************/
|
||||
@@ -69,6 +71,8 @@ struct lis331dl_vector_s
|
||||
int8_t z;
|
||||
};
|
||||
|
||||
struct i2c_dev_s;
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
@@ -204,4 +208,5 @@ FAR const struct lis331dl_vector_s *
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* CONFIG_I2C && CONFIG_I2C_TRANSFER && CONFIG_LIS331DL */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_LIS331DL_H */
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_LM75)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -52,6 +54,14 @@
|
||||
*/
|
||||
|
||||
#define CONFIG_LM75_BASEADDR 0x48
|
||||
#define CONFIG_LM75_ADDR0 (CONFIG_LM75_BASEADDR + 0)
|
||||
#define CONFIG_LM75_ADDR1 (CONFIG_LM75_BASEADDR + 1)
|
||||
#define CONFIG_LM75_ADDR2 (CONFIG_LM75_BASEADDR + 2)
|
||||
#define CONFIG_LM75_ADDR3 (CONFIG_LM75_BASEADDR + 3)
|
||||
#define CONFIG_LM75_ADDR4 (CONFIG_LM75_BASEADDR + 4)
|
||||
#define CONFIG_LM75_ADDR5 (CONFIG_LM75_BASEADDR + 5)
|
||||
#define CONFIG_LM75_ADDR6 (CONFIG_LM75_BASEADDR + 6)
|
||||
#define CONFIG_LM75_ADDR7 (CONFIG_LM75_BASEADDR + 7)
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
@@ -86,12 +96,10 @@
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
struct i2c_dev_s;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
@@ -131,4 +139,5 @@ int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_I2C && CONFIG_I2C_LM75 */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_LM75_H */
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_LM92)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -101,12 +103,10 @@
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
struct i2c_dev_s;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
@@ -147,4 +147,5 @@ int lm92_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_I2C && CONFIG_LM92 */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_LM92_H */
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#ifndef __DRIVERS_SENSORS_MPL115A_H
|
||||
#define __DRIVERS_SENSORS_MPL115A_H
|
||||
|
||||
#if defined(CONFIG_MPL115A)
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_MPL115A)
|
||||
|
||||
/********************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@@ -83,6 +85,12 @@
|
||||
/* 0x0c - 0x11 are reserved */
|
||||
#define MPL115A_CONVERT 0x12 /* Start Pressure and Temperature Conversion */
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Types
|
||||
********************************************************************************************/
|
||||
|
||||
struct spi_dev_s;
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************************/
|
||||
@@ -118,5 +126,5 @@ int mpl115a_register(FAR const char *devpath, FAR struct spi_dev_s *spi);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SENSORS_MPL115A */
|
||||
#endif /* CONFIG_SPI && CONFIG_MPL115A */
|
||||
#endif /* __DRIVERS_SENSORS_MPL115A_H */
|
||||
|
||||
Reference in New Issue
Block a user