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
RF12B.h
- Committer:
- harryeakins
- Date:
- 2011-03-10
- Revision:
- 2:99cf337cd23e
- Parent:
- 1:42b124ed1f57
- Child:
- 3:e72ad65868ab
File content as of revision 2:99cf337cd23e:
#ifndef _RF12B_H #define _RF12B_H #include "mbed.h" class RF12B { public: RF12B(PinName SDI, PinName SDO, PinName SCK, PinName NCS, PinName NIRQ); /* Reads a byte of data from the RF module's buffer This is a blocking call */ unsigned char read(); /* Sends a byte of data to the RF module for transmission */ void write(unsigned char * data); /* Flushes all data from the RF module's buffer */ void flush(); private: SPI spi; DigitalOut NCS; DigitalIn NIRQ; bool trans; bool initialized; unsigned int writeCmd(unsigned int cmd); void send(unsigned char data); /* Initialises the RF12B module */ void init(); /* Switch module between receive and transmit modes */ void mode(bool trans); }; #endif /* _RF12B_H */