96 uint16_t ticks, quarter, half_quarter;
113 half_quarter = ticks/8;
116 TCE0.CCA = half_quarter;
117 TCE0.CCB = half_quarter+quarter;
118 TCE0.CCC = half_quarter+(2*quarter);
119 TCE0.CCD = half_quarter+(3*quarter);
121 TCE0.CCA = half_quarter+(3*quarter);
122 TCE0.CCB = half_quarter+(2*quarter);
123 TCE0.CCC = half_quarter+quarter;
124 TCE0.CCD = half_quarter;
128 TCE0.CTRLA = TC_CLKSEL_DIV1_gc;
131 TCE0.INTCTRLB = TC0_CCAINTLVL0_bm | TC0_CCBINTLVL0_bm |
132 TC0_CCCINTLVL0_bm | TC0_CCDINTLVL0_bm;
133 TCC0.INTCTRLA = TC0_ERRINTLVL0_bm;
135 qPort->DIRSET = 0xFF;
147 static uint16_t i = 0;
207 static uint8_t j = 0;
uint8_t freq
If GENERATE_TEST_SIGNAL is defined the system generates a test signal with frequency equal to freq (R...
uint8_t test_lineCount
Number of lines in the Quadrature encoder.
This file implements some macros that makes the IAR C-compiler and avr-gcc work with the same code ba...
ISR(TCE0_CCA_vect)
Creates a Quadrature signal, up or down counting depending on the configured direction(dir = 1 -> CW/...
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.
PORT_t * q_test_sig_Port
The port to set the signal out on.
#define F_CPU
Define default CPU frequency, if this is not already defined.