#include "main.h"
#include "tim.h"
#include "ctrl_app.h"

void CTRL_encoderHandler(void)
{
    static uint8_t cnt;
    if (htim3.Instance->CNT == cnt || htim3.Instance->CNT % 2 == 1)
    {
        return;
    }

    // SEGGER_RTT_printf(0, "TIM3.cnt: %d\n", htim3.Instance->CNT);
    CTRL_encoderEvent(htim3.Instance->CNT - cnt);
    cnt = (uint8_t)htim3.Instance->CNT;
}