36#ifndef _DEV_I2C_SENSOR_LM75A_H
37#define _DEV_I2C_SENSOR_LM75A_H
55int i2c_dev_register_sensor_lm75a(
63 SENSOR_LM75A_SET_CONF,
64 SENSOR_LM75A_CLEAR_AND_SET_CONF,
65 SENSOR_LM75A_GET_TEMP,
68 SENSOR_LM75A_GET_THYST,
69 SENSOR_LM75A_SET_THYST
70} sensor_lm75a_command;
72static inline int sensor_lm75a_get_conf(
int fd, uint8_t *val)
74 return ioctl(fd, SENSOR_LM75A_GET_CONF, val);
77static inline int sensor_lm75a_set_conf(
int fd, uint8_t val)
79 return ioctl(fd, SENSOR_LM75A_SET_CONF, (
void *)(uintptr_t) val);
82static inline int sensor_lm75a_clear_and_set_conf(
88 uint16_t clear_and_set = (uint16_t) (((uint16_t) set << 8) | clear);
92 SENSOR_LM75A_CLEAR_AND_SET_CONF,
93 (
void *)(uintptr_t) clear_and_set
97static inline int sensor_lm75a_get_temp(
int fd, int16_t *val)
99 return ioctl(fd, SENSOR_LM75A_GET_TEMP, val);
102static inline int sensor_lm75a_get_temp_celsius(
int fd,
double *celsius)
107 rv = ioctl(fd, SENSOR_LM75A_GET_TEMP, &val);
108 *celsius = (((int) val) >> 5) * 0.125;
112static inline int sensor_lm75a_get_tos(
int fd, uint16_t *val)
114 return ioctl(fd, SENSOR_LM75A_GET_TOS, val);
117static inline int sensor_lm75a_set_tos(
int fd, uint16_t val)
119 return ioctl(fd, SENSOR_LM75A_SET_TOS, (
void *)(uintptr_t) val);
122static inline int sensor_lm75a_get_thyst(
int fd, uint16_t *val)
124 return ioctl(fd, SENSOR_LM75A_GET_THYST, val);
127static inline int sensor_lm75a_set_thyst(
int fd, uint16_t val)
129 return ioctl(fd, SENSOR_LM75A_SET_THYST, (
void *)(uintptr_t) val);
Inter-Integrated Circuit (I2C) Driver API.
#define I2C_DEV_IO_CONTROL
Base number for device IO control commands.
Definition: i2c.h:342