Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议 - 增加高频读取或者设置 GPIO 状态的接口 #17

Open
page31 opened this issue May 27, 2016 · 1 comment
Open

建议 - 增加高频读取或者设置 GPIO 状态的接口 #17

page31 opened this issue May 27, 2016 · 1 comment

Comments

@page31
Copy link

page31 commented May 27, 2016

使用高精度编码器时需要高频获取 A B 输出的状态,JavaScript 的计时器无法满足要求。建议在 Native 代码中实现数据获取,缓冲之后回调给 JavaScript 处理。提供一个类似这样的接口:

$.poll({devices:[GPIO_1, GPIO_2], frequency: 10000, interval: 100}, function(buffer) {
   // 这个回调每 100 毫秒触发一次,不需要很精确
   // buffer 刚好包含 100 帧数据,不多不少,每一帧都有 GPIO_1, GPIO_2 的状态
});
@vilicvane
Copy link

@bsdelf 这个我感觉可以讨论下可能的场景, 搞一个比较通用的驱动 (或者直接在现有 GPIO 驱动上提供更多接口).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants