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: FreescaleIAP mbed-rtos mbed
Fork of workinQM_10thDec by
Diff: ACS.cpp
- Revision:
- 18:3662058a7c10
- Parent:
- 17:fc782f7548c6
- Child:
- 19:79e69017c855
diff -r fc782f7548c6 -r 3662058a7c10 ACS.cpp
--- a/ACS.cpp Fri May 13 11:56:49 2016 +0000
+++ b/ACS.cpp Sat May 14 11:19:13 2016 +0000
@@ -408,8 +408,14 @@
wait_ms(1);
//_______________________________________________________________________________//
-/*stop as of now this approach i.e pass through state*/
-/*
+/*start as of now this approach i.e pass through state*/
+/*
+ cmd[0]=0x35;//event status
+ i2c.write(SLAVE_ADDR,cmd,1);
+ i2c.read(SLAVE_ADDR_READ,&status,1);
+ wait_ms(1);
+ pc_acs.printf("\n\rEvent Status at start is %x\n \r",(int)status);
+
cmd[0]=ALGO_CTRL; //When 0x00 is written to ALGO CONTROL register we get scaled sensor values
cmd[1]=0x01;//Places sentral in standby state
i2c.write(SLAVE_ADDR,cmd,2);
@@ -428,7 +434,13 @@
wait_ms(1);
printf("\n\r the value of the pass through status register is = %x",(int)store);
+ cmd[0]=0x35;//event status
+ i2c.write(SLAVE_ADDR,cmd,1);
+ i2c.read(SLAVE_ADDR_READ,&status,1);
+ wait_ms(1);
+ pc_acs.printf("\n\rEvent Status at end initialization is %x\n \r",(int)status);
*/
+
//_______________________________________________________________________________//
ACS_INIT_STATUS = 'c'; //set ACS_INIT_STATUS flag
@@ -453,6 +465,7 @@
if(((int)status&40)==40){ //when both work
/// if((int)status==8){ //for just mag
/// if((int)status == 36){ //for just gyro as status 24(in binary) = 36 in decimal
+/// if((int)status==___yet to be decided___){ //for pass through state see how it tworks
/*don't ask for info if the gyro cupped as interrupt makes it go haywire that is enables the pins for gyro*/
cmd[0]=GYRO_XOUT_H; //0x22 gyro LSB of x
@@ -481,35 +494,35 @@
i2c.write(SLAVE_ADDR,cmd,1);
i2c.read(SLAVE_ADDR_READ,&status,1);
wait_ms(1);
- pc_acs.printf("\n\rEvent Status at the end is %x\n \r",(int)status);
+ pc_acs.printf("\n\rEvent Status at the end is %x",(int)status);
cmd[0]=0x33;//enable events
i2c.write(SLAVE_ADDR,cmd,1);
i2c.read(SLAVE_ADDR_READ,&status,1);
wait_ms(1);
- pc_acs.printf("\n\rEnable events is %x\n \r",(int)status);
+ pc_acs.printf("\n\rEnable events is %x",(int)status);
cmd[0]=0x57;//gyro rate
i2c.write(SLAVE_ADDR,cmd,1);
i2c.read(SLAVE_ADDR_READ,&status,1);
wait_ms(1);
- pc_acs.printf("\n\rgyro rate is %x\n \r",(int)status);
+ pc_acs.printf("\n\rgyro rate is %x",(int)status);
cmd[0]=0x55;//mag rate 0x00 indicate value lost
i2c.write(SLAVE_ADDR,cmd,1);
i2c.read(SLAVE_ADDR_READ,&status,1);
wait_ms(1);
- pc_acs.printf("\n\rmag rate is %x\n \r",(int)status);
+ pc_acs.printf("\n\rmag rate is %x",(int)status);
cmd[0]=0x36;//sensorstatus
i2c.write(SLAVE_ADDR,cmd,1);
i2c.read(SLAVE_ADDR_READ,&status,1);
wait_ms(1);
- pc_acs.printf("\n\rsensor Status is %x\n \r",(int)status);
+ pc_acs.printf("\n\rsensor Status is %x",(int)status);
cmd[0]=0x50;//error register
