Changed interrupt order to match vector numbers

This commit is contained in:
BlackMark 2019-08-02 15:46:07 +02:00
parent 3aeb43ee1e
commit 5d6bc4761c
2 changed files with 20 additions and 20 deletions

View File

@ -59,22 +59,22 @@ constexpr int operator<<(const int &lhs, const ControlFlagsB0 &rhs) { return lhs
constexpr int operator<<(const int &lhs, const ControlFlagsC0 &rhs) { return lhs << static_cast<int>(rhs); } constexpr int operator<<(const int &lhs, const ControlFlagsC0 &rhs) { return lhs << static_cast<int>(rhs); }
// clang-format on // clang-format on
static void (*fnDataReg0EmptyIntHandler)() = nullptr;
static void (*fnRx0IntHandler)() = nullptr; static void (*fnRx0IntHandler)() = nullptr;
static void (*fnDataReg0EmptyIntHandler)() = nullptr;
static void (*fnTx0IntHandler)() = nullptr; static void (*fnTx0IntHandler)() = nullptr;
ISR(USART0_UDRE_vect)
{
if (fnDataReg0EmptyIntHandler)
fnDataReg0EmptyIntHandler();
}
ISR(USART0_RX_vect) ISR(USART0_RX_vect)
{ {
if (fnRx0IntHandler) if (fnRx0IntHandler)
fnRx0IntHandler(); fnRx0IntHandler();
} }
ISR(USART0_UDRE_vect)
{
if (fnDataReg0EmptyIntHandler)
fnDataReg0EmptyIntHandler();
}
ISR(USART0_TX_vect) ISR(USART0_TX_vect)
{ {
if (fnTx0IntHandler) if (fnTx0IntHandler)
@ -120,8 +120,8 @@ class Hardware0<mode, cfg, Driven::INTERRUPT> {
static void init() FORCE_INLINE static void init() FORCE_INLINE
{ {
detail::fnDataReg0EmptyIntHandler = dataRegEmptyIntHandler;
detail::fnRx0IntHandler = rxIntHandler; detail::fnRx0IntHandler = rxIntHandler;
detail::fnDataReg0EmptyIntHandler = dataRegEmptyIntHandler;
detail::fnTx0IntHandler = txIntHandler; detail::fnTx0IntHandler = txIntHandler;
HardwareImpl::init(); HardwareImpl::init();
@ -140,12 +140,12 @@ class Hardware0<mode, cfg, Driven::INTERRUPT> {
using HardwareImpl = detail::Hardware<detail::Registers0, detail::ControlFlagsA0, detail::ControlFlagsB0, using HardwareImpl = detail::Hardware<detail::Registers0, detail::ControlFlagsA0, detail::ControlFlagsB0,
detail::ControlFlagsC0, cfg, mode, Driven::INTERRUPT>; detail::ControlFlagsC0, cfg, mode, Driven::INTERRUPT>;
static void dataRegEmptyIntHandler() static void rxIntHandler()
{ {
// TODO // TODO
} }
static void rxIntHandler() static void dataRegEmptyIntHandler()
{ {
// TODO // TODO
} }

View File

@ -59,22 +59,22 @@ constexpr int operator<<(const int &lhs, const ControlFlagsB1 &rhs) { return lhs
constexpr int operator<<(const int &lhs, const ControlFlagsC1 &rhs) { return lhs << static_cast<int>(rhs); } constexpr int operator<<(const int &lhs, const ControlFlagsC1 &rhs) { return lhs << static_cast<int>(rhs); }
// clang-format on // clang-format on
static void (*fnDataReg1EmptyIntHandler)() = nullptr;
static void (*fnRx1IntHandler)() = nullptr; static void (*fnRx1IntHandler)() = nullptr;
static void (*fnDataReg1EmptyIntHandler)() = nullptr;
static void (*fnTx1IntHandler)() = nullptr; static void (*fnTx1IntHandler)() = nullptr;
ISR(USART1_UDRE_vect)
{
if (fnDataReg1EmptyIntHandler)
fnDataReg1EmptyIntHandler();
}
ISR(USART1_RX_vect) ISR(USART1_RX_vect)
{ {
if (fnRx1IntHandler) if (fnRx1IntHandler)
fnRx1IntHandler(); fnRx1IntHandler();
} }
ISR(USART1_UDRE_vect)
{
if (fnDataReg1EmptyIntHandler)
fnDataReg1EmptyIntHandler();
}
ISR(USART1_TX_vect) ISR(USART1_TX_vect)
{ {
if (fnTx1IntHandler) if (fnTx1IntHandler)
@ -124,8 +124,8 @@ class Hardware1<mode, cfg, Driven::INTERRUPT> {
static void init() FORCE_INLINE static void init() FORCE_INLINE
{ {
detail::fnDataReg1EmptyIntHandler = dataRegEmptyIntHandler;
detail::fnRx1IntHandler = rxIntHandler; detail::fnRx1IntHandler = rxIntHandler;
detail::fnDataReg1EmptyIntHandler = dataRegEmptyIntHandler;
detail::fnTx1IntHandler = txIntHandler; detail::fnTx1IntHandler = txIntHandler;
HardwareImpl::init(); HardwareImpl::init();
@ -144,12 +144,12 @@ class Hardware1<mode, cfg, Driven::INTERRUPT> {
using HardwareImpl = detail::Hardware<detail::Registers1, detail::ControlFlagsA1, detail::ControlFlagsB1, using HardwareImpl = detail::Hardware<detail::Registers1, detail::ControlFlagsA1, detail::ControlFlagsB1,
detail::ControlFlagsC1, cfg, mode, Driven::INTERRUPT>; detail::ControlFlagsC1, cfg, mode, Driven::INTERRUPT>;
static void dataRegEmptyIntHandler() static void rxIntHandler()
{ {
// TODO // TODO
} }
static void rxIntHandler() static void dataRegEmptyIntHandler()
{ {
// TODO // TODO
} }