12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #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;
- uint32_t vcell;
- uint32_t soc;
- os_timer_t battery_timer;
- uint32_t battery_timeout;
- } Encoder_t;
- typedef struct {
- uint32_t vcell;
- uint32_t motion;
- } Encoder_Battery_t;
- static Encoder_t encoder;
- void ICACHE_FLASH_ATTR Encoder_Shutdown(void)
- {
- Light_Shutdown();
- IO_Shutdown();
- }
- /* Motion Functions */
- void ICACHE_FLASH_ATTR Encoder_MotionSetCallback(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_MotionStartTimer(uint32_t timeout)
- {
- encoder.motion_timeout = timeout;
- os_timer_arm(&encoder.motion_timer, encoder.motion_timeout, false);
- }
- void ICACHE_FLASH_ATTR Encoder_MotionStopTimer()
- {
- os_timer_disarm(&encoder.motion_timer);
- }
- /* Battery Monitor Functions */
- // static void ICACHE_FLASH_ATTR encoder_battery_monitor_cb(void)
- // {
- //
- // }
- //
- // void ICACHE_FLASH_ATTR Encoder_StartBatteryMonitor(uint32_t battery_monitor_rate)
- // {
- //
- // }
- //
- // void ICACHE_FLASH_ATTR Encoder_StopBatteryMonitor(void)
- // {
- //
- // }
- //
- // Encoder_Battery_t ICACHE_FLASH_ATTR Encoder_GetBatteryStatus(void)
- // {
- //
- // }
|