CR95F X-Nucleo NFC03A1 Shield STM

Dependents:   Nucleo_NFC03A1_Demo

Revision:
0:57769c77d24e
Child:
1:549e63ac990c
diff -r 000000000000 -r 57769c77d24e CR95HF.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CR95HF.cpp	Fri Aug 24 13:12:48 2018 +0000
@@ -0,0 +1,71 @@
+#include <CR95HF.h>
+#include "main.h"
+
+DigitalOut InterfacePin(D9);
+DigitalOut myLed4(D4);
+
+CR95HF::CR95HF(PinName tx, PinName rx) : serial(tx,rx) 
+{
+    /* Set Uart on Interface Pin */
+    InterfacePin = false;
+}
+
+CR95HF::~CR95HF() {};
+        
+uint8_t CR95HF::CR95HF_Init()
+{   
+    char commandInfo[] = {0x01, 0x00};
+    char commandSetProtocoll[] = {0x02, 0x01, 0x02, 0x00};
+
+    
+    uint8_t position;
+    
+    printf("CR95HF_Init\r\n");
+    
+    serial.baud(57600);
+
+    serial.attach(this, &CR95HF::readLineCallback);
+
+    wait_ms(500);
+    for(position=0;position<2;position++)
+    {
+        wait_us(10);
+        serial.putc(commandInfo[position]);
+    }
+
+    wait_ms(500);
+    for(position=0;position<4;position++)
+    {
+        wait_us(10);
+        serial.putc(commandSetProtocoll[position]);
+    }
+    
+
+
+    return(0);       
+}
+
+uint8_t CR95HF::CR95HF_ConfigManagerTagHunting()
+{
+    uint8_t returnValue = false;
+    uint8_t position;
+
+    char detectCard[] = {0x00, 0x04, 0x02, 0x26, 0x07};
+    
+    wait_ms(500);
+    for(position=0;position<5;position++)
+    {
+        wait_us(10);
+        serial.putc(detectCard[position]);
+    }
+    
+    return(returnValue);
+}
+
+/** private functions */
+
+void CR95HF::readLineCallback()
+{
+    myLed4 = !myLed4;
+    printf("%u", serial.getc());
+}
\ No newline at end of file