Library for the Robotics RedBee™RFID Reader.

Revision:
0:9765e979a653
diff -r 000000000000 -r 9765e979a653 robotics_rfid_reader.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/robotics_rfid_reader.cpp	Wed Nov 10 16:46:03 2021 +0100
@@ -0,0 +1,34 @@
+#include "robotics_rfid_reader.h"
+
+/**
+ * @file robotics_rfid_reader.cpp
+ * @brief  RFID Robotics reader class
+ * @author sepro
+ * @version 1.0
+ * @class RoboticsRfidReader
+ * @date 31/01/2021
+ */
+
+RoboticsRfidReader::RoboticsRfidReader(PinName Tx, PinName Rx)
+    : _rfid(Tx, Rx)
+
+{
+  _rfid.baud(9600);
+  _rfid.format(8, SerialBase::None, 1);
+}
+
+
+bool RoboticsRfidReader::rfidRead(unsigned char *tampon) {
+  static int iBuffer = 0;
+
+  if (_rfid.readable()) {
+    _rfid.read(&_c,1);
+    tampon[iBuffer++] = _c;
+    if (_c == '\n') {
+      tampon[iBuffer] = 0;
+      iBuffer = 0;
+      return true;
+    }
+  }
+  return false;
+}