#include "interface/encoder_interface.h" typedef void (* motion_function_t)(void); typedef struct { os_timer_t motion_timer; uint32_t motion_timeout; motion_function_t motion_cb; } Encoder_t; static Encoder_t encoder; void ICACHE_FLASH_ATTR Encoder_Shutdown(void) { Light_Shutdown(); IO_Shutdown(); } void ICACHE_FLASH_ATTR Encoder_Motion_SetCallback(motion_function_t motion_cb) { encoder.motion_cb = motion_cb; os_timer_setfn(&encoder.motion_timer, (os_timer_func_t *)encoder.motion_cb, NULL); } void ICACHE_FLASH_ATTR Encoder_Motion_StartTimer(uint32_t timeout) { encoder.motion_timeout = timeout; os_timer_arm(&encoder.motion_timer, encoder.motion_timeout, false); } void ICACHE_FLASH_ATTR Encoder_Motion_StopTimer() { os_timer_disarm(&encoder.motion_timer); }