|
|
| uint8_t i2c_slave_data_io |
( |
uint8_t * |
data, |
|
|
uint8_t * |
number_bytes, |
|
|
uint8_t |
command |
|
) |
| |
Sends or receives data from slave to master or vice versa via I2C. This function handles the communication with a master.
- Note
- The first byte transmitted from master to the slave sets the register address. After each read or write the pointer to the data registers will be incremented.
This function can be used in interrupt mode (in cooperation with the respective interrupt service routine in isr.c) or in polling mode with manual checks for a master access and the current state of the communication.
Depending on the mode (interrupt or polling) the function either will be called by the respective interrup service routine or must be called manually, when the master accesses the slave.
- Parameters
-
| [in] | data | array with data bytes:
[slave_address + Read/Write-Bit,
register address,
data byte,
data byte,
data byte ... ]
|
| [in] | number_bytes | number of data bytes in array read or written from master |
| [in] | command | specifies if slave mode is continued, stopped after complete transmission or aborted during the current transmission (see the definitions for the slave mode commands in i2c.h) |
- Date
- Created 16.05.2010
- Modified 16.05.2010
- See Also
- i2c.h, I2C_SLAVE_INTERRUPT_OPERATION, the interrupt service routine for the slave mode I2C communication in the file isr.c
- Returns
- I2C return codes for slave mode (see the respective part in i2c.h)
- Author
- Michael Skutek, micha.nosp@m.el@s.nosp@m.kutek.nosp@m..de
Definition at line 567 of file i2c.c.
Referenced by ISR().
|