ibutton read with modified ds18b20 libraries
Due to the lack of programs for ibutton interfacing with mbed, i built this one (still needs a lot of development), it's in a very basic state, but i'm working on it...
main.cpp@0:4f399e4b64a9, 2013-08-23 (annotated)
- Committer:
- Renato
- Date:
- Fri Aug 23 08:36:59 2013 +0000
- Revision:
- 0:4f399e4b64a9
Function to read ibutton serial & family
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Renato | 0:4f399e4b64a9 | 1 | #include "mbed.h" |
Renato | 0:4f399e4b64a9 | 2 | #include "ds1990.h" |
Renato | 0:4f399e4b64a9 | 3 | #include "DS1Wire.h" |
Renato | 0:4f399e4b64a9 | 4 | |
Renato | 0:4f399e4b64a9 | 5 | Serial pc(USBTX, USBRX); |
Renato | 0:4f399e4b64a9 | 6 | DigitalInOut sensor(p21); |
Renato | 0:4f399e4b64a9 | 7 | AnalogIn input(p18); |
Renato | 0:4f399e4b64a9 | 8 | |
Renato | 0:4f399e4b64a9 | 9 | |
Renato | 0:4f399e4b64a9 | 10 | |
Renato | 0:4f399e4b64a9 | 11 | int main(void){ |
Renato | 0:4f399e4b64a9 | 12 | |
Renato | 0:4f399e4b64a9 | 13 | |
Renato | 0:4f399e4b64a9 | 14 | ROM_Code_t ROM_Code = ReadROM(); |
Renato | 0:4f399e4b64a9 | 15 | |
Renato | 0:4f399e4b64a9 | 16 | |
Renato | 0:4f399e4b64a9 | 17 | pc.printf("Family code: 0x%X\n\r", ROM_Code.BYTES.familyCode); |
Renato | 0:4f399e4b64a9 | 18 | pc.printf("Serial Number: "); |
Renato | 0:4f399e4b64a9 | 19 | for (uint32_t i = 8; i != 0; --i) { |
Renato | 0:4f399e4b64a9 | 20 | pc.printf("%02X%s", ROM_Code.BYTES.serialNo[i-1], (i != 1)?":":"\r\n"); |
Renato | 0:4f399e4b64a9 | 21 | } |
Renato | 0:4f399e4b64a9 | 22 | Reset(); |
Renato | 0:4f399e4b64a9 | 23 | } |