sakthi priya amirtharaj
/
BAE_b4hw_test
sw_test_workin
Fork of BAE_icecream_1_0 by
Diff: mnm.cpp
- Revision:
- 7:603c2a89effc
- Parent:
- 5:4199c0dfed33
diff -r 1cdbda747f99 -r 603c2a89effc mnm.cpp --- a/mnm.cpp Fri Feb 06 18:26:46 2015 +0000 +++ b/mnm.cpp Fri Feb 27 19:06:04 2015 +0000 @@ -23,6 +23,14 @@ float senstivity_gyro =6.5536; //senstivity is obtained from 2^15/5000dps float senstivity_mag =32.768; //senstivity is obtained from 2^15/1000microtesla float gyro_error[3]= {0,0,0}, mag_error[3]= {0,0,0}; + +Timer r0; +Timer r1; +Timer r2; +Timer r3; +Timer r4; + + /* int main(void) { @@ -40,21 +48,27 @@ }*/ void INIT_PNI() -{ +{ r0.start(); 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 + i2c.write(SLAVE_ADDR,cmd,2); + r0.stop(); //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 cmd[0]=SENTRALSTATUS; + r1.start(); i2c.write(SLAVE_ADDR,cmd,1); i2c.read(SLAVE_ADDR_READ,&store,1); + r1.stop(); wait_ms(100); //to check whether EEPROM is uploaded - switch((int)store) { + + /* switch((int)store) { case(3): { + printf("\nstore :%d\n",store); break; } case(11): { + printf("\nstore11 :%d\n",store); break; } default: { @@ -63,20 +77,26 @@ i2c.write(SLAVE_ADDR,cmd,2); wait_ms(2000); } - } + }*/ //mnm.printf("Sentral Status is %x\n",(int)store); + r2.start(); 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); + r2.stop(); wait_ms(100); + r3.start(); 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); + r3.stop(); + wait_ms(100); + r4.start(); 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); + r4.stop(); + wait_ms(100); 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); @@ -85,6 +105,7 @@ cmd[1]=BIT_EVT_ENB; i2c.write(SLAVE_ADDR,cmd,2); wait_ms(100); + printf("\n \r %d %d %d %d %d",r0.read_us(),r1.read_us(),r2.read_us(),r3.read_us(),r4.read_us()); } float *EXECUTE_PNI()