I have two arduinos intercepting events. They have to deliver these events to a raspberry pi. According to my understanding of the I2C protocol, the RPi must be configured as slave, and the two arduinos as masters. Now, the problems are the following:
- it is my understanding that RPi cannot be used as a I2C slave. See here, and here but these posts are old. Is it still like this in the latest RPi kernel?
- Since I have to receive events from two masters, how would that work? specifically:
- what happens if the two masters transmit on the same bus at the same time?
- coding wise, how is the raspberry pi going to listen to these events? can it differentiate the two masters as two independent origins? Or should I have two independent I2C buses?
- how can the RPi react to events. Can I register a handler, or should I read in blocking mode and have two threads (one per each bus) or one thread (if one bus) wait for something to come in?
- Considering my use case, would SPI be better?