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: SDFileSystem mbed-rtos mbed
Fork of CDMS_RTOS by
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 #include "hk.h" 00004 #include "i2c.h" 00005 InterruptIn data_ready(D10); 00006 InterruptIn data_ready1(D3); 00007 int init=0; 00008 char data_receive[25]; 00009 00010 extern DigitalOut interrupt; 00011 extern I2C master; 00012 00013 Thread * ptr_t_hk; 00014 Thread * ptr_t_i2c1; 00015 Thread * ptr_t_i2c; 00016 /* 00017 void FUNC_HK_DATA() 00018 { 00019 storedata(data_receive,25); 00020 }*/ 00021 void FUNC_SCIENCE_DATA() 00022 { 00023 printf("Saved Science in SD"); 00024 } 00025 00026 /*void T_I2C_HK(void const *args) 00027 { 00028 00029 while(1) 00030 { 00031 Thread::signal_wait(0x1); 00032 FUNC_HK_DATA(); 00033 } 00034 }*/ 00035 00036 void T_I2C_MASTER_FSLAVE1(void const *args) 00037 { 00038 while(1) 00039 { 00040 Thread::signal_wait(0x2); 00041 FUNC_SCIENCE_DATA(); 00042 } 00043 } 00044 00045 void T_I2C_MASTER_FSLAVE(void const *args) 00046 { 00047 char data_receive[25]; 00048 while(1) 00049 { 00050 Thread::signal_wait(0x1); 00051 00052 00053 FUNC_I2C_MASTER_FSLAVE(data_receive,25); 00054 /*i2c_data * i2c_data_r = i2c_data_receive.alloc(); 00055 strcpy(i2c_data_r->data , data_receive); 00056 i2c_data_r->length = 25; 00057 i2c_data_receive.put(i2c_data_r);*/ 00058 printf("\n Data received from slave is %s\n\r",data_receive); 00059 TC_DECODE(data_receive); 00060 } 00061 } 00062 00063 void FUNC_INT() 00064 { 00065 00066 ptr_t_i2c->signal_set(0x1); 00067 00068 } 00069 void FUNC_INT1() 00070 { 00071 00072 ptr_t_i2c1->signal_set(0x2); 00073 00074 } 00075 00076 00077 int main() 00078 00079 { 00080 if(init==0) 00081 { 00082 init_rtc(); 00083 init++; 00084 } 00085 interrupt=0; 00086 //ptr_t_hk = new Thread (T_I2C_HK); 00087 data_ready.rise(&FUNC_INT); 00088 ptr_t_i2c1= new Thread (T_I2C_MASTER_FSLAVE1); 00089 data_ready1.rise(&FUNC_INT1); 00090 00091 ptr_t_i2c = new Thread(T_I2C_MASTER_FSLAVE); 00092 // data_ready.rise(&FUNC_INT); 00093 printf("\nstarted master\n"); 00094 master.frequency(100000); 00095 while(1) 00096 { //Thread::wait(9000); 00097 //interrupt = 1; 00098 00099 FUNC_MASTER_WRITE(); 00100 //interrupt = 0; 00101 ; 00102 } 00103 } 00104 00105 00106 00107
Generated on Tue Jul 12 2022 22:48:17 by
