|
|
|
@ -20,6 +20,13 @@ void timer_test(timerNo_t timer, pinNo_t pin)
|
|
|
|
|
pinWrite(pin,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void timer_capture_compare_test(timerNo_t timer)
|
|
|
|
|
{
|
|
|
|
|
timerInitCounter(timer, 4000, 999, downCounting);
|
|
|
|
|
// We use pin PA3 (Arduino header A2)
|
|
|
|
|
timerInitOutputCompare(timer, toggle, 4, pinA3, 2,0);
|
|
|
|
|
timerSart(timer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
@ -58,16 +65,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
pinWrite(pinB3,0);
|
|
|
|
|
|
|
|
|
|
for (i = 0 ; i < MAX_TIMER_CHANNEL_COUNT; i++ )
|
|
|
|
|
{
|
|
|
|
|
print_Usart(usart2, const_cast<char *>("Testing Timer :"));
|
|
|
|
|
usartSendChar(usart2, i+48);
|
|
|
|
|
print_Usart(usart2, const_cast<char *>("\r\n"));
|
|
|
|
|
timer_test(timers[i], pinB3);
|
|
|
|
|
print_Usart(usart2, const_cast<char *>("Testing Completed \r\n\r\n"));
|
|
|
|
|
delayMs(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timer_capture_compare_test(timer_2);
|
|
|
|
|
print_Usart(usart2, const_cast<char *>("All is working fine \r\n"));
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|