Header file of LM75 Driver.
More...
#include "no_os_util.h"
#include "no_os_i2c.h"
|
| enum | lm75_register {
lm75_temperature_reg = 0x00
,
lm75_configuration_reg = 0x01
,
lm75_hyst_reg = 0x02
,
lm75_os_reg = 0x03
} |
| |
| enum | lm75_os_polarity {
lm75_os_active_low = 0
,
lm75_os_active_high
} |
| |
| enum | lm75_temperature_type {
lm75_die_temperature = 0
,
lm75_hysteresis_temperature
,
lm75_over_temperature
} |
| |
| enum | lm75_mode {
lm75_comparator_mode = 0
,
lm75_interrupt_mode
} |
| |
| enum | lm75_fault_queue {
lm75_1_fault = 0
,
lm75_2_fault
,
lm75_4_fault
,
lm75_6_fault
} |
| |
|
| 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.
|
| |
Header 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_ADDR_MASK
| #define LM75_ADDR_MASK 0xFFFF |
◆ LM75_CONFIG_FAULT_QUEUE
◆ LM75_CONFIG_INT_EN
◆ LM75_CONFIG_OS_POLARITY
◆ LM75_CONFIG_SHUTDOWN
◆ LM75_DEVICE_SIGNATURE
| #define LM75_DEVICE_SIGNATURE 0x7f4c4d75 |
◆ LM75_FRAME_SIZE
| #define LM75_FRAME_SIZE 3 |
◆ LM75_HW_ADDR
| #define LM75_HW_ADDR 0b1001000 |
◆ LM75_HYST_POR_VALUE
| #define LM75_HYST_POR_VALUE 0x4b00 |
◆ LM75_MAX_TEMP
| #define LM75_MAX_TEMP 125 |
◆ LM75_MAX_TEMP_MILLICEL
◆ LM75_MIN_TEMP
| #define LM75_MIN_TEMP -55 |
◆ LM75_MIN_TEMP_MILLICEL
◆ LM75_OS_POR_VALUE
| #define LM75_OS_POR_VALUE 0x5000 |
◆ LM75_SENSOR_DATA_MASK
| #define LM75_SENSOR_DATA_MASK 0xFF80 |
◆ LM75_TEMP_MASK
◆ lm75_fault_queue
| Enumerator |
|---|
| lm75_1_fault | |
| lm75_2_fault | |
| lm75_4_fault | |
| lm75_6_fault | |
◆ lm75_mode
| Enumerator |
|---|
| lm75_comparator_mode | |
| lm75_interrupt_mode | |
◆ lm75_os_polarity
| Enumerator |
|---|
| lm75_os_active_low | |
| lm75_os_active_high | |
◆ lm75_register
| Enumerator |
|---|
| lm75_temperature_reg | |
| lm75_configuration_reg | |
| lm75_hyst_reg | |
| lm75_os_reg | |
◆ lm75_temperature_type
| Enumerator |
|---|
| lm75_die_temperature | |
| lm75_hysteresis_temperature | |
| lm75_over_temperature | |
◆ 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.