green rosh
/
all_combined_week6
Updated BAE RTOS
Fork of all_combined_week6 by
Diff: main.cpp
- Revision:
- 6:82153349cc9b
- Parent:
- 5:c7cd684d25a8
- Child:
- 7:b3f876f605d9
--- a/main.cpp Sat Jul 12 07:27:15 2014 +0000 +++ b/main.cpp Tue Jul 15 10:04:38 2014 +0000 @@ -2,7 +2,8 @@ #include "rtos.h" #include "HK.h" #include "slave.h" -#include "ShortBeacon.h" +#include "beacon.h" +#include "ACS.h" //watda? Serial pc(USBTX, USBRX); @@ -51,12 +52,13 @@ { t.start(); Thread::signal_wait(0x4); - printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); + printf("\nEntered t_hk_send2cdms\n"); + /*printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); printf("The state of acs_main thread is %d\n",ptr_t_acs->get_state()); printf("The state of acs_write2flash thread is %d\n",ptr_t_acs_write2flash->get_state()); - printf("The state of beacon thread is %d\n",ptr_t_bea->get_state()); + printf("The state of beacon thread is %d\n",ptr_t_bea->get_state());*/ - FUNC_I2C_SLAVE_MAIN(24); + //FUNC_I2C_SLAVE_MAIN(24); printf("The time to execute send2cdms is %f\n",t.read()); t.reset(); } @@ -73,11 +75,12 @@ t.start(); FUNC_HK_MAIN(); - thread_2.signal_set(0x4); - printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); + //thread_2.signal_set(0x4); + FUNC_I2C_SLAVE_MAIN(24); + /*printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); printf("The state of acs_main thread is %d\n",ptr_t_acs->get_state()); printf("The state of acs_write2flash thread is %d\n",ptr_t_acs_write2flash->get_state()); - printf("The state of beacon thread is %d\n",ptr_t_bea->get_state()); + printf("The state of beacon thread is %d\n",ptr_t_bea->get_state());*/ t.stop(); printf("The time to execute hk_acq is %f seconds\n",t.read()); t.reset(); @@ -105,10 +108,10 @@ pc.printf("Executing control algo\n"); } -void func_acs_pwmgen() +/*void func_acs_pwmgen() { pc.printf("Generating PWM signal\n"); -} +}*/ void func_acs_write2flash(sensor_data *ptr2) { @@ -127,13 +130,13 @@ func_acs_readdata(ptr); q_acs.put(ptr); func_acs_ctrlalgo(); - func_acs_pwmgen(); + FUNC_ACS_GENPWM(); - printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); + /*printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); printf("The state of acs_main thread is %d\n",ptr_t_acs->get_state()); printf("The state of acs_write2flash thread is %d\n",ptr_t_acs_write2flash->get_state()); printf("The state of beacon thread is %d\n",ptr_t_bea->get_state()); - printf("The time to execute t_acs is %f seconds\n",t.read()); + printf("The time to execute t_acs is %f seconds\n",t.read());*/ // Thread::wait(10000); t.reset(); } @@ -151,7 +154,7 @@ func_acs_write2flash(ptr); q_acs.free(ptr); } - printf("Writing in the flash\n"); + printf("Writing acsd data in the flash\n"); } } @@ -189,15 +192,16 @@ Thread::signal_wait(0x3); printf("\nTHIS IS BEACON %f\n",t1.read()); t.start(); - printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); + /*printf("The state of hk_acq thread is %d\n",ptr_t_hk_acq->get_state()); printf("The state of acs_main thread is %d\n",ptr_t_acs->get_state()); printf("The state of acs_write2flash thread is %d\n",ptr_t_acs_write2flash->get_state()); - printf("The state of beacon thread is %d\n",ptr_t_bea->get_state()); + printf("The state of beacon thread is %d\n",ptr_t_bea->get_state());*/ if(beac_flag==0) { //func_bea_readbaeflash(); //func_bea_spiwrite(); - Thread::wait(30000); + beacon_func(); + //Thread::wait(30000); } else { @@ -260,15 +264,15 @@ schedcount = 0; } - if(schedcount%10==0) + if(schedcount%1==0) { ptr_t_acs -> signal_set(0x1); } - if(schedcount%20==0) + if(schedcount%2==0) { ptr_t_hk_acq -> signal_set(0x2); } - if(schedcount%30==0) + if(schedcount%3==0) { ptr_t_bea -> signal_set(0x3); } @@ -312,12 +316,12 @@ pc.printf("\n T_ACS_WRITE2FLASH priority is %d",ptr_t_acs_write2flash->get_priority()); pc.printf("\n T_BEA priority is %d",ptr_t_bea->get_priority()); RtosTimer t_sc_timer(t_sc,osTimerPeriodic); - t_sc_timer.start(1000); + t_sc_timer.start(10000); printf("\n%f\n",t1.read()); while(1) { - //Thread::wait(1000); + Thread::wait(10000); ; }