Javascript wrappers for LSM6DSL Sensor library
Dependencies: LSM6DSL
Diff: LSM6DSL_JS.cpp
- Revision:
- 3:87ac9fb0d287
- Parent:
- 1:7e5e76bf3efe
- Child:
- 4:0eb0cded8861
--- a/LSM6DSL_JS.cpp Thu Oct 12 11:10:53 2017 +0200 +++ b/LSM6DSL_JS.cpp Mon Oct 23 16:41:14 2017 +0200 @@ -68,10 +68,10 @@ /* fill in leading fractional zeros */ for (i/=10;i>1; i/=10, ptr++) { - if (fractPart >= i) { - break; - } - *ptr = '0'; + if (fractPart >= i) { + break; + } + *ptr = '0'; } /* fill in (rest of) fractional part */ @@ -111,8 +111,8 @@ * @brief Initiaze the component. * @param i2c object of an helper class which handles the I2C peripheral */ -LSM6DSL_JS::LSM6DSL_JS(DevI2C &i2c){ - acc_gyro = new LSM6DSLSensor(&i2c, LSM6DSL_ACC_GYRO_I2C_ADDRESS_HIGH,D4,D5); +LSM6DSL_JS::LSM6DSL_JS(I2C &i2c){ + acc_gyro = new LSM6DSLSensor(reinterpret_cast<DevI2C*>(&i2c), LSM6DSL_ACC_GYRO_I2C_ADDRESS_HIGH,D4,D5); acc_gyro->init(NULL); acc_gyro->enable_x(); acc_gyro->enable_g();