I have been googling diligently for a couple of days trying to figure this out, and if anyone has already done it and has code I can steal, that would be a big time-saver ... the focus of my project is not i2c development, I just thought I would use i2c as a comm bus between duinos.
I have a need (and googling tells me I am not the first to face this challenge) for a master and slave duino to share some data, with the master writing some elements of a struct and the slave writing others. (It is just fine for the master to control the timing, i.e. write to the slave and request from the slave. There is no need for a "2 master" bus which I gather is complicated and not robust.)
I used the EasyTransfer library initially, when the communication was 1-way, and it works like a charm! Super easy to set up and use. But it seems to be unidirectional, i.e. master sends, slave receives. I have found breadcrumbs here and there indicating that people have tried to modify it to be bidirectional, but never found an actual downloadable file for a 2-way version.
Unf my C programming skills are not quite up to modifying ET myself; I looked at the source code and immediately saw syntax I didn't recognise -- scary! I'd rather not get into a big side project of learning more advanced C and modifying this (excellent!) library, so I was hoping that someone else had already done so & would be willing to share.
What I was hoping for was basically EasyTransfer with one extra command (on the master side): ET.request(SlaveAddress), with a respond-to-request ISR on the slave side that does an ET.send of the shared data.
Alternatively if there is a hardware way to do this -- if there is maybe an IC that can be used as a "drop box" between two duinos so that each can write values to it and read from it, using a shared struct definition, I'd be interested in that option also.