/** * TODO file description */ #include #include "main.h" #include "app_knob.h" #include "tim.h" static struct { uint16_t wheel; bool push; } s_knob = {}; void app_knob_init() { /* Enable the rotary encoder */ LL_TIM_CC_EnableChannel(TIM_KNOB, LL_TIM_CHANNEL_CH1 | LL_TIM_CHANNEL_CH2); LL_TIM_EnableCounter(TIM_KNOB); // HAL_TIM_Encoder_Start(&htim4, TIM_CHANNEL_ALL); } uint16_t app_knob_get_raw() { return LL_TIM_GetCounter(TIM_KNOB); } bool app_knob_pushed() { return 0 == LL_GPIO_IsInputPinSet(KNOB_PUSH_GPIO_Port, KNOB_PUSH_Pin); }