Files at this revision

API Documentation at this revision

Comitter:
kaushalpkk
Date:
Tue Aug 02 15:21:04 2011 +0000
Commit message:
will add later

Changed in this revision

TPA81.cpp Show annotated file Show diff for this revision Revisions of this file
TPA81.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r bd1c02c7bc8a TPA81.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TPA81.cpp	Tue Aug 02 15:21:04 2011 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "TPA81.h"
+
+
+
+TPA81::TPA81(PinName mysda, PinName myscl): _TPA(mysda,myscl) {
+    _delay = 51;
+    _addr = 0xD0;
+}
+
+void TPA81::setAddress(char inAddr) {
+
+}
+
+int TPA81::getTempAt() {
+    _cmd[0] = 1;
+    _cmd[1] = 1;
+
+    _TPA.write(_addr, _cmd, 2);
+    _TPA.read(_addr, _cmd, 1);
+
+    return _cmd[0];
+}
+
+int TPA81::getTemp(short i) {
+    _cmd[0] = i;
+    _cmd[1] = i;
+
+    _TPA.write(_addr, _cmd, 2);
+    _TPA.read(_addr, _cmd, 1);
+
+    return _cmd[0];
+}
\ No newline at end of file
diff -r 000000000000 -r bd1c02c7bc8a TPA81.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TPA81.h	Tue Aug 02 15:21:04 2011 +0000
@@ -0,0 +1,19 @@
+#ifndef MY_TPA_H
+#define MY_TPA_H
+
+class TPA81{
+public:
+    TPA81(PinName, PinName);
+    void setAddress(char);
+    int getTempAt();
+    int getTemp(short);
+protected:
+    int _aTemp;
+    int _temp[8];
+    I2C _TPA;
+    char _addr;
+    char _cmd[2];
+    float _delay;
+};
+
+#endif
\ No newline at end of file