Majid-Derhambakhsh / i2c-unit

Driver for working with I2C(TWI) unit of AVR microcontroller.
1 stars 1 forks source link

Library usage for slave mode #1

Open dmitrij9992905 opened 3 years ago

dmitrij9992905 commented 3 years ago

Comments in code are incomplete to describe I2C slave mode. It's only for master and work with EEPROM. However, there are setAddress function for slave mode. How to process master acquirings?

Majid-Derhambakhsh commented 3 years ago

Hello, I have not developed functions for slave mode in this library, I will add these features at the appropriate time but the required information and codes are included, you can use other functions and commands to use slave mode Or create your slave mode functions with these functions.

Control functions:

I2C_BeginTransmission();
I2C_ReceiveACK();
I2C_ReceiveNACK();

and other functions.

Response values: Slave Receiver

_SR_SLA_W_RECEIVED_ACK
_SR_SLA_RW_ARB_LOST
_SR_GEN_ADDR_RECEIVED_ACK
_SSR_SLA_RW_ARB_LOST_2
_SR_DATA_RECEIVED_SLA_ACK
_SR_DATA_RECEIVED_SLA_NACK
_SR_DATA_RECEIVED_GEN_ADDR_ACK
_SR_DATA_RECEIVED_GEN_ADDR_NACK
_SR_STOP_REP_START

Slave Transmitter

_ST_SLA_R_RECEIVED_ACK
_ST_SLA_RW_ARB_LOST
_ST_DATA_TRANSMITTED_ACK
_ST_DATA_TRANSMITTED_NACK
_ST_LAST_DATA_TRANSMITTED_ACK

README added in this repository