本文整理汇总了C++中TEMP_FROM_REG函数的典型用法代码示例。如果您正苦于以下问题:C++ TEMP_FROM_REG函数的具体用法?C++ TEMP_FROM_REG怎么用?C++ TEMP_FROM_REG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TEMP_FROM_REG函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: show_temp_min_hyst
static ssize_t show_temp_min_hyst(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lm92_data *data = lm92_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[t_min])
+ TEMP_FROM_REG(data->temp[t_hyst]));
}
示例2: max1619_remote_crit
static void max1619_remote_crit(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results)
{
struct max1619_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0; /* magnitude */
else if (operation == SENSORS_PROC_REAL_READ) {
max1619_update_client(client);
results[0] = TEMP_FROM_REG(data->remote_max);
results[1] = TEMP_FROM_REG(data->remote_hyst);
*nrels_mag = 2;
} else if (operation == SENSORS_PROC_REAL_WRITE) {
if (*nrels_mag >= 1) {
data->remote_max = TEMP_TO_REG(results[0]);
i2c_smbus_write_byte_data(client,
MAX1619_REG_W_REMOTE_TMAX, data->remote_max);
}
if (*nrels_mag >= 2) {
data->remote_hyst = TEMP_TO_REG(results[1]);
i2c_smbus_write_byte_data(client,
MAX1619_REG_W_REMOTE_THYST, data->remote_hyst);
}
}
}
示例3: show_temp_hyst
static ssize_t show_temp_hyst(struct device *dev,
struct device_attribute *devattr, char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct lm92_data *data = lm92_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[attr->index])
- TEMP_FROM_REG(data->temp[t_hyst]));
}
示例4: show_temp_max
static ssize_t
show_temp_max(struct device *dev, struct device_attribute *attr, char *buf)
{
int index = to_sensor_dev_attr(attr)->index;
struct adm1025_data *data = adm1025_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[index]));
}
示例5: show_temp_offset
static ssize_t show_temp_offset(struct device *dev, struct device_attribute
*attr, char *buf)
{
struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
int nr = sensor_attr->index;
struct smsc47m192_data *data = smsc47m192_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_offset[nr]));
}
示例6: max1619_local_temp
static void max1619_local_temp(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results)
{
struct max1619_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0; /* magnitude */
else if (operation == SENSORS_PROC_REAL_READ) {
max1619_update_client(client);
results[0] = TEMP_FROM_REG(data->local_temp);
*nrels_mag = 1;
}
}
示例7: set_temp1_crit_hyst
static ssize_t set_temp1_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf,
size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct lm92_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10);
mutex_lock(&data->update_lock);
data->temp1_hyst = TEMP_FROM_REG(data->temp1_crit) - val;
i2c_smbus_write_word_data(client, LM92_REG_TEMP_HYST,
swab16(TEMP_TO_REG(data->temp1_hyst)));
mutex_unlock(&data->update_lock);
return count;
}
示例8: set_temp1_crit_hyst
static ssize_t set_temp1_crit_hyst(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct lm92_data *data = i2c_get_clientdata(client);
long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock);
data->temp1_hyst = TEMP_FROM_REG(data->temp1_crit) - val;
i2c_smbus_write_word_swapped(client, LM92_REG_TEMP_HYST,
TEMP_TO_REG(data->temp1_hyst));
mutex_unlock(&data->update_lock);
return count;
}
示例9: set_temp_hyst
static ssize_t set_temp_hyst(struct device *dev,
struct device_attribute *devattr,
const char *buf, size_t count)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct lm92_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
long val;
int err;
err = kstrtol(buf, 10, &val);
if (err)
return err;
mutex_lock(&data->update_lock);
data->temp[t_hyst] = TEMP_FROM_REG(data->temp[attr->index]) - val;
i2c_smbus_write_word_swapped(client, LM92_REG_TEMP_HYST,
TEMP_TO_REG(data->temp[t_hyst]));
mutex_unlock(&data->update_lock);
return count;
}
示例10: show_temp_hyst
static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *da,
char *buf)
{
struct lm78_data *data = lm78_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst));
}