sd 32 update

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Committer:
pradeepvk2208
Date:
Tue Jan 19 12:29:15 2016 +0000
Revision:
72:7460872eef79
Parent:
52:0bd68655c651
Child:
55:39e59903bc3a
Child:
69:20f09a0c3fd2
sd update 32

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aniruddhv 52:0bd68655c651 1 #define tm_len 134
aniruddhv 52:0bd68655c651 2 #define tc_len 135
aniruddhv 52:0bd68655c651 3 #define tc_test_len 135
aniruddhv 52:0bd68655c651 4
aniruddhv 52:0bd68655c651 5 DigitalOut irpt_2_slv(PIN67); //I2C interrupt to CDMS
aniruddhv 52:0bd68655c651 6 I2C master(PIN32,PIN31);
aniruddhv 52:0bd68655c651 7 DigitalOut led1(PIN46);
aniruddhv 52:0bd68655c651 8 DigitalOut led2(PIN95);
aniruddhv 52:0bd68655c651 9 const int addr = 0x20; //slave address
aniruddhv 52:0bd68655c651 10 char telecommand[tc_len];
aniruddhv 52:0bd68655c651 11 char telemetry[tm_len];
aniruddhv 52:0bd68655c651 12 Timer test;
aniruddhv 52:0bd68655c651 13 Timer t_read;
aniruddhv 52:0bd68655c651 14 bool write_ack = true;
aniruddhv 52:0bd68655c651 15 bool read_ack = true;
aniruddhv 52:0bd68655c651 16
aniruddhv 52:0bd68655c651 17 int count = 0;
aniruddhv 52:0bd68655c651 18
aniruddhv 52:0bd68655c651 19 void FCTN_I2C_WRITE(char *data)
aniruddhv 52:0bd68655c651 20 {
aniruddhv 52:0bd68655c651 21 irpt_2_slv = 1;
aniruddhv 52:0bd68655c651 22 //t.start();
aniruddhv 52:0bd68655c651 23 write_ack = master.write(addr|0x00,data,tc_len);
aniruddhv 52:0bd68655c651 24 //t.stop();
aniruddhv 52:0bd68655c651 25 //if(write_ack == 0)
aniruddhv 52:0bd68655c651 26 //pc.printf("\n\r data not sent \n");
aniruddhv 52:0bd68655c651 27
aniruddhv 52:0bd68655c651 28 if (write_ack == 1)
aniruddhv 52:0bd68655c651 29 {
aniruddhv 52:0bd68655c651 30 led2 = 1;
aniruddhv 52:0bd68655c651 31 printf("\n\r data not sent \n");
aniruddhv 52:0bd68655c651 32 led2 = 0;
aniruddhv 52:0bd68655c651 33 }
aniruddhv 52:0bd68655c651 34 irpt_2_slv = 0;
aniruddhv 52:0bd68655c651 35 //pc.printf("\n\r %d \n",t.read_us());
aniruddhv 52:0bd68655c651 36 //t.reset();
aniruddhv 52:0bd68655c651 37 }
aniruddhv 52:0bd68655c651 38
aniruddhv 52:0bd68655c651 39
aniruddhv 52:0bd68655c651 40 void FCTN_I2C_READ(char *data)
aniruddhv 52:0bd68655c651 41 {
aniruddhv 52:0bd68655c651 42 irpt_2_slv = 1;
aniruddhv 52:0bd68655c651 43 t_read.start();
aniruddhv 52:0bd68655c651 44 read_ack = master.read(addr|1,data,tm_len);
aniruddhv 52:0bd68655c651 45 t_read.stop();
aniruddhv 52:0bd68655c651 46
aniruddhv 52:0bd68655c651 47 //if(read_ack == 0)
aniruddhv 52:0bd68655c651 48 // printf("\n\rData received from BAE %s \n",data);
aniruddhv 52:0bd68655c651 49 if (read_ack == 1)
aniruddhv 52:0bd68655c651 50 {
aniruddhv 52:0bd68655c651 51 led2 = 1;
aniruddhv 52:0bd68655c651 52 printf("\n \r data not received \n");
aniruddhv 52:0bd68655c651 53 led2 = 0;
aniruddhv 52:0bd68655c651 54 }
aniruddhv 52:0bd68655c651 55 //if(read_ack == 1)
aniruddhv 52:0bd68655c651 56 //pc.printf("\n \r data not received \n");
aniruddhv 52:0bd68655c651 57
aniruddhv 52:0bd68655c651 58 irpt_2_slv = 0;
aniruddhv 52:0bd68655c651 59 //printf("\n\r %d \n",t.read_us());
aniruddhv 52:0bd68655c651 60 //t.reset();
aniruddhv 52:0bd68655c651 61 }