brtaylor
Well-known member
Hi all, I'm working on improving some classes that I have to read and interpret sensor data, which is sent to one of the Teensy Hardware Serial ports. Currently, my classes require calling a data collection function within void loop(), which reads any available serial data and runs it through a parser. Once the parser finds a good packet the results are stored and used later.
What I would like is an interrupt when the hardware serial receives a byte. Within my interrupt function, I would like to read that byte and store it within a ring buffer. Outside of the interrupt context, when the sensor data is actually being used, I would like to then feed the ring buffer into my parser and use the contents of the newest packet.
The issue that I am having is finding a way to attach an interrupt to the hardware serial receiving data. I looked at eventResponder, but didn't see how I could attach a function to the hardware serial receiving data...
What I would like is an interrupt when the hardware serial receives a byte. Within my interrupt function, I would like to read that byte and store it within a ring buffer. Outside of the interrupt context, when the sensor data is actually being used, I would like to then feed the ring buffer into my parser and use the contents of the newest packet.
The issue that I am having is finding a way to attach an interrupt to the hardware serial receiving data. I looked at eventResponder, but didn't see how I could attach a function to the hardware serial receiving data...