lcm1602: Initial C implementation

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson
2016-10-06 13:28:05 -06:00
parent 255d6139ee
commit 7fe6f856a1
10 changed files with 1175 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
%module javaupm_i2clcd
%include "../upm.i"
%include "stdint.i"
%include "typemaps.i"
%include "arrays_java.i";
%apply signed char[] {uint8_t []};
%ignore BasicFont;
%typemap(jni) (uint8_t *data, int bytes) "jbyteArray";
%typemap(jtype) (uint8_t *data, int bytes) "byte[]";
%typemap(jstype) (uint8_t *data, int bytes) "byte[]";
%typemap(javain) (uint8_t *data, int bytes) "$javainput";
%typemap(in) (uint8_t *data, int bytes) {
$1 = (uint8_t *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
$2 = JCALL1(GetArrayLength, jenv, $input);
}
%typemap(freearg) (uint8_t *data, int bytes) {
JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
}
%{
#include "lcm1602.hpp"
%}
%include "lcm1602.hpp"
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_i2clcd");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}