Test code for LM75AIM

Dependencies:   LM75A mbed-src

Revision:
2:4dc9d2360484
Parent:
1:7d868212c8c1
--- a/LM75A/LM75A.cpp	Wed Jun 27 15:46:46 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/* Copyright (C) 2012 mbed.org, MIT License
- *
- * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "LM75A.h"
-
-#define TEMP_REG_ADDR 0x00          // Temperature address
-#define CONFIG_REG_ADDR 0x01        // configuration register
-Serial pc2(USBTX, USBRX);
-
-// costructor
-LM75A::LM75A(PinName sda, PinName scl, int addr) : m_i2c(sda, scl), m_addr(addr){
-
-}
-
-
-// destructor
-LM75A::~LM75A(){
-
-}
-
-
-float LM75A::read(){
-
-  const char tempRegAddr = TEMP_REG_ADDR;
-
-  m_i2c.write(m_addr, &tempRegAddr, 1);      // Pointer to the temperature register
- 
-  char cmd[2] = {0,0};
-  m_i2c.read(m_addr, cmd, 2);        // read temperature register
-  
-  unsigned short val = ((cmd[0] << 8) + cmd[1]) >> 7;     //val = (cmd[ 1 ] << 1) | ( cmd[ 0 ] >> 7 ) ;
-  
-  pc2.printf("reg: ");
-  pc2.printf("%d - %d \n", cmd[1], cmd[0]);         // debug
-  
-  float temp = (float) ((float)val * 0.5);  
-  
-  return temp;
-}
-
-
-char LM75A::read_reg(char addr){
-
-
-    char data[1] = {0};
-    char ret = addr;
-    m_i2c.write(m_addr, &ret, 1);    
-    wait_us(10);         
-    m_i2c.read(m_addr, data, 1);              // Read register content
-    wait_us(20);
-    pc2.printf("reg: %#x \n\r", data[0]);         // debug
-    
-    return ret;
-
-}
-
-
-
-/** Write to specified MMA7660FC register
-*
-* @param char addr: the internal registeraddress of the MMA7660FC
-* @param char data: write data to selected Register
-*/
-void LM75A::write_reg(char addr, char data){
-
-    char data2[2] = {0, 0};
-    
-    data2[0] = addr;
-    data2[1] = data;
-    
-    m_i2c.write(m_addr, data2, 2);             
-    wait_us(50);
-}
-