I in a sense want to combine an analogue output from a sensor and another sensor which is i2c into one sensor using an attiny.
The reason for this is those two sensors are part of a highly specialised module for my project and I would like to take their data and process it and plot it over time until my main bus decides to request the data to store or be used in its own application.
The primary bus is i2c and has a multimaster system that changes masters between two (aux master and the core master) depending on the needs of the primary master as it has many other processes it handles.
So having the attiny become a master does not seem practical because if the primary master and the tiny want to communicate at the same time the primary master may miss its window to communicate with the other device it wants to.
I essentially want the attiny to master only one i2c device and read from an analogue device to receive information from them and then act as its own separate i2c device able to communicate the processed data when requested by the primary bus.
I have come up with two ideas, however im not sure which if either are actually possible or practical.
First i could have the Attiny run as an i2c master on two pins to request the data occasionally from the sensor and then immediately switch to a slave on two separate pins to await a request and in the meantime it processes the data.
A problem i can see is during the master portion the sensor will miss requests by the bus and be inaccessible.
The other solution is using a library I found called tinywire that is a composite master/slave library and will function on the same pins but the problem is that as a master the tiny will control the aux bus blocking its use from other masters and I'm not sure if the library includes functionality for an i2c request data from a composite master/slave.
Are there other solutions I am not seeing?