14 .id=CLSID_ENCODER_LOCAL,
24 HAL_TIM_Base_Start_IT(
htim);
25 this->
htim->Instance->CNT = 0x7fff;
27 this->
htim->Instance->CR1 = 1;
43 this->
htim->Instance->CR1 = 0;
60 this->
offset = (int16_t)ofs;
67 return (int32_t)
htim->Instance->CNT - (int32_t)0x7fff;
82 this->pos =
pos - cnt;
84 int32_t idxpos = ((int32_t)
indexpos - (int32_t)0x7fff);
95 this->
htim->Instance->ARR = period-1;
99 if(GPIO_Pin == ENCODER_Z_Pin){
100 if(HAL_GPIO_ReadPin(ENCODER_Z_GPIO_Port, ENCODER_Z_Pin) == GPIO_PIN_RESET){
105 htim->Instance->CNT = 0x7fff;
116 if(
htim == this->htim){
122 if(
htim->Instance->CNT > this->htim->Instance->ARR/2){
TIM_HandleTypeDef TIM_ENC
static CommandStatus handleGetFuncSetFunc(const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal(cls1::*getfunc)(), void(cls2::*setfunc)(TVal), cls *obj)
void registerCommand(const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0)
static CommandStatus handleGetSet(const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value)
virtual uint32_t getCpr()
void exti(uint16_t GPIO_Pin) override
void timerElapsed(TIM_HandleTypeDef *htim)
void setPeriod(uint32_t period)
const ClassIdentifier getInfo()
Command handlers always have class infos. Works well with ChoosableClass.
static ClassIdentifier info
EncoderType getEncoderType()
CommandStatus command(const ParsedCommand &cmd, std::vector< CommandReply > &replies)
void setCpr(uint32_t cpr)
bool Flash_Write(uint16_t adr, uint16_t dat)
bool Flash_Read(uint16_t adr, uint16_t *buf, bool checkempty=true)