23 #ifndef _DEV_I2C_SENSOR_LM75A_H 24 #define _DEV_I2C_SENSOR_LM75A_H 42 int i2c_dev_register_sensor_lm75a(
50 SENSOR_LM75A_SET_CONF,
51 SENSOR_LM75A_CLEAR_AND_SET_CONF,
52 SENSOR_LM75A_GET_TEMP,
55 SENSOR_LM75A_GET_THYST,
56 SENSOR_LM75A_SET_THYST
57 } sensor_lm75a_command;
59 static inline int sensor_lm75a_get_conf(
int fd, uint8_t *val)
61 return ioctl(fd, SENSOR_LM75A_GET_CONF, val);
64 static inline int sensor_lm75a_set_conf(
int fd, uint8_t val)
66 return ioctl(fd, SENSOR_LM75A_SET_CONF, (
void *)(uintptr_t) val);
69 static inline int sensor_lm75a_clear_and_set_conf(
75 uint16_t clear_and_set = (uint16_t) (((uint16_t)
set << 8) | clear);
79 SENSOR_LM75A_CLEAR_AND_SET_CONF,
80 (
void *)(uintptr_t) clear_and_set
84 static inline int sensor_lm75a_get_temp(
int fd, int16_t *val)
86 return ioctl(fd, SENSOR_LM75A_GET_TEMP, val);
89 static inline int sensor_lm75a_get_temp_celsius(
int fd,
double *celsius)
94 rv = ioctl(fd, SENSOR_LM75A_GET_TEMP, &val);
95 *celsius = (((int) val) >> 5) * 0.125;
99 static inline int sensor_lm75a_get_tos(
int fd, uint16_t *val)
101 return ioctl(fd, SENSOR_LM75A_GET_TOS, val);
104 static inline int sensor_lm75a_set_tos(
int fd, uint16_t val)
106 return ioctl(fd, SENSOR_LM75A_SET_TOS, (
void *)(uintptr_t) val);
109 static inline int sensor_lm75a_get_thyst(
int fd, uint16_t *val)
111 return ioctl(fd, SENSOR_LM75A_GET_THYST, val);
114 static inline int sensor_lm75a_set_thyst(
int fd, uint16_t val)
116 return ioctl(fd, SENSOR_LM75A_SET_THYST, (
void *)(uintptr_t) val);
#define I2C_DEV_IO_CONTROL
Base number for device IO control commands.
Definition: i2c.h:285
Inter-Integrated Circuit (I2C) Driver API.