Trung Nguyen / Mbed 2 deprecated FINAL_PROJECT_4180

Dependencies:   mbed

Fork of FINAL_PROJECT_4180 by Gedeon Nyengele

Files at this revision

API Documentation at this revision

Comitter:
nyengele
Date:
Sun Apr 24 23:30:27 2016 +0000
Child:
1:0e5e9821d89d
Commit message:
final project - initial commit

Changed in this revision

lib.cpp Show annotated file Show diff for this revision Revisions of this file
lib.h 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib.cpp	Sun Apr 24 23:30:27 2016 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#include "lib.h"
+
+int hashcode(const char *data, int size)
+{
+    int hash = 17;
+    for (int i = 0; i < size; i++) {
+        hash += 31*hash + data[i];
+    }
+    return hash;
+}
+void read_mag_card(Serial *device, char *dest, int *size)
+{
+    int pos = 0;
+    bool done = false;
+    int markercount = 0;
+    while (!done) {
+        while (!device->readbale());
+        dest[pos] = device->getc();
+        if (dest[pos] == '?') markercount++;
+        if (markercount >= 2) done  = true;
+        pos++;
+    }
+    *size = pos - 1;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib.h	Sun Apr 24 23:30:27 2016 +0000
@@ -0,0 +1,4 @@
+#include "mbed.h"
+
+int hashcode(const char *data, int size);
+void read_mag_card(Serial *device, char *dest, int *size);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 24 23:30:27 2016 +0000
@@ -0,0 +1,6 @@
+#include "mbed.h"
+
+
+int main() {
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 24 23:30:27 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file