From 8e249b46b531ee3091d423745240a95ebeebb004 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Fri, 20 May 2016 22:33:47 +0200 Subject: [PATCH] Fixed USART1 --- usart/usart.cpp | 24 ++++++++++++++++++++++++ usart/usart.h | 7 +++++++ 2 files changed, 31 insertions(+) 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(); };