#include "drv_types.h" #include "debounce.h" static void debounce_timer_function(void *arg) { DEBOUNCE *db = (DEBOUNCE*)arg; db->notice(db->param); } void debounce_init(DEBOUNCE *db, DEBOUNCE_FUNCTION notice) { init_timer(&db->tm); db->notice = notice; db->param = NULL; } void debounce_exit(DEBOUNCE *db) { del_timer(&db->tm); } void debounce_notice(DEBOUNCE *db, void *param, UINT32 dDelay_ms) { del_timer(&db->tm); db->tm.expires = jiffies + ((HZ / 1000) * (dDelay_ms + 1)); db->tm.data = (UINT32)db; db->tm.function = (void (*)(ULONG))debounce_timer_function; db->param = param; add_timer(&db->tm); }