sensors: do not use choice for I2C address

Set the value for the I2C address directly and use only
one per sensor.

Change-Id: I24d06a964e8e372eddf262b70fe5d9854a04563c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2016-10-05 08:45:54 -04:00 committed by Anas Nashif
parent efd6b94929
commit f320338066
25 changed files with 90 additions and 329 deletions

View file

@ -59,10 +59,12 @@ config AK8975_I2C_ADDR
range 0x0C 0x0F
help
I2C address of the AK8975 sensor. Choose:
- 0x0C if CAD1 connected to GND nad CAD0 is connected to GND
- 0x0D if CAD1 connected to GND nad CAD0 is connected to VDD
- 0x0E if CAD1 connected to VDD nad CAD0 is connected to GND
- 0x0F if CAD1 connected to VDD nad CAD0 is connected to VDD
If the AK8975 sensor is part of a MPU9159 chip, the I2C address
needs to be 0x0C.

View file

@ -74,43 +74,18 @@ config BMA280_NAME
help
Device name with which the sensor is identified.
choice
prompt "I2C address"
config BMA280_I2C_ADDR
hex "BMA280 I2C address"
depends on BMA280
default BMA280_I2C_ADDR_0x18 if BMA280_CHIP_BMA280
default BMA280_I2C_ADDR_0x10 if BMA280_CHIP_BMC150_ACCEL
default 0x18 if BMA280_CHIP_BMA280
default 0x10 if BMA280_CHIP_BMC150_ACCEL
help
I2C address of the BMA280 sensor.
config BMA280_I2C_ADDR_0x10
bool
prompt "0x10"
depends on BMA280_CHIP_BMC150_ACCEL
help
Choose this option if the SDO pin is pulled to GND.
config BMA280_I2C_ADDR_0x11
bool
prompt "0x11"
depends on BMA280_CHIP_BMC150_ACCEL
help
Choose this option if the SDO pin is pulled to VDDIO.
config BMA280_I2C_ADDR_0x18
bool
prompt "0x18"
depends on BMA280_CHIP_BMA280
help
Choose this option if the SDO pin is pulled to GND.
config BMA280_I2C_ADDR_0x19
bool
prompt "0x19"
depends on BMA280_CHIP_BMA280
help
Choose this option if the SDO pin is pulled to VDDIO.
endchoice
0x10: Use if the SDO pin is pulled to GND.
0x10: Use if the SDO pin is pulled to VDDIO.
0x18: Use if the SDO pin is pulled to GND.
0x19: Use if the SDO pin is pulled to VDDIO.
config BMA280_I2C_MASTER_DEV_NAME
string

View file

@ -47,22 +47,15 @@ config BMC150_MAGN_DEV_NAME
depends on BMC150_MAGN
default "bmc150_magn"
choice
prompt "BMC150_MAGN I2C slave address"
default BMC150_MAGN_I2C_ADDR_12
config BMC150_MAGN_I2C_ADDR
hex "BMC150_MAGN I2C slave address"
default 0x12
depends on BMC150_MAGN
help
Specify the I2C slave address for the BMC150_MAGN.
config BMC150_MAGN_I2C_ADDR_12
bool
prompt "0x12 (GND)"
config BMC150_MAGN_I2C_ADDR_13
bool
prompt "0x13 (VCC)"
endchoice
0x12: GND
0x13: VCC
config BMC150_MAGN_I2C_MASTER_DEV_NAME
string "I2C master where BMC150_MAGN is connected"

View file

@ -46,22 +46,15 @@ config BME280_DEV_NAME
depends on BME280
default "BME280"
choice
prompt "BME280 I2C slave address"
default BME280_I2C_ADDR_76
config BME280_I2C_ADDR
hex "BME280 I2C slave address"
default 0x76
depends on BME280
help
Specify the I2C slave address for the BME280.
config BME280_I2C_ADDR_76
bool
prompt "0x76 (GND)"
config BME280_I2C_ADDR_77
bool
prompt "0x77 (VCC)"
endchoice
0x76: Ground
0x77: VCC
config BME280_I2C_MASTER_DEV_NAME
string "I2C master where BME280 is connected"

View file

@ -51,46 +51,15 @@ config HDC1008_NAME
help
Device name with which the HDC1008 sensor is identified.
config HDC1008_INIT_PRIORITY
int
prompt "Init priority"
depends on HDC1008
default 70
config HDC1008_I2C_ADDR
hex
prompt "I2C Address for HDC1008"
default "0x40"
help
Device driver initialization priority.
choice
prompt "I2C address"
depends on HDC1008
default HDC1008_I2C_ADDR_0
help
I2C address of the HDC1008 sensor.
config HDC1008_I2C_ADDR_0
bool
prompt "0x40"
help
A0 connected GND and A1 connected to GND.
config HDC1008_I2C_ADDR_1
bool
prompt "0x41"
help
A0 connected VDD and A1 connected to GND.
config HDC1008_I2C_ADDR_2
bool
prompt "0x42"
help
A0 connected GND and A1 connected to VDD.
config HDC1008_I2C_ADDR_3
bool
prompt "0x43"
help
A0 connected VDD and A1 connected to VDD.
endchoice
0x40: A0 connected GND and A1 connected to GND.
0x41: A0 connected VDD and A1 connected to GND.
0x42: A0 connected GND and A1 connected to VDD.
0x43: A0 connected VDD and A1 connected to VDD.
config HDC1008_I2C_MASTER_DEV_NAME
string

View file

@ -51,26 +51,16 @@ config LIS3DH_NAME
help
Device name with which the LIS3DH sensor is identified.
choice
prompt "I2C address"
config LIS3DH_I2C_ADDR
hex
prompt "LIS3DH I2C address"
depends on LIS3DH
default LIS3DH_I2C_ADDR_0x18
default 0x18
help
I2C address of the LIS3DH sensor.
config LIS3DH_I2C_ADDR_0x18
bool
prompt "0x18"
help
Choose this option if the SDO pin is pulled to GND.
config LIS3DH_I2C_ADDR_0x19
bool
prompt "0x19"
help
Choose this option if the SDO pin is pulled to VDDIO.
endchoice
0x18: Choose this option if the SDO pin is pulled to GND.
0x19: Choose this option if the SDO pin is pulled to VDDIO.
config LIS3DH_I2C_MASTER_DEV_NAME
string

View file

@ -53,7 +53,7 @@ config LIS3MDL_I2C_ADDR
hex
prompt "I2C address"
depends on LIS3MDL
default "0x1C"
default 0x1C
help
I2C address of the LIS3MDL sensor.
Use 0x1C if the SA1 pin is pulled to GND or 0x1E if the SA1 pin

View file

@ -51,9 +51,9 @@ config LSM6DS0_DEV_NAME
config LSM6DS0_I2C_ADDR
hex
prompt "I2C address"
prompt "LSM6DS0 I2C address"
depends on LSM6DS0
default "0x6B"
default 0x6B
help
I2C address of the LSM6DS0 sensor.
Use 0x6A if the SA0 pin is pulled to GND or 0x6B if the SA0 pin

View file

@ -47,22 +47,16 @@ config LSM9DS0_GYRO_DEV_NAME
depends on LSM9DS0_GYRO
default "lsm9ds0_gyro"
choice
config LSM9DS0_GYRO_I2C_ADDR
hex
prompt "LSM9DS0_GYRO I2C slave address"
default LSM9DS0_GYRO_I2C_ADDR_6A
default 0x6A
depends on LSM9DS0_GYRO
help
Specify the I2C slave address for the LSM9DS0_GYRO.
config LSM9DS0_GYRO_I2C_ADDR_6A
bool
prompt "0x6A (GND)"
config LSM9DS0_GYRO_I2C_ADDR_6B
bool
prompt "0x6B (VCC)"
endchoice
0x6A: GND
0x6B: VCC
config LSM9DS0_GYRO_I2C_MASTER_DEV_NAME
string "I2C master where LSM9DS0 gyroscope is connected"

View file

@ -48,22 +48,15 @@ config LSM9DS0_MFD_DEV_NAME
depends on LSM9DS0_MFD
default "lsm9ds0_mfd"
choice
prompt "LSM9DS0_MFD I2C slave address"
default LSM9DS0_MFD_I2C_ADDR_1E
config LSM9DS0_MFD_I2C_ADDR
string "LSM9DS0_MFD I2C slave address"
default "0x1E"
depends on LSM9DS0_MFD
help
Specify the I2C slave address for the LSM9DS0_MFD.
config LSM9DS0_MFD_I2C_ADDR_1E
bool
prompt "0x1E (GND)"
config LSM9DS0_MFD_I2C_ADDR_1F
bool
prompt "0x1F (VCC)"
endchoice
0x1E: GND
0x1F: VCC
config LSM9DS0_MFD_I2C_MASTER_DEV_NAME
string "I2C master where LSM9DS0 gyroscope is connected"

View file

@ -51,26 +51,17 @@ config MAX44009_DRV_NAME
help
Device name with which the MAX44009 light is identified.
choice
prompt "I2C address"
config MAX44009_I2C_ADDR
hex
prompt "MAX44009 I2C address"
depends on MAX44009
default MAX44009_I2C_ADDR_0
default "0x4a"
help
I2C address of the MAX44009 sensor.
I2C address of the MAX44009 sensor. Possible configurations:
config MAX44009_I2C_ADDR_0
bool
prompt "0x4a"
help
A0 connected to GND.
config MAX44009_I2C_ADDR_1
bool
prompt "0x4b"
help
A0 connected to VCC.
endchoice
0x4a: A0 connected to GND.
0x4b: A0 connected to VCC.
config MAX44009_I2C_DEV_NAME
string

View file

@ -51,26 +51,15 @@ config SHT3XD_NAME
help
Device name with which the SHT3xD sensor is identified.
choice
prompt "I2C address"
config SHT3XD_I2C_ADDR
hex "SHT3XD I2C address"
depends on SHT3XD
default SHT3XD_I2C_ADDR_A
default "0x44"
help
I2C address of the SHT3xD sensor.
config SHT3XD_I2C_ADDR_A
bool
prompt "0x44"
help
Choose this option if the ADDR pin is connected to VSS.
config SHT3XD_I2C_ADDR_B
bool
prompt "0x45"
help
Choose this option if the ADDR pin is connected to VDD.
endchoice
0x44: Choose this option if the ADDR pin is connected to VSS.
0x45: Choose this option if the ADDR pin is connected to VDD.
config SHT3XD_I2C_MASTER_DEV_NAME
string

View file

@ -51,62 +51,22 @@ config TMP007_NAME
help
Device name with which the TMP007 sensor is identified.
choice
prompt "I2C address"
config TMP007_I2C_ADDR
hex
prompt "I2C address for TMP006 Sensor"
depends on TMP007
default TMP007_I2C_ADDR_0
default "0x40"
help
I2C address of the TMP007 sensor.
config TMP007_I2C_ADDR_0
bool
prompt "0x40"
help
A0 connected GND and A1 connected to GND.
config TMP007_I2C_ADDR_1
bool
prompt "0x41"
help
A0 connected VDD and A1 connected to GND.
config TMP007_I2C_ADDR_2
bool
prompt "0x42"
help
A0 connected SDA and A1 connected to GND.
config TMP007_I2C_ADDR_3
bool
prompt "0x43"
help
A0 connected SCL and A1 connected to GND.
config TMP007_I2C_ADDR_4
bool
prompt "0x44"
help
A0 connected GND and A1 connected to VDD.
config TMP007_I2C_ADDR_5
bool
prompt "0x45"
help
A0 connected VDD and A1 connected to VDD.
config TMP007_I2C_ADDR_6
bool
prompt "0x46"
help
A0 connected SDA and A1 connected to VDD.
config TMP007_I2C_ADDR_7
bool
prompt "0x47"
help
A0 connected SCL and A1 connected to VDD.
endchoice
0x40: A0 connected GND and A1 connected to GND.
0x41: A0 connected VDD and A1 connected to GND.
0x42: A0 connected SDA and A1 connected to GND.
0x43: A0 connected SCL and A1 connected to GND.
0x44: A0 connected GND and A1 connected to VDD.
0x45: A0 connected VDD and A1 connected to VDD.
0x46: A0 connected SDA and A1 connected to VDD.
0x47: A0 connected SCL and A1 connected to VDD.
config TMP007_I2C_MASTER_DEV_NAME
string

View file

@ -51,38 +51,18 @@ config TMP112_NAME
help
Device name with which the TMP112 sensor is identified.
choice
prompt "I2C address"
config TMP112_I2C_ADDR
hex "I2C address for TMP112"
depends on TMP112
default TMP112_I2C_ADDR_0
default 0x48
help
I2C address of the TMP112 sensor.
config TMP112_I2C_ADDR_0
bool
prompt "0x48"
help
A0 connected GND and A1 connected to GND.
0x48: A0 connected GND and A1 connected to GND.
0x49: A0 connected VDD and A1 connected to GND.
0x4A: A0 connected SDA and A1 connected to GND.
0x4B: A0 connected SCL and A1 connected to GND.
config TMP112_I2C_ADDR_1
bool
prompt "0x49"
help
A0 connected VDD and A1 connected to GND.
config TMP112_I2C_ADDR_2
bool
prompt "0x4A"
help
A0 connected SDA and A1 connected to GND.
config TMP112_I2C_ADDR_3
bool
prompt "0x4B"
help
A0 connected SCL and A1 connected to GND.
endchoice
config TMP112_I2C_MASTER_DEV_NAME
string

View file

@ -23,15 +23,7 @@
#include <gpio.h>
#include <misc/nano_work.h>
#if CONFIG_BMA280_I2C_ADDR_0x10
#define BMA280_I2C_ADDRESS 0x10
#elif CONFIG_BMA280_I2C_ADDR_0x11
#define BMA280_I2C_ADDRESS 0x11
#elif CONFIG_BMA280_I2C_ADDR_0x18
#define BMA280_I2C_ADDRESS 0x18
#elif CONFIG_BMA280_I2C_ADDR_0x19
#define BMA280_I2C_ADDRESS 0x19
#endif
#define BMA280_I2C_ADDRESS CONFIG_BMA280_I2C_ADDR
#define BMA280_REG_CHIP_ID 0x00
#if CONFIG_BMA280_CHIP_BMA280

View file

@ -83,11 +83,7 @@
#define BMC150_MAGN_MASK_DRDY_LATCHING BIT(1)
#define BMC150_MAGN_MASK_DRDY_INT3_POLARITY BIT(0)
#if defined(CONFIG_BMC150_MAGN_I2C_ADDR_12)
#define BMC150_MAGN_I2C_ADDR 0x12
#elif defined(CONFIG_BMC150_MAGN_I2C_ADDR_13)
#define BMC150_MAGN_I2C_ADDR 0x13
#endif
#define BMC150_MAGN_I2C_ADDR CONFIG_BMC150_MAGN_I2C_ADDR
#if defined(CONFIG_BMC150_MAGN_SAMPLING_REP_XY) || \
defined(CONFIG_BMC150_MAGN_SAMPLING_REP_Z)

View file

@ -109,11 +109,7 @@
BME280_FILTER | \
BME280_SPI_3W_DISABLE)
#if defined CONFIG_BME280_I2C_ADDR_76
#define BME280_I2C_ADDR 0x76
#elif defined CONFIG_BME280_I2C_ADDR_77
#define BME280_I2C_ADDR 0x77
#endif
#define BME280_I2C_ADDR CONFIG_BME280_I2C_ADDR
struct bme280_data {
struct device *i2c_master;

View file

@ -19,15 +19,7 @@
#include <nanokernel.h>
#if CONFIG_HDC1008_I2C_ADDR_0
#define HDC1008_I2C_ADDRESS 0x40
#elif CONFIG_HDC1008_I2C_ADDR_1
#define HDC1008_I2C_ADDRESS 0x41
#elif CONFIG_HDC1008_I2C_ADDR_2
#define HDC1008_I2C_ADDRESS 0x42
#elif CONFIG_HDC1008_I2C_ADDR_3
#define HDC1008_I2C_ADDRESS 0x43
#endif
#define HDC1008_I2C_ADDRESS 0x40
#define HDC1008_REG_TEMP 0x0
#define HDC1008_REG_HUMIDITY 0x1

View file

@ -23,11 +23,7 @@
#include <gpio.h>
#include <misc/nano_work.h>
#if CONFIG_LIS3DH_I2C_ADDR_0x18
#define LIS3DH_I2C_ADDRESS 0x18
#elif CONFIG_LIS3DH_I2C_ADDR_0x19
#define LIS3DH_I2C_ADDRESS 0x19
#endif
#define LIS3DH_I2C_ADDRESS CONFIG_LIS3DH_I2C_ADDR
#define LIS3DH_AUTOINCREMENT_ADDR BIT(7)

View file

@ -196,11 +196,7 @@
BIT(0))
#define LSM9DS0_GYRO_SHIFT_INT1_DURATION_G_D 0
#if defined(CONFIG_LSM9DS0_GYRO_I2C_ADDR_6A)
#define LSM9DS0_GYRO_I2C_ADDR 0x6A
#elif defined(CONFIG_LSM9DS0_GYRO_I2C_ADDR_6B)
#define LSM9DS0_GYRO_I2C_ADDR 0x6B
#endif
#define LSM9DS0_GYRO_I2C_ADDR CONFIG_LSM9DS0_GYRO_I2C_ADDR
#if defined(CONFIG_LSM9DS0_GYRO_FULLSCALE_245)
#define LSM9DS0_GYRO_DEFAULT_FULLSCALE 0

View file

@ -404,11 +404,7 @@
BIT(1) | BIT(0))
#define LMS9DS0_MFD_SHIFT_ACT_DUR_ACTD 0
#if defined(CONFIG_LSM9DS0_MFD_I2C_ADDR_1E)
#define LSM9DS0_MFD_I2C_ADDR 0x1E
#elif defined(CONFIG_LSM9DS0_MFD_I2C_ADDR_1F)
#define LSM9DS0_MFD_I2C_ADDR 0x1F
#endif
#define LSM9DS0_MFD_I2C_ADDR CONFIG_LSM9DS0_MFD_I2C_ADDR
#if defined(CONFIG_LSM9DS0_MFD_ACCEL_SAMPLING_RATE_0)
#define LSM9DS0_MFD_ACCEL_DEFAULT_AODR 0

View file

@ -23,11 +23,7 @@
#define SYS_LOG_LEVEL CONFIG_MAX44009_SYS_LOG_LEVEL
#include <misc/sys_log.h>
#if CONFIG_MAX44009_I2C_ADDR_0
#define MAX44009_I2C_ADDRESS 0x4a
#elif CONFIG_MAX44009_I2C_ADDR_1
#define MAX44009_I2C_ADDRESS 0x4b
#endif
#define MAX44009_I2C_ADDRESS CONFIG_MAX44009_I2C_ADDR
#define MAX44009_SAMPLING_CONTROL_BIT BIT(7)
#define MAX44009_CONTINUOUS_SAMPLING BIT(7)

View file

@ -22,11 +22,7 @@
#include <gpio.h>
#include <misc/nano_work.h>
#if CONFIG_SHT3XD_I2C_ADDR_A
#define SHT3XD_I2C_ADDRESS 0x44
#elif CONFIG_SHT3XD_I2C_ADDR_B
#define SHT3XD_I2C_ADDRESS 0x45
#endif
#define SHT3XD_I2C_ADDRESS CONFIG_SHT3XD_I2C_ADDR
#define SHT3XD_CMD_FETCH 0xE000
#define SHT3XD_CMD_ART 0x2B32

View file

@ -21,23 +21,7 @@
#include <gpio.h>
#include <misc/util.h>
#if CONFIG_TMP007_I2C_ADDR_0
#define TMP007_I2C_ADDRESS 0x40
#elif CONFIG_TMP007_I2C_ADDR_1
#define TMP007_I2C_ADDRESS 0x41
#elif CONFIG_TMP007_I2C_ADDR_2
#define TMP007_I2C_ADDRESS 0x42
#elif CONFIG_TMP007_I2C_ADDR_3
#define TMP007_I2C_ADDRESS 0x43
#elif CONFIG_TMP007_I2C_ADDR_4
#define TMP007_I2C_ADDRESS 0x44
#elif CONFIG_TMP007_I2C_ADDR_5
#define TMP007_I2C_ADDRESS 0x45
#elif CONFIG_TMP007_I2C_ADDR_6
#define TMP007_I2C_ADDRESS 0x46
#elif CONFIG_TMP007_I2C_ADDR_7
#define TMP007_I2C_ADDRESS 0x47
#endif
#define TMP007_I2C_ADDRESS CONFIG_TMP007_I2C_ADDR
#define TMP007_REG_CONFIG 0x02
#define TMP007_ALERT_EN_BIT BIT(8)

View file

@ -26,15 +26,7 @@
#define SYS_LOG_LEVEL CONFIG_TMP112_SYS_LOG_LEVEL
#include <misc/sys_log.h>
#if CONFIG_TMP112_I2C_ADDR_0
#define TMP112_I2C_ADDRESS 0x48
#elif CONFIG_TMP112_I2C_ADDR_1
#define TMP112_I2C_ADDRESS 0x49
#elif CONFIG_TMP112_I2C_ADDR_2
#define TMP112_I2C_ADDRESS 0x4A
#elif CONFIG_TMP112_I2C_ADDR_3
#define TMP112_I2C_ADDRESS 0x4B
#endif
#define TMP112_I2C_ADDRESS CONFIG_TMP112_I2C_ADDR
#define TMP112_REG_TEMPERATURE 0x00
#define TMP112_D0_BIT BIT(0)