Neil Thiessen / LM75B

Dependents:   app-board-TempAlarm LM75B IoTWorkshopSensors EduRobot ... more

Files at this revision

API Documentation at this revision

Comitter:
neilt6
Date:
Fri May 02 17:28:17 2014 +0000
Parent:
14:3a44310726fe
Child:
16:7ac462ba84ac
Commit message:
Added an I2C frequency argument to the constructor

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
--- a/LM75B.cpp	Tue Nov 12 17:22:12 2013 +0000
+++ b/LM75B.cpp	Fri May 02 17:28:17 2014 +0000
@@ -16,10 +16,10 @@
 
 #include "LM75B.h"
 
-LM75B::LM75B(PinName sda, PinName scl, Address addr) : m_I2C(sda, scl), m_ADDR((int)addr)
+LM75B::LM75B(PinName sda, PinName scl, Address addr, int hz) : m_I2C(sda, scl), m_ADDR((int)addr)
 {
-    //Set the I2C bus frequency to 400kHz
-    m_I2C.frequency(400000);
+    //Set the I2C bus frequency
+    m_I2C.frequency(hz);
 }
 
 bool LM75B::open()
--- a/LM75B.h	Tue Nov 12 17:22:12 2013 +0000
+++ b/LM75B.h	Fri May 02 17:28:17 2014 +0000
@@ -100,8 +100,9 @@
      * @param sda The I2C data pin.
      * @param scl The I2C clock pin.
      * @param addr The I2C slave address (defaults to ADDRESS_0).
+     * @param hz The I2C bus frequency (defaults to 400kHz).
      */
-    LM75B(PinName sda, PinName scl, Address addr = ADDRESS_0);
+    LM75B(PinName sda, PinName scl, Address addr = ADDRESS_0, int hz = 400000);
 
     /** Probe for the LM75B and indicate if it's present on the bus
      *