4 Replies Latest reply on Jul 9, 2020 10:42 AM by FlHe_4723206

    Set register prior to I2C_MasterWriteBuf


      uint8 writeRegister8(uint8 i2c_address, uint8 reg, uint8 data){




                  return I2C_MasterSendStop();



                  return 1;



              return 99u; //placeholder




      with the loop in my main code being:



          for(uint8 i=0; i<BUF_LENGTH; i++){

              status = writeRegister8(i2c_address, PWM_REGISTER+i,gamma32[brightness]);



      I want to replace the loop+function call with I2C_MasterWriteBuf function. However, I2C_MasterWriteBuf does not have a register field. I have tried all sorts of combinations of writing register address first as a byte, restarting the bus, stopping and starting again, writing the buffer directly after setting the register address... Nothing works in terms of that the slave device never gets the right values.


      Basic question is: How do I use


      in an intended way when I need to set a register to write to first?