Library to send and receive data using RF12B transceiver modules Big thanks to the tutorial at https://loee.jottit.com/rfm12b_and_avr_-_quick_start and madcowswe
Dependents: Measure_system Quadcopter_copy
Diff: RF12B.h
- Revision:
- 7:9f9e2a63a8a2
- Parent:
- 6:98da0571ec31
- Child:
- 8:6fc24b44e027
--- a/RF12B.h Fri Mar 11 15:47:06 2011 +0000 +++ b/RF12B.h Fri Mar 11 19:30:30 2011 +0000 @@ -16,19 +16,24 @@ 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 */ + bool read(unsigned char* data, unsigned int size); /* Reads a byte of data from the receive buffer Returns 0xFF if there is no data */ unsigned char read(); /* Transmits a packet of data */ - void write(unsigned char * data, unsigned char length); + void write(unsigned char* data, unsigned char length); /* Transmits a 1-byte packet of data */ void write(unsigned char data); - /* Returns true if data is available in the receive buffer*/ - bool available(); + /* Returns the packet length if data is available in the receive buffer, 0 otherwise*/ + unsigned int available(); protected: /* Receive FIFO buffer */