void I2C_Transaction(uint8_t address, uint8_t* tx, uint8_t* rx, uint8_t txlen, uint8_t rxlen) { commandComplete = 0; I2C0_transfer(address << 1, tx, NULL, txlen, 0); while(!commandComplete); commandComplete = 0; I2C0_transfer(address << 1 | 1, NULL, rx, 0, rxlen); while(!commandComplete); }
void I2C_Transaction(uint8_t address, uint8_t* tx, uint8_t* rx, uint8_t txlen, uint8_t rxlen) { transferError = -1; commandComplete = 0; I2C0_transfer(address << 1, tx, &rx[1], txlen, rxlen); while (!commandComplete) ; rx[0] = transferError; }