Radio Structures in OOP

Dependencies:   mbed mbed-rtos

Committer:
jjones646
Date:
Sun Dec 28 06:05:17 2014 +0000
Revision:
2:7d523bdd2f50
Child:
3:dc7e9c6bc26c
outlining communication implementations

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jjones646 2:7d523bdd2f50 1 #include "CC1101.h"
jjones646 2:7d523bdd2f50 2
jjones646 2:7d523bdd2f50 3
jjones646 2:7d523bdd2f50 4 // Default constructor
jjones646 2:7d523bdd2f50 5 CC1101::CC1101() :
jjones646 2:7d523bdd2f50 6 CommLink()
jjones646 2:7d523bdd2f50 7 {
jjones646 2:7d523bdd2f50 8 // [] - 1 - Initialize the CC1101 radio transceiver for operation
jjones646 2:7d523bdd2f50 9
jjones646 2:7d523bdd2f50 10 // [] - 2 - Test the interrupt pin for proper operation
jjones646 2:7d523bdd2f50 11
jjones646 2:7d523bdd2f50 12 // [] - 3 - Check the CC1101's version register to ensure the chip is what we believe it to be
jjones646 2:7d523bdd2f50 13
jjones646 2:7d523bdd2f50 14 // [] - 4 - Set the base class's `_isInit` variable to true if all checks are passed
jjones646 2:7d523bdd2f50 15 }
jjones646 2:7d523bdd2f50 16
jjones646 2:7d523bdd2f50 17
jjones646 2:7d523bdd2f50 18 // Deconstructor
jjones646 2:7d523bdd2f50 19 CC1101::~CC1101()
jjones646 2:7d523bdd2f50 20 {
jjones646 2:7d523bdd2f50 21
jjones646 2:7d523bdd2f50 22 }
jjones646 2:7d523bdd2f50 23
jjones646 2:7d523bdd2f50 24
jjones646 2:7d523bdd2f50 25 bool CC1101::isConnected(void)
jjones646 2:7d523bdd2f50 26 {
jjones646 2:7d523bdd2f50 27 // [] - 1 - Perform a check to ensure the CC1101 can provide communication with a secondary base station link
jjones646 2:7d523bdd2f50 28 // Note: This does not necessarily mean the link must be reliable, this only needs to determine: `Can the perheripial provide communication?`
jjones646 2:7d523bdd2f50 29
jjones646 2:7d523bdd2f50 30 // [] - 2 - Return true/false for indicating a connected communication link
jjones646 2:7d523bdd2f50 31
jjones646 2:7d523bdd2f50 32 return true;
jjones646 2:7d523bdd2f50 33 }
jjones646 2:7d523bdd2f50 34
jjones646 2:7d523bdd2f50 35
jjones646 2:7d523bdd2f50 36 uint32_t CC1101::reset(void)
jjones646 2:7d523bdd2f50 37 {
jjones646 2:7d523bdd2f50 38 // [] - 1 - Perform a soft reset for the CC1101 transceiver
jjones646 2:7d523bdd2f50 39
jjones646 2:7d523bdd2f50 40 // [] - 2 - Return any error codes if necessary
jjones646 2:7d523bdd2f50 41
jjones646 2:7d523bdd2f50 42 return 1;
jjones646 2:7d523bdd2f50 43 }
jjones646 2:7d523bdd2f50 44
jjones646 2:7d523bdd2f50 45
jjones646 2:7d523bdd2f50 46 uint32_t CC1101::selfTest(void)
jjones646 2:7d523bdd2f50 47 {
jjones646 2:7d523bdd2f50 48 // [] - 1 - Perform a self test for the CC1101 radio transceiver
jjones646 2:7d523bdd2f50 49
jjones646 2:7d523bdd2f50 50 // [] - 2 - Return any error codes if necessary
jjones646 2:7d523bdd2f50 51
jjones646 2:7d523bdd2f50 52 return 1;
jjones646 2:7d523bdd2f50 53 }
jjones646 2:7d523bdd2f50 54
jjones646 2:7d523bdd2f50 55
jjones646 2:7d523bdd2f50 56 uint32_t CC1101::sendPacket(RTP_t* p)
jjones646 2:7d523bdd2f50 57 {
jjones646 2:7d523bdd2f50 58 // [] - 1 - Read a packet from the txQueue
jjones646 2:7d523bdd2f50 59
jjones646 2:7d523bdd2f50 60 // [] - 2 - Send the packet to the CC1101 in proper format
jjones646 2:7d523bdd2f50 61
jjones646 2:7d523bdd2f50 62 // [] - 3 - Set the CC1101 to begin transmitting the data
jjones646 2:7d523bdd2f50 63
jjones646 2:7d523bdd2f50 64 // [] - 4 - Return any error codes if necessary
jjones646 2:7d523bdd2f50 65
jjones646 2:7d523bdd2f50 66 return 1;
jjones646 2:7d523bdd2f50 67 }
jjones646 2:7d523bdd2f50 68
jjones646 2:7d523bdd2f50 69 // * The receivePacket method must account for being called from an interrupt trigger *
jjones646 2:7d523bdd2f50 70 uint32_t CC1101::receivePacket(void)
jjones646 2:7d523bdd2f50 71 {
jjones646 2:7d523bdd2f50 72 // [] - 1 - Read in received data from the CC1101
jjones646 2:7d523bdd2f50 73
jjones646 2:7d523bdd2f50 74 // [] - 2 - Decipher the RTP packet and place it in the passed RTP_t* p pointer's data structure
jjones646 2:7d523bdd2f50 75
jjones646 2:7d523bdd2f50 76 // [] - 3 - Add the packet to the base class (CommLink) rxQueue
jjones646 2:7d523bdd2f50 77
jjones646 2:7d523bdd2f50 78 // [] - 4 - Ensure that the base class is informed of this newly received packet
jjones646 2:7d523bdd2f50 79
jjones646 2:7d523bdd2f50 80 // [] - 3 - Return any error codes if necessary
jjones646 2:7d523bdd2f50 81
jjones646 2:7d523bdd2f50 82 return 1;
jjones646 2:7d523bdd2f50 83 }
jjones646 2:7d523bdd2f50 84