当前位置: 首页>>代码示例>>C++>>正文


C++ dev_to_iio_dev函数代码示例

本文整理汇总了C++中dev_to_iio_dev函数的典型用法代码示例。如果您正苦于以下问题:C++ dev_to_iio_dev函数的具体用法?C++ dev_to_iio_dev怎么用?C++ dev_to_iio_dev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dev_to_iio_dev函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ade7758_spi_write_reg_16

static int ade7758_spi_write_reg_16(struct device *dev, u8 reg_address,
				    u16 value)
{
	int ret;
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct ade7758_state *st = iio_priv(indio_dev);
	struct spi_transfer xfers[] = {
		{
			.tx_buf = st->tx,
			.bits_per_word = 8,
			.len = 3,
		}
	};
开发者ID:mdamt,项目名称:linux,代码行数:13,代码来源:ade7758_core.c

示例2: show_zone

static ssize_t show_zone(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	u8 zone;
	int ret;

	ret = lm3533_als_get_zone(indio_dev, &zone);
	if (ret)
		return ret;

	return scnprintf(buf, PAGE_SIZE, "%u\n", zone);
}
开发者ID:asmalldev,项目名称:linux,代码行数:13,代码来源:lm3533-als.c

示例3: show_prox_infrared_suppression

/* proximity scheme */
static ssize_t show_prox_infrared_suppression(struct device *dev,
					      struct device_attribute *attr,
					      char *buf)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct isl29018_chip *chip = iio_priv(indio_dev);

	/*
	 * return the "proximity scheme" i.e. if the chip does on chip
	 * infrared suppression (1 means perform on chip suppression)
	 */
	return sprintf(buf, "%d\n", chip->prox_scheme);
}
开发者ID:020gzh,项目名称:linux,代码行数:14,代码来源:isl29018.c

示例4: ms5611_i2c_read_prom_word

static int ms5611_i2c_read_prom_word(struct device *dev, int index, u16 *word)
{
	int ret;
	struct ms5611_state *st = iio_priv(dev_to_iio_dev(dev));

	ret = i2c_smbus_read_word_swapped(st->client,
			MS5611_READ_PROM_WORD + (index << 1));
	if (ret < 0)
		return ret;

	*word = ret;

	return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:14,代码来源:ms5611_i2c.c

示例5: adis16136_read_frequency

static ssize_t adis16136_read_frequency(struct device *dev,
	struct device_attribute *attr, char *buf)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct adis16136 *adis16136 = iio_priv(indio_dev);
	unsigned int freq;
	int ret;

	ret = adis16136_get_freq(adis16136, &freq);
	if (ret < 0)
		return ret;

	return sprintf(buf, "%d\n", freq);
}
开发者ID:03199618,项目名称:linux,代码行数:14,代码来源:adis16136.c

示例6: nau7802_show_scales

static ssize_t nau7802_show_scales(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	struct nau7802_state *st = iio_priv(dev_to_iio_dev(dev));
	int i, len = 0;

	for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++)
		len += scnprintf(buf + len, PAGE_SIZE - len, "0.%09d ",
				 st->scale_avail[i]);

	buf[len-1] = '\n';

	return len;
}
开发者ID:AK101111,项目名称:linux,代码行数:14,代码来源:nau7802.c

示例7: as3935_sensor_sensitivity_show

static ssize_t as3935_sensor_sensitivity_show(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{
	struct as3935_state *st = iio_priv(dev_to_iio_dev(dev));
	int val, ret;

	ret = as3935_read(st, AS3935_AFE_GAIN, &val);
	if (ret)
		return ret;
	val = (val & AS3935_AFE_MASK) >> 1;

	return sprintf(buf, "%d\n", val);
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:14,代码来源:as3935.c

示例8: ade7753_spi_read_reg_24

static int ade7753_spi_read_reg_24(struct device *dev,
				   u8 reg_address,
				   u32 *val)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct ade7753_state *st = iio_priv(indio_dev);
	int ret;
	struct spi_transfer xfers[] = {
		{
			.tx_buf = st->tx,
			.bits_per_word = 8,
			.len = 1,
		}, {
			.rx_buf = st->tx,
开发者ID:mdamt,项目名称:linux,代码行数:14,代码来源:ade7753.c

示例9: ms5611_spi_read_adc

static int ms5611_spi_read_adc(struct device *dev, s32 *val)
{
	int ret;
	u8 buf[3] = { MS5611_READ_ADC };
	struct ms5611_state *st = iio_priv(dev_to_iio_dev(dev));

	ret = spi_write_then_read(st->client, buf, 1, buf, 3);
	if (ret < 0)
		return ret;

	*val = (buf[0] << 16) | (buf[1] << 8) | buf[2];

	return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:14,代码来源:ms5611_spi.c

示例10: adis16400_read_frequency

static ssize_t adis16400_read_frequency(struct device *dev,
		struct device_attribute *attr,
		char *buf)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct adis16400_state *st = iio_priv(indio_dev);
	int ret;

	ret = st->variant->get_freq(st);
	if (ret < 0)
		return ret;

	return sprintf(buf, "%d.%.3d\n", ret / 1000, ret % 1000);
}
开发者ID:nahuelange,项目名称:yoda-kernel-H7-PLK-L01-MM,代码行数:14,代码来源:adis16400_core.c

示例11: kxcjk1013_get_samp_freq_avail

static ssize_t kxcjk1013_get_samp_freq_avail(struct device *dev,
					     struct device_attribute *attr,
					     char *buf)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct kxcjk1013_data *data = iio_priv(indio_dev);
	const char *str;

	if (data->chipset == KXTF9)
		str = kxtf9_samp_freq_avail;
	else
		str = kxcjk1013_samp_freq_avail;

	return sprintf(buf, "%s\n", str);
}
开发者ID:lfd,项目名称:PreemptRT,代码行数:15,代码来源:kxcjk-1013.c

示例12: show_int_time_available

static ssize_t show_int_time_available(struct device *dev,
				       struct device_attribute *attr, char *buf)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct isl29018_chip *chip = iio_priv(indio_dev);
	int i, len = 0;

	for (i = 0; i < ARRAY_SIZE(isl29018_int_utimes[chip->type]); ++i)
		len += sprintf(buf + len, "0.%06d ",
			       isl29018_int_utimes[chip->type][i]);

	buf[len - 1] = '\n';

	return len;
}
开发者ID:020gzh,项目名称:linux,代码行数:15,代码来源:isl29018.c

示例13: hmc5843_show_sampling_frequency

static ssize_t hmc5843_show_sampling_frequency(struct device *dev,
			struct device_attribute *attr, char *buf)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
	struct hmc5843_data *data = iio_priv(indio_dev);
	s32 rate;

	rate = i2c_smbus_read_byte_data(client, this_attr->address);
	if (rate < 0)
		return rate;
	rate = (rate & HMC5843_RATE_BITMASK) >> HMC5843_RATE_OFFSET;
	return sprintf(buf, "%s\n", data->variant->regval_to_sample_freq[rate]);
}
开发者ID:IIosTaJI,项目名称:linux-2.6,代码行数:15,代码来源:hmc5843.c

示例14: temp_show

static ssize_t temp_show(struct device *dev,
				  struct device_attribute *attr,
				  char *buf)
{
	struct mxc4005_data *data = iio_priv(dev_to_iio_dev(dev));
	unsigned int val;
	int ret;

	ret = regmap_read(data->regmap, MXC4005_REG_TEMP, &val);
	if (ret)
		dev_err(data->dev, "unable to read temp\n");


	return sprintf(buf, "temp=%d\n", val);
}
开发者ID:tinocyngn,项目名称:sofia-kernel,代码行数:15,代码来源:mxc4005.c

示例15: ade7758_spi_write_reg_8

int ade7758_spi_write_reg_8(struct device *dev, u8 reg_address, u8 val)
{
	int ret;
	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
	struct ade7758_state *st = iio_priv(indio_dev);

	mutex_lock(&st->buf_lock);
	st->tx[0] = ADE7758_WRITE_REG(reg_address);
	st->tx[1] = val;

	ret = spi_write(st->us, st->tx, 2);
	mutex_unlock(&st->buf_lock);

	return ret;
}
开发者ID:513855417,项目名称:linux,代码行数:15,代码来源:ade7758_core.c


注:本文中的dev_to_iio_dev函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。