Commit 61ff5bbb authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

softi2c: Work around MSP430 timing issues with softi2c_timer=1

parent 3e884d67
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -176,6 +176,15 @@ signed char SoftI2C::xmit(unsigned char address,

volatile unsigned char timer_done = 0;

/*
 * Note: On MSP430, if F_CPU / F_I2C < 60 (approx.), await_timer() does not
 * work.  Probably related to missed interrupts / not enough cycles between
 * start and idle?  We work around this for now by simulating an immediate
 * return in these cases.
 */
#if MULTIPASS_ARCH_msp430fr5969lp && ((F_CPU / F_I2C) < 60)
inline void await_timer() {}
#else
inline void await_timer()
{
	timer_done = 0;
@@ -185,6 +194,7 @@ inline void await_timer()
	}
	timer.stop();
}
#endif

signed char SoftI2C::setup()
{