Source file of LM75 Driver.
More...
#include <errno.h>
#include "no_os_alloc.h"
#include "lm75.h"
|
| struct | lm75_reg_permissions |
| |
|
| int | lm75_init (struct lm75_dev **devpp, struct lm75_init_param *ip) |
| | Initialize LM75 device driver.
|
| |
| int | lm75_remove (struct lm75_dev *dev) |
| | Uninitialize LM75 device driver.
|
| |
| int | lm75_read_temperature (struct lm75_dev *dev, enum lm75_temperature_type whence, uint16_t *val) |
| | Read temperature data.
|
| |
| int | lm75_write_temperature (struct lm75_dev *dev, enum lm75_temperature_type whence, uint16_t val) |
| | Write temperature data.
|
| |
| int | lm75_raw_to_millicelsius (const uint16_t raw_temp) |
| | Convert a raw sensor data to milliCelsius value.
|
| |
| uint16_t | lm75_millicelsius_to_raw (const int millicelsius) |
| | Convert a milliCelsius value to raw sensor data that can be written to an LM75 device.
|
| |
| int | lm75_is_shutdown (struct lm75_dev *dev, bool *flag) |
| | Read if LM75 is in shutdown or normal operation.
|
| |
| int | lm75_shutdown (struct lm75_dev *dev, bool flag) |
| | Put the LM75 into normal or shutdown operation.
|
| |
| int | lm75_read_mode (struct lm75_dev *dev, enum lm75_mode *mode) |
| | Read the event mode of LM75, whether interrupt based or comparator.
|
| |
| int | lm75_write_mode (struct lm75_dev *dev, enum lm75_mode mode) |
| | Change the event mode of LM75, whether interrupt based or comparator.
|
| |
| int | lm75_read_os_polarity (struct lm75_dev *dev, enum lm75_os_polarity *pol) |
| | Read the over temperature line polarity setting.
|
| |
| int | lm75_write_os_polarity (struct lm75_dev *dev, enum lm75_os_polarity pol) |
| | Write the polarity of the over temperature line.
|
| |
| int | lm75_read_fault_queue (struct lm75_dev *dev, enum lm75_fault_queue *fq) |
| | Read fault count.
|
| |
| int | lm75_write_fault_queue (struct lm75_dev *dev, enum lm75_fault_queue fq) |
| | Write fault count.
|
| |
Source file of LM75 Driver.
- Author
- Niel Acuna (niel..nosp@m.acun.nosp@m.a@ana.nosp@m.log..nosp@m.com)
Copyright 2025(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ lm75_init()
Initialize LM75 device driver.
Creates an LM75 device driver descriptor and puts the LM75 device into comparator mode initially.
- Parameters
-
| [out] | devpp | the newly create LM75 device descriptor. |
| [in] | ip | lm75 initialization parameter structure. |
- Returns
- 0 on success, negative value on error.
◆ lm75_is_shutdown()
Read if LM75 is in shutdown or normal operation.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [out] | flag | true shuts down the LM75. false puts the LM75 into normal operation. |
- Returns
- 0 in case of success
-
-ENODEV if dev is NULL
-
-EINVAL if flag is NULL
◆ lm75_millicelsius_to_raw()
| uint16_t lm75_millicelsius_to_raw |
( |
const int | millicelsius | ) |
|
Convert a milliCelsius value to raw sensor data that can be written to an LM75 device.
Used primarily to update hyst and over temperature.
- Parameters
-
| [in] | millicelsius | milliCelsius value to convert to raw sensor data. |
- Returns
- raw converted sensor value from millicelsius.
◆ lm75_raw_to_millicelsius()
| int lm75_raw_to_millicelsius |
( |
const uint16_t | raw_temp | ) |
|
Convert a raw sensor data to milliCelsius value.
- Parameters
-
| [in] | raw_temp | raw sensor data to convert to MilliCelsius. |
- Returns
- converted MilliCelsius value from raw sensor data.
◆ lm75_read_fault_queue()
Read fault count.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [out] | fq | buffer where fault queue number will be written. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ lm75_read_mode()
Read the event mode of LM75, whether interrupt based or comparator.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [out] | mode | buffer where mode will be written. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ lm75_read_os_polarity()
Read the over temperature line polarity setting.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [out] | pol | buffer where fault queue number will be written. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ lm75_read_temperature()
Read temperature data.
Used to read die, hysteresis and over temperature.
- Parameters
-
| [in] | dev | the LM75 device. |
| [in] | whence | the type of temperature to update, can be lm75_die_temperature, lm75_hysteresis_temperature or lm75_over_temperature. |
| [out] | val | raw sensor temperature data defined by whence parameter. |
- Returns
- 0 on success, negative value on error.
◆ lm75_remove()
| int lm75_remove |
( |
struct lm75_dev * | dev | ) |
|
Uninitialize LM75 device driver.
Put LM75 into shutdown (low power mode) and release resources back to system.
- Parameters
-
- Returns
- 0 on success, negative value on fail.
◆ lm75_shutdown()
Put the LM75 into normal or shutdown operation.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [in] | flag | true shuts down the LM75. false puts the LM75 into normal operation. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ lm75_write_fault_queue()
Write fault count.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [in] | fq | fault queue number. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ lm75_write_mode()
Change the event mode of LM75, whether interrupt based or comparator.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [in] | mode | either lm75_comparator_mode or lm75_interrupt_mode |
- Returns
- 0 in case of success, negative error code otherwise.
◆ lm75_write_os_polarity()
Write the polarity of the over temperature line.
- Parameters
-
| [in] | dev | The LM75 device structure. |
| [out] | pol | lm75_os_active_low or lm75_os_active_high. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ lm75_write_temperature()
Write temperature data.
Used to update hysteresis and over temperature. Die temperature is read-only.
- Parameters
-
| [in] | dev | the LM75 device. |
| [in] | whence | the type of temperature to update, can be either lm75_hysteresis_temperature or lm75_over_temperature only. |
| [in] | val | the raw sensor data to write. |
- Returns
- 0 on success, negative value on error.