Hello, I am using the LP-CC2652R7
I was writing code for a water pressure sensor that can change its baud rate. I will have the code repeat the write address for reading the pressure on the rope but I also need to set the baud rate for the Rope this is the code I have so far.
uint8_t writeReadRope[8] = {0x03, 0x00, 0x00, 0x00, 0x02, 0xCF, 0x91 };
uint8_t writeBuad[8] = {0x06, 0x00, 0x30, 0x04, 0x80, 0x82, 0xCF } ;
uint8_t readBuffer[8];
I2C_init();
Display_init();
GPIO_init();
GPIO_setConfig(Vp_EN, GPIO_CFG_OUT_STR_HIGH);
GPIO_setConfig(V5_EN, GPIO_CFG_OUT_STR_HIGH);
I2C_Params params;
I2C_Params_init(¶ms);
params.bitRate = I2C_100kHz;
I2C_Handle i2cHandle = I2C_open(SENSORS, ¶ms);
I2C_Transaction transaction = {0};
transaction.targetAddress = SENS_ADDR;
transaction.writeBuf = writeBuad;
transaction.writeCount = sizeof(writeBuad);
transaction.targetAddress = SENS_ADDR;
transaction.writeBuf = writeReadRope;
transaction.writeCount = sizeof(writeReadRope);
transaction.readBuf = readBuffer;
transaction.readCount = sizeof(readBuffer);
My one concern is would I need to clear the RXBuffer if I where to write the writeBuad into the TX buffer, in order to receive the read data from writeReadRope? Because the Sensor returns 8 bytes of data from querying writeBuad, would I need to receive the writeBuad data in a different RX buffer or is there a way to clear the RX buffer before writing the ReadRope to the TX?