Javascript wrappers for LPS22HB Sensor library

Dependencies:   LPS22HB

Dependents:   ST_SENSOR_JS

Revision:
1:6b7b798e36ae
Parent:
0:c256bbccd0d4
Child:
3:3e19d8808491
--- a/LPS22HB_JS.cpp	Tue Oct 10 11:51:55 2017 +0200
+++ b/LPS22HB_JS.cpp	Wed Oct 11 10:09:09 2017 +0200
@@ -126,18 +126,11 @@
  * @brief  Get the temperature reading from LPS22HB
  * @retval Temperature value in string form
  */
-unsigned char *LPS22HB_JS::get_temperature_string(){
+char *LPS22HB_JS::get_temperature_string(char *buffer){
 	float value;
-	char buffer[32];
-	
 	press_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;
 }
 
 /**
@@ -155,25 +148,9 @@
  * @brief  Get the pressure reading from LPS22HB
  * @retval pressure value in string form
  */
-unsigned char *LPS22HB_JS::get_pressure_string(){
+char *LPS22HB_JS::get_pressure_string(char *buffer){
 	float value;
-	char buffer[32];
 	press_temp->get_pressure(&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;
 }
-uint8_t LPS22HB_JS::give(){
-	return 43;
-}
-
-/* Simple main function */
-void LPS22HB_JS::print_sensor_info(){
-	uint8_t id;
-	press_temp->read_id(&id);
-  	printf("LPS22HB  pressure & temperature    = 0x%X\r\n", id);
-}
\ No newline at end of file