Made library header only again and provided way to disable interrupt vectors

This commit is contained in:
2019-08-15 18:07:11 +02:00
parent 2fd05483ee
commit ddf105a175
5 changed files with 86 additions and 66 deletions

View File

@@ -1,4 +1,5 @@
#pragma once
#ifndef UART_HARDWARE_1_HPP
#define UART_HARDWARE_1_HPP
#include <stdint.h>
@@ -118,3 +119,40 @@ class Hardware1<cfg, Driven::INTERRUPT, mode>
} // namespace uart
#undef FORCE_INLINE
#endif
//////////////////////////////////////////////////////////////////////////
#ifdef UART1_INT_VECTORS
#include <avr/interrupt.h>
namespace uart {
namespace detail {
#if defined(__AVR_ATmega1284P__)
void (*fnRx1IntHandler)() = nullptr;
void (*fnDataReg1EmptyIntHandler)() = nullptr;
ISR(USART1_RX_vect)
{
if (fnRx1IntHandler)
fnRx1IntHandler();
}
ISR(USART1_UDRE_vect)
{
if (fnDataReg1EmptyIntHandler)
fnDataReg1EmptyIntHandler();
}
#endif
} // namespace detail
} // namespace uart
#undef UART1_INT_VECTORS
#endif