I'm trying to modify a copy of the Wire library I copied into my Sketches folder but I'm confused on how / when class TWBRemulation is used. I wan't to add a 20 Khz (or close) I2C clock speed for a project I have that I have to deal with an I2C bus with 10 nF caps on the clock and data lines. That's way over what appears to be the maximum (400 pf) I found listed in a few places thus the need for a slow clock. The modules I am talking to are 20 years old and the caps are under a metal shield and can't be changed for a number of reasons.
I'm confused on when class TWBRemulation is called. inline operator int () const __attribute__((always_inline) appears to "return" 12 the cpu clock is a standard speed 4 mhz or higher else it "returns" 72.
TWBRemulation appears to use inline operator int () const __attribute__((always_inline) and sets the clock to 100 khz (about) if its 72 else its 400 khz (about).
I cant find where inline operator TWBRemulation is actually called so I'm not sure if I need to modify it or not. To get the speed I want I need to set I2C0_F to 0x3A (for 72 Mhz CPU clock) in TwoWire::setClock(uint32_t frequency).
Can I get away with just modifying WireKinetis.cpp TwoWire::setClock(uint32_t frequency) to add a 20khz option for 72 Mhz?
I'm confused on when class TWBRemulation is called. inline operator int () const __attribute__((always_inline) appears to "return" 12 the cpu clock is a standard speed 4 mhz or higher else it "returns" 72.
TWBRemulation appears to use inline operator int () const __attribute__((always_inline) and sets the clock to 100 khz (about) if its 72 else its 400 khz (about).
I cant find where inline operator TWBRemulation is actually called so I'm not sure if I need to modify it or not. To get the speed I want I need to set I2C0_F to 0x3A (for 72 Mhz CPU clock) in TwoWire::setClock(uint32_t frequency).
Can I get away with just modifying WireKinetis.cpp TwoWire::setClock(uint32_t frequency) to add a 20khz option for 72 Mhz?