mirror of
https://github.com/0x1abin/MultiButton.git
synced 2025-01-25 08:32:55 +08:00
修改拼写错误 && 格式化代码
1,将EVENT_CB(ev)宏函数中的handle参数强制类型转换为BtnCallback类型定义一致,而不是在函数调用时通过传递参数做隐性的类型转换。 2,#include 改用<>,引入系统头文件。
This commit is contained in:
parent
41514fed4b
commit
3e5fb48a6b
@ -5,7 +5,7 @@
|
||||
|
||||
#include "multi_button.h"
|
||||
|
||||
#define EVENT_CB(ev) if(handle->cb[ev])handle->cb[ev]((Button*)handle)
|
||||
#define EVENT_CB(ev) if(handle->cb[ev])handle->cb[ev]((void*)handle)
|
||||
|
||||
//button handle list head.
|
||||
static struct Button* head_handle = NULL;
|
||||
@ -142,7 +142,7 @@ static void button_handler(struct Button* handle)
|
||||
//continue hold trigger
|
||||
handle->event = (uint8_t)LONG_PRESS_HOLD;
|
||||
EVENT_CB(LONG_PRESS_HOLD);
|
||||
} else { //releasd
|
||||
} else { //released
|
||||
handle->event = (uint8_t)PRESS_UP;
|
||||
EVENT_CB(PRESS_UP);
|
||||
handle->state = 0; //reset
|
||||
|
@ -6,8 +6,8 @@
|
||||
#ifndef _MULTI_BUTTON_H_
|
||||
#define _MULTI_BUTTON_H_
|
||||
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
//According to your need to modify the constants.
|
||||
#define TICKS_INTERVAL 5 //ms
|
||||
|
Loading…
x
Reference in New Issue
Block a user