From f6c24bc802f2cb5ec959a768b60dadc957f113cb Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 24 Oct 2018 10:20:19 +0200 Subject: I2C: Add support for manual / always-on gpio pullups --- include/driver/soft_i2c.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') 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 ©); 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, -- cgit v1.2.3