summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-24 10:20:19 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-24 10:20:19 +0200
commitf6c24bc802f2cb5ec959a768b60dadc957f113cb (patch)
tree7052d5ad788702893e6002b3107dcd1883eeab0b /include
parent7dac0cccc846d4452293b47b40d43f6b50ebcc33 (diff)
I2C: Add support for manual / always-on gpio pullups
Diffstat (limited to 'include')
-rw-r--r--include/driver/soft_i2c.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/driver/soft_i2c.h b/include/driver/soft_i2c.h
index aff63e3..f3ba14f 100644
--- a/include/driver/soft_i2c.h
+++ b/include/driver/soft_i2c.h
@@ -6,6 +6,9 @@ class SoftI2C {
SoftI2C(const SoftI2C &copy);
unsigned char sda, scl;
+#if SOFTI2C_PULLUP_EXTERNAL || SOFTI2C_PULLUP_FIXED_GPIO
+ unsigned char sda_pull, scl_pull;
+#endif
void start();
void stop();
@@ -13,7 +16,13 @@ class SoftI2C {
unsigned char rx(bool send_ack);
public:
+#if SOFTI2C_PULLUP_EXTERNAL || SOFTI2C_PULLUP_FIXED_GPIO
+ SoftI2C(unsigned char sda, unsigned char scl,
+ unsigned char sda_pull, unsigned char scl_pull) :
+ sda(sda), scl(scl), sda_pull(sda_pull), scl_pull(scl_pull) {}
+#else
SoftI2C(unsigned char sda, unsigned char scl) : sda(sda), scl(scl) {}
+#endif
signed char setup();
void scan(unsigned int *results);
signed char xmit(unsigned char address,