L3GD20 & L3G4200D / STMicroelectronics / MEMS motion sensor, three-axis gyroscope library
Dependents: GR-PEACH_test_wo_rtos GR-PEACH_test_on_rtos_works_well
Diff: L3GD20.cpp
- Revision:
- 1:9475fd0e35ff
- Parent:
- 0:de66621e5370
- Child:
- 2:8073008f3036
--- a/L3GD20.cpp Fri Aug 29 13:26:33 2014 +0000 +++ b/L3GD20.cpp Sun Sep 07 01:26:41 2014 +0000 @@ -11,7 +11,7 @@ * http://www.page.sannet.ne.jp/kenjia/index.html * http://mbed.org/users/kenjiArai/ * Created: July 13th, 2014 - * Revised: August 29th, 2014 + * Revised: September 7th, 2014 * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE @@ -28,7 +28,8 @@ } L3GX_GYRO::L3GX_GYRO (I2C& p_i2c, - uint8_t addr, uint8_t data_rate, uint8_t bandwidth, uint8_t fullscale) : i2c(p_i2c) { + uint8_t addr, uint8_t data_rate, uint8_t bandwidth, uint8_t fullscale) : i2c(p_i2c) { + i2c.frequency(400000); initialize (addr, data_rate, bandwidth, fullscale); } @@ -131,6 +132,10 @@ return 1;; } +void L3GX_GYRO::frequency(int hz) { + i2c.frequency(hz); +} + uint8_t L3GX_GYRO::read_reg(uint8_t addr) { if (gyro_ready == 1){ dbf[0] = addr;