I'm using I2C in a project on STM32, and i was wondering what's the difference between HAL_I2C_Master_Transmit and HAL_I2C_mem_write, and the difference between HAL_I2C_Master_Receive and HAL_I2C_mem_read.
1 Answer
The MEM functios can directly read and write devices that have register address based access. They write the register addresss before reading or writing the register data. Most chips are like this. The non-MEM functions just do simple reads and writes.
-
4\$\begingroup\$ Adding on to your description: The non-MEM functions send start bit, slave I2C address, data, and stop bit. The MEM functions send start bit, slave I2C address, slave internal mem address, repeat start bit, data, and stop bit. \$\endgroup\$– kkramboFeb 7, 2020 at 15:43