#include <otSerial.h>
#include <otTimer.h>
#include <otPrintfLite.h>
U32 counts[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
FAST_CODE_2 void _timer0CallBack()
{
counts[0]++;
}
FAST_CODE_2 void _timer1CallBack()
{
counts[1]++;
}
FAST_CODE_2 void _timer2CallBack()
{
counts[2]++;
}
FAST_CODE_2 void _timer3CallBack()
{
counts[3]++;
}
FAST_CODE_2 void _timer4CallBack()
{
counts[4]++;
}
FAST_CODE_2 void _timer5CallBack()
{
counts[5]++;
}
FAST_CODE_2 void _timer6CallBack()
{
counts[6]++;
}
FAST_CODE_2 void _timer7CallBack()
{
counts[7]++;
}
void setup()
{
UartEnableSignals(UART0);
UartSetBaud(UART0, 115200);
setStdout(UART0);
TimerSetInterruptService(TIMER0, _timer0CallBack, TimerRateMs(1000));
TimerEnable(TIMER0, true);
TimerSetInterruptService(TIMER1, _timer1CallBack, TimerRateMs(1500));
TimerEnable(TIMER1, true);
TimerSetInterruptService(TIMER2, _timer2CallBack, TimerRateMs(3000));
TimerEnable(TIMER2, true);
TimerSetInterruptService(TIMER3, _timer3CallBack, TimerRateMs(4500));
TimerEnable(TIMER3, true);
TimerSetInterruptService(TIMER4, _timer4CallBack, TimerRateMs(6000));
TimerEnable(TIMER4, true);
TimerSetInterruptService(TIMER5, _timer5CallBack, TimerRateMs(9000));
TimerEnable(TIMER5, true);
TimerSetInterruptService(TIMER6, _timer6CallBack, TimerRateMs(13500));
TimerEnable(TIMER6, true);
TimerSetInterruptService(TIMER7, _timer7CallBack, TimerRateMs(20250));
TimerEnable(TIMER7, true);
}
void loop()
{
U32 c = counts[0];
printf("%5u %5u %5u %5u %5u %5u %5u %5u\n", counts[0], counts[1], counts[2], counts[3], counts[4], counts[5], counts[6], counts[7]);
while(c == counts[0]) DelayMs(10);
}