write a wire.cpp signal on digital out (pin) ?


I would to write on one digital output a signal from arduino library (wire.cpp) , I have an arduino design with an udp communication and i2c master manager. In my arduino design i need in [u]real time[/u] to write on a digital output the signal transmitting (uint8_t TwoWire::transmitting = 0;) from wire.cpp.

Thank you for your help

The transmission-flag is set at the beginning of beginTransmission() and cleared at the end of endTransmission(). So you can control the pin that you want to control just before the call to beginTransmission end just after the call to endTransmission.

Real time is always a big word; do the few microseconds actually matter? What do you want to achieve?

If it's important, you can modify the above two functions and use direct port manipulation; direct port manipulation because it mostly removes the overhead of digitalWrite to make it more 'real time' (at the possible cost of being micro-controller independent).

Hello Sterretje,

I trying to explain exactly what do i want !
My arduino design in i2c master send and read data from arduino i2c slave. But i need a hardware digital (enable) signal synchronous on clock i2c SCL. This signal stay low when i2c slave drive SDA and stay high when i2c master drive SDA.
This signal will remote enable level shift RS485 buffer on i2c wire. These explain the word real time.


Have you considered a bi-directional level shifter specifically made for connecting 3.3V I2C devices with 5.0V I2C devices: https://www.adafruit.com/product/757

the RS485 is a harware level protocol it's a project requirement

Ahhh…so you’re trying to run I2C protocol over RS485 physical layer? A somewhat non-standard configuration. You are now what I like to call an “unpaid test pilot”.