mirror of
https://github.com/utkumaden/esp-idf-ds3231.git
synced 2025-01-23 04:56:32 +01:00
Fix multiple byte writes.
This commit is contained in:
parent
7849f31d8e
commit
0049e6381b
@ -34,11 +34,11 @@ esp_err_t ds3231_io_write(i2c_port_t port, uint8_t addr, const void *data, size_
|
|||||||
|
|
||||||
if ((cmd = i2c_cmd_link_create()))
|
if ((cmd = i2c_cmd_link_create()))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < sz; ++ i)
|
for (int i = 0; i < sz; ++i)
|
||||||
{
|
{
|
||||||
i2c_master_start(cmd);
|
i2c_master_start(cmd);
|
||||||
i2c_master_write_byte(cmd, DS3231_ADDR | I2C_MASTER_WRITE, true);
|
i2c_master_write_byte(cmd, DS3231_ADDR | I2C_MASTER_WRITE, true);
|
||||||
i2c_master_write_byte(cmd, addr, true);
|
i2c_master_write_byte(cmd, addr + i, true);
|
||||||
i2c_master_write_byte(cmd, ((uint8_t*)data)[i], true);
|
i2c_master_write_byte(cmd, ((uint8_t*)data)[i], true);
|
||||||
}
|
}
|
||||||
i2c_master_stop(cmd);
|
i2c_master_stop(cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user