Code in for loop outside of if (usbInterruptIsReady()) {...}
Posted: Mon Jun 27, 2011 8:17 am
Is it not OK to do work in the for loop outside of the if (usbInterruptIsReady()) code block?
I have code between wdt_reset() and usbPoll(). Sometimes the device enumerates correctly
but usually not. Why doesn't this work or why shouldn't I do this? Does the amount of
work done there matter? Do I need to call wdt_reset() multiple times?
I have code between wdt_reset() and usbPoll(). Sometimes the device enumerates correctly
but usually not. Why doesn't this work or why shouldn't I do this? Does the amount of
work done there matter? Do I need to call wdt_reset() multiple times?
Code: Select all
for(;;)
{
wdt_reset();
//doing some work here
foo = froobulate(foo, bar, baz);
usbPoll();
if (usbInterruptIsReady())
{
my_report.foo = foo;
usbSetInterrupt((void *)&my_report, sizeof(my_report));
}
}