Javascript wrappers for HTS221 Sensor library
Dependencies: HTS221
Revision 4:6043b9511072, committed 2017-10-25
- Comitter:
- akhtar.syedzeeshan@gmail.com
- Date:
- Wed Oct 25 13:58:13 2017 +0200
- Parent:
- 3:df24cbc8aaf0
- Child:
- 5:bbe15d3cac27
- Commit message:
- Fully implemented DevI2C support
Changed in this revision
--- a/HTS221_JS-js.cpp Mon Oct 23 16:38:37 2017 +0200
+++ b/HTS221_JS-js.cpp Wed Oct 25 13:58:13 2017 +0200
@@ -178,23 +178,23 @@
CHECK_ARGUMENT_COUNT(HTS221_JS, __constructor, args_count == 1);
CHECK_ARGUMENT_TYPE_ALWAYS(HTS221_JS, __constructor, 0, object);
- // Extract native I2C argument (objects are always pointers)
- 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);
+ // Extract native DevI2C argument (objects are always pointers)
+ 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 HTS221_JS pointer (from this object)
- HTS221_JS *native_ptr = new HTS221_JS(*i2c);
+ HTS221_JS *native_ptr = new HTS221_JS(*devI2c);
jerry_value_t js_object = jerry_create_object();
jerry_set_object_native_pointer(js_object, native_ptr, &native_obj_type_info);
--- a/HTS221_JS.cpp Mon Oct 23 16:38:37 2017 +0200
+++ b/HTS221_JS.cpp Wed Oct 25 13:58:13 2017 +0200
@@ -84,10 +84,10 @@
/** Constructor
* @brief Initializing 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
*/
-HTS221_JS::HTS221_JS(I2C &i2c){
- hum_temp = new HTS221Sensor(reinterpret_cast<DevI2C*>(&i2c));
+HTS221_JS::HTS221_JS(DevI2C &devI2c){
+ hum_temp = new HTS221Sensor(&devI2c);
hum_temp->init(NULL);
hum_temp->enable();
}
--- a/HTS221_JS.h Mon Oct 23 16:38:37 2017 +0200
+++ b/HTS221_JS.h Wed Oct 25 13:58:13 2017 +0200
@@ -61,7 +61,7 @@
public:
/* Constructors */
HTS221_JS(){ printf("calling empty constructor"); }
- HTS221_JS(I2C &i2c);
+ HTS221_JS(DevI2C &devI2c);
/* Destructor */
~HTS221_JS();