Manchester
Diff: Manchester.h
- Revision:
- 5:3b2c7e9fda3f
- Parent:
- 2:de778df5892c
- Child:
- 6:7454ad91f714
--- a/Manchester.h Thu May 18 13:37:21 2017 +0000
+++ b/Manchester.h Sun May 21 19:17:28 2017 +0000
@@ -26,12 +26,31 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/*
+ This library implements Manchester code according to both IEEE 802.3
+ and G.E. Thomas' convention.
+ • A '0' is expressed by a high-to-low transition, a '1' by low-to-high transition
+ in the IEEE 802.3 convention. The reverse is true in the G.E. Thomas' convention.
+ • The transitions which signify 0 or 1 occur at the midpoint of a period.
+ • Transitions at the start of a period are overhead and don't signify data.
+ • Least significant bit is sent first
+ • There is one synchronization pulse at the begin of transmission
+
+ The IEEE 802.3 convention is used by default.
+ Select a convention to be used by commenting or uncommenting
+ the line "#define G_E_THOMAS 1" below.
+*/
+
#ifndef MANCHESTER_H
#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
{
enum State
@@ -53,8 +72,8 @@
(
PinName txPin, /* transmitter pin name */
PinName rxPin, /* receiver pin name */
- uint32_t speed = 1200 /* speed in bits per second */,
- uint8_t tol = 20 /* pulse width tolerance (+/-) in % */
+ uint32_t speed = 1200, /* speed in bits per second */
+ uint8_t tol = 25 /* pulse width tolerance (+/-) in % */
);
~Manchester(void) { }
void transmit(ManchesterMsg& msg);