Hi Mark,
I wish to have a function to simply have a delay before jumping to the next line. I have the below for adding a milli or micro second delay. How many channels in the timer are there used by utasker? Im using channel 1 , but dont know if there are others available.
Below I call the Delayms(.) for a delay, do you see any issues doing this?
Regards
Neil
volatile char DelayTimeout;
void Delayms(int Delay)
{
DelayTimeout=0;
SetOneShotTimerG2(Delay,1);
while(!DelayTimeout)
;
}
void G2TimerProcedure(void)
{
DelayTimeout=1;
}
void SetOneShotTimerG2(int Tme,char IsMS)
{
DMA_TIMER_SETUP timer_setup;
timer_setup.int_type = DMA_TIMER_INTERRUPT;
timer_setup.channel = 1; // timer channel
timer_setup.int_priority = DMA_TIMER1_INTERRUPT_PRIORITY;
timer_setup.int_handler = G2TimerProcedure; // enter timer call-back
timer_setup.mode = (DMA_TIMER_INTERNAL_CLOCK | DMA_TIMER_SINGLE_SHOT_INTERRUPT);
if(IsMS)
timer_setup.count_delay = DMA_TIMER_MS_DELAY(1,1,Tme);
else
timer_setup.count_delay = DMA_TIMER_US_DELAY(1,1,Tme);
fnConfigureInterrupt((void *)&timer_setup);
}