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_5thJan_azad by
Diff: main.cpp
- Revision:
- 34:1b41c34b12ea
- Parent:
- 33:76f2b8735501
- Child:
- 35:7193e581932f
--- a/main.cpp Mon Jul 04 04:29:59 2016 +0000 +++ b/main.cpp Mon Jul 04 07:01:26 2016 +0000 @@ -165,6 +165,8 @@ extern uint16_t ACS_MM_Z_COMSN; extern uint16_t ACS_MG_Z_COMSN; +extern uint8_t B_SCZ_ANGLE; + extern uint8_t controlmode_mms; //BCN @@ -483,6 +485,25 @@ mag_data[i] = actual_data.Bvalue_actual[i]/1000000; gyro_data[i] = actual_data.AngularSpeed_actual[i]*3.14159/180; } + + int b_inclination = mag_data[2]/(mag_data[0]*mag_data[0]+mag_data[1]*mag_data[1]+mag_data[2]*mag_data[2]) ; + if(b_inclination <0) + b_inclination = (-1)*b_inclination; + + + + b_inclination = b_inclination*16; + printf("\n\r the scale is %x",(uint16_t)val); + B_SCZ_ANGLE = (uint8_t)b_inclination; + if(b_inclination>=16) + {B_SCZ_ANGLE = 0x0F; + } + if(b_inclination<0) + {B_SCZ_ANGLE = 0x00; + } + + + if(ACS_STATE == 0) // check ACS_STATE = ACS_CONTROL_OFF? {