11//
22// FILE: GY521.cpp
33// AUTHOR: Rob Tillaart
4- // VERSION: 0.4.0
4+ // VERSION: 0.4.1
55// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
66// URL: https://github.com/RobTillaart/GY521
77
@@ -124,7 +124,7 @@ int16_t GY521::read()
124124
125125 // duration interval
126126 now = micros ();
127- float duration = (now - _lastMicros) * 1e-6 ; // duration in seconds.
127+ float duration = (now - _lastMicros) * 1e-6 ; // duration in seconds.
128128 _lastMicros = now;
129129
130130
@@ -180,7 +180,7 @@ int16_t GY521::read()
180180 // correction at 375 due to the factor 0.96 in pitch
181181 if (_gay >= 375 ) _gay -= 375 ;
182182 else if (_gay < 0 ) _gay += 375 ;
183- // correction at 360
183+ // correction at 360
184184 if (_gaz >= 360 ) _gaz -= 360 ;
185185 else if (_gaz < 0 ) _gaz += 360 ;
186186 }
@@ -335,7 +335,7 @@ int16_t GY521::readGyro()
335335 // correction at 375 due to the factor 0.96 in pitch
336336 if (_gay >= 375 ) _gay -= 375 ;
337337 else if (_gay < 0 ) _gay += 375 ;
338- // correction at 360
338+ // correction at 360
339339 if (_gaz >= 360 ) _gaz -= 360 ;
340340 else if (_gaz < 0 ) _gaz += 360 ;
341341 }
@@ -376,7 +376,7 @@ bool GY521::setAccelSensitivity(uint8_t as)
376376 {
377377 return false ;
378378 }
379- // no need to write same value
379+ // no need to write same value
380380 if (((val >> 3 ) & 3 ) != _afs)
381381 {
382382 val &= 0xE7 ;
@@ -386,7 +386,7 @@ bool GY521::setAccelSensitivity(uint8_t as)
386386 return false ;
387387 }
388388 }
389- // calculate conversion factor. // 4 possible values => lookup table?
389+ // calculate conversion factor. // 4 possible values => lookup table?
390390 _raw2g = (1 << _afs) * GY521_RAW2G;
391391 return true ;
392392}
@@ -397,7 +397,7 @@ uint8_t GY521::getAccelSensitivity()
397397 uint8_t val = getRegister (GY521_ACCEL_CONFIG);
398398 if (_error != GY521_OK)
399399 {
400- return _error; // return and propagate error (best thing to do)
400+ return _error; // return and propagate error (best thing to do)
401401 }
402402 _afs = (val >> 3 ) & 3 ;
403403 return _afs;
@@ -423,7 +423,7 @@ bool GY521::setGyroSensitivity(uint8_t gs)
423423 return false ;
424424 }
425425 }
426- // calculate conversion factor..
426+ // calculate conversion factor..
427427 // 4 possible values => lookup table?
428428 _raw2dps = (1 << _gfs) * GY521_RAW2DPS;
429429 return true ;
@@ -487,5 +487,5 @@ int16_t GY521::_WireRead2()
487487}
488488
489489
490- // -- END OF FILE --
490+ // -- END OF FILE --
491491
0 commit comments