Javascript wrappers for LSM303AGR Sensor library
Dependencies: LSM303AGR
Diff: LSM303AGR_JS-js.cpp
- Revision:
- 2:ddbdfca82832
- Parent:
- 1:78c55e099d6c
- Child:
- 3:d076984ee23b
--- a/LSM303AGR_JS-js.cpp Mon Oct 23 16:41:41 2017 +0200 +++ b/LSM303AGR_JS-js.cpp Wed Oct 25 14:00:26 2017 +0200 @@ -150,22 +150,22 @@ CHECK_ARGUMENT_TYPE_ALWAYS(LSM303AGR_JS, __constructor, 0, object); // Unwrap native LSM303AGR_JS object - void *i2c_ptr; - const jerry_object_native_info_t *i2c_type_ptr; - bool i2c_has_ptr = jerry_get_object_native_pointer(args[0], &i2c_ptr, &i2c_type_ptr); + void *devI2c_ptr; + const jerry_object_native_info_t *devI2c_type_ptr; + bool devI2c_has_ptr = jerry_get_object_native_pointer(args[0], &devI2c_ptr, &devI2c_type_ptr); - // Check if we have the i2c pointer - if (!i2c_has_ptr) { - printf("Not a I2C input!"); + // Check if we have the devI2c pointer + if (!devI2c_has_ptr) { + printf("Not a DevI2C input!"); return jerry_create_error(JERRY_ERROR_TYPE, (const jerry_char_t *) "Failed to get native DigitalOut pointer"); } // Cast the argument to C++ - I2C* i2c = reinterpret_cast<I2C*>(i2c_ptr); + DevI2C* devI2c = reinterpret_cast<DevI2C*>(devI2c_ptr); // Extract native LSM303AGR_JS pointer (from this object) - LSM303AGR_JS *native_ptr = new LSM303AGR_JS(*i2c); + LSM303AGR_JS *native_ptr = new LSM303AGR_JS(*devI2c); jerry_value_t js_object = jerry_create_object(); jerry_set_object_native_pointer(js_object, native_ptr, &native_obj_type_info);