![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
for testing
Diff: main.cpp
- Revision:
- 1:24f2092e3add
- Parent:
- 0:a93f830eae68
- Child:
- 2:9b4647a9558c
diff -r a93f830eae68 -r 24f2092e3add main.cpp --- a/main.cpp Tue Oct 27 13:15:15 2015 +0000 +++ b/main.cpp Tue Oct 27 17:39:35 2015 +0000 @@ -100,13 +100,16 @@ writereg(RF22_REG_6E_TX_DATA_RATE,0x01); writereg(RF22_REG_6F_TX_DATA_RATE,0x4F);//160bps writereg(RF22_REG_3E_PACKET_LENGTH,SHORT_TX_DATA); //short packet length - - wait(0.02); - - - - //get short_beacon array - + /* + init(); + //init complete + pc.printf("init complete.....press t to send\n"); + while(pc.getc()=='t') + { */ + //button.rise(&interrupt_func); //interrupt enabled ( rising edge of pin 9) + wait(0.02); // pl. update this value or even avoid it!!! + int i=0; + //extract values from short_beacon[] struct Short_beacon { uint8_t Voltage[1]; @@ -117,17 +120,22 @@ }Shortbeacon = { {0x88}, {0x99, 0xAA} , {0xAA},{0xAA,0xDD,0xEE}, {0x00} }; //filling hk data + //uint8_t short_beacon[] = { 0xAB, 0x8A, 0xE2, 0xBB, 0xB8, 0xA2, 0x8E,Shortbeacon.Voltage[0],Shortbeacon.AngularSpeed[0], Shortbeacon.AngularSpeed[1],Shortbeacon.SubsystemStatus[0],Shortbeacon.Temp[0],Shortbeacon.Temp[1],Shortbeacon.Temp[2],Shortbeacon.ErrorFlag[0]}; uint8_t short_beacon[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,Shortbeacon.Voltage[0],Shortbeacon.AngularSpeed[0], Shortbeacon.AngularSpeed[1],Shortbeacon.SubsystemStatus[0],Shortbeacon.Temp[0],Shortbeacon.Temp[1],Shortbeacon.Temp[2],Shortbeacon.ErrorFlag[0]}; - - - - + + //uint8_t short_beacon[15]; +// for(int i = 0;i<15;i++) +// { +// short_beacon[i] = 0xAA; +// } + + //writereg(RF22_REG_07_OPERATING_MODE1,0x01); //ready mode ?? clearTxBuf(); //writing data first time - uint8_t byte = 0; + int byte = 0; cs = 0; spi.write(0xFF); - + pc.printf("line 151"); for (int byte_counter = 0; byte_counter <15 ; byte_counter++) { for(int j = 3; j >= 0 ; j--) @@ -153,17 +161,18 @@ } cs = 1; - + pc.printf("line 177\n"); //Set to Tx mode writereg(RF22_REG_07_OPERATING_MODE1,0x09); //Check for fifoThresh while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) != 0x20); - - //Check for packetsent interrupt + //pc.printf("fifothresh1?\n"); + pc.printf("line 184\n"); + //rf22.waitPacketSent(); while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) != 0x04); - - //pc.printf("Short packet sent\r\n"); + //pc.printf(" chk pkt sent!\r\n"); + pc.printf("Short packet sent\r\n"); writereg(RF22_REG_07_OPERATING_MODE1,0x00); //standby mode @@ -219,7 +228,7 @@ //Check for packetsent interrupt while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) != 0x04); - //pc.printf("Long packet sent\r\n"); + pc.printf("Long packet sent\r\n"); writereg(RF22_REG_07_OPERATING_MODE1,0x00); //standby mode }