Manchester

Revision:
9:7a23184aa9ef
Parent:
8:c1b5893191fe
--- a/Manchester.h	Sun Oct 14 09:38:33 2018 +0000
+++ b/Manchester.h	Thu Apr 11 07:52:23 2019 +0000
@@ -43,11 +43,6 @@
 #define MANCHESTER_H
 
 #include "mbed.h"
-#include "ManchesterMsg.h"
-
-//Uncomment the following line to use G.E.Thomas' convention
-
-//#define G_E_THOMAS 1
 
 class   Manchester
 {
@@ -72,15 +67,15 @@
         PinName     txPin,          /* transmitter pin name */
         PinName     rxPin,          /* receiver pin name */
         uint32_t    speed = 1200,   /* speed in bits per second */
-        uint8_t     tol = 25,       /* pulse width tolerance (+/-) in % */
+        uint8_t     tol = 10,       /* pulse width tolerance (+/-) in % */
         float       rxTimeout = 5   /* receive timeout */
     );
     ~       Manchester(void)    { }
-    void    transmit(ManchesterMsg& msg);
-    bool    receive(ManchesterMsg& msg);
+    void    transmit(uint8_t *msg, uint8_t len);
+    bool    receive(uint8_t *msg, uint8_t *len);
     void    setPreamble(uint8_t preamble)   { _preamble = preamble; }
     void    setRxTimeout(float seconds)     { _rxTimeout = seconds; }
-    char*   lastError()                     { return _error; }
+
 private:
     DigitalOut  _tx;                // transmitter line
     InterruptIn _rx;                // receiver line
@@ -94,10 +89,9 @@
     float       _rxTimeout;         // reception timeout [s]
     State       _state;             // state
     char*       _data;              // data array
-    size_t      _len;               // data length in bytes
-    size_t      _maxLen;            // maximum length
+    uint8_t     _len;               // data length in bytes
+    uint8_t     _maxLen;            // maximum length
     size_t      _preamble;          // number of start patterns
-    char*       _error;
     void        transmission(void);
     void        reception(void);
     void        onTxTimeout(void);