You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/**
|
|
|
|
* TODO file description
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#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);
|
|
|
|
}
|