#include "RotaryCoder.h"

uint16_t COUNT;
uint16_t DIR;

uint8_t EC11_init(void)
{
    COUNT = 0;
    DIR = 0;
    HAL_TIM_Encoder_Start(&htim3, TIM_CHANNEL_ALL);
    // HAL_TIM_Encoder_Start_IT(&htim3,TIM_CHANNEL_ALL);
    return 1;
}

uint16_t EC11_DIR(void)
{
    DIR = __HAL_TIM_IS_TIM_COUNTING_DOWN(&htim3);
    // STATUS.DATA.COUNT = __HAL_TIM_GET_COUNTER(&htim3);
    return DIR;
}

uint16_t EC11_COUNT(void)
{
    COUNT = __HAL_TIM_GET_COUNTER(&htim3);
    return COUNT;
}