This is an experimental driver for the XBee 900 HP pro module's SPI connection. This driver is unfinished and stability is not guaranteed. Use with caution.

Dependents:   Sentinel_BASE Sentinel_NODE

Committer:
ottaviano3
Date:
Thu Apr 23 17:09:28 2015 +0000
Revision:
2:7f4ddf710a44
Parent:
1:b97d46c5d7ce
Child:
3:3c3707b0f5cd
added read capability

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ottaviano3 0:8c8a8244e590 1 #ifndef XBEE900HP_H
ottaviano3 0:8c8a8244e590 2 #define XBEE900HP_H
ottaviano3 0:8c8a8244e590 3
ottaviano3 0:8c8a8244e590 4 #include "mbed.h"
ottaviano3 0:8c8a8244e590 5
ottaviano3 0:8c8a8244e590 6 /**
ottaviano3 0:8c8a8244e590 7 * Wrapper for the xBee 900 HP Module
ottaviano3 0:8c8a8244e590 8 */
ottaviano3 0:8c8a8244e590 9 class xbee900hp
ottaviano3 0:8c8a8244e590 10 {
ottaviano3 0:8c8a8244e590 11 public:
ottaviano3 0:8c8a8244e590 12
ottaviano3 0:8c8a8244e590 13 /**
ottaviano3 0:8c8a8244e590 14 * Initialize the xBee Module
ottaviano3 0:8c8a8244e590 15 */
ottaviano3 1:b97d46c5d7ce 16 xbee900hp(PinName pin_mosi,PinName pin_miso,PinName pin_sck,PinName pin_attn, PinName pin_rst);
ottaviano3 0:8c8a8244e590 17
ottaviano3 0:8c8a8244e590 18 /**
ottaviano3 0:8c8a8244e590 19 * Destructor
ottaviano3 0:8c8a8244e590 20 */
ottaviano3 0:8c8a8244e590 21 ~xbee900hp();
ottaviano3 0:8c8a8244e590 22
ottaviano3 0:8c8a8244e590 23 /**
ottaviano3 0:8c8a8244e590 24 * Subroutine to reset the xBee Module
ottaviano3 0:8c8a8244e590 25 */
ottaviano3 0:8c8a8244e590 26 void reset();
ottaviano3 0:8c8a8244e590 27
ottaviano3 0:8c8a8244e590 28 /**
ottaviano3 0:8c8a8244e590 29 * Send packet over spi to xBee for TX
ottaviano3 0:8c8a8244e590 30 */
ottaviano3 0:8c8a8244e590 31 void sendPacket(char* data, unsigned int length);
ottaviano3 0:8c8a8244e590 32
ottaviano3 1:b97d46c5d7ce 33 /**
ottaviano3 1:b97d46c5d7ce 34 * Write a setting value to the module
ottaviano3 1:b97d46c5d7ce 35 */
ottaviano3 1:b97d46c5d7ce 36 void writeSetting(char command[2], unsigned int value);
ottaviano3 1:b97d46c5d7ce 37
ottaviano3 2:7f4ddf710a44 38 /**
ottaviano3 2:7f4ddf710a44 39 * Wait for and read incoming data packet
ottaviano3 2:7f4ddf710a44 40 */
ottaviano3 2:7f4ddf710a44 41 int readPacket(char* data);
ottaviano3 2:7f4ddf710a44 42
ottaviano3 2:7f4ddf710a44 43 /**
ottaviano3 2:7f4ddf710a44 44 * Check ATTN signal
ottaviano3 2:7f4ddf710a44 45 */
ottaviano3 2:7f4ddf710a44 46 int attn();
ottaviano3 2:7f4ddf710a44 47
ottaviano3 0:8c8a8244e590 48 private:
ottaviano3 0:8c8a8244e590 49 // Setup pin input types.
ottaviano3 0:8c8a8244e590 50
ottaviano3 0:8c8a8244e590 51 // Reset
ottaviano3 0:8c8a8244e590 52 DigitalOut _pin_rst;
ottaviano3 1:b97d46c5d7ce 53 // Asert Pin Use Interrupts for Super Speed
ottaviano3 2:7f4ddf710a44 54 DigitalIn _pin_attn;
ottaviano3 1:b97d46c5d7ce 55
ottaviano3 1:b97d46c5d7ce 56 void readDataISR();
ottaviano3 0:8c8a8244e590 57
ottaviano3 0:8c8a8244e590 58 // SPI
ottaviano3 0:8c8a8244e590 59 SPI _xbeespi;
ottaviano3 0:8c8a8244e590 60
ottaviano3 0:8c8a8244e590 61 };
ottaviano3 0:8c8a8244e590 62
ottaviano3 0:8c8a8244e590 63 #endif