大胡子登登登恩恩 发表于 2022-7-25 13:06:01

ec11驱动源码

在 gpio-keyc的基础上改写的旋转按钮 ec11的驱动,已经经过了测试。可自定义左旋和右旋的键值。如果按键值输入是第三个引脚,也支持按键操作 补存的头文件: gpio_ec11.h #ifndef _GPIO_EC11_H #define _GPIO_EC11_H struct device; struct gpio_desc; /** * struct gpio_ec11_button - configuration parameters * @leftcode: ec11 left direction input event code (KEY_*, SW_*) * @rightcode: ec11 right direction in put event code (KEY_*, SW_*) * @gpio: %-1 if this key does not support gpio * @gpio: %-1 if this key does not support gpio * @active_low: %true indicates that button is considered * depressed when gpio is low * @desc: label that will be attached to button's gpio * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS) * @wakeup: configure the button as a wake-up source * @debounce_interval: debounce ticks interval in msecs * @can_disable: %true indicates that userspace is allowed to * disable button via sysfs * @value: axis value for %EV_ABS * @irq: Irq number in case of interrupt keys * @gpiod: GPIO descriptor */ struct gpio_ec11_button { unsigned int code; unsigned int leftcode; /*记录左旋键值*/ unsigned int rightcode; /*记录右旋键值*/ int gpio; /*旋转编码器A引脚的gpio号*/ int subgpio; /*旋转编码器B引脚的gpio号*/ int active_low; const char *desc; unsigned int type; int wakeup; int debounce_interval; bool can_disable; int value; unsigned int irq; unsigned int irq_flags; struct gpio_desc *gpiod; }; /** * struct gpio_ec11_platform_data - platform data for gpio_ec11 driver * @buttons: pointer to array of &gpio;_keys_button structures * describing buttons attached to the device * @nbuttons: number of elements in @buttons array * @poll_interval: polling interval in msecs - for polling driver only * @rep: enable input subsystem auto repeat * @enable: platform hook for enabling the device * @disable: platform hook for disabling the device * @name: input device name */ struct gpio_ec11_platform_data { struct gpio_ec11_button *buttons; int nbuttons; unsigned int poll_interval; unsigned int rep:1; int (*enable)(struct device *dev); void (*disable)(struct device *dev); const char *name; }; #endif




资源下载地址和密码(百度云盘):**** Hidden Message ***** 百度网盘信息回帖可见



本资源由Java自学网收集整理【www.javazx.com】

junyang 发表于 2022-7-25 13:16:03

不错啊啊啊啊啊啊

ngx 发表于 2022-7-25 19:18:09

哈哈哈哈哈,开心

爱本格瑞斯 发表于 2022-8-18 06:10:43

看起来好像不错的样子

灰机大爷 发表于 2022-8-27 09:21:52

呵呵。。。

bigdream168 发表于 2022-8-28 23:55:56

棒棒哒!!很不错!!

mybhenry 发表于 2022-9-10 10:54:58

要赶紧学习了,走起

sombersong 发表于 2022-9-27 13:04:06

太难找了 居然在这里

KEVING828 发表于 2022-10-17 20:58:09

学习下

Scorpio93 发表于 2022-10-25 14:48:27

完整 清晰 真不错
页: [1] 2 3 4 5 6
查看完整版本: ec11驱动源码