예제 #1
0
int mir3da_register_read_continuously( unsigned char addr, unsigned char count, unsigned char *data)
{
    int     res = 0;

    res = (count==i2c_read_block_data(addr, count, data)) ? 0 : 1;
    if(res != 0) {
        return res;
    }

    return res;
}
예제 #2
0
// Reads a 24-bit adc_code from LTC2992
int8_t LTC2992_read_24_bits(uint8_t i2c_address, uint8_t adc_command, uint32_t *adc_code)
// The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack;

  LT_union_int32_4bytes data;

  ack = i2c_read_block_data(i2c_address, adc_command, (uint8_t)3, data.LT_byte);

  *adc_code = 0x0FFFFFF & data.LT_int32;
  return(ack);
}
int ami304_i2c_read(u8 RegAddr, u8 *RegValue, u8 len) {
	int Ret;
	struct i2c_client *client = g_ami304_data->client;

	if (client == NULL) {
		printk("%s - no client initialized\n", __FUNCTION__);
		return -1;
	}

	Ret = i2c_read_block_data(client, DEVICE_I2C_ADDRESS_SIZE_1BYTE, len, RegAddr, RegValue);

	if (Ret < 0) {
		printk("%s - failed \n", __FUNCTION__);
		return -1;
	}
	
	return 0;
}