Tool Libs
UMIT-TIROL Institute of Automation and Control Engineering library collection
 
Loading...
Searching...
No Matches
encoder.h File Reference

Copyright (c) 2020 IACE. More...

#include "gpio.h"
#include "hal.h"
#include "timer.h"
Include dependency graph for encoder.h:

Go to the source code of this file.

Classes

class  TIMER::Encoder
 Quadrature Encoder support. More...
 
struct  TIMER::Encoder::Conf
 Encoder constructor. More...
 

Detailed Description

Copyright (c) 2020 IACE.


Class Documentation

◆ TIMER::Encoder::Conf

struct TIMER::Encoder::Conf

Encoder constructor.

make sure the pins for the encoder are on channels 1 and 2 of the used timer.

Parameters
timMicrocontroller Timer Peripheral (e.g. TIM2)
aAlternate Function initialized pin A
bAlternate Function initialized pin B
factorall encompassing conversion factor from encoder value to needed unit
Examples:
  • 4-bit/revolution rotary encoder, position in degrees:
    factor = 1 / pow(2, 4) * 360; 
  • 12-bit/revolution rotary encoder, position in radiants:
    factor = 1 / pow(2, 12) * M_PI; 
  • 10-bit/revolution rotary encoder, position in m traveled with a 6cm radius wheel:
    factor = 1 / pow(2, 10) * M_PI * 0.06; 
Collaboration diagram for TIMER::Encoder::Conf:
[legend]