1 Star 0 Fork 0

LibDriver/MULTI_BUTTON

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

English | 简体中文 | 繁體中文 | 日本語 | Deutsch | 한국어

LibDriver MULTI_BUTTON

MISRA API License

按钮是一种简单的开关机制用于控制机器或过程的某些方面。 按钮一般由硬质材料制成,常见的是塑料或金属。 按钮表面是平坦的或形状适合人手指的。 按钮通常是偏置开关,尽管许多非偏置按钮(由于其物理性质)仍然需要弹簧才能返回到未按下的状态。

LibDriver MULTI_BUTTON是LibDriver推出的MULTI_BUTTON全功能驱动,该驱动提供多按键或者矩阵按压检测、释放检测、单击检测、双击检测、三击检测、重复按键检测、短按检测、长按检测等功能并且它符合MISRA标准。

LibDriver MULTI_BUTTON支持多按键和矩阵按键检测,如果您使用单按键,您可以使用一种更有效的检测方法。

单按键驱动可以参考 https://gitee.com/libdriver/button

目录

说明

/src目录包含了LibDriver MULTI_BUTTON的源文件。

/interface目录包含了LibDriver MULTI_BUTTON与平台无关的GPIO总线模板。

/test目录包含了LibDriver MULTI_BUTTON驱动测试程序,该程序可以简单的测试芯片必要功能。

/example目录包含了LibDriver MULTI_BUTTON编程范例。

/doc目录包含了LibDriver MULTI_BUTTON离线文档。

/datasheet目录包含了MULTI_BUTTON数据手册。

/project目录包含了常用Linux与单片机开发板的工程样例。所有工程均采用shell脚本作为调试方法,详细内容可参考每个工程里面的README.md。

/misra目录包含了LibDriver MISRA代码扫描结果。

安装

参考/interface目录下与平台无关的GPIO总线模板,完成指定平台的GPIO总线驱动。

将/src目录,您使用平台的接口驱动和您开发的驱动加入工程,如果您想要使用默认的范例驱动,可以将/example目录加入您的工程。

使用

您可以参考/example目录下的编程范例完成适合您的驱动,如果您想要使用默认的编程范例,以下是它们的使用方法。

example basic

#include "driver_multi_button_basic.h"

uint8_t res;
uint32_t timeout;

static void a_receive_callback(uint16_t row, uint16_t col, multi_button_t *data)
{
    switch (data->status)
    {
        case MULTI_BUTTON_STATUS_PRESS :
        {
            break;
        }
        case MULTI_BUTTON_STATUS_RELEASE :
        {
            break;
        }
        case MULTI_BUTTON_STATUS_SINGLE_CLICK :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq single click.\n", row, col);
            
            break;
        }
        case MULTI_BUTTON_STATUS_DOUBLE_CLICK :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq double click.\n", row, col);
            
            break;
        }
        case MULTI_BUTTON_STATUS_TRIPLE_CLICK :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq triple click.\n", row, col);
            
            break;
        }
        case MULTI_BUTTON_STATUS_REPEAT_CLICK :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq repeat click with %d times.\n", row, col, data->times);
            
            break;
        }
        case MULTI_BUTTON_STATUS_SHORT_PRESS_START :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq short press start.\n", row, col);
            
            break;
        }
        case MULTI_BUTTON_STATUS_SHORT_PRESS_END :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq short press end.\n", row, col);
            
            break;
        }
        case MULTI_BUTTON_STATUS_LONG_PRESS_START :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq long press start.\n", row, col);
            
            break;
        }
        case MULTI_BUTTON_STATUS_LONG_PRESS_HOLD :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq long press hold.\n", row, col);
            
            break;
        }
        case MULTI_BUTTON_STATUS_LONG_PRESS_END :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq long press end.\n", row, col);
            
            break;
        }
        default :
        {
            multi_button_interface_debug_print("multi_button: row %d col %d irq unknown status.\n", row, col);
            
            break;
        }
    }
}

/* basic init */
res = multi_button_basic_init(4, 4, a_receive_callback);
if (res != 0)
{
    return 1;
}

/* 100s timeout */
timeout = 10000;

/* check timeout */
while (timeout != 0)
{
    /* timeout -- */
    timeout--;

    /* delay 5ms */
    multi_button_interface_delay_ms(5);

    /* process */
    (void)multi_button_basic_process();
    
    
    ....
}

...

/* basic deinit */
(void)multi_button_basic_deinit();

return 0;

文档

在线文档: https://www.libdriver.com/docs/multi_button/index.html

离线文档: /doc/html/index.html。

贡献

请参考CONTRIBUTING.md。

版权

版权 (c) 2015 - 现在 LibDriver 版权所有

MIT 许可证(MIT)

特此免费授予任何获得本软件副本和相关文档文件(下称“软件”)的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、转授许可和/或出售该软件副本,以及再授权被配发了本软件的人如上的权利,须在下列条件下:

上述版权声明和本许可声明应包含在该软件的所有副本或实质成分中。

本软件是“如此”提供的,没有任何形式的明示或暗示的保证,包括但不限于对适销性、特定用途的适用性和不侵权的保证。在任何情况下,作者或版权持有人都不对任何索赔、损害或其他责任负责,无论这些追责来自合同、侵权或其它行为中,还是产生于、源于或有关于本软件以及本软件的使用或其它处置。

联系我们

请联系lishifenging@outlook.com。

The MIT License (MIT) Copyright (c) 2015 - present LibDriver Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

适用于通用MCU和Linux系统的MULTI_BUTTON全功能驱动 展开 收起
取消

发行版 (4)

全部
14天前

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/libdriver/multi_button.git
git@gitee.com:libdriver/multi_button.git
libdriver
multi_button
MULTI_BUTTON
main

搜索帮助