Driver for the LM75 temperature sensor. More...
Driver for the LM75 temperature sensor.
Definition in file lm75.h.
Go to the source code of this file.
Data Structures | |
struct | lm75_properties |
temperature reading properties/resolutions struct of the LM75 sensors More... | |
struct | lm75_params |
params required for initialization More... | |
struct | lm75 |
lm75 device descriptor More... | |
LM75 return values | |
enum | { LM75_SUCCESS = 0 , LM75_ERROR_I2C , LM75_ERROR } |
typedef struct lm75_properties | lm75_properties_t |
temperature reading properties/resolutions struct of the LM75 sensors | |
typedef struct lm75_params | lm75_params_t |
params required for initialization | |
typedef struct lm75 | lm75_t |
lm75 device descriptor | |
lm75_properties_t | lm75a_properties |
declaration present in lm75.c | |
lm75_properties_t | tmp1075_properties |
declaration present in lm75.c | |
int | lm75_init (lm75_t *dev, const lm75_params_t *params) |
Initialization of the LM75 sensor. | |
int | lm75_get_temperature_raw (lm75_t *dev, int *temperature) |
Temperature values of LM75 sensor. | |
int | lm75_get_temperature (lm75_t *dev, int *temperature) |
Temperature values of LM75 sensor. | |
int | lm75_set_temp_limits (lm75_t *dev, int temp_hyst, int temp_os, gpio_cb_t cb, void *arg) |
Sets the values for Overtemperature shutdown(OS) and Hysteresis temperature(HYST). | |
int | lm75_get_os_temp (lm75_t *dev, int *temperature) |
Overshutdown temperature value of LM75 sensor. | |
int | lm75_get_hyst_temp (lm75_t *dev, int *temperature) |
Hysteresis temperature value of LM75 sensor. | |
int | lm75_get_os_pin (lm75_t *dev, bool *os_pin_state) |
Read the current state of the OS pin to see if it's active. | |
int | lm75_poweroff (lm75_t *dev) |
Activate the LM75 sensor shutdown mode. | |
int | lm75_poweron (lm75_t *dev) |
Deactivate the LM75 sensor shutdown mode. | |
int | tmp1075_one_shot (lm75_t *dev) |
Activates one shot conversion mode. | |
int | lm75_low_power_mode (lm75_t *dev, uint16_t interval) |
Activates low power mode operation. | |
int lm75_get_hyst_temp | ( | lm75_t * | dev, |
int * | temperature | ||
) |
Hysteresis temperature value of LM75 sensor.
Reads the sensor hysteresis temperature value from THYST_REG in ºC.
[in] | dev | device structure |
[out] | temperature | buffer where HYST temperature value will be written |
int lm75_get_os_pin | ( | lm75_t * | dev, |
bool * | os_pin_state | ||
) |
Read the current state of the OS pin to see if it's active.
Read the configuration register to see the OS pin's polarity and then reads its state. Then outputs if the pin is active and whether it's in the low and active or high and active.
[in] | dev | device structure |
[out] | os_pin_state | pointer to the state of the OS pin - 0 for inactive and 1 for active |
int lm75_get_os_temp | ( | lm75_t * | dev, |
int * | temperature | ||
) |
Overshutdown temperature value of LM75 sensor.
Reads the sensor OS temperature value from TOS_REG in ºC.
[in] | dev | device structure |
[out] | temperature | buffer where OS temperature value will be written |
int lm75_get_temperature | ( | lm75_t * | dev, |
int * | temperature | ||
) |
Temperature values of LM75 sensor.
Gets the device's temperature register with the lm75_get_temperature_raw function and then returns the values in mºC, truncating values smaller than this, if available
[in] | dev | device structure |
[in] | temperature | buffer where temperature value will be written in mºC |
int lm75_get_temperature_raw | ( | lm75_t * | dev, |
int * | temperature | ||
) |
Temperature values of LM75 sensor.
Reads the sensor temperature values from TEMP_REG the value is given with the full precision the device is capable of If divided by the device's mult property, the result will be the temperature in ºC and the remainder of that division will be the decimal part of the temperature, at the maximum resolution the device is capable of.
[in] | dev | device structure |
[in] | temperature | buffer where temperature value will be written |
int lm75_init | ( | lm75_t * | dev, |
const lm75_params_t * | params | ||
) |
Initialization of the LM75 sensor.
Initializes the sensor according to specific input parameters.
[out] | dev | device structure to initialize |
[in] | params | initialization parameters |
int lm75_low_power_mode | ( | lm75_t * | dev, |
uint16_t | interval | ||
) |
Activates low power mode operation.
This function makes the device measure temperatures in a strictly discrete way at a user definable rate, as opposed to performing continuous measurements at the device's conversion rate. It allows the device to stay in shutdown mode for the most part, therefore consuming less power. In the tmp1075 and other devices which have the one shot feature this is done automatically. In the LM75A sensor nd other sensors which lack the one shot mode feature this is done manually by switching the device to and from shutdown mode and staying awake at least long enough to perform one ne measurement.
[in] | dev | device structure |
[in] | interval | time interval in ms between measurements |
int lm75_poweroff | ( | lm75_t * | dev | ) |
Activate the LM75 sensor shutdown mode.
[in] | dev | device structure to set into shutdown mode |
int lm75_poweron | ( | lm75_t * | dev | ) |
Deactivate the LM75 sensor shutdown mode.
[in] | dev | device structure to wake up from shutdown mode |
Sets the values for Overtemperature shutdown(OS) and Hysteresis temperature(HYST).
OS gives the temperature's higher bound and HYST the lower bound values are rounded to the lowest value that the device supports,
[in] | dev | device structure |
[in] | temp_os | desired OS temperature in mºC |
[in] | temp_hyst | desired HYST temperature in mºC |
[in] | cb | callback that is called from interrupt context |
[in] | *arg | optional arguments for the gpio_init_int function |
int tmp1075_one_shot | ( | lm75_t * | dev | ) |
Activates one shot conversion mode.
Wakes from shutdown mode, does a single temperature conversion and writes in into the temperature register and then goes back into shutdown
[in] | dev | device structure |