modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
733 stars 132 forks source link

UART RX interrupt name not correct for ATmega8 #211

Closed Sh4rK closed 5 years ago

Sh4rK commented 5 years ago

Hi again!

A problem has come up with the UART on ATmega8. The UART template assumes that the RX interrupt name is USART{{ id }}_RX, but on the mega8 it is USART_RXC.

According to the avr-libc docs on interrupts the devices that use this interrupt name are ATmega16, ATmega32, ATmega323, ATmega8.

What's the correct way to fix this?

salkinium commented 5 years ago

We use an unhealthy dose of preprocessor for that, because this is an insane problem: https://github.com/modm-io/modm/blob/66c0868dcf8a4b05105ebffacb9acc63af6ecbac/src/modm/platform/uart/at90_tiny_mega/uart_defines.h#L89

This is missing the “no instance” case that you just added.