Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE by
Diff: adf.h
- Revision:
- 18:f87a5b919d60
- Parent:
- 9:e9eaada136c6
--- a/adf.h Thu Dec 31 13:14:59 2015 +0000
+++ b/adf.h Fri Jan 01 06:40:02 2016 +0000
@@ -6,6 +6,7 @@
bool loop_on;
bool ADF_off;
bool buffer_state;
+bool stop_transmission = false;
bool finish_write_data;
uint8_t signal = 0x00;
unsigned char bbram_buffer[66]={0x19,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0xF4,0xC2,0x10,0xC0,0x00,0x30,0x31,0x07,0x00,0x01,0x00,0x7F,0x00,0x0B,0x37,0x00,0x00,0x40,0x0C,0x00,0x05,0x00,0x00,0x18,0x12,0x34,0x56,0x10,0x10,0xC4,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00};
@@ -388,7 +389,6 @@
SPI_mutex.unlock();\
}
-
#define write_data {\
SPI_mutex.lock();\
gCS_ADF=0;\
@@ -421,9 +421,10 @@
}
-void check(){
+void check() {
+
if(IRQ){
- gCOM_MNG_TMTC_THREAD->signal_set(signal);
+ gCOM_MNG_TMTC_THREAD->signal_set(8);\
}
}
@@ -463,6 +464,7 @@
spi.write(0xFF);\
spi.write(0xFF);\
gCS_ADF=1;\
+ gPC.puts("1 \r\n");\
SPI_mutex.unlock();\
ticker.attach_us(&check,32000);\
}
@@ -523,55 +525,74 @@
// gCOM_MNG_TMTC_THREAD->signal_set(signal);
//}
-void configure_adf(){
- finish_write_data = false;
- buffer_state = true;
- last_buffer = false;
- loop_on = true;
- ADF_off = false;
- /*initial adf check*/
- initial_adf_check;
- gPC.puts("initial adf check\r\n");
- initiate;
-// gPC.puts("initiate done\r\n");
- gPC.puts("adf configured\r\n");
+#define configure_adf {\
+ finish_write_data = false;\
+ buffer_state = true;\
+ last_buffer = false;\
+ loop_on = true;\
+ ADF_off = false;\
+ /*initial adf check*/\
+ initial_adf_check;\
+ gPC.puts("initial adf check\r\n");\
+ initiate;\
+ gPC.puts("adf configured\r\n");\
}
-void adf_not_SDcard(){
- sent_tmfrom_SDcard = false;
- configure_adf();
- signal = COM_MNG_TMTC_SIGNAL_ADF_NSD;
- send_data;
-
-// gPC.puts("Inside adf transmission\r\n");
-// ADF_non_responsive_timeout.attach(&ADF_non_responsive_fun, 10);
-
- while(loop_on){
- gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_NSD);
-// if( ADF_non_responsive_flag == false ){
- if(finish_write_data){
- if(ADF_off){
- SPI_mutex.lock();
- ticker.detach();
- // wait_ms(35);
- gCS_ADF=0;
- spi.write(0xB1);
- gCS_ADF=1;
- SPI_mutex.unlock();
- loop_on = false;
- gPC.puts("Transmission done\r\n");
- }
- else{
- ADF_off = true;
- }
- }else{
- write_data;
- snd_tm.transmit_data(buffer_112,&last_buffer);
- }
+#define adf_not_SDcard(){\
+ gLEDG = 0;\
+ gLEDR = 1;\
+ sent_tmfrom_SDcard = false;\
+ configure_adf;\
+ signal = COM_MNG_TMTC_SIGNAL_ADF_NSD;\
+ send_data;\
+ while(loop_on){\
+ gCOM_MNG_TMTC_THREAD->signal_wait(8);\
+ gLEDR = !gLEDR;\
+ if(!ADF_off){\
+ if(stop_transmission){\
+ write_data;\
+ ADF_off=true;\
+ }\
+ else{\
+ write_data;\
+ snd_tm.transmit_data(buffer_112,&last_buffer);\
+ }\
+ }\
+ else{\
+ wait_ms(20);\
+ ticker.detach();\
+ gCS_ADF=0;\
+ spi.write(0xB1);\
+ gCS_ADF=1;\
+/* gPC.puts("transmission done\r\n");*/\
+/* cout<<counter<<endl;*/\
+ loop_on=false; \
+ } \
+ }\
+}
+
+ //if(finish_write_data){
+// if(ADF_off){
+// wait_ms(30);
+// SPI_mutex.lock();
+// ticker.detach();
+// // wait_ms(35);
+// gCS_ADF=0;
+// spi.write(0xB1);
+// gCS_ADF=1;
+// SPI_mutex.unlock();
+// loop_on = false;
+// gPC.puts("Transmission done\r\n");
+// }
+// else{
+// ADF_off = true;
+// }
+// }else{
+// write_data;
+// snd_tm.transmit_data(buffer_112,&last_buffer);
+// }
// }
// else{
// gPC.puts("ADF non responsive\r\n");
// break;
-// }
- }
-}
\ No newline at end of file
+// }
\ No newline at end of file
