Dummy commit.
Dependents: iBeacon acnsensa acnSENSA
Fork of ACD52832_LSM9DS1 by
Revision 5:d6a0d907988f, committed 2018-03-02
- Comitter:
- Dautor
- Date:
- Fri Mar 02 12:37:11 2018 +0000
- Parent:
- 4:a1a57aaacc4c
- Commit message:
- Made naming be more consistent
Changed in this revision
LSM9DS1.cpp | Show annotated file Show diff for this revision Revisions of this file |
LSM9DS1.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r a1a57aaacc4c -r d6a0d907988f LSM9DS1.cpp --- a/LSM9DS1.cpp Tue Sep 26 14:11:26 2017 +0000 +++ b/LSM9DS1.cpp Fri Mar 02 12:37:11 2018 +0000 @@ -7,7 +7,7 @@ _i2c = i2c; } -void LSM9DS1::startMag(){ +void LSM9DS1::startMagnetometer(){ char data[2]; data[0] = (char)CTRL_REG1_M; // Target register @@ -31,23 +31,23 @@ _i2c->write(TWI_MAG_ADDR, data, 0x02,0); } -void LSM9DS1::readMag(int16_t *results){ +void LSM9DS1::readMagnetometer(int16_t *results){ char results_[6]; - int16_t res_final[3]; + int16_t resultFinal[3]; char out_x_l_m = OUT_X_L_M; _i2c->write(TWI_MAG_ADDR, &out_x_l_m, 1, true); _i2c->read(TWI_MAG_ADDR, results_, 6, 0); - res_final[0] = ((results_[1]<<8) | results_[0]); - res_final[1] = ((results_[3]<<8) | results_[2]); - res_final[2] = ((results_[5]<<8) | results_[4]); + resultFinal[0] = ((results_[1]<<8) | results_[0]); + resultFinal[1] = ((results_[3]<<8) | results_[2]); + resultFinal[2] = ((results_[5]<<8) | results_[4]); - *(results) = res_final[0]; - *(results + 1) = res_final[1]; - *(results + 2) = res_final[2]; + *(results) = resultFinal[0]; + *(results + 1) = resultFinal[1]; + *(results + 2) = resultFinal[2]; } -void LSM9DS1::startAcc(){ +void LSM9DS1::startAccelerometer(){ char data[2]; data[0] = (char)CTRL_REG5_XL; // Target register @@ -60,23 +60,23 @@ _i2c->write(TWI_AG_ADDR, data, 0x02,0); } -void LSM9DS1::readAcc(int16_t *results){ +void LSM9DS1::readAccelerometer(int16_t *results){ char results_[6]; - int16_t res_final[3]; + int16_t resultFinal[3]; char out_x_l_xl = OUT_X_L_XL; _i2c->write(TWI_AG_ADDR, &out_x_l_xl, 1, true); _i2c->read(TWI_AG_ADDR, results_, 6, 0); - res_final[0] = ((results_[1]<<8) | results_[0]); - res_final[1] = ((results_[3]<<8) | results_[2]); - res_final[2] = ((results_[5]<<8) | results_[4]); + resultFinal[0] = ((results_[1]<<8) | results_[0]); + resultFinal[1] = ((results_[3]<<8) | results_[2]); + resultFinal[2] = ((results_[5]<<8) | results_[4]); - *(results) = res_final[0]; - *(results + 1) = res_final[1]; - *(results + 2) = res_final[2]; + *(results) = resultFinal[0]; + *(results + 1) = resultFinal[1]; + *(results + 2) = resultFinal[2]; } -void LSM9DS1::startGyro(){ +void LSM9DS1::startGyroscope(){ char data[2]; data[0] = (char)CTRL_REG6_XL; // Target register @@ -109,18 +109,18 @@ } -void LSM9DS1::readGyro(int16_t *results){ +void LSM9DS1::readGyroscope(int16_t *results){ char results_[6]; - int16_t res_final[3]; + int16_t resultFinal[3]; char out_x_l_g = OUT_X_L_G; _i2c->write(TWI_AG_ADDR, &out_x_l_g, 1, true); _i2c->read(TWI_AG_ADDR, results_, 6, 0); - res_final[0] = ((results_[1]<<8) | results_[0]); - res_final[1] = ((results_[3]<<8) | results_[2]); - res_final[2] = ((results_[5]<<8) | results_[4]); + resultFinal[0] = ((results_[1]<<8) | results_[0]); + resultFinal[1] = ((results_[3]<<8) | results_[2]); + resultFinal[2] = ((results_[5]<<8) | results_[4]); - *(results) = res_final[0]; - *(results + 1) = res_final[1]; - *(results + 2) = res_final[2]; + *(results) = resultFinal[0]; + *(results + 1) = resultFinal[1]; + *(results + 2) = resultFinal[2]; } \ No newline at end of file
diff -r a1a57aaacc4c -r d6a0d907988f LSM9DS1.h --- a/LSM9DS1.h Tue Sep 26 14:11:26 2017 +0000 +++ b/LSM9DS1.h Fri Mar 02 12:37:11 2018 +0000 @@ -3,12 +3,12 @@ class LSM9DS1{ public: LSM9DS1(I2C *i2c); - void startMag(void); - void readMag(int16_t *results); - void startAcc(void); - void readAcc(int16_t *results); - void startGyro(void); - void readGyro(int16_t *results); + void startMagnetometer(void); + void readMagnetometer(int16_t *results); + void startAccelerometer(void); + void readAccelerometer(int16_t *results); + void startGyroscope(void); + void readGyroscope(int16_t *results); private: I2C *_i2c; }; \ No newline at end of file