Javascript wrappers for LSM6DSL Sensor library

Dependencies:   LSM6DSL

Dependents:   ST_SENSOR_JS

Revision:
4:0eb0cded8861
Parent:
3:87ac9fb0d287
Child:
5:4f29cb91aaef
--- a/LSM6DSL_JS.cpp	Mon Oct 23 16:41:14 2017 +0200
+++ b/LSM6DSL_JS.cpp	Wed Oct 25 13:59:25 2017 +0200
@@ -109,10 +109,10 @@
 
 /** Constructor
  * @brief     Initiaze the component.
- * @param i2c object of an helper class which handles the I2C peripheral
+ * @param devI2c object of an helper class which handles the DevI2C peripheral
  */
-LSM6DSL_JS::LSM6DSL_JS(I2C &i2c){
-	acc_gyro = new LSM6DSLSensor(reinterpret_cast<DevI2C*>(&i2c), LSM6DSL_ACC_GYRO_I2C_ADDRESS_HIGH,D4,D5);
+LSM6DSL_JS::LSM6DSL_JS(DevI2C &devI2c){
+	acc_gyro = new LSM6DSLSensor(&devI2c, LSM6DSL_ACC_GYRO_I2C_ADDRESS_HIGH,D4,D5);
 	acc_gyro->init(NULL);
 	acc_gyro->enable_x();
 	acc_gyro->enable_g();
@@ -142,9 +142,8 @@
  * @brief  Get the accleremeter reading from LSM6DSL
  * @retval Accleremeter value
  */
-int32_t *LSM6DSL_JS::get_accelerometer_axes(){
-	int32_t axes[3];
-  	acc_gyro->get_x_axes(axes);
+int32_t *LSM6DSL_JS::get_accelerometer_axes(int32_t *axes){
+	acc_gyro->get_x_axes(axes);
     printf("LSM6DSL [acc/mg]:        %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
 	return axes;
 }
@@ -170,9 +169,8 @@
  * @brief  Get the gyroscope reading from LSM6DSL
  * @retval Gyroscope value
  */
-int32_t *LSM6DSL_JS::get_gyroscope_axes(){
-	int32_t axes[3];
-    acc_gyro->get_g_axes(axes);
+int32_t *LSM6DSL_JS::get_gyroscope_axes(int32_t * axes){
+	acc_gyro->get_g_axes(axes);
     printf("LSM6DSL [gyro/mdps]:     %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
     return axes;
 }