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.
28 lines
453 B
28 lines
453 B
/**
|
|
* 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 */
|
|
HAL_TIM_Encoder_Start(&htim4, TIM_CHANNEL_ALL);
|
|
}
|
|
|
|
uint16_t app_knob_get_raw() {
|
|
return htim4.Instance->CNT;
|
|
}
|
|
|
|
|
|
bool app_knob_pushed() {
|
|
return 0 == HAL_GPIO_ReadPin(KNOB_PUSH_GPIO_Port, KNOB_PUSH_Pin);
|
|
}
|
|
|