I don't understand how to use the HAL_I2C_Master_Transmit function. RTC DS3231
I am using I2C to transfer data from STM32F4 to DS3231 Real Time Clock registers.
HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
*hi2c - I2C structure
DevAddress - Device address
*pData - I don't understand this parameter.
It is written on the Internet that this is a pointer for data, but this pointer is used to transfer the register address in the Slave device.
Size - data size in Bytes.
What parameter should the data be passed?
I can use the HAL_I2C_Mem_Write function. This function has a parameter for data transfer.
This parameter is also called *pData
HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
int main()
{
uint8_t RegisterAddress=0x0;
HAL_I2C_Master_Transmit(&hi2c1, 0xD0, &RegisterAddress, 1, 1000 );
}
I think that something is wrong with the &RegisterAddress parameter, but I don’t understand how it will be right.
As a result, I need to write data to the I2C Slave Device at the address I chose.


