diff --git a/usart/usart.cpp b/usart/usart.cpp index 037e95e..01f1893 100644 --- a/usart/usart.cpp +++ b/usart/usart.cpp @@ -379,8 +379,20 @@ ISR( USART0_UDRE_vect_D ) USART0::inst().transmitInterruptHandler(); } +/************************************************************************/ +/************************************************************************/ + #ifdef SECOND_USART +////////////////////////////////////////////////////////////////////////// +USART1 USART1::sm_cInstance; + +////////////////////////////////////////////////////////////////////////// +USART1& USART1::inst() +{ + return sm_cInstance; +} + ////////////////////////////////////////////////////////////////////////// USART1::USART1() { @@ -392,4 +404,16 @@ USART1::USART1() m_vui8pUDR = &UDR1; } +////////////////////////////////////////////////////////////////////////// +ISR( USART1_RX_vect_D ) +{ + USART1::inst().receiveInterruptHandler(); +} + +////////////////////////////////////////////////////////////////////////// +ISR( USART1_UDRE_vect_D ) +{ + USART1::inst().transmitInterruptHandler(); +} + #endif \ No newline at end of file diff --git a/usart/usart.h b/usart/usart.h index 7591f74..7a412c0 100644 --- a/usart/usart.h +++ b/usart/usart.h @@ -151,6 +151,13 @@ public: class USART1 : public USART0 { public: + static USART1& inst(); + USART1( const USART1& ) = delete; + void operator=( const USART1& ) = delete; + +private: + static USART1 sm_cInstance; + USART1(); };