It seems like the FreeRTOS has some support to program a timeout, but unpublished anywhere. I’ve checked the FreeRTOS source code, regarding the usage, and it seems like it’s quite safe to use it under user’s application.
Here’s what I’ve found:
It seems like the FreeRTOS has some support to program a timeout, but unpublished anywhere. I’ve checked the FreeRTOS source code, regarding the usage, and it seems like it’s quite safe to use it under user’s application.
Here’s what I’ve found:
In java, you can have composite pattern easily using interface, like this:
Animal[] animals = new Animal[] { new Elephant(), new Cow(), new Cat() };
for(Animal currAnimal : animals) {
// Do the stuff here
}
Now, I want to have the same thing for serial RX interrupt in AVR. Something like this:
ISR(USART0_RX_vect) {
uint8_t data = UDR0;
for(InterruptHandler currHandler: interruptHandlers) {
currHandler.handle(data);
}
}
By that way, I can chain the interrupt handler easily. Of course, mixing C and Java in C-compiler won’t be OK for AVR-GCC. But I found out some way to do the similar thing in C.
In life, you need two examples: good one, and bad one. Here’s one of my bad design of interrupt handling.
The purpose of the firmware was to read a line (CR/LF terminated characters) from serial port, then parse it. Actually, I tried to port my simple AT handler from Java into C (AVR-GCC). It works, and as you can see, this program runs okay under x86 PC, but not under AVR with 8Mhz xtal.
Here’s the actual problem: