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:
parent
1575bac0c7
commit
813477aa8a
19 changed files with 418 additions and 335 deletions
|
@ -55,7 +55,7 @@ const float ads111x_gain_values[] = {
|
|||
static uint16_t read_reg(uint8_t addr, uint8_t reg)
|
||||
{
|
||||
uint16_t res = 0;
|
||||
if (!i2c_slave_read(addr, reg, (uint8_t *)&res, 2))
|
||||
if (i2c_slave_read(addr, ®, (uint8_t *)&res, 2))
|
||||
debug("Could not read register %d", reg);
|
||||
//debug("Read %d: 0x%04x", reg, res);
|
||||
return res;
|
||||
|
@ -64,8 +64,8 @@ static uint16_t read_reg(uint8_t addr, uint8_t reg)
|
|||
static void write_reg(uint8_t addr, uint8_t reg, uint16_t val)
|
||||
{
|
||||
//debug("Write %d: 0x%04x", reg, val);
|
||||
uint8_t buf[3] = {reg, val >> 8, val};
|
||||
if (!i2c_slave_write(addr, buf, 3))
|
||||
uint8_t buf[2] = { val >> 8, val};
|
||||
if (i2c_slave_write(addr, ®, buf, 2))
|
||||
debug("Could not write 0x%04x to register %d", val, reg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue