![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
cdms b4 check
Dependencies: SDFileSystem mbed-rtos mbed
Fork of CDMS_BAE_1 by
main.cpp
- Committer:
- sakthipriya
- Date:
- 2015-02-05
- Revision:
- 7:60e940b7a36b
- Parent:
- 6:ee97f01e6b7d
- Child:
- 8:4acac3bf5e9b
File content as of revision 7:60e940b7a36b:
#include "mbed.h" #include "rtos.h" #include "hk.h" #include "i2c.h" InterruptIn data_ready(D10); InterruptIn data_ready1(D3); int init=0; char data_receive[25]; extern DigitalOut interrupt; extern I2C master; Thread * ptr_t_hk; Thread * ptr_t_i2c1; /* void FUNC_HK_DATA() { storedata(data_receive,25); }*/ void FUNC_SCIENCE_DATA() { printf("Saved Science in SD"); } /*void T_I2C_HK(void const *args) { while(1) { Thread::signal_wait(0x1); FUNC_HK_DATA(); } }*/ void T_I2C_MASTER_FSLAVE1(void const *args) { while(1) { Thread::signal_wait(0x2); FUNC_SCIENCE_DATA(); } } void T_I2C_MASTER_FSLAVE(void const *args) { char data_receive[25]; while(1) { Thread::signal_wait(0x1); FUNC_I2C_MASTER_FSLAVE(data_receive,25); /*i2c_data * i2c_data_r = i2c_data_receive.alloc(); strcpy(i2c_data_r->data , data_receive); i2c_data_r->length = 25; i2c_data_receive.put(i2c_data_r);*/ printf("\n Data received from slave is %s\n\r",data_receive); //TC_DECODE(data_receive); } } void FUNC_INT() { ptr_t_hk->signal_set(0x1); } void FUNC_INT1() { ptr_t_i2c1->signal_set(0x2); } int main() { if(init==0) { init_rtc(); init++; } interrupt=0; //ptr_t_hk = new Thread (T_I2C_HK); data_ready.rise(&FUNC_INT); ptr_t_i2c1= new Thread (T_I2C_MASTER_FSLAVE1); data_ready1.rise(&FUNC_INT1); //ptr_t_i2c = new Thread(T_I2C_MASTER_FSLAVE); // data_ready.rise(&FUNC_INT); printf("\nstarted master\n"); master.frequency(100000); while(1) { //Thread::wait(9000); //interrupt = 1; FUNC_MASTER_WRITE(); //interrupt = 0; ; } }