Programme de test de la lib HTRC110

Dependencies:   HTRC110_lib mbed

Files at this revision

API Documentation at this revision

Comitter:
garivetm
Date:
Tue May 02 13:46:16 2017 +0000
Commit message:
First commit

Changed in this revision

HTRC110_lib.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 91277c4a0269 HTRC110_lib.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTRC110_lib.lib	Tue May 02 13:46:16 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Hublex/code/HTRC110_lib/#ec877e8509d0
diff -r 000000000000 -r 91277c4a0269 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 02 13:46:16 2017 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "RFIDer.h"
+
+RFIDer RFID_reader(SPI_SCK, SPI_MOSI, SPI_MISO);
+Ticker loop;
+char* tag;
+
+bool flag = 0;
+
+void ISR_loop(void){
+    flag = 1;
+}
+
+int main() {
+    RFID_reader.setComPeriod(40);
+    // Clock crystal
+    RFID_reader.setClockFrequency(8000000);
+    RFID_reader.setSamplingTime(40);
+    RFID_reader.startReadingTag();
+    
+    loop.attach(&ISR_loop, 0.5);
+    
+    while(1){
+        if (flag){
+            if(RFID_reader.isTagAvailable()){
+                tag = RFID_reader.getTag();
+                printf("ID: ");
+                for (int i = 0 ; i <= 7 ; i++){
+                    printf("0x%d ",tag[i]);
+                }
+                printf("\n\r");
+                //RFID_reader.stopReadingTag();
+            }
+            //printf("Antenna Status = %s\n\r", RFID_reader.getAntennaStatus() ? "Failure" : "OK");
+            //printf("F = %d\n\r", RFID_reader.getClockFrequency());
+            //printf("Phase = %d\n\r", RFID_reader.readPhase());
+            flag = 0;
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 91277c4a0269 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 02 13:46:16 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file