Custom UART Interrupt

Hello All,

I'm looking to create my own UART interrupt. For those who need to know why it's because I need to stop the timer as soon as a value comes in. While I know I will get a lot of reasons and explanations why this is not necessary I'm a lot more interested in how to go about doing this.

I have to commented out

void SERCOM5_Handler()
{
Serial1.IrqHandler();
}

in the variant.cpp file which works to remove the Arduino code from doing what it wants. The issue I'm having now is finding the function Serial.read(). I'm trying to read the uart rx buffer but with Atmel's documentation what it is this is not as easy as it should be.

I have tried

void SERCOM5_Handler()
{
char temp = SERCOM5->USART.DATA.reg;
if (temp == 'h' || temp == 'H'){
digitalWrite(LED_BUILTIN, HIGH);
}
if (temp == 'l' || temp == 'L'){
digitalWrite(LED_BUILTIN, LOW);
}
}

without much success. Therefore any help in reading the UART rx register would be very much appreciated.

K

It might help to tell us which exact variant you're using.

Sorry about that, late night working.

I’m working with an MKR WiFi 1010, I also plan on using a MKR 1000.

Kas