Solved
Please help with porting this arduino library. I have to use HAL_I2C_Master_Transmit and HAL_I2C_Master_Receive to write to an i2c and I have no clue how to do.
I have this functions to work with:
void write8(uint8_t reg, uint32_t value)
read8(uint8_t reg)
I am a newbie when it comes to c programming and have little knowledge when it comes to registers and how to write and read them.
Right now the functions look something like this:
void Adafruit_TCS34725::write8(uint8_t reg, uint32_t value) {
uint8_t buffer[2] = {TCS34725_COMMAND_BIT | reg, value & 0xFF};
i2c_dev->write(buffer, 2);
}
uint8_t Adafruit_TCS34725::read8(uint8_t reg) {
uint8_t buffer[1] = {TCS34725_COMMAND_BIT | reg};
i2c_dev->write_then_read(buffer, 1, buffer, 1);
return buffer[0];
}Please help :(
