36 static uint32_t
_hash(uint32_t hv,
int old_val,
int new_val)
40 if (new_val < (old_val * 0.60)) val = 13;
41 else if (old_val < (new_val * 0.60)) val = 23;
50 static void _cb(
int gpio,
int level, uint32_t tick,
void *user)
77 hasher->
t1 = hasher->
t2;
78 hasher->
t2 = hasher->
t3;
79 hasher->
t3 = hasher->
t4;
82 if (hasher->
edges > 3)
86 (hasher->
t2)-(hasher->
t1),
87 (hasher->
t4)-(hasher->
t3));
99 if (hasher->
edges > 12)
int gpioSetAlertFunc(unsigned gpio, gpioAlertFunc_t f)
void Pi_Hasher_cancel(Pi_Hasher_t *hasher)
int gpioSetWatchdog(unsigned gpio, unsigned timeout)
int gpioSetMode(unsigned gpio, unsigned mode)
int gpioSetAlertFuncEx(unsigned gpio, gpioAlertFuncEx_t f, void *userdata)
static uint32_t _hash(uint32_t hv, int old_val, int new_val)
static void _cb(int gpio, int level, uint32_t tick, void *user)
void(* Pi_Hasher_CB_t)(uint32_t)
Pi_Hasher_t * Pi_Hasher(int gpio, Pi_Hasher_CB_t callback, int timeout)