Skip to content

Commit

Permalink
Merge pull request #2 from Guozhanxin/master
Browse files Browse the repository at this point in the history
[update]add LONG_HOLD_CYC control LONG_PRESS_HOLD callback period.|
  • Loading branch information
liu2guang committed Nov 19, 2018
2 parents 656fce2 + 47c4133 commit 71df3ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion multi_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ void button_handler(struct button* handle)
if(handle->button_level == handle->active_level)
{
handle->event = (uint8_t)LONG_PRESS_HOLD;
EVENT_CB(LONG_PRESS_HOLD);
if (handle->ticks % LONG_HOLD_CYC == 0)
{
EVENT_CB(LONG_PRESS_HOLD);
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions multi_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define DEBOUNCE_TICKS 3 //MAX 8
#define SHORT_TICKS (300 / TICKS_INTERVAL)
#define LONG_TICKS (1000 / TICKS_INTERVAL)
#define LONG_HOLD_CYC (500 / TICKS_INTERVAL)

typedef void (*BtnCallback)(void*);

Expand Down

0 comments on commit 71df3ba

Please sign in to comment.