mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
Add I2C Slave driver
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
6114c0b948
commit
f4a234613e
@@ -30,6 +30,10 @@ if(CONFIG_I2C)
|
||||
list(APPEND SRCS i2c_bitbang.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_I2C_SLAVE_DRIVER)
|
||||
list(APPEND SRCS i2c_slave_driver.c)
|
||||
endif()
|
||||
|
||||
# Include the selected I2C multiplexer drivers
|
||||
|
||||
if(CONFIG_I2CMULTIPLEXER_PCA9540BDP)
|
||||
|
||||
@@ -24,6 +24,30 @@ config I2C_SLAVE
|
||||
bool "I2C Slave"
|
||||
default n
|
||||
|
||||
menu "I2C Slave Support"
|
||||
|
||||
config I2C_SLAVE_DRIVER
|
||||
bool "I2C Slave driver"
|
||||
default n
|
||||
---help---
|
||||
Enable I2C Slave driver
|
||||
|
||||
config I2C_SLAVE_READBUFSIZE
|
||||
int "I2C Slave driver read buffer size"
|
||||
default 32
|
||||
depends on I2C_SLAVE_DRIVER
|
||||
---help---
|
||||
I2C Slave read buffer size
|
||||
|
||||
config I2C_SLAVE_WRITEBUFSIZE
|
||||
int "I2C Slave driver write buffer size"
|
||||
default 32
|
||||
depends on I2C_SLAVE_DRIVER
|
||||
---help---
|
||||
I2C Slave write buffer size
|
||||
|
||||
endmenu # I2C Slave Support
|
||||
|
||||
config I2C_POLLED
|
||||
bool "Polled I2C (no interrupts)"
|
||||
default n
|
||||
|
||||
@@ -32,6 +32,10 @@ ifeq ($(CONFIG_I2C_BITBANG),y)
|
||||
CSRCS += i2c_bitbang.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C_SLAVE_DRIVER),y)
|
||||
CSRCS += i2c_slave_driver.c
|
||||
endif
|
||||
|
||||
# Include the selected I2C multiplexer drivers
|
||||
|
||||
ifeq ($(CONFIG_I2CMULTIPLEXER_PCA9540BDP),y)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -223,6 +223,33 @@ extern "C"
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C_SLAVE_DRIVER
|
||||
|
||||
/****************************************************************************
|
||||
* Name: i2c_slave_register
|
||||
*
|
||||
* Description:
|
||||
* Register the I2C Slave character device driver as 'devpath'.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - An instance of the I2C Slave interface to use to communicate
|
||||
* with the I2C Slave device
|
||||
* bus - The I2C Slave bus number. This will be used as the I2C device
|
||||
* minor number. The I2C Slave character device will be
|
||||
* registered as /dev/i2cslvN where N is the minor number
|
||||
* addr - I2C Slave address
|
||||
* nbits - The number of address bits provided (7 or 10)
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int i2c_slave_register(FAR struct i2c_slave_s *dev, int bus, int addr,
|
||||
int nbit);
|
||||
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user