From 405dab1725aee321897b4e6701d04507c6f2f0e2 Mon Sep 17 00:00:00 2001 From: Zion Orent Date: Wed, 10 Dec 2014 16:30:46 -0500 Subject: [PATCH] lsm303: Modifications to js swig file Signed-off-by: Zion Orent Signed-off-by: Jon Trulson Signed-off-by: Sarah Knepper --- src/lsm303/jsupm_lsm303.i | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lsm303/jsupm_lsm303.i b/src/lsm303/jsupm_lsm303.i index f87e7f7e..f6f65cf7 100644 --- a/src/lsm303/jsupm_lsm303.i +++ b/src/lsm303/jsupm_lsm303.i @@ -1,5 +1,12 @@ %module jsupm_lsm303 %include "../upm.i" +%include "../carrays_int16_t.i" + +// Adding this typemap because SWIG is converting int16 into a short by default +// This forces SWIG to convert it correctly +%typemap(out) int16_t* { + jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 ); +} %{ #include "lsm303.h"