![]() |
no-OS
|
Header file of LM75 Driver. More...
Go to the source code of this file.
Classes | |
| struct | lm75_init_param |
| struct | lm75_dev |
Macros | |
| #define | LM75_DEVICE_SIGNATURE 0x7f4c4d75 |
| #define | LM75_HW_ADDR 0b1001000 |
| #define | LM75_FRAME_SIZE 3 |
| #define | LM75_ADDR_MASK 0xFFFF |
| #define | LM75_SENSOR_DATA_MASK 0xFF80 |
| #define | LM75_MIN_TEMP -55 |
| #define | LM75_MAX_TEMP 125 |
| #define | LM75_MIN_TEMP_MILLICEL (LM75_MIN_TEMP * 1000) |
| #define | LM75_MAX_TEMP_MILLICEL (LM75_MAX_TEMP * 1000) |
| #define | LM75_CONFIG_SHUTDOWN NO_OS_BIT(0) |
| #define | LM75_CONFIG_INT_EN NO_OS_BIT(1) |
| #define | LM75_CONFIG_OS_POLARITY NO_OS_BIT(2) |
| #define | LM75_CONFIG_FAULT_QUEUE NO_OS_GENMASK(4, 3) |
| #define | LM75_HYST_POR_VALUE 0x4b00 |
| #define | LM75_OS_POR_VALUE 0x5000 |
| #define | LM75_TEMP_MASK NO_OS_GENMASK(15, 7) |
Enumerations | |
| 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 } |
Functions | |
| 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.
Copyright 2025(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define LM75_ADDR_MASK 0xFFFF |
| #define LM75_CONFIG_FAULT_QUEUE NO_OS_GENMASK(4, 3) |
| #define LM75_CONFIG_INT_EN NO_OS_BIT(1) |
| #define LM75_CONFIG_OS_POLARITY NO_OS_BIT(2) |
| #define LM75_CONFIG_SHUTDOWN NO_OS_BIT(0) |
| #define LM75_DEVICE_SIGNATURE 0x7f4c4d75 |
| #define LM75_FRAME_SIZE 3 |
| #define LM75_HW_ADDR 0b1001000 |
| #define LM75_HYST_POR_VALUE 0x4b00 |
| #define LM75_MAX_TEMP 125 |
| #define LM75_MAX_TEMP_MILLICEL (LM75_MAX_TEMP * 1000) |
| #define LM75_MIN_TEMP -55 |
| #define LM75_MIN_TEMP_MILLICEL (LM75_MIN_TEMP * 1000) |
| #define LM75_OS_POR_VALUE 0x5000 |
| #define LM75_SENSOR_DATA_MASK 0xFF80 |
| #define LM75_TEMP_MASK NO_OS_GENMASK(15, 7) |
| enum lm75_fault_queue |
| enum lm75_mode |
| enum lm75_os_polarity |
| enum lm75_register |
| int lm75_init | ( | struct lm75_dev ** | devpp, |
| struct lm75_init_param * | ip ) |
Initialize LM75 device driver.
Creates an LM75 device driver descriptor and puts the LM75 device into comparator mode initially.
| [out] | devpp | the newly create LM75 device descriptor. |
| [in] | ip | lm75 initialization parameter structure. |
Read if LM75 is in shutdown or normal operation.
| [in] | dev | The LM75 device structure. |
| [out] | flag | true shuts down the LM75. false puts the LM75 into normal operation. |
| 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.
| [in] | millicelsius | milliCelsius value to convert to raw sensor data. |
| int lm75_raw_to_millicelsius | ( | const uint16_t | raw_temp | ) |
Convert a raw sensor data to milliCelsius value.
| [in] | raw_temp | raw sensor data to convert to MilliCelsius. |
| int lm75_read_fault_queue | ( | struct lm75_dev * | dev, |
| enum lm75_fault_queue * | fq ) |
Read fault count.
| [in] | dev | The LM75 device structure. |
| [out] | fq | buffer where fault queue number will be written. |
Read the event mode of LM75, whether interrupt based or comparator.
| [in] | dev | The LM75 device structure. |
| [out] | mode | buffer where mode will be written. |
| int lm75_read_os_polarity | ( | struct lm75_dev * | dev, |
| enum lm75_os_polarity * | pol ) |
Read the over temperature line polarity setting.
| [in] | dev | The LM75 device structure. |
| [out] | pol | buffer where fault queue number will be written. |
| int lm75_read_temperature | ( | struct lm75_dev * | dev, |
| enum lm75_temperature_type | whence, | ||
| uint16_t * | val ) |
Read temperature data.
Used to read die, hysteresis and over temperature.
| [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. |
| int lm75_remove | ( | struct lm75_dev * | dev | ) |
Uninitialize LM75 device driver.
Put LM75 into shutdown (low power mode) and release resources back to system.
| [in] | dev | the LM75 device. |
Put the LM75 into normal or shutdown operation.
| [in] | dev | The LM75 device structure. |
| [in] | flag | true shuts down the LM75. false puts the LM75 into normal operation. |
| int lm75_write_fault_queue | ( | struct lm75_dev * | dev, |
| enum lm75_fault_queue | fq ) |
Write fault count.
| [in] | dev | The LM75 device structure. |
| [in] | fq | fault queue number. |
Change the event mode of LM75, whether interrupt based or comparator.
| [in] | dev | The LM75 device structure. |
| [in] | mode | either lm75_comparator_mode or lm75_interrupt_mode |
| int lm75_write_os_polarity | ( | struct lm75_dev * | dev, |
| enum lm75_os_polarity | pol ) |
Write the polarity of the over temperature line.
| [in] | dev | The LM75 device structure. |
| [out] | pol | lm75_os_active_low or lm75_os_active_high. |
| int lm75_write_temperature | ( | struct lm75_dev * | dev, |
| enum lm75_temperature_type | whence, | ||
| uint16_t | val ) |
Write temperature data.
Used to update hysteresis and over temperature. Die temperature is read-only.
| [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. |