DS1Wire simple Library
DS18B20.h@0:bfa1afd9ae98, 2011-12-30 (annotated)
- Committer:
- feabhas
- Date:
- Fri Dec 30 19:34:53 2011 +0000
- Revision:
- 0:bfa1afd9ae98
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
feabhas | 0:bfa1afd9ae98 | 1 | #ifndef _DS18B20_ |
feabhas | 0:bfa1afd9ae98 | 2 | #define _DS18B20_ |
feabhas | 0:bfa1afd9ae98 | 3 | |
feabhas | 0:bfa1afd9ae98 | 4 | #include <stdint.h> |
feabhas | 0:bfa1afd9ae98 | 5 | #include "mbed.h" |
feabhas | 0:bfa1afd9ae98 | 6 | |
feabhas | 0:bfa1afd9ae98 | 7 | // Device Faimly ID and Setial number information |
feabhas | 0:bfa1afd9ae98 | 8 | typedef union { |
feabhas | 0:bfa1afd9ae98 | 9 | uint8_t rom[8]; |
feabhas | 0:bfa1afd9ae98 | 10 | struct { |
feabhas | 0:bfa1afd9ae98 | 11 | uint8_t familyCode; |
feabhas | 0:bfa1afd9ae98 | 12 | uint8_t serialNo[6]; |
feabhas | 0:bfa1afd9ae98 | 13 | uint8_t CRC; |
feabhas | 0:bfa1afd9ae98 | 14 | } BYTES; |
feabhas | 0:bfa1afd9ae98 | 15 | } ROM_Code_t; |
feabhas | 0:bfa1afd9ae98 | 16 | |
feabhas | 0:bfa1afd9ae98 | 17 | ROM_Code_t ReadROM() ; |
feabhas | 0:bfa1afd9ae98 | 18 | |
feabhas | 0:bfa1afd9ae98 | 19 | // temperature is store as 7.4 fixed point format (assuming 12 bit conversion) |
feabhas | 0:bfa1afd9ae98 | 20 | void displayTemperature(Serial& s) ; |
feabhas | 0:bfa1afd9ae98 | 21 | float getTemperature(); |
feabhas | 0:bfa1afd9ae98 | 22 | |
feabhas | 0:bfa1afd9ae98 | 23 | #endif |