summaryrefslogtreecommitdiff
path: root/peripheral/libupm/src/st7735/javaupm_st7735.i
blob: e60367c9d6b3f1e8c5480f7cd18ff2c55ef37a0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%module javaupm_st7735
%include "../upm.i"
%include "arrays_java.i"
%include "typemaps.i"
%include "stdint.i"

%ignore m_map;
%ignore Bcmd;
%ignore font;
%ignore Rcmd1;
%ignore Rcmd2green;
%ignore Rcmd2red;
%ignore Rcmd3;


/*
%typemap(jni) unsigned char[] "jbyteArray";
%typemap(jtype) unsigned char[] "byte[]";
%typemap(jstype) unsigned char[] "byte[]";

%typemap(out) unsigned char[] {
    $result = SWIG_JavaArrayOutSchar(jenv, reinterpret_cast<signed char*>($1), sizeof($1));
}
%typemap(freearg) unsigned char* {
    JCALL3(ReleaseByteArrayElements, jenv, $input, reinterpret_cast<jbyte*>($1), 0);
}
*/
%typemap(jni) unsigned char* "jbyteArray";
%typemap(jtype) unsigned char* "byte[]";
%typemap(jstype) unsigned char* "byte[]";

%typemap(javain) unsigned char* "$javainput"

%typemap(in) unsigned char* {
    $1 = (unsigned char *)JCALL2(GetByteArrayElements, jenv, $input, NULL);
}

%include "gfx.h"
%{
    #include "gfx.h"
%}

%include "st7735.h"
%{
    #include "st7735.h"
%}

%pragma(java) jniclasscode=%{
    static {
        try {
            System.loadLibrary("javaupm_st7735");
        } catch (UnsatisfiedLinkError e) {
            System.err.println("Native code library failed to load. \n" + e);
            System.exit(1);
        }
    }
%}