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:
- 0:bd1232f200be
- Child:
- 1:42b124ed1f57
File content as of revision 0:bd1232f200be:
#ifndef _RF12B_H #define _RF12B_H #include "mbed.h" class RF12B { public: RF12B(PinName SDI, PinName SDO, PinName SCK, PinName NCS, PinName NIRQ); /* Initialises the RF12B module as transmitter or receiver. This should be called after the RF module has fully started up (give it a few hundred ms) */ void init(bool _trans = true); // Default transmitter /* 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); }; #endif /* _RF12B_H */