Hi,
How to get this done using TWI this temperature sensor's I2C to write 16 bit register, it is sending start after device address then data. I tried as below, but it will send slave address again also tried sending all in one call but when read data that bit is not setting. Temperature reading is working fine, but I need to put that device in shut down mode.
static void AT30TS01_ShutDown(uint8_t on_off)
{
uint8_t lu8_Buf[2];
uint8_t lu8_Reg = AT30TS01_REG_CONFIG;
lu8_Buf[0] = 0x01;
lu8_Buf[1] = 0x00;
memset(lu8_Buf, 0, sizeof(lu8_Buf));
twi_write(AT30TS01_I2C_SLAVE_ADDRESS, &lu8_Reg, 1);
twi_write(AT30TS01_I2C_SLAVE_ADDRESS, &lu8_Buf[0], 2);
NRF_LOG_DEBUG("AT30TS01_ShutDown : %d\r\n", on_off);
}
Workaround I thought
lets just send that MSB byte of register in slave address but problem is that LCB bit i need to set to 1 and that bit used by I2C as read write bit and for write it is 0 so I am stuck :(
twi_write(AT30TS01_I2C_SLAVE_ADDRESS, &lu8_Reg, 1);
twi_write(lu8_Buf[0], &lu8_Buf[1], 1);
