应该包括几部分:1、应用层,只要2个button,一个打开led灯,一个关闭led灯就可以了 .2、中间层(HAL) 通过severs方式struct led_control_device_t {
struct hw_device_t common;
/* supporting control APIs go here */
int (*set_on)(struct led_control_device_t *dev, int32_t led);
int (*set_off)(struct led_control_device_t *dev, int32_t led);
};3、驱动层(GPIO高低电平控制)其实主要是整个代码流程(关键是衔接驱动和应用的中间层),哪里调用哪里的什么函数,有这样一个例子就可以把应用和驱动串起来了
谁有相关经验写个分享一下,写下主要流程也可以(在哪里建什么文件,这个文件干写什么,和别的文件怎么串起来)
struct hw_device_t common;
/* supporting control APIs go here */
int (*set_on)(struct led_control_device_t *dev, int32_t led);
int (*set_off)(struct led_control_device_t *dev, int32_t led);
};3、驱动层(GPIO高低电平控制)其实主要是整个代码流程(关键是衔接驱动和应用的中间层),哪里调用哪里的什么函数,有这样一个例子就可以把应用和驱动串起来了
谁有相关经验写个分享一下,写下主要流程也可以(在哪里建什么文件,这个文件干写什么,和别的文件怎么串起来)
上层指的是APK应用程序
中间层指的是用JNI编译生成的SO库,其中调用到底层的驱动,比如open,ioctl,read,等等
底层也就是指驱动了
我是这样理解的,如有错,还望指点指点