summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-15 15:32:58 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-15 15:32:58 +0200
commit8402005b21f0b2debc4afd0eb1bcc2b7118948de (patch)
tree831af9035f3089fa221f9f43601c8be801261f3f /src
parenta00d69c60a66b997bad1351d0eb94cd50465d6b0 (diff)
adjust soft_i2c to recent infrastructure changes
Diffstat (limited to 'src')
-rw-r--r--src/driver/soft_i2c.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/driver/soft_i2c.cc b/src/driver/soft_i2c.cc
index 99a88aa..e69bd2c 100644
--- a/src/driver/soft_i2c.cc
+++ b/src/driver/soft_i2c.cc
@@ -2,6 +2,10 @@
#include "driver/gpio.h"
#include "arch.h"
+#ifndef F_I2C
+#define F_I2C 100000
+#endif
+
#ifdef SOFTI2C_TIMER
#ifdef TIMER_CYCLES
#error "SOFTI2C_TIMER and TIMER_CYCLES are mutually exclusive"
@@ -147,10 +151,6 @@ signed char SoftI2C::xmit(unsigned char address,
#else
-#ifndef F_I2C
-#define F_I2C 100000
-#endif
-
volatile unsigned char timer_done = 0;
inline void await_timer()
@@ -175,7 +175,7 @@ signed char SoftI2C::setup()
* timer.setup wants kHz and not Hz, so we have
* Timer Freq [kHz] = I2C Freq [Hz] * 2 / 1000
*/
- timer.setup(F_I2C / 500);
+ timer.setup_khz(F_I2C / 500);
return 0;
}
@@ -291,15 +291,14 @@ signed char SoftI2C::xmit(unsigned char address,
return 0;
}
-ON_TIMER_INTERRUPT
-{
+ON_TIMER_INTERRUPT_head
timer_done = 1;
-}
+ON_TIMER_INTERRUPT_tail
#endif
#ifdef MULTIPASS_ARCH_esp8266
-SoftI2C i2c(GPIO::d7, GPIO::d8);
+SoftI2C i2c(GPIO::d6, GPIO::d7);
#elif MULTIPASS_ARCH_arduino_nano
SoftI2C i2c(GPIO::pc4, GPIO::pc5);
#elif MULTIPASS_ARCH_blinkenrocket