aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/i2c.c')
-rw-r--r--libmaple/i2c.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libmaple/i2c.c b/libmaple/i2c.c
index 0e6a64c..3c92bef 100644
--- a/libmaple/i2c.c
+++ b/libmaple/i2c.c
@@ -120,29 +120,29 @@ void i2c_bus_reset(const i2c_dev *dev) {
* Make sure the bus is free by clocking it until any slaves release the
* bus.
*/
- while (!gpio_read_bit(dev->gpio_port, dev->sda_pin)) {
+ while (!gpio_read_bit(sda_port(dev), dev->sda_pin)) {
/* Wait for any clock stretching to finish */
- while (!gpio_read_bit(dev->gpio_port, dev->scl_pin))
+ while (!gpio_read_bit(scl_port(dev), dev->scl_pin))
;
delay_us(10);
/* Pull low */
- gpio_write_bit(dev->gpio_port, dev->scl_pin, 0);
+ gpio_write_bit(scl_port(dev), dev->scl_pin, 0);
delay_us(10);
/* Release high again */
- gpio_write_bit(dev->gpio_port, dev->scl_pin, 1);
+ gpio_write_bit(scl_port(dev), dev->scl_pin, 1);
delay_us(10);
}
/* Generate start then stop condition */
- gpio_write_bit(dev->gpio_port, dev->sda_pin, 0);
+ gpio_write_bit(sda_port(dev), dev->sda_pin, 0);
delay_us(10);
- gpio_write_bit(dev->gpio_port, dev->scl_pin, 0);
+ gpio_write_bit(scl_port(dev), dev->scl_pin, 0);
delay_us(10);
- gpio_write_bit(dev->gpio_port, dev->scl_pin, 1);
+ gpio_write_bit(scl_port(dev), dev->scl_pin, 1);
delay_us(10);
- gpio_write_bit(dev->gpio_port, dev->sda_pin, 1);
+ gpio_write_bit(sda_port(dev), dev->sda_pin, 1);
}
/**