// Write a 16-bit code to the LTC2943. int8_t LTC2943_write_16_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t code) // The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge. { int8_t ack; ack = i2c_write_word_data(i2c_address, adc_command, code); return(ack); }
int16_t parse_cmd_i2c_write_word_data(char *cmd, char *output, uint16_t len) { uint8_t cadr; uint8_t dadr; uint16_t data; sscanf_P(cmd, PSTR("%u %u %x"), &cadr, &dadr, &data); if (cadr < 7 || cadr > 127) return ECMD_ERR_PARSE_ERROR; uint16_t ret = i2c_write_word_data(cadr, dadr, data); #ifdef ECMD_MIRROR_REQUEST return ECMD_FINAL(snprintf_P(output, len, PSTR("i2c wwd %d %d 0x%02X"), cadr, dadr, ret)); #else return ECMD_FINAL(snprintf_P(output, len, PSTR("0x%02X"), ret)); #endif }