From f00de88f97360024c7e4bcc5651b91bf48a5da47 Mon Sep 17 00:00:00 2001 From: Zion Orent Date: Thu, 15 Jan 2015 14:24:22 -0800 Subject: [PATCH] hmc5883l: Modifications to js swig file Signed-off-by: Zion Orent Signed-off-by: Jon Trulson Signed-off-by: Sarah Knepper --- src/hmc5883l/jsupm_hmc5883l.i | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hmc5883l/jsupm_hmc5883l.i b/src/hmc5883l/jsupm_hmc5883l.i index 1735f17a..b04b3e90 100644 --- a/src/hmc5883l/jsupm_hmc5883l.i +++ b/src/hmc5883l/jsupm_hmc5883l.i @@ -1,8 +1,14 @@ %module jsupm_hmc5883l %include "../upm.i" - +%include "../carrays_int16_t.i" %{ #include "hmc5883l.h" %} +// Adding this typemap because SWIG is converting int16 into a short by default +// This forces SWIG to convert it correctly +%typemap(out) int16_t* { + $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 ); +} + %include "hmc5883l.h"