Jonathan Jones
/
Radios
Radio Structures in OOP
Diff: main.cpp
- Revision:
- 6:4a3dbfbc30f1
- Parent:
- 5:146523a0d1f4
--- a/main.cpp Wed Jan 14 17:46:44 2015 +0000 +++ b/main.cpp Thu Jan 15 07:15:33 2015 +0000 @@ -4,7 +4,6 @@ #if RJ_BOOT_LOG LocalFileSystem local("local"); // Create the local filesystem object #endif -DigitalOut ll(p5, 1); // trigger for logic analyzer DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); @@ -12,20 +11,6 @@ Serial pc(USBTX, USBRX); -// Dummy function -void primary_radio_rx_handle(void) -{ - led3 != led3; -} -/* -// Dummy function -void primary_radio_tx_handle(RTP_t* p) -{ - led4 = !led4; -} -*/ - - // Sets the mbed's baudrate for debugging purposes void baud(int baudrate) { @@ -36,7 +21,6 @@ // Main program operations ======================= int main() { - led4 = 0; // Set the baud rate baud(57600); @@ -54,9 +38,7 @@ #endif -DigitalOut temppp(RJ_PRIMARY_RADIO_INT, 1); -temppp = 0; -temppp = 1; + DigitalOut temppp(RJ_PRIMARY_RADIO_INT, 1); // Create a new physical hardware communication link CC1101 radio_900( @@ -64,16 +46,13 @@ RJ_PRIMARY_RADIO_CS, RJ_PRIMARY_RADIO_INT ); - - radio_900.selfTest(); - - radio_900.status(CCXXX1_MARCSTATE); // Create a Communication Module Object CommModule comm; - radio_900.setCommModule(comm); + + radio_900.setModule(comm); + comm.TxHandler((CommLink*)&radio_900, &CommLink::sendPacket, 8); - //comm.RxHandler((CommLink*)&radio_900, &CommLink::ISR, 8); comm.openSocket(8); // Open a socket for the Communication Module. Give it a port number and a function to call when a packet of that port number is received @@ -81,10 +60,13 @@ // Create a dummy packet that is set to send out from socket connection 8 RTP_t dummy_packet; + for (int i=0; i<20; i++) + dummy_packet.data[i] = i; + + dummy_packet.data_size = 20; dummy_packet.port = 8; dummy_packet.subclass = 1; - for (int i=0; i<20; i++) - dummy_packet.data[0] = i; + // Enable watchdog timer //Watchdog watchdog; @@ -94,6 +76,7 @@ while(1) { led1 = !led1; + //radio_900.status(); //comm.send(dummy_packet); osDelay(500);