68 #define CLOCK_DIV_bm TC_CLKSEL_DIV64_gc 114 EVSYS_CHMUX_PORTD_PIN0_gc,
124 #ifdef GENERATE_TEST_SIGNAL 129 PMIC.CTRL |= PMIC_LOLVLEN_bm;
138 if ((TCD0.INTFLAGS & TC0_CCAIF_bm) != 0) {
#define CLOCK_DIV_bm
Defines the clock division for the timer used. if changed both defines NEED to be changed correspondi...
uint8_t freq
If GENERATE_TEST_SIGNAL is defined the system generates a test signal with frequency equal to freq (R...
This file implements some macros that makes the IAR C-compiler and avr-gcc work with the same code ba...
#define GetCaptureValue(_tc)
This macro return the value of the capture register.
uint16_t captureFreq
Global frequency variable.
The XMEGA Quadrature Decoder driver header file.
bool QDEC_Total_Setup(PORT_t *qPort, uint8_t qPin, bool invIO, uint8_t qEvMux, EVSYS_CHMUX_t qPinInput, bool useIndex, EVSYS_QDIRM_t qIndexState, TC0_t *qTimer, TC_EVSEL_t qEventChannel, uint8_t lineCount)
Wrapperfunction to set up all parameters for the quadrature decoder.
uint8_t lineCount
Number of lines in the quadrature encoder.
void generate_qdec_signal(PORT_t *qPort, uint8_t lineCount, uint8_t freq, bool dir)
Initializes TCE0 to create Qadrature signal.
bool dir
Direction of the output signal.
#define F_CPU
Define default CPU frequency, if this is not already defined.
int main(void)
Quadrature decoding example.
void QDEC_TC_Freq_Setup(TC0_t *qTimer, TC_EVSEL_t qEventChannel, EVSYS_CHMUX_t qPinInput, TC_CLKSEL_t clksel)
This function set up the needed configuration for a Timer/Counter to handle the frequency/speed measu...