瑞芯微Rockchip开发者社区
直播中

李英

7年用户 1409经验值
私信 关注
[问答]

怎样去调用一个第三方的驱动库呢

怎样去调用一个第三方的驱动库呢?
如何用IIC驱动Terawins的图像处理芯片T613呢?

回帖(1)

李皓圳

2022-3-4 09:30:59
有时候我们会需要使用第三方的so库。

但是我们在使用的时候,看不到源码。只能根据库的提供者,提供的信息来使用这个库。

我们需要知道库的接口,和库里面的包名。

今天我们调用一个第三方的驱动库,主要是用IIC驱动Terawins的图像处理芯片T613。

首先库的接口如下:

package com.t613.t613_demo;

/**
* Created by Administrator on 2019/7/19.
*/

public class t613_Interface {
    static {
        System.loadLibrary("T613_I2C_DLL");
        System.loadLibrary("T613_algorithm_DLL");
    }

    //function declaration
    public native byte[] I2c_read_single(byte u8BusIndex, int u32RegStart, int nLen);
    public native int I2c_write_single(byte u8BusIndex, int u32RegStart, byte[] szBufWrite);
    public native int I2c_nbytes_write(byte u8BusIndex, int u32RegStart, byte[] szBufWrite, int nLen);

    public native static String get();
    public native static int[] t613_register_config(T613_parameter t613_param);
    public native static int[] t613_perspective(T613_parameter t613_param, double perspect_info[][]);
    public native static int[] t613_predict_correction(T613_parameter t613_param, float[] angle);
}

IIC写底层寄存器和T613的初始化参数和梯形变换以及四点校正。

首先我们把so库拷贝到libs下面。



这里面是我们要调用的两个so库,一个是T613_I2C_DLL

另一个是T613_algorithm_DLL。如下图





包的层次是 com.t613.t613_demo

我们需要新建包,层次如下:



然后再这个目录下新建t613_Interface和T613_parameter两个类。

最后我们还要设置一下,指定调用库的路径。在app目录下的build.gradle中设置:



到这里我们对第三方库的添加就完成。

最后我们的demo中可以看到我们在调用第三方库后的图像处理效果。(图像处理部分略去)。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分