UART Interrupt in Energia

2 posts in this topic

Energia does not implement an API for UART TX/RX interrupt callback. You could however easily modify HardwareSerial.cpp/.h and insert an optional hardware callback.

I would add a function e.g. HardwareSerial::attachTxInterrupt(void (*userFunc)(void)) / HardwareSerial::attachRxInterrupt(void (*userFunc)(void)). Use attachInterrupt(void (*userFunc)(void)) in WInterrupts.c as an example. Add the TX and RX userFunc as a private member in HardwareSerial.h. Then in the tx/rx ISR check if the a function has been registered, if so call it.

Fmilburn likes this

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now