some correction to work nice
Fork of L3GD20 by
Revision 1:53d0deb65d1b, committed 2013-11-12
- Comitter:
- patsteph
- Date:
- Tue Nov 12 17:25:28 2013 +0000
- Parent:
- 0:62dfce144cf7
- Child:
- 2:90eddd0eff29
- Commit message:
- Pour S Bouaziz
Changed in this revision
L3GD20.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/L3GD20.cpp Thu Feb 21 00:21:23 2013 +0000 +++ b/L3GD20.cpp Tue Nov 12 17:25:28 2013 +0000 @@ -63,11 +63,11 @@ bool L3GD20::read(float *gx, float *gy, float *gz) { char gyr[6]; - if (recv(GYR_ADDRESS, L3GD20_OUT_X_L, gyr, 6)) { + if (recv(GYR_ADDRESS, L3GD20_OUT_X_L, (char *)gyr, 6)) { //scale is 8.75 mdps/digit - *gx = float(short(gyr[1] << 8 | gyr[0]))*0.00875; - *gy = float(short(gyr[3] << 8 | gyr[2]))*0.00875; - *gz = float(short(gyr[5] << 8 | gyr[4]))*0.00875; + *gx = *((short *)gyr)*0.00875; //((((short)gyr[1]) << 8 )| gyr[0])*0.00875; + *gy = *((short *)(gyr+2))*0.00875; //((((short)gyr[3]) << 8 )| gyr[2])*0.00875; + *gz = *((short *)(gyr+4))*0.00875;//((((short)gyr[5]) << 8 )| gyr[4])*0.00875; return true;