Diff: RF12B/RF12B.h
- Revision:
- 1:0370ea94b64a
- Parent:
- 0:7583de124698
--- a/RF12B/RF12B.h Fri Mar 30 19:44:25 2012 +0000 +++ b/RF12B/RF12B.h Thu Apr 26 17:50:00 2012 +0000 @@ -2,10 +2,12 @@ #define _RF12B_H #include "mbed.h" -#include <queue> +//#include <queue> enum rfmode_t{RX, TX}; +class DummyCT; + class RF12B { public: /* Constructor */ @@ -14,6 +16,7 @@ PinName SCK, PinName NCS, PinName NIRQ); + /* Reads a packet of data. Returns false if read failed. Use available() to check how much space to allocate for buffer */ @@ -26,15 +29,20 @@ /* Transmits a packet of data */ void write(unsigned char* data, unsigned char length); void write(unsigned char data); /* 1-byte packet */ - void write(std::queue<char> &data, int length = -1); /* sends a whole queue */ +// void write(std::queue<char> &data, int length = -1); /* sends a whole queue */ /* Returns the packet length if data is available in the receive buffer, 0 otherwise*/ unsigned int available(); + + /** A assigns a callback function when a new reading is available **/ + void (*callbackfunc)(unsigned char rx_code); + DummyCT* callbackobj; + void (DummyCT::*mcallbackfunc)(unsigned char rx_code); protected: /* Receive FIFO buffer */ - std::queue<unsigned char> fifo; - std::queue<unsigned char> temp; //for storing stuff mid-packet +// std::queue<unsigned char> fifo; +// std::queue<unsigned char> temp; //for storing stuff mid-packet /* SPI module */ SPI spi;