mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
Remove I2C slave methods from I2C master interface; rename i2c_dev_s to i2c_master_s.
This commit is contained in:
+1
-1
Submodule Documentation updated: b7d0b9c21a...bd05adddce
+1
-1
Submodule arch updated: ce5362e2da...5ea918534a
+1
-1
Submodule configs updated: 6b24789ace...c4eea61723
@@ -2464,7 +2464,7 @@ static void wm8904_hw_reset(FAR struct wm8904_dev_s *priv)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct audio_lowerhalf_s *
|
FAR struct audio_lowerhalf_s *
|
||||||
wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s,
|
wm8904_initialize(FAR struct i2c_master_s *i2c, FAR struct i2s_dev_s *i2s,
|
||||||
FAR const struct wm8904_lower_s *lower)
|
FAR const struct wm8904_lower_s *lower)
|
||||||
{
|
{
|
||||||
FAR struct wm8904_dev_s *priv;
|
FAR struct wm8904_dev_s *priv;
|
||||||
|
|||||||
@@ -1067,7 +1067,7 @@ struct wm8904_dev_s
|
|||||||
/* Our specific driver data goes here */
|
/* Our specific driver data goes here */
|
||||||
|
|
||||||
const FAR struct wm8904_lower_s *lower; /* Pointer to the board lower functions */
|
const FAR struct wm8904_lower_s *lower; /* Pointer to the board lower functions */
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C driver to use */
|
FAR struct i2c_master_s *i2c; /* I2C driver to use */
|
||||||
FAR struct i2s_dev_s *i2s; /* I2S driver to use */
|
FAR struct i2s_dev_s *i2s; /* I2S driver to use */
|
||||||
struct dq_queue_s pendq; /* Queue of pending buffers to be sent */
|
struct dq_queue_s pendq; /* Queue of pending buffers to be sent */
|
||||||
struct dq_queue_s doneq; /* Queue of sent buffers to be returned */
|
struct dq_queue_s doneq; /* Queue of sent buffers to be returned */
|
||||||
|
|||||||
@@ -68,7 +68,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int i2c_read(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
|
int i2c_read(FAR struct i2c_master_s *dev,
|
||||||
|
FAR const struct i2c_config_s *config,
|
||||||
FAR uint8_t *buffer, int buflen)
|
FAR uint8_t *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct i2c_msg_s msg;
|
struct i2c_msg_s msg;
|
||||||
|
|||||||
@@ -68,7 +68,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int i2c_write(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
|
int i2c_write(FAR struct i2c_master_s *dev,
|
||||||
|
FAR const struct i2c_config_s *config,
|
||||||
FAR const uint8_t *buffer, int buflen)
|
FAR const uint8_t *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct i2c_msg_s msg;
|
struct i2c_msg_s msg;
|
||||||
|
|||||||
@@ -69,7 +69,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int i2c_writeread(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
|
int i2c_writeread(FAR struct i2c_master_s *dev,
|
||||||
|
FAR const struct i2c_config_s *config,
|
||||||
FAR const uint8_t *wbuffer, int wbuflen,
|
FAR const uint8_t *wbuffer, int wbuflen,
|
||||||
FAR uint8_t *rbuffer, int rbuflen)
|
FAR uint8_t *rbuffer, int rbuflen)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -165,7 +165,7 @@ struct mxt_dev_s
|
|||||||
* lower half configuration data.
|
* lower half configuration data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FAR struct i2c_dev_s *i2c;
|
FAR struct i2c_master_s *i2c;
|
||||||
FAR const struct mxt_lower_s *lower;
|
FAR const struct mxt_lower_s *lower;
|
||||||
|
|
||||||
/* This is the allocated array of object information */
|
/* This is the allocated array of object information */
|
||||||
@@ -1850,7 +1850,7 @@ errout_with_objtab:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mxt_register(FAR struct i2c_dev_s *i2c,
|
int mxt_register(FAR struct i2c_master_s *i2c,
|
||||||
FAR const struct mxt_lower_s * const lower, int minor)
|
FAR const struct mxt_lower_s * const lower, int minor)
|
||||||
{
|
{
|
||||||
FAR struct mxt_dev_s *priv;
|
FAR struct mxt_dev_s *priv;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ struct stmpe811_dev_s
|
|||||||
#ifdef CONFIG_STMPE811_SPI
|
#ifdef CONFIG_STMPE811_SPI
|
||||||
FAR struct spi_dev_s *spi; /* Saved SPI driver instance */
|
FAR struct spi_dev_s *spi; /* Saved SPI driver instance */
|
||||||
#else
|
#else
|
||||||
FAR struct i2c_dev_s *i2c; /* Saved I2C driver instance */
|
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t inuse; /* STMPE811 pins in use */
|
uint8_t inuse; /* STMPE811 pins in use */
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ static void stmpe811_reset(FAR struct stmpe811_dev_s *priv)
|
|||||||
STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev,
|
STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev,
|
||||||
FAR struct stmpe811_config_s *config)
|
FAR struct stmpe811_config_s *config)
|
||||||
#else
|
#else
|
||||||
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev,
|
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
|
||||||
FAR struct stmpe811_config_s *config)
|
FAR struct stmpe811_config_s *config)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ struct tsc2007_dev_s
|
|||||||
sem_t waitsem; /* Used to wait for the availability of data */
|
sem_t waitsem; /* Used to wait for the availability of data */
|
||||||
|
|
||||||
FAR struct tsc2007_config_s *config; /* Board configuration data */
|
FAR struct tsc2007_config_s *config; /* Board configuration data */
|
||||||
FAR struct i2c_dev_s *i2c; /* Saved I2C driver instance */
|
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
|
||||||
struct work_s work; /* Supports the interrupt handling "bottom half" */
|
struct work_s work; /* Supports the interrupt handling "bottom half" */
|
||||||
struct tsc2007_sample_s sample; /* Last sampled touch point data */
|
struct tsc2007_sample_s sample; /* Last sampled touch point data */
|
||||||
|
|
||||||
@@ -1210,7 +1210,7 @@ errout:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int tsc2007_register(FAR struct i2c_dev_s *dev,
|
int tsc2007_register(FAR struct i2c_master_s *dev,
|
||||||
FAR struct tsc2007_config_s *config, int minor)
|
FAR struct tsc2007_config_s *config, int minor)
|
||||||
{
|
{
|
||||||
FAR struct tsc2007_dev_s *priv;
|
FAR struct tsc2007_dev_s *priv;
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ static int pca9555_interrupt(int irq, FAR void *context)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct ioexpander_dev_s *pca9555_initialize(FAR struct i2c_dev_s *i2cdev,
|
FAR struct ioexpander_dev_s *pca9555_initialize(FAR struct i2c_master_s *i2cdev,
|
||||||
FAR struct pca9555_config_s *config)
|
FAR struct pca9555_config_s *config)
|
||||||
{
|
{
|
||||||
FAR struct pca9555_dev_s *pcadev;
|
FAR struct pca9555_dev_s *pcadev;
|
||||||
|
|||||||
@@ -116,14 +116,14 @@
|
|||||||
|
|
||||||
struct pca9555_dev_s
|
struct pca9555_dev_s
|
||||||
{
|
{
|
||||||
struct ioexpander_dev_s dev; /* Nested structure to allow casting as public gpio expander. */
|
struct ioexpander_dev_s dev; /* Nested structure to allow casting as public gpio expander. */
|
||||||
|
|
||||||
#ifdef CONFIG_PCA9555_MULTIPLE
|
#ifdef CONFIG_PCA9555_MULTIPLE
|
||||||
FAR struct pca9555_dev_s * flink; /* Supports a singly linked list of drivers */
|
FAR struct pca9555_dev_s *flink; /* Supports a singly linked list of drivers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FAR struct pca9555_config_s *config; /* Board configuration data */
|
FAR struct pca9555_config_s *config; /* Board configuration data */
|
||||||
FAR struct i2c_dev_s * i2c; /* Saved I2C driver instance */
|
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ struct ssd1306_dev_s
|
|||||||
#ifdef CONFIG_LCD_SSD1306_SPI
|
#ifdef CONFIG_LCD_SSD1306_SPI
|
||||||
FAR struct spi_dev_s *spi; /* Cached SPI device reference */
|
FAR struct spi_dev_s *spi; /* Cached SPI device reference */
|
||||||
#else
|
#else
|
||||||
FAR struct i2c_dev_s *i2c; /* Cached SPI device reference */
|
FAR struct i2c_master_s *i2c; /* Cached SPI device reference */
|
||||||
uint8_t addr; /* 7-bit I2C address */
|
uint8_t addr; /* 7-bit I2C address */
|
||||||
#endif
|
#endif
|
||||||
uint8_t contrast; /* Current contrast setting */
|
uint8_t contrast; /* Current contrast setting */
|
||||||
|
|||||||
@@ -807,7 +807,7 @@ static int ssd1306_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
|
|||||||
#ifdef CONFIG_LCD_SSD1306_SPI
|
#ifdef CONFIG_LCD_SSD1306_SPI
|
||||||
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct spi_dev_s *dev, unsigned int devno)
|
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct spi_dev_s *dev, unsigned int devno)
|
||||||
#else
|
#else
|
||||||
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_dev_s *dev, unsigned int devno)
|
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_master_s *dev, unsigned int devno)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
FAR struct ssd1306_dev_s *priv = &g_oleddev;
|
FAR struct ssd1306_dev_s *priv = &g_oleddev;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
struct pca9635pw_dev_s
|
struct pca9635pw_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c;
|
FAR struct i2c_master_s *i2c;
|
||||||
uint8_t i2c_addr;
|
uint8_t i2c_addr;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ static int pca9635pw_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t const pca9635pw_i2c_addr)
|
uint8_t const pca9635pw_i2c_addr)
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
|
|||||||
@@ -150,15 +150,15 @@
|
|||||||
|
|
||||||
struct at24c_dev_s
|
struct at24c_dev_s
|
||||||
{
|
{
|
||||||
struct mtd_dev_s mtd; /* MTD interface */
|
struct mtd_dev_s mtd; /* MTD interface */
|
||||||
FAR struct i2c_dev_s *dev; /* Saved I2C interface instance */
|
FAR struct i2c_master_s *dev; /* Saved I2C interface instance */
|
||||||
bool initd; /* True: The device has been initialize */
|
bool initd; /* True: The device has been initialize */
|
||||||
#ifdef CONFIG_AT24XX_EXTENDED
|
#ifdef CONFIG_AT24XX_EXTENDED
|
||||||
bool extended; /* True: use extended memory region */
|
bool extended; /* True: use extended memory region */
|
||||||
#endif
|
#endif
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
uint16_t pagesize; /* 32, 63 */
|
uint16_t pagesize; /* 32, 63 */
|
||||||
uint16_t npages; /* 128, 256, 512, 1024 */
|
uint16_t npages; /* 128, 256, 512, 1024 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -547,9 +547,9 @@ static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_AT24XX_MULTI
|
#ifdef CONFIG_AT24XX_MULTI
|
||||||
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev, uint8_t address)
|
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev, uint8_t address)
|
||||||
#else
|
#else
|
||||||
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev)
|
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
FAR struct at24c_dev_s *priv;
|
FAR struct at24c_dev_s *priv;
|
||||||
|
|||||||
@@ -93,13 +93,13 @@ struct bq2425x_dev_s
|
|||||||
/* The common part of the battery driver visible to the upper-half driver */
|
/* The common part of the battery driver visible to the upper-half driver */
|
||||||
|
|
||||||
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
|
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
|
||||||
sem_t batsem; /* Enforce mutually exclusive access */
|
sem_t batsem; /* Enforce mutually exclusive access */
|
||||||
|
|
||||||
/* Data fields specific to the lower half BQ2425x driver follow */
|
/* Data fields specific to the lower half BQ2425x driver follow */
|
||||||
|
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
uint32_t frequency; /* I2C frequency */
|
uint32_t frequency; /* I2C frequency */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -715,8 +715,9 @@ static int bq2425x_current(struct battery_charger_dev_s *dev, int value)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct battery_charger_dev_s *bq2425x_initialize(FAR struct i2c_dev_s *i2c,
|
FAR struct battery_charger_dev_s *
|
||||||
uint8_t addr, uint32_t frequency)
|
bq2425x_initialize(FAR struct i2c_master_s *i2c, uint8_t addr,
|
||||||
|
uint32_t frequency)
|
||||||
{
|
{
|
||||||
FAR struct bq2425x_dev_s *priv;
|
FAR struct bq2425x_dev_s *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -178,13 +178,13 @@ struct max1704x_dev_s
|
|||||||
/* The common part of the battery driver visible to the upper-half driver */
|
/* The common part of the battery driver visible to the upper-half driver */
|
||||||
|
|
||||||
FAR const struct battery_gauge_operations_s *ops; /* Battery operations */
|
FAR const struct battery_gauge_operations_s *ops; /* Battery operations */
|
||||||
sem_t batsem; /* Enforce mutually exclusive access */
|
sem_t batsem; /* Enforce mutually exclusive access */
|
||||||
|
|
||||||
/* Data fields specific to the lower half MAX1704x driver follow */
|
/* Data fields specific to the lower half MAX1704x driver follow */
|
||||||
|
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
uint32_t frequency; /* I2C frequency */
|
uint32_t frequency; /* I2C frequency */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -520,7 +520,7 @@ static int max1704x_capacity(struct battery_gauge_dev_s *dev, b16_t *value)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_dev_s *i2c,
|
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr,
|
uint8_t addr,
|
||||||
uint32_t frequency)
|
uint32_t frequency)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ struct adxl345_dev_s
|
|||||||
#ifdef CONFIG_ADXL345_SPI
|
#ifdef CONFIG_ADXL345_SPI
|
||||||
FAR struct spi_dev_s *spi; /* Saved SPI driver instance */
|
FAR struct spi_dev_s *spi; /* Saved SPI driver instance */
|
||||||
#else
|
#else
|
||||||
FAR struct i2c_dev_s *i2c; /* Saved I2C driver instance */
|
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t status; /* See ADXL345_STAT_* definitions */
|
uint8_t status; /* See ADXL345_STAT_* definitions */
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ static void adxl345_reset(FAR struct adxl345_dev_s *priv)
|
|||||||
ADXL345_HANDLE adxl345_instantiate(FAR struct spi_dev_s *dev,
|
ADXL345_HANDLE adxl345_instantiate(FAR struct spi_dev_s *dev,
|
||||||
FAR struct adxl345_config_s *config)
|
FAR struct adxl345_config_s *config)
|
||||||
#else
|
#else
|
||||||
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_dev_s *dev,
|
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
|
||||||
FAR struct adxl345_config_s *config)
|
FAR struct adxl345_config_s *config)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,9 +57,9 @@
|
|||||||
|
|
||||||
struct as5048b_dev_s
|
struct as5048b_dev_s
|
||||||
{
|
{
|
||||||
struct qe_lowerhalf_s lower; /* AS5048B quadrature encoder lower half */
|
struct qe_lowerhalf_s lower; /* AS5048B quadrature encoder lower half */
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -577,7 +577,7 @@ static int as5048b_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_dev_s *i2c,
|
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr)
|
uint8_t addr)
|
||||||
{
|
{
|
||||||
FAR struct as5048b_dev_s *priv;
|
FAR struct as5048b_dev_s *priv;
|
||||||
|
|||||||
@@ -110,10 +110,10 @@
|
|||||||
|
|
||||||
struct bmp180_dev_s
|
struct bmp180_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* BMP180 I2C address */
|
uint8_t addr; /* BMP180 I2C address */
|
||||||
int freq; /* BMP180 Frequency <= 3.4MHz */
|
int freq; /* BMP180 Frequency <= 3.4MHz */
|
||||||
int16_t bmp180_cal_ac1; /* Calibration coefficients */
|
int16_t bmp180_cal_ac1; /* Calibration coefficients */
|
||||||
int16_t bmp180_cal_ac2;
|
int16_t bmp180_cal_ac2;
|
||||||
int16_t bmp180_cal_ac3;
|
int16_t bmp180_cal_ac3;
|
||||||
uint16_t bmp180_cal_ac4;
|
uint16_t bmp180_cal_ac4;
|
||||||
@@ -124,8 +124,8 @@ struct bmp180_dev_s
|
|||||||
int16_t bmp180_cal_mb;
|
int16_t bmp180_cal_mb;
|
||||||
int16_t bmp180_cal_mc;
|
int16_t bmp180_cal_mc;
|
||||||
int16_t bmp180_cal_md;
|
int16_t bmp180_cal_md;
|
||||||
int32_t bmp180_utemp; /* Uncompensated temperature read from BMP180 */
|
int32_t bmp180_utemp; /* Uncompensated temperature read from BMP180 */
|
||||||
int32_t bmp180_upress; /* Uncompensated pressure read from BMP180 */
|
int32_t bmp180_upress; /* Uncompensated pressure read from BMP180 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -569,7 +569,7 @@ static ssize_t bmp180_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int bmp180_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c)
|
int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c)
|
||||||
{
|
{
|
||||||
FAR struct bmp180_dev_s *priv;
|
FAR struct bmp180_dev_s *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
struct lis331dl_dev_s
|
struct lis331dl_dev_s
|
||||||
{
|
{
|
||||||
struct i2c_dev_s *i2c;
|
struct i2c_master_s *i2c;
|
||||||
uint8_t address;
|
uint8_t address;
|
||||||
struct lis331dl_vector_s a;
|
struct lis331dl_vector_s a;
|
||||||
uint8_t cr1;
|
uint8_t cr1;
|
||||||
@@ -217,7 +217,7 @@ static int lis331dl_readregs(FAR struct lis331dl_dev_s *dev)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_dev_s *i2c,
|
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_master_s *i2c,
|
||||||
uint16_t address)
|
uint16_t address)
|
||||||
{
|
{
|
||||||
FAR struct lis331dl_dev_s * dev;
|
FAR struct lis331dl_dev_s * dev;
|
||||||
|
|||||||
@@ -67,9 +67,9 @@
|
|||||||
|
|
||||||
struct lm75_dev_s
|
struct lm75_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
bool fahrenheit; /* true: temperature will be reported in fahrenheit */
|
bool fahrenheit; /* true: temperature will be reported in fahrenheit */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -503,7 +503,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c, uint8_t addr)
|
int lm75_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, uint8_t addr)
|
||||||
{
|
{
|
||||||
FAR struct lm75_dev_s *priv;
|
FAR struct lm75_dev_s *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -69,9 +69,9 @@
|
|||||||
|
|
||||||
struct lm92_dev_s
|
struct lm92_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
bool fahrenheit; /* true: temperature will be reported in Fahrenheit */
|
bool fahrenheit; /* true: temperature will be reported in Fahrenheit */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -595,7 +595,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int lm92_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int lm92_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr)
|
uint8_t addr)
|
||||||
{
|
{
|
||||||
FAR struct lm92_dev_s *priv;
|
FAR struct lm92_dev_s *priv;
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ struct lsm9ds1_ops_s
|
|||||||
|
|
||||||
struct lsm9ds1_dev_s
|
struct lsm9ds1_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
|
|
||||||
FAR const struct lsm9ds1_ops_s *ops;
|
FAR const struct lsm9ds1_ops_s *ops;
|
||||||
@@ -567,7 +567,7 @@ static int lsm9ds1_ioctl(FAR struct file *filep, int cmd,
|
|||||||
/* Common Register Function */
|
/* Common Register Function */
|
||||||
|
|
||||||
static int lsm9ds1_register(FAR const char *devpath,
|
static int lsm9ds1_register(FAR const char *devpath,
|
||||||
FAR struct i2c_dev_s *i2c, uint8_t addr,
|
FAR struct i2c_master_s *i2c, uint8_t addr,
|
||||||
FAR const struct lsm9ds1_ops_s *ops,
|
FAR const struct lsm9ds1_ops_s *ops,
|
||||||
uint8_t datareg);
|
uint8_t datareg);
|
||||||
|
|
||||||
@@ -1413,7 +1413,7 @@ static int lsm9ds1_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int lsm9ds1_register(FAR const char *devpath,
|
static int lsm9ds1_register(FAR const char *devpath,
|
||||||
FAR struct i2c_dev_s *i2c, uint8_t addr,
|
FAR struct i2c_master_s *i2c, uint8_t addr,
|
||||||
FAR const struct lsm9ds1_ops_s *ops,
|
FAR const struct lsm9ds1_ops_s *ops,
|
||||||
uint8_t datareg)
|
uint8_t datareg)
|
||||||
{
|
{
|
||||||
@@ -1486,7 +1486,7 @@ static int lsm9ds1_register(FAR const char *devpath,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr)
|
uint8_t addr)
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
@@ -1513,7 +1513,7 @@ int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr)
|
uint8_t addr)
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
@@ -1540,7 +1540,7 @@ int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int lsm9ds1mag_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int lsm9ds1mag_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr)
|
uint8_t addr)
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
|
|||||||
@@ -57,8 +57,8 @@
|
|||||||
|
|
||||||
struct mb7040_dev_s
|
struct mb7040_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -336,7 +336,7 @@ static int mb7040_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mb7040_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int mb7040_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr)
|
uint8_t addr)
|
||||||
{
|
{
|
||||||
FAR struct mb7040_dev_s *priv;
|
FAR struct mb7040_dev_s *priv;
|
||||||
|
|||||||
@@ -56,8 +56,8 @@
|
|||||||
|
|
||||||
struct mcp9844_dev_s
|
struct mcp9844_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -317,7 +317,7 @@ static int mcp9844_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mcp9844_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int mcp9844_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr)
|
uint8_t addr)
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
|
|||||||
@@ -75,18 +75,18 @@
|
|||||||
|
|
||||||
struct ms58xx_dev_s
|
struct ms58xx_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* I2C interface */
|
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||||
uint8_t addr; /* I2C address */
|
uint8_t addr; /* I2C address */
|
||||||
|
|
||||||
enum ms58xx_model_e model;
|
enum ms58xx_model_e model;
|
||||||
uint8_t crcindex;
|
uint8_t crcindex;
|
||||||
uint8_t crcshift;
|
uint8_t crcshift;
|
||||||
|
|
||||||
int32_t temp; /* Uncompensated temperature (degrees Centigrade) */
|
int32_t temp; /* Uncompensated temperature (degrees Centigrade) */
|
||||||
int32_t press; /* Uncompensated pressure (millibar) */
|
int32_t press; /* Uncompensated pressure (millibar) */
|
||||||
|
|
||||||
uint8_t osr; /* Oversampling ratio bits */
|
uint8_t osr; /* Oversampling ratio bits */
|
||||||
useconds_t delay; /* Oversampling ratio delay */
|
useconds_t delay; /* Oversampling ratio delay */
|
||||||
|
|
||||||
/* Calibration coefficients */
|
/* Calibration coefficients */
|
||||||
|
|
||||||
@@ -838,7 +838,7 @@ static int ms58xx_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int ms58xx_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int ms58xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr, uint16_t osr, enum ms58xx_model_e model)
|
uint8_t addr, uint16_t osr, enum ms58xx_model_e model)
|
||||||
{
|
{
|
||||||
FAR struct ms58xx_dev_s *priv;
|
FAR struct ms58xx_dev_s *priv;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
|
|
||||||
struct ds3231_dev_s
|
struct ds3231_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* Contained reference to the I2C bus driver */
|
FAR struct i2c_master_s *i2c; /* Contained reference to the I2C bus driver */
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -237,7 +237,7 @@ static int rtc_bcd2bin(uint8_t value)
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
int dsxxxx_rtc_initialize(FAR struct i2c_dev_s *i2c)
|
int dsxxxx_rtc_initialize(FAR struct i2c_master_s *i2c)
|
||||||
{
|
{
|
||||||
/* Remember the i2c device and claim that the RTC is enabled */
|
/* Remember the i2c device and claim that the RTC is enabled */
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
|
|
||||||
struct pcf85263_dev_s
|
struct pcf85263_dev_s
|
||||||
{
|
{
|
||||||
FAR struct i2c_dev_s *i2c; /* Contained reference to the I2C bus driver */
|
FAR struct i2c_master_s *i2c; /* Contained reference to the I2C bus driver */
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -237,7 +237,7 @@ static int rtc_bcd2bin(uint8_t value)
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
int pcf85263_rtc_initialize(FAR struct i2c_dev_s *i2c)
|
int pcf85263_rtc_initialize(FAR struct i2c_master_s *i2c)
|
||||||
{
|
{
|
||||||
/* Remember the i2c device and claim that the RTC is enabled */
|
/* Remember the i2c device and claim that the RTC is enabled */
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -286,16 +286,16 @@ struct ovr2640_reg_s
|
|||||||
|
|
||||||
/* OV2640 register operations */
|
/* OV2640 register operations */
|
||||||
|
|
||||||
static int ov2640_putreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr,
|
static int ov2640_putreg(FAR struct i2c_master_s *i2c, uint8_t regaddr,
|
||||||
uint8_t regval);
|
uint8_t regval);
|
||||||
static uint8_t ov2640_getreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr);
|
static uint8_t ov2640_getreg(FAR struct i2c_master_s *i2c, uint8_t regaddr);
|
||||||
static int ov2640_putreglist(FAR struct i2c_dev_s *i2c,
|
static int ov2640_putreglist(FAR struct i2c_master_s *i2c,
|
||||||
FAR const struct ovr2640_reg_s *reglist, size_t nentries);
|
FAR const struct ovr2640_reg_s *reglist, size_t nentries);
|
||||||
|
|
||||||
/* Initialization */
|
/* Initialization */
|
||||||
|
|
||||||
static int ovr2640_chipid(FAR struct i2c_dev_s *i2c);
|
static int ovr2640_chipid(FAR struct i2c_master_s *i2c);
|
||||||
static int ov2640_reset(FAR struct i2c_dev_s *i2c);
|
static int ov2640_reset(FAR struct i2c_master_s *i2c);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@@ -687,7 +687,7 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_uxga_resolution[] =
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int ov2640_putreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr,
|
static int ov2640_putreg(FAR struct i2c_master_s *i2c, uint8_t regaddr,
|
||||||
uint8_t regval)
|
uint8_t regval)
|
||||||
{
|
{
|
||||||
uint8_t buffer[2];
|
uint8_t buffer[2];
|
||||||
@@ -731,7 +731,7 @@ static int ov2640_putreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static uint8_t ov2640_getreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr)
|
static uint8_t ov2640_getreg(FAR struct i2c_master_s *i2c, uint8_t regaddr)
|
||||||
{
|
{
|
||||||
uint8_t regval;
|
uint8_t regval;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -780,7 +780,7 @@ static uint8_t ov2640_getreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int ov2640_putreglist(FAR struct i2c_dev_s *i2c,
|
static int ov2640_putreglist(FAR struct i2c_master_s *i2c,
|
||||||
FAR const struct ovr2640_reg_s *reglist,
|
FAR const struct ovr2640_reg_s *reglist,
|
||||||
size_t nentries)
|
size_t nentries)
|
||||||
{
|
{
|
||||||
@@ -815,7 +815,7 @@ static int ov2640_putreglist(FAR struct i2c_dev_s *i2c,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int ovr2640_chipid(FAR struct i2c_dev_s *i2c)
|
static int ovr2640_chipid(FAR struct i2c_master_s *i2c)
|
||||||
{
|
{
|
||||||
uint8_t pidl;
|
uint8_t pidl;
|
||||||
uint8_t pidh;
|
uint8_t pidh;
|
||||||
@@ -870,7 +870,7 @@ static int ovr2640_chipid(FAR struct i2c_dev_s *i2c)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int ov2640_reset(FAR struct i2c_dev_s *i2c)
|
static int ov2640_reset(FAR struct i2c_master_s *i2c)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -903,7 +903,7 @@ static int ov2640_reset(FAR struct i2c_dev_s *i2c)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int ov2640_initialize(FAR struct i2c_dev_s *i2c)
|
int ov2640_initialize(FAR struct i2c_master_s *i2c)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -214,12 +214,12 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct i2c_dev_s; /* Forward reference. Defined in include/nuttx/i2c/i2c_master.h */
|
struct i2c_master_s; /* Forward reference. Defined in include/nuttx/i2c/i2c_master.h */
|
||||||
struct i2s_dev_s; /* Forward reference. Defined in include/nuttx/audio/i2s.h */
|
struct i2s_dev_s; /* Forward reference. Defined in include/nuttx/audio/i2s.h */
|
||||||
struct audio_lowerhalf_s; /* Forward reference. Defined in nuttx/audio/audio.h */
|
struct audio_lowerhalf_s; /* Forward reference. Defined in nuttx/audio/audio.h */
|
||||||
|
|
||||||
FAR struct audio_lowerhalf_s *
|
FAR struct audio_lowerhalf_s *
|
||||||
wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s,
|
wm8904_initialize(FAR struct i2c_master_s *i2c, FAR struct i2s_dev_s *i2s,
|
||||||
FAR const struct wm8904_lower_s *lower);
|
FAR const struct wm8904_lower_s *lower);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -47,17 +47,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* If a dynamic timeout is selected, then a non-negative, non-zero micro-
|
|
||||||
* seconds per byte value must be provided as well.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_I2C_DYNTIMEO
|
|
||||||
# if CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE < 1
|
|
||||||
# warning "Ignoring CONFIG_STM32_I2C_DYNTIMEO because of CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE"
|
|
||||||
# undef CONFIG_STM32_I2C_DYNTIMEO
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* I2C address calculation. Convert 7- and 10-bit address to 8-bit and
|
/* I2C address calculation. Convert 7- and 10-bit address to 8-bit and
|
||||||
* 16-bit read/write address
|
* 16-bit read/write address
|
||||||
*/
|
*/
|
||||||
@@ -95,7 +84,7 @@
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the I2C frequency. This frequency will be retained in the struct
|
* Set the I2C frequency. This frequency will be retained in the struct
|
||||||
* i2c_dev_s instance and will be used with all transfers. Required.
|
* i2c_master_s instance and will be used with all transfers. Required.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - Device-specific state data
|
* dev - Device-specific state data
|
||||||
@@ -113,7 +102,7 @@
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the I2C slave address. This frequency will be retained in the struct
|
* Set the I2C slave address. This frequency will be retained in the struct
|
||||||
* i2c_dev_s instance and will be used with all transfers. Required.
|
* i2c_master_s instance and will be used with all transfers. Required.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - Device-specific state data
|
* dev - Device-specific state data
|
||||||
@@ -127,32 +116,6 @@
|
|||||||
|
|
||||||
#define I2C_SETADDRESS(d,a,n) ((d)->ops->setaddress(d,a,n))
|
#define I2C_SETADDRESS(d,a,n) ((d)->ops->setaddress(d,a,n))
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: I2C_SETOWNADDRESS
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Set our own I2C address. Calling this function enables Slave mode and
|
|
||||||
* disables Master mode on given instance (note that I2C is a bus, where
|
|
||||||
* multiple masters and slave may be handled by one device driver).
|
|
||||||
*
|
|
||||||
* One may register a callback to be notified about reception. During the
|
|
||||||
* slave mode reception, the function READ and WRITE must be used to
|
|
||||||
* to handle reads and writes from a master.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* dev - Device-specific state data
|
|
||||||
* address - Our own slave address; If it is 0x00, then the device driver
|
|
||||||
* listens to general call
|
|
||||||
* nbits - The number of address bits provided (7 or 10)
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* OK on valid address and if the same address has not been assigned
|
|
||||||
* to another instance sharing the same port. Otherwise ERROR is returned.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define I2C_SETOWNADDRESS(d,a,n) ((d)->ops->setownaddress(d,a,n))
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: I2C_WRITE
|
* Name: I2C_WRITE
|
||||||
*
|
*
|
||||||
@@ -222,25 +185,20 @@
|
|||||||
|
|
||||||
/* The I2C vtable */
|
/* The I2C vtable */
|
||||||
|
|
||||||
struct i2c_dev_s;
|
struct i2c_master_s;
|
||||||
struct i2c_msg_s;
|
struct i2c_msg_s;
|
||||||
struct i2c_ops_s
|
struct i2c_ops_s
|
||||||
{
|
{
|
||||||
uint32_t (*setfrequency)(FAR struct i2c_dev_s *dev, uint32_t frequency);
|
uint32_t (*setfrequency)(FAR struct i2c_master_s *dev, uint32_t frequency);
|
||||||
int (*setaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits);
|
int (*setaddress)(FAR struct i2c_master_s *dev, int addr, int nbits);
|
||||||
int (*write)(FAR struct i2c_dev_s *dev, FAR const uint8_t *buffer,
|
int (*write)(FAR struct i2c_master_s *dev, FAR const uint8_t *buffer,
|
||||||
int buflen);
|
int buflen);
|
||||||
int (*read)(FAR struct i2c_dev_s *dev, FAR uint8_t *buffer,
|
int (*read)(FAR struct i2c_master_s *dev, FAR uint8_t *buffer,
|
||||||
int buflen);
|
int buflen);
|
||||||
#ifdef CONFIG_I2C_TRANSFER
|
#ifdef CONFIG_I2C_TRANSFER
|
||||||
int (*transfer)(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs,
|
int (*transfer)(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s *msgs,
|
||||||
int count);
|
int count);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_I2C_SLAVE
|
|
||||||
int (*setownaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits);
|
|
||||||
int (*registercallback)(FAR struct i2c_dev_s *dev,
|
|
||||||
int (*callback)(FAR void *arg), FAR void *arg);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This structure contains the full state of I2C as needed for a specific
|
/* This structure contains the full state of I2C as needed for a specific
|
||||||
@@ -273,7 +231,7 @@ struct i2c_msg_s
|
|||||||
* add additional, device specific fields after the vtable.
|
* add additional, device specific fields after the vtable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct i2c_dev_s
|
struct i2c_master_s
|
||||||
{
|
{
|
||||||
const struct i2c_ops_s *ops; /* I2C vtable */
|
const struct i2c_ops_s *ops; /* I2C vtable */
|
||||||
};
|
};
|
||||||
@@ -296,7 +254,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Initialize the selected I2C port. And return a unique instance of struct
|
* Initialize the selected I2C port. And return a unique instance of struct
|
||||||
* struct i2c_dev_s. This function may be called to obtain multiple
|
* struct i2c_master_s. This function may be called to obtain multiple
|
||||||
* instances of the interface, each of which may be set up with a
|
* instances of the interface, each of which may be set up with a
|
||||||
* different frequency and slave address.
|
* different frequency and slave address.
|
||||||
*
|
*
|
||||||
@@ -308,7 +266,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct i2c_dev_s *up_i2cinitialize(int port);
|
FAR struct i2c_master_s *up_i2cinitialize(int port);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_i2cuninitialize
|
* Name: up_i2cuninitialize
|
||||||
@@ -325,7 +283,7 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int up_i2cuninitialize(FAR struct i2c_dev_s *dev);
|
int up_i2cuninitialize(FAR struct i2c_master_s *dev);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: up_i2creset
|
* Name: up_i2creset
|
||||||
@@ -336,7 +294,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s *dev);
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_I2C_RESET
|
#ifdef CONFIG_I2C_RESET
|
||||||
int up_i2creset(FAR struct i2c_dev_s *dev);
|
int up_i2creset(FAR struct i2c_master_s *dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -360,7 +318,7 @@ int up_i2creset(FAR struct i2c_dev_s *dev);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_I2C_TRANSFER
|
#ifdef CONFIG_I2C_TRANSFER
|
||||||
int i2c_writeread(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
|
int i2c_writeread(FAR struct i2c_master_s *dev, FAR const struct i2c_config_s *config,
|
||||||
FAR const uint8_t *wbuffer, int wbuflen,
|
FAR const uint8_t *wbuffer, int wbuflen,
|
||||||
FAR uint8_t *rbuffer, int rbuflen);
|
FAR uint8_t *rbuffer, int rbuflen);
|
||||||
#endif
|
#endif
|
||||||
@@ -385,7 +343,7 @@ int i2c_writeread(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *conf
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_I2C_TRANSFER
|
#ifdef CONFIG_I2C_TRANSFER
|
||||||
int i2c_write(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
|
int i2c_write(FAR struct i2c_master_s *dev, FAR const struct i2c_config_s *config,
|
||||||
FAR const uint8_t *buffer, int buflen);
|
FAR const uint8_t *buffer, int buflen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -409,7 +367,7 @@ int i2c_write(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_I2C_TRANSFER
|
#ifdef CONFIG_I2C_TRANSFER
|
||||||
int i2c_read(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
|
int i2c_read(FAR struct i2c_master_s *dev, FAR const struct i2c_config_s *config,
|
||||||
FAR uint8_t *buffer, int buflen);
|
FAR uint8_t *buffer, int buflen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mxt_register(FAR struct i2c_dev_s *i2c,
|
int mxt_register(FAR struct i2c_master_s *i2c,
|
||||||
FAR const struct mxt_lower_s *lower, int minor);
|
FAR const struct mxt_lower_s *lower, int minor);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ extern "C"
|
|||||||
STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev,
|
STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev,
|
||||||
FAR struct stmpe811_config_s *config);
|
FAR struct stmpe811_config_s *config);
|
||||||
#else
|
#else
|
||||||
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev,
|
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
|
||||||
FAR struct stmpe811_config_s *config);
|
FAR struct stmpe811_config_s *config);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int tsc2007_register(FAR struct i2c_dev_s *dev,
|
int tsc2007_register(FAR struct i2c_master_s *dev,
|
||||||
FAR struct tsc2007_config_s *config, int minor);
|
FAR struct tsc2007_config_s *config, int minor);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
FAR struct ioexpander_dev_s* pca9555_initialize(FAR struct i2c_dev_s *dev,
|
FAR struct ioexpander_dev_s* pca9555_initialize(FAR struct i2c_master_s *dev,
|
||||||
FAR struct pca9555_config_s *config);
|
FAR struct pca9555_config_s *config);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ struct spi_dev_s; /* See include/nuttx/spi/spi.h */
|
|||||||
#ifdef CONFIG_LCD_SSD1306_SPI
|
#ifdef CONFIG_LCD_SSD1306_SPI
|
||||||
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct spi_dev_s *dev, unsigned int devno);
|
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct spi_dev_s *dev, unsigned int devno);
|
||||||
#else
|
#else
|
||||||
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_dev_s *dev, unsigned int devno);
|
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_master_s *dev, unsigned int devno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************************
|
/************************************************************************************************
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ struct pca9635pw_setled_brightness_arg_s
|
|||||||
* Forward declarations
|
* Forward declarations
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct i2c_dev_s;
|
struct i2c_master_s;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
@@ -189,7 +189,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t const pca9635pw_i2c_addr);
|
uint8_t const pca9635pw_i2c_addr);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
@@ -381,13 +381,13 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *dev);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct i2c_dev_s; /* Forward reference */
|
struct i2c_master_s; /* Forward reference */
|
||||||
|
|
||||||
#ifdef CONFIG_AT24XX_MULTI
|
#ifdef CONFIG_AT24XX_MULTI
|
||||||
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev,
|
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev,
|
||||||
uint8_t address);
|
uint8_t address);
|
||||||
#else
|
#else
|
||||||
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev);
|
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
|
|||||||
@@ -217,9 +217,9 @@ int battery_charger_register(FAR const char *devpath,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_BQ2425X)
|
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_BQ2425X)
|
||||||
struct i2c_dev_s; /* Forward reference */
|
struct i2c_master_s; /* Forward reference */
|
||||||
|
|
||||||
FAR struct battery_charger_dev_s *bq2425x_initialize(FAR struct i2c_dev_s *i2c,
|
FAR struct battery_charger_dev_s *bq2425x_initialize(FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr,
|
uint8_t addr,
|
||||||
uint32_t frequency);
|
uint32_t frequency);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -198,9 +198,9 @@ int battery_gauge_register(FAR const char *devpath,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_MAX1704X)
|
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_MAX1704X)
|
||||||
struct i2c_dev_s; /* Forward reference */
|
struct i2c_master_s; /* Forward reference */
|
||||||
|
|
||||||
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_dev_s *i2c
|
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c
|
||||||
uint8_t addr,
|
uint8_t addr,
|
||||||
uint32_t frequency);
|
uint32_t frequency);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ struct adxl345_config_s
|
|||||||
|
|
||||||
typedef FAR void *ADXL345_HANDLE;
|
typedef FAR void *ADXL345_HANDLE;
|
||||||
|
|
||||||
struct i2c_dev_s;
|
struct i2c_master_s;
|
||||||
struct spi_dev_s;
|
struct spi_dev_s;
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@@ -361,7 +361,7 @@ extern "C"
|
|||||||
ADXL345_HANDLE adxl345_instantiate(FAR struct spi_dev_s *dev,
|
ADXL345_HANDLE adxl345_instantiate(FAR struct spi_dev_s *dev,
|
||||||
FAR struct adxl345_config_s *config);
|
FAR struct adxl345_config_s *config);
|
||||||
#else
|
#else
|
||||||
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_dev_s *dev,
|
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
|
||||||
FAR struct adxl345_config_s *config);
|
FAR struct adxl345_config_s *config);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct i2c_dev_s;
|
struct i2c_master_s;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
@@ -129,7 +129,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_dev_s *i2c,
|
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr);
|
uint8_t addr);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct i2c_dev_s;
|
struct i2c_master_s;
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
@@ -89,7 +89,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int bmp180_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c);
|
int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ struct lis331dl_vector_s
|
|||||||
int8_t z;
|
int8_t z;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct i2c_dev_s;
|
struct i2c_master_s;
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
@@ -100,7 +100,7 @@ struct i2c_dev_s;
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_dev_s * i2c,
|
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_master_s * i2c,
|
||||||
uint16_t address);
|
uint16_t address);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct i2c_dev_s;
|
struct i2c_master_s;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
@@ -131,7 +131,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
|
int lm75_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||||
uint8_t addr);
|
uint8_t addr);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user