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
Diff: LM75B.cpp
- Revision:
- 9:74b44a27fa40
- Parent:
- 8:2b797c309258
- Child:
- 13:27c19044ace6
--- a/LM75B.cpp Wed Aug 14 04:33:25 2013 +0000 +++ b/LM75B.cpp Wed Aug 28 17:17:24 2013 +0000 @@ -15,7 +15,6 @@ */ #include "LM75B.h" -#include "mbed.h" LM75B::LM75B(PinName sda, PinName scl, Address addr) : m_I2C(sda, scl) { @@ -23,6 +22,23 @@ m_Addr = (int)addr; } +bool LM75B::open(void) +{ + //Probe for the LM75B using a Zero Length Transfer + if (!m_I2C.write(m_Addr, NULL, 0)) { + //Reset the device to default configuration + write8(REG_CONF, 0x00); + write16(REG_THYST, 0x4B00); + write16(REG_TOS, 0x5000); + + //Return success + return true; + } else { + //Return failure + return false; + } +} + LM75B::PowerMode LM75B::powerMode(void) { //Read the 8-bit register value