Demo program for MAXREFDES132. Searches 1-Wire® bus and prints ROM IDs of devices found. If the DS1920 is found presents user with menu for interfacing with the DS1920 temperature iButton

Dependencies:   OneWire Terminal mbed

Files at this revision

API Documentation at this revision

Comitter:
andrewae
Date:
Mon Jul 10 23:02:11 2017 +0000
Parent:
11:11a01dc7a2c9
Commit message:
Fixed print_rom_id

Changed in this revision

OneWire.lib Show annotated file Show diff for this revision Revisions of this file
Terminal.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 11a01dc7a2c9 -r a649f4e955a4 OneWire.lib
--- a/OneWire.lib	Mon Jul 10 17:58:11 2017 +0000
+++ b/OneWire.lib	Mon Jul 10 23:02:11 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/Maxim-Integrated/code/OneWire/#5bd0a7a82bb4
+https://developer.mbed.org/teams/Maxim-Integrated/code/OneWire/#cf38f48a2a49
diff -r 11a01dc7a2c9 -r a649f4e955a4 Terminal.lib
--- a/Terminal.lib	Mon Jul 10 17:58:11 2017 +0000
+++ b/Terminal.lib	Mon Jul 10 23:02:11 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/j3/code/Terminal/#419eea2fe960
+https://developer.mbed.org/users/j3/code/Terminal/#9ab22fc6e88b
diff -r 11a01dc7a2c9 -r a649f4e955a4 main.cpp
--- a/main.cpp	Mon Jul 10 17:58:11 2017 +0000
+++ b/main.cpp	Mon Jul 10 23:02:11 2017 +0000
@@ -126,21 +126,11 @@
 void print_rom_id(Terminal & term, const RomId & romId)
 {
     //print the rom number
-    term.printf("\n");
-    int8_t idx = (RomId::byteLen - 1);
-    do
-    {
-        if(romId[idx] < 16)
-        {
-            term.printf("0x0%x ", romId[idx--]);
-        }
-        else
-        {
-            term.printf("0x%2x ", romId[idx--]);
-        }
+    term.printf("\r\n");
+    for(int idx = 7; idx >= 0; idx--) {
+        term.printf("0x%02x ", romId.buffer[idx]);
     }
-    while(idx >= 0);
-    term.printf("\n");
+    term.printf("\r\n");
 }