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.
Fork of LSM303DLH by
Revision 8:cc338ded0b2c, committed 2017-08-06
- Comitter:
- salco
- Date:
- Sun Aug 06 23:57:25 2017 +0000
- Parent:
- 7:275a0a69cff5
- Commit message:
- remove part of my debug comment
Changed in this revision
LSM303DLH.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/LSM303DLH.cpp Sun Aug 06 23:42:07 2017 +0000 +++ b/LSM303DLH.cpp Sun Aug 06 23:57:25 2017 +0000 @@ -217,12 +217,11 @@ usec1 = t.read_us(); #endif - //OUT_XYZ_t my_test,dataOut; - static vector a_test, m_test; + static vector local_a, local_m; - result &= read_acc_raw(&a_test); + result &= read_acc_raw(&local_a); - result &= read_mag_raw(&m_test); + result &= read_mag_raw(&local_m); #if defined(CHECK_TIME_SEQUENCE) @@ -254,13 +253,13 @@ a.y = (float) (_filt_ay >> FILTER_SHIFT); a.z = (float) (_filt_az >> FILTER_SHIFT);*/ - a = a_test; + a = local_a; // offset and scale - m.x = (/*m_*/m_test.x + _offset_x) * _scale_x; - m.y = (/*m_*/m_test.y + _offset_y) * _scale_y; - m.z = (/*m_*/m_test.z + _offset_z) * _scale_z; + m.x = (/*m_*/local_m.x + _offset_x) * _scale_x; + m.y = (/*m_*/local_m.y + _offset_y) * _scale_y; + m.z = (/*m_*/local_m.z + _offset_z) * _scale_z; } @@ -329,7 +328,6 @@ OUT_XYZ_t dataOut; read_reg(addr_acc,STATUS_REG_A,&data_read_acc); - //char _FS = get_FullScall_selection(); if(((Status_Reg_A_t*)&data_read_acc)->ZYXDA)//new data { @@ -338,8 +336,6 @@ if(result) { a->x = get_acc_value_in_g(&dataOut); - - //setText(0,0,"read from reg _x:(%d) %.2X %.2X \n",my_test.value/*number*/, my_test.byte[1],my_test.byte[0]); } else { @@ -353,8 +349,6 @@ if(result) { a->y = get_acc_value_in_g(&dataOut); - - //setText(0,1,"read from reg _y:(%d) %.2X %.2X \n",my_test.value/*number*/, my_test.byte[1],my_test.byte[0]); } else { @@ -368,14 +362,11 @@ if(result) { a->z = get_acc_value_in_g(&dataOut); - - //setText(0,2,"read from reg _z:(%d) %.2X %.2X \n",my_test.value/*number*/, my_test.byte[1],my_test.byte[0]); } else { debug("error reading \n"); } - //setText(0,4,"test 4: x: %.4f y: %.4f z: %.4f \n",a_test.x,a_test.y,a_test.z); } return result; @@ -398,34 +389,26 @@ float gainxy[] = { 1100., 855., 670., 450., 400., 330., 230. }; float gainz[] = { 980., 760., 600., 400., 355., 295., 205. }; - //setText(0,6,"GN: %d \n",_GN); result &= read_reg_short(addr_mag,OUT_X_M,&dataOut); if(result) { - //dataOut.value = (dataOut.byte[0]<<8)+(dataOut.byte[1]);//only a test - - setText(0,0,"read from reg _x:(%d) %.2X %.2X \n",dataOut.value/*number*/, dataOut.byte[1],dataOut.byte[0]); + //dataOut.value = (dataOut.byte[0]<<8)+(dataOut.byte[1]);//only a test m->x = float(dataOut.value) / gainxy[m_GN]; } result &= read_reg_short(addr_mag,OUT_Y_M,&dataOut); if(result) { - //dataOut.value = (dataOut.byte[0]<<8)+(dataOut.byte[1]);//only a test - - setText(0,1,"read from reg _y:(%d) %.2X %.2X \n",dataOut.value/*number*/, dataOut.byte[1],dataOut.byte[0]); + //dataOut.value = (dataOut.byte[0]<<8)+(dataOut.byte[1]);//only a test m->y = float(dataOut.value) / gainxy[m_GN]; } result &= read_reg_short(addr_mag,OUT_Z_M,&dataOut); if(result) { - //dataOut.value = (dataOut.byte[0]<<8)+(dataOut.byte[1]);//only a test - - setText(0,2,"read from reg _z:(%d) %.2X %.2X \n",dataOut.value/*number*/, dataOut.byte[1],dataOut.byte[0]); + //dataOut.value = (dataOut.byte[0]<<8)+(dataOut.byte[1]);//only a test m->z = float(dataOut.value) / gainz[m_GN]; } - setText(0,4,"test 4: x: %.4f y: %.4f z: %.4f \n",m->x,m->y,m->z); } return result;