-
Notifications
You must be signed in to change notification settings - Fork 2
/
TMP006Module.h
64 lines (53 loc) · 1.43 KB
/
TMP006Module.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* TMP006Module.h
*
* Created on: Feb 21, 2014
* Author: Saminda
*/
#ifndef TMP006MODULE_H_
#define TMP006MODULE_H_
#include "Template.h"
#include "TMP006Representation.h"
#include "hw_tmp006.h"
//*****************************************************************************
//
// Define TMP006 I2C Address.
//
//*****************************************************************************
#define TMP006_I2C_ADDRESS 0x41
MODULE(TMP006Module)
PROVIDES(TMP006Representation)
END_MODULE
class TMP006Module: public TMP006ModuleBase
{
private:
class TMP006
{
public:
//
// The I2C address of the TMP006.
//
uint8_t ui8Addr;
//
// Calibration factor. Left to application to implement calibration
// See term S0 in http://www.ti.com/lit/ug/sbou107/sbou107.pdf
//
float fCalibrationFactor;
//
// The data buffer used for sending/receiving data to/from the TMP006.
//
uint8_t pui8Data[4];
TMP006() :
ui8Addr(TMP006_I2C_ADDRESS), fCalibrationFactor(6.40e-14)
{
}
};
TMP006 parameters;
public:
void init();
void update(TMP006Representation& theTMP006Representation);
private:
int16_t readRegister(const uint8_t& cmd);
void writeRegister(const uint8_t& ui8Count);
};
#endif /* TMP006MODULE_H_ */