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 CDMS_CODE by
Diff: main.cpp
- Revision:
- 152:8e4155426581
- Parent:
- 151:e6c7d4f87704
- Child:
- 157:e808cdb56239
--- a/main.cpp Sat Apr 02 20:31:31 2016 +0000
+++ b/main.cpp Mon Apr 04 10:44:44 2016 +0000
@@ -62,80 +62,61 @@
gPC.baud(115200);
// COMMON SPI
- spi.format(8,0);
- spi.frequency(1000000);
-
- // SD CARD
- cs_sd = 1;
- gCS_RTC = 1;
- gCS_ADF = 1;
-
- //FCTN_CDMS_INIT_RTC();/* rtc initialization*/
- #if SDCARD
- FCTN_CDMS_SD_INIT();/* sd card initialization*/
- #endif
-
- #if DEBUG
- gPC.puts("welcome to mng_tmtc\r\n");
- #endif
-
- // COM_MNG_TMTC THREAD
- gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
- gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
- #if DEBUG
- gPC.puts("allocating threads\r\n");
- #endif
- #if SDCARD
- gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
- // gPC.puts("step one complete\r\n");
- gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
- #endif
-
- #if DEBUG
- gPC.puts("competed allocating threads\r\n");
- #endif
-
+ // spi.format(8,0);
+// spi.frequency(1000000);
+//
+// // SD CARD
+// cs_sd = 1;
+// gCS_RTC = 1;
+// gCS_ADF = 1;
+//
+// //FCTN_CDMS_INIT_RTC();/* rtc initialization*/
+// #if SDCARD
+// FCTN_CDMS_SD_INIT();/* sd card initialization*/
+// #endif
+//
+// #if DEBUG
+// gPC.puts("welcome to mng_tmtc\r\n");
+// #endif
+//
+// // COM_MNG_TMTC THREAD
+// gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
+// gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
+// #if DEBUG
+// gPC.puts("allocating threads\r\n");
+// #endif
+// #if SDCARD
+// gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
+// // gPC.puts("step one complete\r\n");
+// gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
+// #endif
+//
+// #if DEBUG
+// gPC.puts("competed allocating threads\r\n");
+// #endif
+//
// *******************INITIALISATIONS END********************
//RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);
//gCDMS_HK_TIMER.start(5000);
-
- /*starting the thread with signal*/
-// set_sig();
-
- /*Calculating Stack used*/
-
- int state;
- /*while (true) {
- Thread::wait(500);
- state = gSCIENCE_THREAD->get_state();
- //gPC.printf("Thread state %d\r\n", state);
- if(state == Thread::Inactive)
- {delete gSCIENCE_THREAD;
- break;}
- }*/
- #if I2c
- int i =0 ;
- char test[1] ;
- test[0] = 7;
- while(1)
- {
-
- wait(5);
- printf("Wriring to I2C\n");
- master.write(addr_pl|0x00,test,1);
-
- if(rcv_isr == 1)
- {
- for(i = 0; i < 134 ; i++)
- {
- printf("%d\r\n",PL_I2C_DATA[i]);
- }
- rcv_isr = 0;
- }
-
- }
- #endif
+
+ uint8_t TC[11] = {0x1, 0x60, 0x81, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1d, 0xd9};
+ uint8_t TM[134];
+ FCTN_I2C_WRITE((char*)TC,TC_SHORT_SIZE);
+
+ wait(1); //TimeOut instead of wait
+ if(BAE_I2C_GPIO == 1)
+ {
+
+ //printf("receiving...\r\n");
+ FCTN_I2C_READ((char*)TM,TM_LONG_SIZE);
+ //printf("%s", tm_pointer->TM_string);
+ }
+ else
+ {
+ gPC.printf("bae_INTR NOT HIGH");
+ }
+
while(true){
Thread::wait(osWaitForever);
//state = gCOM_MNG_TMTC_THREAD->get_state() + '0';
