TMP102

Committer:
Nikollao
Date:
Wed Feb 10 16:10:42 2016 +0000
Revision:
0:fea9b4d9a373
now the library is ready to use;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nikollao 0:fea9b4d9a373 1 #ifndef TMP102_H
Nikollao 0:fea9b4d9a373 2 #define TMP102_H
Nikollao 0:fea9b4d9a373 3
Nikollao 0:fea9b4d9a373 4 //address for ADD0 connected to GND
Nikollao 0:fea9b4d9a373 5 #define TMP102_ADD 0x48
Nikollao 0:fea9b4d9a373 6 #define TMP102_R_ADD 0x91
Nikollao 0:fea9b4d9a373 7 #define TMP102_W_ADD 0x90
Nikollao 0:fea9b4d9a373 8
Nikollao 0:fea9b4d9a373 9 //register addresses
Nikollao 0:fea9b4d9a373 10
Nikollao 0:fea9b4d9a373 11 #define TEMP_REG 0x00
Nikollao 0:fea9b4d9a373 12 #define CONF_REG 0x01
Nikollao 0:fea9b4d9a373 13 #define THIGH_REG 0x02
Nikollao 0:fea9b4d9a373 14 #define TLOW_REG 0x03
Nikollao 0:fea9b4d9a373 15
Nikollao 0:fea9b4d9a373 16 #include "mbed.h"
Nikollao 0:fea9b4d9a373 17
Nikollao 0:fea9b4d9a373 18 class TMP102
Nikollao 0:fea9b4d9a373 19
Nikollao 0:fea9b4d9a373 20 //define the methods that are public, which could be used by the user
Nikollao 0:fea9b4d9a373 21
Nikollao 0:fea9b4d9a373 22 public:
Nikollao 0:fea9b4d9a373 23
Nikollao 0:fea9b4d9a373 24 TMP102(PinName sda, PinName scl);
Nikollao 0:fea9b4d9a373 25
Nikollao 0:fea9b4d9a373 26 void init();
Nikollao 0:fea9b4d9a373 27
Nikollao 0:fea9b4d9a373 28 float get_temperature;
Nikollao 0:fea9b4d9a373 29
Nikollao 0:fea9b4d9a373 30 //define private methods, could be used in the library itself, but could not called by the user
Nikollao 0:fea9b4d9a373 31
Nikollao 0:fea9b4d9a373 32 void error();
Nikollao 0:fea9b4d9a373 33
Nikollao 0:fea9b4d9a373 34 void read_temperature();
Nikollao 0:fea9b4d9a373 35
Nikollao 0:fea9b4d9a373 36 public:
Nikollao 0:fea9b4d9a373 37
Nikollao 0:fea9b4d9a373 38 private:
Nikollao 0:fea9b4d9a373 39
Nikollao 0:fea9b4d9a373 40 I2C* i2c_;
Nikollao 0:fea9b4d9a373 41 DigitalOut* led;
Nikollao 0:fea9b4d9a373 42 float temperature_;
Nikollao 0:fea9b4d9a373 43
Nikollao 0:fea9b4d9a373 44 #endif
Nikollao 0:fea9b4d9a373 45
Nikollao 0:fea9b4d9a373 46