summaryrefslogtreecommitdiff
path: root/peripheral/libupm/src/lcd/javaupm_i2clcd.i
blob: 2bf10d4b2883becc068b2a17cb92db82cfd6a5aa (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
%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 "lcd.hpp"
    #include "ssd.hpp"
    #include "ssd1327.hpp"
    #include "ssd1308.hpp"
    #include "ssd1306.hpp"
    #include "eboled.hpp"
    #include "lcm1602.hpp"
    #include "jhd1313m1.hpp"
    #include "sainsmartks.hpp"
%}

%include "lcd.hpp"
%include "ssd.hpp"
%include "ssd1327.hpp"
%include "ssd1308.hpp"
%include "ssd1306.hpp"
%include "eboled.hpp"
%include "lcm1602.hpp"
%include "jhd1313m1.hpp"
%include "sainsmartks.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);
        }
    }
%}