Unfinished v0.7, added bearing detection
Fork of Pi_Swarm_Library_v06_alpha by
Diff: alpha433.h
- Revision:
- 1:b067a08ff54e
- Parent:
- 0:9ffe8ebd1c40
- Child:
- 4:52b3e4c5a425
diff -r 9ffe8ebd1c40 -r b067a08ff54e alpha433.h --- a/alpha433.h Fri Jan 31 22:59:25 2014 +0000 +++ b/alpha433.h Sun Feb 02 18:05:58 2014 +0000 @@ -1,12 +1,12 @@ /* University of York Robot Lab Pi Swarm Library: 433MHz Alpha Transceiver * * (C) Dr James Hilder, Dept. Electronics & Computer Science, University of York - * + * * Version 0.4 January 2014 * * Designed for use with the Pi Swarm Board (enhanced MBED sensor board) v1.2 * - * Based on code developed by Tobias Dipper, University of Stuttgart (see copyright notice at end of file) + * Based on code developed by Tobias Dipper, University of Stuttgart (see copyright notice at end of file) */ #ifndef ALPHA433_H @@ -195,22 +195,23 @@ #define ALPHA433_TIMEOUT 100 #define TIMEOUT 8.0 -class Alpha433 : public Stream { +class Alpha433 : public Stream +{ // Public Functions public: - /** Create the alpha433 object connected to the default pins - * - * @param mosi pin - default is p5 - * @param miso pin - default is p6 - * @param sck pin - default is p7 - * @param fss pin - default is p8 - * @param nirq pin - default is p11 - */ + /** Create the alpha433 object connected to the default pins + * + * @param mosi pin - default is p5 + * @param miso pin - default is p6 + * @param sck pin - default is p7 + * @param fss pin - default is p8 + * @param nirq pin - default is p11 + */ Alpha433(); - + /** Create the alpha433 object connected to specific pins * */ @@ -218,52 +219,52 @@ // Send a string to the RF transmitter -unsigned long sendString(char ucCount, char* ucBuffer); + unsigned long sendString(char ucCount, char* ucBuffer); // Enable RF Transmitter -void enableTransmitter(void); + void enableTransmitter(void); // Disable RF Transmitter -void disableTransmitter(void); + void disableTransmitter(void); // Enable RF Receiver -void enableReceiver(void); + void enableReceiver(void); // Disable RF Receiver -void disableReceiver(void); + void disableReceiver(void); // SSI FiFo Clear -void clearBuffer(void); + void clearBuffer(void); // Reset RF -void rf_reset(void); + void rf_reset(void); // Initialise RF -void rf_init(void); + void rf_init(void); // RF Interrupt -void interrupt(void); + void interrupt(void); // RF Set Datarate -void setDatarate(unsigned long ulValue); + void setDatarate(unsigned long ulValue); // RF Set Frequency -void setFrequency(unsigned long ulValue); + void setFrequency(unsigned long ulValue); // Enable RF Receiver FiFo fill -void enableFifoFill(void); + void enableFifoFill(void); // Disable RF Receiver FiFo fill -void disableFifoFill(void); + void disableFifoFill(void); // Handle new RF Data -void dataAvailable(char cCount, char* cBuffer); + void dataAvailable(char cCount, char* cBuffer); // Read status byte -int readStatusByte(); + int readStatusByte(); // Reset timeout: stops hanging on bad receive; resets alpha 433 -void timeout(); + void timeout(); private : @@ -271,16 +272,16 @@ SPI _spi; DigitalIn _nirq_test; InterruptIn _nirq; - - //Write a byte (data) to address + + //Write a byte (data) to address void _write(int address); //Read a byte (return val) from address int _read(int address); - + virtual int _putc(int c); virtual int _getc(); - + }; #endif // ALPHA433_H \ No newline at end of file