Hi,
I tried to search first but could not find an answer.
I am trying to figure out how to read from LIS3MDL with a sub address using the "new" i2c_master lib, not the old legacy i2c.h and running on an esp32c6 device. Writing seems to work just by putting the register at index 0.
But how do I do a read? I need it to send the register address as the sub-address and then read the data.
i2c_master_receive(....
the i2c_master_transmit_receive seems to do a new start message and sending the address again before the read.
uint8_t data[2] = {0x05, 0x00};
// Works set the register address in data[0] and the data to be sent in data[1]
i2c_master_transmit(dev_handle, ®, 2, 1000 / 1);
Thanx in advance!
i2c_master.h
i2c_master.h
- Attachments
-
- i2c.jpg (296.71 KiB) Viewed 459 times
Who is online
Users browsing this forum: No registered users and 329 guests