Subversion Repositories HomeAutomation

Rev

Rev 834 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

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