Improvements to Olieman's MODI2C library. Supports calls from IRQ.
Dependents: FreeIMU FreeIMU_external_magnetometer FreeIMU
Fork of MODI2C by
Diff: MODI2C.cpp
- Revision:
- 2:22f93d992c83
- Parent:
- 1:eed116eb680a
diff -r eed116eb680a -r 22f93d992c83 MODI2C.cpp --- a/MODI2C.cpp Sat Nov 09 08:59:02 2013 +0000 +++ b/MODI2C.cpp Sun Nov 17 08:00:23 2013 +0000 @@ -160,7 +160,7 @@ void MODI2C::frequency(int hz) { //The I2C clock by default runs on quarter of system clock, which is 96MHz //So to calculate high/low count times, we do 96MHz/4/2/frequency - duty = 120000000/8/hz; + duty = SystemCoreClock/8/hz; if (duty>65535) duty=65535; if (duty<4)