Subversion Repositories HomeAutomation

Rev

Rev 869 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
834 linlun 1
#ifndef FOST02_H_
2
#define FOST02_H_
3
 
4
/*-----------------------------------------------
5
 * Includes
6
 * ---------------------------------------------*/
7
#include <stdlib.h>
8
#include <inttypes.h>
9
#include <config.h>
1140 linlun 10
#include <drivers/mcu/gpio.h>
834 linlun 11
 
12
/*-----------------------------------------------
13
 * Defines
14
 * ---------------------------------------------*/
15
 
16
/*
17
 * Define which PORT/PIN to use:
18
*/
19
#ifndef FOST02_DATA
1140 linlun 20
#warning FOST02_DATA not defined, useing EXP_M
21
#define FOST02_DATA     EXP_M
834 linlun 22
#endif 
1140 linlun 23
#ifndef FOST02_CLK
24
#warning FOST02_CLK not defined, useing EXP_L
25
#define FOST02_CLK      EXP_L
26
#endif 
834 linlun 27
 
28
/*-----------------------------------------------
29
 * Functions
30
 * ---------------------------------------------*/
31
 
32
/*
33
 * Initiate FOST02 for reading temperature and humidity from sensor.
34
 */
35
void FOST02Init(void);
36
void sendReset(void);
37
uint8_t sendCommand(uint8_t cmd);
38
uint8_t getFOST02PinStatus(void);
39
uint16_t getFOST02Data(void);
40
 
41
/*
42
 * Start reading and return the temperature value.
43
 */
44
void measureFOST02temperature(void);
45
void measureFOST02humidity(void);
46
uint16_t getFOST02temperature(void);
47
uint16_t getFOST02humidity(void);
48
void getFOST02DataByte(uint8_t *data1, uint8_t *data2);
49
 
855 linlun 50
//static unsigned uint16_t __attribute__ ((progmem)) HumidityTable[] = {
51
static uint16_t HumidityTable[] = {
834 linlun 52
0x0000,
53
0x0000,
54
0x0000,
55
0x0000,
56
0x0000,
57
0x0000,
58
0x0000,
59
0x0032,
60
0x010D,
61
0x014D,
62
0x0228,
63
0x0304,
64
0x0343,
65
0x041E,
66
0x045D,
67
0x0537,
68
0x0612,
69
0x0650,
70
0x072B,
71
0x0805,
72
0x0843,
73
0x091D,
74
0x095A,
75
0x0A34,
76
0x0B0D,
77
0x0B4B,
78
0x0C24,
79
0x0C61,
80
0x0D39,
81
0x0E12,
82
0x0E4F,
83
0x0F27,
84
0x0F63,
85
0x103B,
86
0x1113,
87
0x114F,
88
0x1227,
89
0x1263,
90
0x133A,
91
0x1411,
92
0x144C,
93
0x1523,
94
0x155E,
95
0x1635,
96
0x170B,
97
0x1746,
98
0x181C,
99
0x1856,
100
0x192C,
101
0x1A02,
102
0x1A3B,
103
0x1B11,
104
0x1B4A,
105
0x1C20,
106
0x1C59,
107
0x1D2E,
108
0x1E03,
109
0x1E3B,
110
0x1F10,
111
0x1F48,
112
0x201C,
113
0x2054,
114
0x2128,
115
0x2160,
116
0x2234,
117
0x2307,
118
0x233F,
119
0x2412,
120
0x2449,
121
0x251C,
122
0x2553,
123
0x2625,
124
0x265C,
125
0x272E,
126
0x2800,
127
0x2837,
128
0x2908,
129
0x293E,
130
0x2A10,
131
0x2A45,
132
0x2B17,
133
0x2B4C,
134
0x2C1D,
135
0x2C52,
136
0x2D23,
137
0x2D57,
138
0x2E28,
139
0x2E5C,
140
0x2F2C,
141
0x2F60,
142
0x3030,
143
0x3100,
144
0x3134,
145
0x3203,
146
0x3237,
147
0x3306,
148
0x3339,
149
0x3408,
150
0x343A,
151
0x3509,
152
0x353B,
153
0x360A,
154
0x363C,
155
0x370A,
156
0x373C,
157
0x380A,
158
0x383B,
159
0x3909,
160
0x393A,
161
0x3A07,
162
0x3A38,
163
0x3B05,
164
0x3B36,
165
0x3C03,
166
0x3C33,
167
0x3C63,
168
0x3D2F,
169
0x3D5F,
170
0x3E2B,
171
0x3E5B,
172
0x3F27,
173
0x3F56,
174
0x4021,
175
0x4051,
176
0x411C,
177
0x414B,
178
0x4215,
179
0x4244,
180
0x430E,
181
0x433D,
182
0x4407,
183
0x4435,
184
0x4463,
185
0x452C,
186
0x455A,
187
0x4623,
188
0x4651,
189
0x471A,
190
0x4747,
191
0x4810,
192
0x483C,
193
0x4905,
194
0x4931,
195
0x495E,
196
0x4A26,
197
0x4A52,
198
0x4B1A,
199
0x4B45,
200
0x4C0D,
201
0x4C38,
202
0x4D00,
203
0x4D2B,
204
0x4D56,
205
0x4E1C,
206
0x4E47,
207
0x4F0E,
208
0x4F38,
209
0x4F62,
210
0x5028,
211
0x5052,
212
0x5118,
213
0x5142,
214
0x5208,
215
0x5231,
216
0x525A,
217
0x531F,
218
0x5348,
219
0x540D,
220
0x5436,
221
0x545E,
222
0x5523,
223
0x554B,
224
0x560F,
225
0x5637,
226
0x565F,
227
0x5723,
228
0x574A,
229
0x580D,
230
0x5835,
231
0x585C,
232
0x591F,
233
0x5946,
234
0x5A08,
235
0x5A2F,
236
0x5A55,
237
0x5B17,
238
0x5B3D,
239
0x5B63,
240
0x5C25,
241
0x5C4B,
242
0x5D0C,
243
0x5D32,
244
0x5D57,
245
0x5E18,
246
0x5E3D,
247
0x5E62,
248
0x5F22,
249
0x5F47,
250
0x6007,
251
0x602B,
252
0x604F,
253
0x610F,
254
0x6133,
255
0x6157,
256
0x6216,
257
0x623A,
258
0x625D,
259
0x6400,
260
0x6400,
261
0x6400,
262
0x6400,
263
0x6400,
264
0x6400,
265
0x6400,
266
0x6400,
267
0x6400,
268
0x6400,
269
0x6400,
270
0x6400,
271
0x6400,
272
0x6400,
273
0x6400,
274
0x6400,
275
0x6400,
276
0x6400,
277
0x6400,
278
0x6400,
279
0x6400,
280
0x6400,
281
0x6400,
282
0x6400,
283
0x6400,
284
0x6400,
285
0x6400,
286
0x6400,
287
0x6400,
288
0x6400,
289
0x6400,
290
0x6400,
291
0x6400,
292
0x6400,
293
0x6400,
294
0x6400,
295
0x6400,
296
0x6400,
297
0x6400,
298
0x6400,
299
0x6400,
300
0x6400,
301
0x6400,
302
0x6400,
303
0x6400,
304
0x6400,
305
0x6400,
306
0x6400,
307
0x6400,
308
0x6400};
309
 
310
 
311
 
312
#endif