diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-10-24 10:20:19 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-10-24 10:20:19 +0200 |
commit | f6c24bc802f2cb5ec959a768b60dadc957f113cb (patch) | |
tree | 7052d5ad788702893e6002b3107dcd1883eeab0b /include | |
parent | 7dac0cccc846d4452293b47b40d43f6b50ebcc33 (diff) |
I2C: Add support for manual / always-on gpio pullups
Diffstat (limited to 'include')
-rw-r--r-- | include/driver/soft_i2c.h | 9 |
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 ©); 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, |