summaryrefslogtreecommitdiff
path: root/peripheral/libupm/src/apa102/javaupm_apa102.i
blob: 372a228b1cb85962a88d3c283a236a04c4f6995b (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
%module javaupm_apa102

%include "../upm.i"
%include "typemaps.i"

%typemap(jtype) (uint8_t *colors) "byte[]"
%typemap(jstype) (uint8_t *colors) "byte[]"
%typemap(jni) (uint8_t *colors) "jbyteArray"
%typemap(javain) (uint8_t *colors) "$javainput"

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

%{
    #include "apa102.hpp"
%}

%include "apa102.hpp"

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