Rian De Rous / LM75B

Dependents:   projectlab

Fork of LM75B by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
RianDeRous
Date:
Fri Apr 28 15:08:39 2017 +0000
Parent:
1:6a70c9303bbe
Commit message:
school project;

Changed in this revision

LM75B.cpp Show annotated file Show diff for this revision Revisions of this file
LM75B.h Show annotated file Show diff for this revision Revisions of this file
diff -r 6a70c9303bbe -r c5b96558c242 LM75B.cpp
--- a/LM75B.cpp	Fri Oct 26 21:40:51 2012 +0000
+++ b/LM75B.cpp	Fri Apr 28 15:08:39 2017 +0000
@@ -1,5 +1,6 @@
 #include "LM75B.h"
 
+
 LM75B::LM75B(PinName sda, PinName scl) : i2c(sda, scl)
 {
    char cmd[2];
@@ -24,3 +25,16 @@
     i2c.read( LM75B_ADDR, cmd, 2); // Send command string    
     return (   float((cmd[0]<<8)|cmd[1]) / 256.0   );
 }
+
+
+void LM75B::readRaw(int* a,int* b){
+    char cmd[2];
+    cmd[0] = LM75B_Temp;
+   
+    i2c.write( LM75B_ADDR, cmd, 1); // Send command string
+    i2c.read( LM75B_ADDR, cmd, 2); // Send command string 
+    if(cmd[1]&&0xf8>0) cmd[1]=cmd[1]||0xf8;
+    *a = cmd[0];
+    *b = cmd[1];       
+
+}
diff -r 6a70c9303bbe -r c5b96558c242 LM75B.h
--- a/LM75B.h	Fri Oct 26 21:40:51 2012 +0000
+++ b/LM75B.h	Fri Apr 28 15:08:39 2017 +0000
@@ -54,6 +54,7 @@
   Reads the temperature register of the LM75B and converts it to a useable value.
   */
   float read();
+  void readRaw(int* a, int*b);
   
 private: