Javascript wrappers for LPS22HB Sensor library
Dependencies: LPS22HB
Diff: LPS22HB_JS-js.cpp
- Revision:
- 1:6b7b798e36ae
- Parent:
- 0:c256bbccd0d4
- Child:
- 2:5ed6416b6b4d
--- a/LPS22HB_JS-js.cpp Tue Oct 10 11:51:55 2017 +0200 +++ b/LPS22HB_JS-js.cpp Wed Oct 11 10:09:09 2017 +0200 @@ -140,15 +140,16 @@ 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 (!devI2c_has_ptr) { printf("Not a I2C input!"); return jerry_create_error(JERRY_ERROR_TYPE, (const jerry_char_t *) "Failed to get native DigitalOut pointer"); } + // Cast the argument to C++ DevI2C* devI2c = reinterpret_cast<DevI2C*>(devI2c_ptr); - // Extract native LPS22HB_JS pointer (from this object) LPS22HB_JS *native_ptr = new LPS22HB_JS(*devI2c);