XBee API mode library
Diff: XBee.h
- Revision:
- 16:cdfcb63b2c4b
- Parent:
- 15:10224db0fc2b
- Child:
- 17:2f728fd13bc0
--- a/XBee.h Thu Mar 14 09:45:41 2013 +0000 +++ b/XBee.h Wed Mar 20 00:28:27 2013 +0000 @@ -23,13 +23,6 @@ #ifndef XBEE_H #define XBEE_H -#define XBEE_RTOS - -#ifdef XBEE_RTOS -#include "rtos.h" -#include "AbstractThread.h" -#include "RingBuffer.h" -#endif #include "mbed.h" #include "XBeeDataTypes.h" @@ -44,11 +37,7 @@ /** * class for XBee module API mode interface */ -class XBee : public Serial -#ifdef XBEE_RTOS -, AbstractThread -#endif -{ +class XBee : public Serial { public: /** @@ -213,7 +202,7 @@ * @param apiMode API mode either 1 or 2 (use escape; default) * @param debug display debugging (I/O state) information through LEDs */ - XBee(Serial& ser, int apiMode = 2, bool debug = false); + XBee(Serial& ser, int apiMode = 2); /** * creates an XBee interface object. @@ -223,7 +212,7 @@ * @param apiMode API mode either 1 or 2 (use escape; default) * @param debug display debugging (I/O state) information through LEDs */ - XBee(PinName tx, PinName rx, int apiMode = 2, bool debug = false); + XBee(PinName tx, PinName rx, int apiMode = 2); /** * creates an XBee interface object. @@ -233,7 +222,7 @@ * @param apiMode API mode either 1 or 2 (use escape; default) * @param debug display debugging (I/O state) information through LEDs */ - XBee(Serial& ser, Serial& mon, int apiMode = 2, bool debug = false); + XBee(Serial& ser, Serial& mon, int apiMode = 2); /** * creates an XBee interface object. @@ -244,7 +233,7 @@ * @param apiMode API mode either 1 or 2 (use escape; default) * @param debug display debugging (I/O state) information through LEDs */ - XBee(PinName tx, PinName rx, Serial& mon, int apiMode = 2, bool debug = false); + XBee(PinName tx, PinName rx, Serial& mon, int apiMode = 2); /** * initializes XBee module. @@ -479,22 +468,15 @@ private: Serial mon; - BusOut leds; int apiMode; - volatile enum {UNKNOWN, LENGTH1, LENGTH2, DATA, SUMCHECK} state; volatile int cur, in, out, received, free; char frame_id; float sendConfirmation; char destination64[8]; char destination16[2]; char buf[BUFSIZE]; -#ifdef XBEE_RTOS - RingBuffer<char, 128> rxBuf; -#endif bool debug; -#ifdef XBEE_RTOS - Mutex mutex; -#endif + void send(char c); void send2(char c); void sendFrame(const char *frame, int length); @@ -506,12 +488,7 @@ FrameType getFrameType(char c); bool scan(int i, ValueType type, char *value, int maxlength = 1, int *length = 0); void flush(); -#ifndef XBEE_RTOS - void rxInterruptHandler(); -#else void rxISR(); - virtual void run(); -#endif void dump(const char *data, int length); void dumpIOSample(const char *data, int length); void copy(char *toBuf, int fromIndex, int length);