38 lines
600 B
C
38 lines
600 B
C
|
#ifndef _WBEE_WRAPPER_H_
|
||
|
#define _WBEE_WRAPPER_H_
|
||
|
|
||
|
#include <Wire.h>
|
||
|
#include <XBee.h>
|
||
|
#include "protocol.h"
|
||
|
#include "packet.h"
|
||
|
|
||
|
#define XBWRECV_OK 0
|
||
|
#define XBWRECV_NONE 1
|
||
|
#define XBWRECV_ERROR 2
|
||
|
|
||
|
#define XBWSEND_OK 0
|
||
|
#define XBWSEND_ERROR 1
|
||
|
#define XBWSEND_UNKNOWN 2
|
||
|
|
||
|
|
||
|
class XBeeWrapper{
|
||
|
private:
|
||
|
XBee xbee;
|
||
|
|
||
|
public:
|
||
|
XBeeWrapper();
|
||
|
|
||
|
// initialises the XBee interface
|
||
|
void begin(unsigned long baud);
|
||
|
|
||
|
// tries to extract a received packet
|
||
|
uint8_t receive(Packet& pkt);
|
||
|
|
||
|
// tries to broadcast a packet
|
||
|
uint8_t broadcast(Packet& pkt);
|
||
|
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
#endif
|