Team Fox / Mbed 2 deprecated BAE_QM_MAR9

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of workinQM_5thJan_azad by Team Fox

Revision:
16:f9e484dc505e
Parent:
15:e09aaaccf134
Child:
17:fc782f7548c6
--- a/ACS.cpp	Tue Apr 19 21:27:07 2016 +0000
+++ b/ACS.cpp	Thu May 12 10:56:44 2016 +0000
@@ -344,17 +344,20 @@
     //FLAG();
     pc_acs.printf("Attitude sensor init called \n \r");
     //FLAG();
-    cmd[0]=RESETREQ;
+   /* as of now no reset
+   cmd[0]=RESETREQ;
     cmd[1]=BIT_RESREQ;
     i2c.write(SLAVE_ADDR,cmd,2); //When 0x01 is written in reset request register Emulates a hard power down/power up
     wait_ms(2000); //waiting for loading configuration file stored in EEPROM
+   // */
+    //wait_ms(3000);
     cmd[0]=SENTRALSTATUS;
     i2c.write(SLAVE_ADDR,cmd,1);
     i2c.read(SLAVE_ADDR_READ,&store,1);
-    wait_ms(100);
+    wait_ms(20); // initially 100
     //to check whether EEPROM is uploaded
     switch((int)store) { 
-        case(3): {
+        case(3): { //actually this state correct
             break;
         }
         case(11): {
@@ -364,30 +367,31 @@
             cmd[0]=RESETREQ;
             cmd[1]=BIT_RESREQ;
             i2c.write(SLAVE_ADDR,cmd,2);
-            wait_ms(2000);
+            wait_ms(2000);//see if it can be changed
         }
     }
+    pc_acs.printf("\n\n\rwait is 1 \n\r");
     pc_acs.printf("Sentral Status is %x\n \r",(int)store);
     cmd[0]=HOST_CTRL; //0x01 is written in HOST CONTROL register to enable the sensors
     cmd[1]=BIT_RUN_ENB;
     i2c.write(SLAVE_ADDR,cmd,2);
-    wait_ms(100);
+    wait_ms(10);
     cmd[0]=MAGRATE; //Output data rate of 100Hz is used for magnetometer
     cmd[1]=BIT_MAGODR;
     i2c.write(SLAVE_ADDR,cmd,2);
-    wait_ms(100);
+    wait_ms(1);
     cmd[0]=GYRORATE; //Output data rate of 150Hz is used for gyroscope
     cmd[1]=BIT_GYROODR;
     i2c.write(SLAVE_ADDR,cmd,2);
-    wait_ms(100);
+    wait_ms(1);
     cmd[0]=ALGO_CTRL; //When 0x00 is written to ALGO CONTROL register we get scaled sensor values
     cmd[1]=0x00;
     i2c.write(SLAVE_ADDR,cmd,2);
-    wait_ms(100);
+    wait_ms(1);
     cmd[0]=ENB_EVT; //enabling the error,gyro values and magnetometer values
     cmd[1]=BIT_EVT_ENB;
     i2c.write(SLAVE_ADDR,cmd,2);
-    wait_ms(100);
+    wait_ms(1);
     ACS_INIT_STATUS = 'c'; //set ACS_INIT_STATUS flag
 }