The I2C HAL API should allow you to define 8 or 16-bit wide addressing, and you can read multiple bytes. Registers in slaves typically auto-increment, such that you read 16-bit values as consecutive bytes, and recombine them, often in big-endian form
uint16_t ublox_ReadLength(void)
{
uint8_t data[2];
HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&I2CHandle, (0x42 << 1), 0xFD, 1, data, sizeof(data), 100);
if (status != HAL_OK)
printf("ublox_ReadLength failed %d %08X\n", status, I2CHandle.ErrorCode);
return(((uint16_t)data[0] << 8) + (uint16_t)data[1]); // Big Endian
}
The 0xFD register in this case being 1-byte (8-bit) and the data content 2-bytes (16-bit)
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..