a loop which iterates infinitely for x seconds - stm32mp157c-dk2
Hi,
In my M4 program within while loop, I have made a for loop which iterates infinitely for 0.75 seconds like this but didnt work at all. I used time.h for that.
Are we allowed to make this kind of loop within the while loop in M4 program ?
Do you have any idea why it didnt work ?
clock_t begin;
double time_spent;
unsigned int i;
begin = clock();
for (i=0;1;i++)
{
/*do my staff */
if (VirtUart0RxMsg) {
Check_Delay(VirtUart0ChannelBuffRx, VirtUart0ChannelRxSize);
VIRT_UART_Transmit(&huart0, VirtUart0ChannelBuffRx, VirtUart0ChannelRxSize);
VirtUart0RxMsg = RESET;
}
time_spent = (double)(clock() - begin) / CLOCKS_PER_SEC;
if (time_spent>=0.75)
break;
}
}