The presence of rtos library, and line 294 in RF12B.cpp causes a crash when ISR occurs on falling edge on pin 9.

Dependencies:   mbed

Committer:
narshu
Date:
Sun Mar 25 20:14:41 2012 +0000
Revision:
0:b4c2aa657754

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
narshu 0:b4c2aa657754 1 #ifndef _RF12B_H
narshu 0:b4c2aa657754 2 #define _RF12B_H
narshu 0:b4c2aa657754 3
narshu 0:b4c2aa657754 4 #include "mbed.h"
narshu 0:b4c2aa657754 5 #include <queue>
narshu 0:b4c2aa657754 6
narshu 0:b4c2aa657754 7 enum rfmode_t{RX, TX};
narshu 0:b4c2aa657754 8
narshu 0:b4c2aa657754 9 class RF12B {
narshu 0:b4c2aa657754 10 public:
narshu 0:b4c2aa657754 11 /* Constructor */
narshu 0:b4c2aa657754 12 RF12B(PinName SDI,
narshu 0:b4c2aa657754 13 PinName SDO,
narshu 0:b4c2aa657754 14 PinName SCK,
narshu 0:b4c2aa657754 15 PinName NCS,
narshu 0:b4c2aa657754 16 PinName NIRQ);
narshu 0:b4c2aa657754 17
narshu 0:b4c2aa657754 18
narshu 0:b4c2aa657754 19
narshu 0:b4c2aa657754 20 /* Reads a packet of data. Returns false if read failed. Use available() to check how much space to allocate for buffer */
narshu 0:b4c2aa657754 21 bool read(unsigned char* data, unsigned int size);
narshu 0:b4c2aa657754 22
narshu 0:b4c2aa657754 23 /* Reads a byte of data from the receive buffer
narshu 0:b4c2aa657754 24 Returns 0xFF if there is no data */
narshu 0:b4c2aa657754 25 unsigned char read();
narshu 0:b4c2aa657754 26
narshu 0:b4c2aa657754 27 /* Transmits a packet of data */
narshu 0:b4c2aa657754 28 void write(unsigned char* data, unsigned char length);
narshu 0:b4c2aa657754 29 void write(unsigned char data); /* 1-byte packet */
narshu 0:b4c2aa657754 30 void write(std::queue<char> &data, int length = -1); /* sends a whole queue */
narshu 0:b4c2aa657754 31
narshu 0:b4c2aa657754 32 /* Returns the packet length if data is available in the receive buffer, 0 otherwise*/
narshu 0:b4c2aa657754 33 unsigned int available();
narshu 0:b4c2aa657754 34
narshu 0:b4c2aa657754 35 protected:
narshu 0:b4c2aa657754 36 /* Receive FIFO buffer */
narshu 0:b4c2aa657754 37 std::queue<unsigned char> fifo;
narshu 0:b4c2aa657754 38
narshu 0:b4c2aa657754 39 /* SPI module */
narshu 0:b4c2aa657754 40 SPI spi;
narshu 0:b4c2aa657754 41
narshu 0:b4c2aa657754 42 /* Other digital pins */
narshu 0:b4c2aa657754 43 DigitalOut NCS;
narshu 0:b4c2aa657754 44 InterruptIn NIRQ;
narshu 0:b4c2aa657754 45 DigitalIn NIRQ_in;
narshu 0:b4c2aa657754 46 //DigitalOut rfled;
narshu 0:b4c2aa657754 47
narshu 0:b4c2aa657754 48 rfmode_t mode;
narshu 0:b4c2aa657754 49
narshu 0:b4c2aa657754 50 /* Initialises the RF12B module */
narshu 0:b4c2aa657754 51 void init();
narshu 0:b4c2aa657754 52
narshu 0:b4c2aa657754 53 /* Write a command to the RF Module */
narshu 0:b4c2aa657754 54 unsigned int writeCmd(unsigned int cmd);
narshu 0:b4c2aa657754 55
narshu 0:b4c2aa657754 56 /* Sends a byte of data across RF */
narshu 0:b4c2aa657754 57 void send(unsigned char data);
narshu 0:b4c2aa657754 58
narshu 0:b4c2aa657754 59 /* Switch module between receive and transmit modes */
narshu 0:b4c2aa657754 60 void changeMode(rfmode_t mode);
narshu 0:b4c2aa657754 61
narshu 0:b4c2aa657754 62 /* Interrupt routine for data reception */
narshu 0:b4c2aa657754 63 void rxISR();
narshu 0:b4c2aa657754 64
narshu 0:b4c2aa657754 65 /* Tell the RF Module this packet is received and wait for the next */
narshu 0:b4c2aa657754 66 void resetRX();
narshu 0:b4c2aa657754 67
narshu 0:b4c2aa657754 68 /* Return the RF Module Status word */
narshu 0:b4c2aa657754 69 unsigned int status();
narshu 0:b4c2aa657754 70
narshu 0:b4c2aa657754 71 /* Calculate CRC8 */
narshu 0:b4c2aa657754 72 unsigned char crc8(unsigned char crc, unsigned char data);
narshu 0:b4c2aa657754 73 };
narshu 0:b4c2aa657754 74
narshu 0:b4c2aa657754 75 #endif /* _RF12B_H */