1 #ifndef LIBPROPELLER_L3GD20_H_
2 #define LIBPROPELLER_L3GD20_H_
5 #include "libpropeller/i2c/i2c.h"
7 #include "libpropeller/i2c/i2cMOCK.h"
60 status_ = bus_->
Ping(device_address);
61 if (status_ ==
false) {
65 bus_->
Put(device_address, kCTRL_REG1, 0b11111111);
66 bus_->
Put(device_address, kCTRL_REG4, 0b00110000);
84 if (status_ ==
false) {
89 if (bus_->
Get(device_address, kOUT_X_L, data, 6) ==
false) {
93 x = ((data[0] | (data[1] << 8)) << 16) >> 16;
94 y = ((data[2] | (data[3] << 8)) << 16) >> 16;
95 z = ((data[4] | (data[5] << 8)) << 16) >> 16;
106 const static unsigned char kCTRL_REG1 = 0x20;
107 const static unsigned char kCTRL_REG4 = 0x23;
108 const static unsigned char kOUT_X_L = 0x28 | 0x80;
110 unsigned char device_address;
113 if (address == LSB_0) {
114 device_address = 0b11010100;
115 }
else if (address == LSB_1) {
116 device_address = 0b11010110;
124 #endif // LIBPROPELLER_L3GD20_H_