I've been looking through the twi_master_using_app_twi example and been trying to change things around for use with a TMP116 instead of a LM75b. I noticed from the LM75b's datasheet that the configuration register is only 8 bits and its default value is 0x00; however, in the TMP116, the configuration register is 16 bits and I would want to initialize it to 0x0624. In the lm75b.c file of the example application, the default_config is an array of 8-bit integers. If I want to replicate this for the TMP116, do I have to make the default_config an array of size 3 instead of 2?
I changed the lines of code to:
static uint8_t const default_config[] = { TMP116_REG_CONF, 0x06, 0x24 };
app_twi_transfer_t const tmp116_init_transfers[TMP116_INIT_TRANSFER_COUNT] =
{
APP_TWI_WRITE(TMP116_ADDR, default_config, sizeof(default_config), 0)
};
Where TMP116_REG_CNF is 0x01, TMP116_ADDR is (0x90U >> 1), and TMP116_INIT_TRANSFER_COUNT is 2 instead of 1. Do these changes make sense? I don't have a breakout board for the temperature sensor so I can't really test it at the minute.
For reference:
TMP116 Datasheet - http://www.ti.com/lit/ds/symlink/tmp116.pdf?&ts=1588943889698
LM75b Datasheet - https://www.nxp.com/docs/en/data-sheet/LM75B.pdf