I2c optimization and features (#321)

* custom delay
* Update comment
* add bus control status, add some missing include & fixed display output on sh1104 (#319)
* add some missing include
* Fixed display on SH1106
* Fix comment, add force sytem, rework flag, 16 bits data transfert
* Update all library with new I2C API
* custom delay
* Update comment, add bus control status
* fix i2c read + fix ds3231 temp + fix ssd1306 send
This commit is contained in:
Zaltora 2017-03-21 07:41:47 +01:00 committed by Ruslan V. Uss
parent 1575bac0c7
commit 813477aa8a
19 changed files with 418 additions and 335 deletions

View file

@ -14,11 +14,7 @@
static void read_data(uint8_t addr, uint8_t *buf, uint8_t size)
{
i2c_start();
i2c_write(addr << 1 | 1);
while (size--)
*(buf++) = i2c_read(!size);
i2c_stop();
i2c_slave_read(addr, NULL, buf, size);
}
bool mcp4725_eeprom_busy(uint8_t addr)
@ -45,7 +41,7 @@ void mcp4725_set_power_mode(uint8_t addr, mcp4725_power_mode_t mode, bool eeprom
value >> 4,
value << 4
};
i2c_slave_write(addr, data, 3);
i2c_slave_write(addr, &data[0], &data[1], 2);
}
uint16_t mcp4725_get_raw_output(uint8_t addr, bool eeprom)
@ -65,7 +61,7 @@ void mcp4725_set_raw_output(uint8_t addr, uint16_t value, bool eeprom)
value >> 4,
value << 4
};
i2c_slave_write(addr, data, 3);
i2c_slave_write(addr, &data[0], &data[1], 2);
}