Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LM75B by
LM75B Class Reference
#include <LM75B.h>
Public Types | |
enum | Address { ADDRESS_0 = (0x48 << 1), ADDRESS_1 = (0x49 << 1), ADDRESS_2 = (0x4A << 1), ADDRESS_3 = (0x4B << 1), ADDRESS_4 = (0x4C << 1), ADDRESS_5 = (0x4D << 1), ADDRESS_6 = (0x4E << 1), ADDRESS_7 = (0x4F << 1) } |
Represents the different I2C address possibilities for the LM75B. More... | |
enum | PowerMode { POWER_NORMAL, POWER_SHUTDOWN } |
Represents the power mode of the LM75B. More... | |
enum | OSMode { OS_COMPARATOR, OS_INTERRUPT } |
Represents OS pin mode of the LM75B. More... | |
enum | OSPolarity { OS_ACTIVE_LOW, OS_ACTIVE_HIGH } |
Represents OS pin polarity of the LM75B. More... | |
enum | OSFaultQueue { OS_FAULT_QUEUE_1, OS_FAULT_QUEUE_2, OS_FAULT_QUEUE_4, OS_FAULT_QUEUE_6 } |
Represents OS pin fault queue length of the LM75B. More... | |
Public Member Functions | |
LM75B (PinName sda, PinName scl, Address addr, int hz) | |
Create an LM75B object connected to the specified I2C pins with the specified I2C slave address. | |
bool | open (void) |
Probe for the LM75B and reset it to default configuration if present. | |
LM75B::PowerMode | powerMode (void) |
Get the current power mode of the LM75B. | |
void | powerMode (PowerMode mode) |
Set the power mode of the LM75B. | |
LM75B::OSMode | osMode (void) |
Get the current OS pin mode of the LM75B. | |
void | osMode (OSMode mode) |
Set the OS pin mode of the LM75B. | |
LM75B::OSPolarity | osPolarity (void) |
Get the current OS pin polarity of the LM75B. | |
void | osPolarity (OSPolarity polarity) |
Set the OS pin polarity of the LM75B. | |
LM75B::OSFaultQueue | osFaultQueue (void) |
Get the current OS pin fault queue length of the LM75B. | |
void | osFaultQueue (OSFaultQueue queue) |
Set the OS pin fault queue length of the LM75B. | |
float | alertTemp (void) |
Get the current alert temperature threshold of the LM75B. | |
void | alertTemp (float temp) |
Set the alert temperature threshold of the LM75B. | |
float | alertHyst (void) |
Get the current alert temperature hysteresis threshold of the LM75B. | |
void | alertHyst (float temp) |
Set the alert temperature hysteresis threshold of the LM75B. | |
float | temp (void) |
Get the current temperature measurement of the LM75B. | |
operator float () | |
A shorthand for temp() |
Detailed Description
LM75B class.
Used for controlling an LM75B temperature sensor connected via I2C.
Example:
#include "mbed.h" #include "LM75B.h" //Create an LM75B object at the default address (ADDRESS_0) LM75B sensor(p28, p27); int main() { //Try to open the LM75B if (sensor.open()) { printf("Device detected!\n"); while (1) { //Print the current temperature printf("Temp = %.3f\n", (float)sensor); //Sleep for 0.5 seconds wait(0.5); } } else { error("Device not detected!\n"); } }
Definition at line 52 of file LM75B.h.
Member Enumeration Documentation
enum Address |
Represents the different I2C address possibilities for the LM75B.
enum OSFaultQueue |
Represents OS pin fault queue length of the LM75B.
enum OSMode |
Represents OS pin mode of the LM75B.
- Enumerator:
enum OSPolarity |
enum PowerMode |
Constructor & Destructor Documentation
Member Function Documentation
float alertHyst | ( | void | ) |
void alertHyst | ( | float | temp ) |
void alertTemp | ( | float | temp ) |
float alertTemp | ( | void | ) |
bool open | ( | void | ) |
operator float | ( | ) |
void osFaultQueue | ( | OSFaultQueue | queue ) |
LM75B::OSFaultQueue osFaultQueue | ( | void | ) |
LM75B::OSMode osMode | ( | void | ) |
void osMode | ( | OSMode | mode ) |
LM75B::OSPolarity osPolarity | ( | void | ) |
void osPolarity | ( | OSPolarity | polarity ) |
void powerMode | ( | PowerMode | mode ) |
LM75B::PowerMode powerMode | ( | void | ) |
Generated on Tue Jul 12 2022 19:35:26 by
