Committer:
sleighton
Date:
Tue Jan 05 11:37:13 2016 +0000
Revision:
3:cf539cfd3d59
Parent:
2:5040ec01dba1
Child:
4:af08c7749f9d
Now includes packet handling functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sleighton 2:5040ec01dba1 1 #include "mbed.h"
sleighton 2:5040ec01dba1 2 #include <vector>
sleighton 3:cf539cfd3d59 3 #include <list>
sleighton 3:cf539cfd3d59 4 #include <algorithm>
sleighton 2:5040ec01dba1 5
sleighton 2:5040ec01dba1 6 class XBee_Robot {
sleighton 2:5040ec01dba1 7 private:
sleighton 2:5040ec01dba1 8
sleighton 3:cf539cfd3d59 9 std::list< std::vector<uint8_t> > addr_list;
sleighton 3:cf539cfd3d59 10
sleighton 2:5040ec01dba1 11 PinName _tx, _rx; // May need to be changed to public
sleighton 2:5040ec01dba1 12
sleighton 2:5040ec01dba1 13 Serial dataLink; //declare global serial
sleighton 2:5040ec01dba1 14
sleighton 2:5040ec01dba1 15 public:
sleighton 2:5040ec01dba1 16
sleighton 2:5040ec01dba1 17 XBee_Robot(PinName _txIn, PinName _rxIn);
sleighton 2:5040ec01dba1 18 //constructor for XBee
sleighton 2:5040ec01dba1 19
sleighton 2:5040ec01dba1 20 void setRxInterrupt();
sleighton 2:5040ec01dba1 21 //enables interrupt for receive pin
sleighton 2:5040ec01dba1 22
sleighton 2:5040ec01dba1 23 void Rx_interrupt();
sleighton 2:5040ec01dba1 24 //ISR for receive pin
sleighton 2:5040ec01dba1 25
sleighton 2:5040ec01dba1 26 void transmitRequest(uint8_t *BitAddress64, uint8_t *BitAddress16, uint8_t broadcastRadius, uint8_t options, uint8_t *data,size_t dataLength);
sleighton 2:5040ec01dba1 27 //assembles and sends transmission requests
sleighton 2:5040ec01dba1 28
sleighton 2:5040ec01dba1 29 uint8_t calculateChecksum(std::vector<uint8_t> & packet);
sleighton 2:5040ec01dba1 30 //calculates checksum for assembled packets
sleighton 3:cf539cfd3d59 31
sleighton 3:cf539cfd3d59 32 void RxPacketControl(std::vector<uint8_t> & packet);
sleighton 3:cf539cfd3d59 33 //seperates packets depending on API command
sleighton 3:cf539cfd3d59 34
sleighton 3:cf539cfd3d59 35 void checkSourceAddr(std::vector<uint8_t> & addr);
sleighton 3:cf539cfd3d59 36 //checks source address of received packet against list of known addresses and adds new addresses
sleighton 2:5040ec01dba1 37 };