Implementation of time output compare is suscessful

interrupts
key 3 years ago
parent d733f2c856
commit e5df688262

@ -153,14 +153,14 @@ void timerInitPwm( timerNo_t timer,
* @param mode The desired output compare mode
* @param timerIoChannel The internal Timer Capture compare channel to be used.
* @param pinNo The desired Pin Number to be used as outpujt
* @param alternate The Alternate funtion No for the given Pin
* @param altFuntion The Alternate funtion No for the given Pin
* @param polarity Sets the <F2> the given Pin
*/
void timerInitOutputCompare( timerNo_t timer,
timerOutputCompareMode_t mode,
uint8_t timerIoChannel,
pinNo_t pinNo,
uint16_t alternate,
uint16_t altFunction,
uint8_t polarity);
/*!
* @brief Set the outoreload value of the timer

@ -101,17 +101,17 @@ void timerInitCounter ( timerNo_t timer,
timerSetAutoReload(timer, autoReload);
}
void timerConfigOutputCompare( timerNo_t timer,
void timerInitOutputCompare( timerNo_t timer,
timerOutputCompareMode_t mode,
uint8_t timerIoChannel,
pinNo_t pinNo,
uint16_t alternate,
uint16_t altFunction,
uint8_t polarity)
{
timerStop(timer);
pinSetAlternate(pinNo,alternate);
pinSetMode(pinNo,alternate);
pinSetAlternate(pinNo,altFunction);
switch(timerIoChannel)
{
case 1:

@ -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)

Loading…
Cancel
Save