Library for ADT7410 I2C temperature sensor. Use this instead of TMP102 when you need to measure temperatures lower than -40 degrees C. The device is guaranteed to work at -55 C but will actually read lower temps. See http://mbed.org/users/tkreyche/notebook/adt7140-i2c-temperature-sensor/ for more info.

Dependents:   BLE_ADT7410_TMP102_Sample BLE_HTM_HRM1017 BLENano_SimpleTemplate_temp_170802 BLENano_SimpleTemplate_temp_170813 ... more

Files at this revision

API Documentation at this revision

Comitter:
tkreyche
Date:
Tue Feb 01 19:05:30 2011 +0000
Parent:
1:257d9e026cc4
Child:
3:834388db599d
Commit message:

Changed in this revision

ADT7410.h Show annotated file Show diff for this revision Revisions of this file
--- a/ADT7410.h	Tue Feb 01 19:00:32 2011 +0000
+++ b/ADT7410.h	Tue Feb 01 19:05:30 2011 +0000
@@ -1,16 +1,16 @@
 /*
 Copyright (c) 2011 Tom Kreyche tkreyche@well.com
- 
+
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:
-  
+
 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.
-  
+
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -28,38 +28,37 @@
 
 
 
-/** Servo control class, based on a PwmOut
+/**
 *
 * Example:
 * @code
-
-#include "mbed.h"
-#include "ADT7410.h"
-
-ADT7410 tempSens1(p28, p27, 0x90, 100000);
-
-int main() {
-
-    // reset sensor to default values
-   tempSens1.reset();
-    
-    // read the config register, should be default
-   printf("Config: 0x%x\n", tempSens1.getConfig());
-    
-    // reduce sample rate to save power
-   tempSens1.setConfig(ONE_SPS_MODE);
-    
-    // check config register was set correctly
-   printf("Config: 0x%x\n", tempSens1.getConfig());
-    
-    // get temperature every two seconds
-    while (1) {
-    
-        printf("Deg C %f\n", tempSens1.getTemp());
-        wait(2);
-    }
-}
-
+*
+* #include "mbed.h"
+* #include "ADT7410.h"
+*
+* ADT7410 tempSens1(p28, p27, 0x90, 100000);
+*
+* int main() {
+*
+*   // reset sensor to default values
+*   tempSens1.reset();
+*
+*   // read the config register, should be default
+*   printf("Config: 0x%x\n", tempSens1.getConfig());
+*
+*   // reduce sample rate to save power
+*   tempSens1.setConfig(ONE_SPS_MODE);
+*
+*   // check config register was set correctly
+*   printf("Config: 0x%x\n", tempSens1.getConfig());
+*
+*   // get temperature every two seconds
+*   while (1) {
+*       printf("Deg C %f\n", tempSens1.getTemp());
+*       wait(2);
+*   }
+* }
+*
 * @endcode
 */
 
@@ -80,33 +79,32 @@
 
 //Library for the ADT7410 temperature sensor
 
-class ADT7410
-{
+class ADT7410 {
 
 public:
 
-  // Creates an instance of the class.
-  // Connect module at I2C address addr using I2C port pins sda and scl
-  ADT7410(PinName sda, PinName scl, char addr, int hz);
-  
-  //Destroys instance.
-  ~ADT7410();
-  
-  //Reads the current temperature.
-  float getTemp();
-  
-  //Set config register
-  void setConfig(char regVal);
-  
-   //Get config register
-  char getConfig(); 
-  
-  //Send reset
-  void reset();
-  
+    // Creates an instance of the class.
+    // Connect module at I2C address addr using I2C port pins sda and scl
+    ADT7410(PinName sda, PinName scl, char addr, int hz);
+
+    //Destroys instance.
+    ~ADT7410();
+
+    //Reads the current temperature.
+    float getTemp();
+
+    //Set config register
+    void setConfig(char regVal);
+
+    //Get config register
+    char getConfig();
+
+    //Send reset
+    void reset();
+
 private:
-  I2C i2c;
-  char busAddr;
+    I2C i2c;
+    char busAddr;
 
 };