PDA

View Full Version : Teensy 3.0 serialEvent



BeattieBoy
10-07-2013, 04:26 AM
I'd love to see the Arduino style serialEvent (and serialEvent1, etc...) interrupt implemented for the Teensy. It would be nice not to have to poll the serial port to check for new data. I've managed to implement them myself using the weak attribute to define them in mk20dx128.h and call them at the end their respective ISR routines in their respective .c files. But the function is only run if the user declares the function in their code, and their is no apparent code size effect. However I'm a far from advanced software guy, so it may not be a perfect implementation, but it seems to work just fine so far. You can find the files I modified here (https://github.com/beattiea/TiltyIMU/tree/master/Tilty%20Software/Arduino/Source%20files).

stevech
10-07-2013, 07:07 AM
Discussed previously. . . I think it's in the to-do list.

In C, you use the FreeRTOS port for the T3; it works.
Or a C state machine. Threading or preemptive RTOS isn't essential.

goaran
11-11-2013, 08:04 PM
@BeattieBoy

Thanks for that. Including your files in my hardware folder did not work, but as far as i could see all to be changed is adding the function in the mk20dx128.h and adding the call in the serial.c
Tried it and this works fine for me.
Is there a reason this is not implemented in the official release?
I need this to get the timing of an incoming data stream to find the beginning of each frame (spektum satellite RC-receiver).