Javascript wrappers for HTS221 Sensor library

Dependencies:   HTS221

Dependents:   ST_SENSOR_JS

Revision:
1:924fb53eb7f8
Parent:
0:89911ffe212d
Child:
3:df24cbc8aaf0
--- a/HTS221_JS.cpp	Tue Oct 10 11:51:26 2017 +0200
+++ b/HTS221_JS.cpp	Wed Oct 11 10:08:12 2017 +0200
@@ -126,18 +126,11 @@
  * @brief  Get the temperature reading from HTS221
  * @retval Temperature value in string
  */
-unsigned char *HTS221_JS::get_temperature_string(){
+char *HTS221_JS::get_temperature_string(char *buffer){
 	float value;
-	char buffer[32];
-	
 	hum_temp->get_temperature(&value);
     print_double(buffer, value);
-	unsigned char *r = new unsigned char[6];
-	for(int i = 0; i < 6; i++){
-		r[i] = buffer[i];
-	}
-	r[5] = '\0';
-	return r;
+	return buffer;
 }
 
 /**
@@ -154,25 +147,9 @@
  * @brief  Get the humidity reading from HTS221
  * @retval Humidity value in string
  */
-unsigned char *HTS221_JS::get_humidity_string(){
+char *HTS221_JS::get_humidity_string(char *buffer){
 	float value;
-	char buffer[32];
 	hum_temp->get_humidity(&value);
     print_double(buffer, value);
-	unsigned char *r = new unsigned char[6];
-	for(int i = 0; i < 6; i++){
-		r[i] = buffer[i];
-	}
-	r[5] = '\0';
-	return r;
-}
-uint8_t HTS221_JS::give(){
-	return 43;
-}
-
-/* Simple main function */
-void HTS221_JS::print_sensor_info(){
-	uint8_t id;
-	hum_temp->read_id(&id);
-  	printf("HTS221  humidity & temperature    = 0x%X\r\n", id);
+	return buffer;
 }
\ No newline at end of file