Page 1 of 1

New MCC i2c code no write CMD, why?

PostPosted: Thu Oct 08, 2020 7:09 am
by jlian168
Dear All :

void I2C2_Write1ByteRegister(i2c2_address_t address, uint8_t reg, uint8_t data)
{
while(!I2C2_Open(address)); // sit here until we get the bus..
I2C2_SetDataCompleteCallback(wr1RegCompleteHandler,&data);
I2C2_SetBuffer(&reg,1);
I2C2_SetAddressNackCallback(NULL,NULL); //NACK polling?
I2C2_MasterWrite();
while(I2C2_BUSY == I2C2_Close()); // sit here until finished.
}

How can I to change to can write CMD? like below...
void I2C2_Write1ByteRegister(i2c2_address_t address, uint8_t reg);

Thank u.