Debian Codegraph @

cores/arduino/HardwareSerial3.cpp

raw
1 /*
2 HardwareSerial3.cpp - Hardware serial library for Wiring
3 Copyright (c) 2006 Nicholas Zambetti. All right reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Modified 23 November 2006 by David A. Mellis
20 Modified 28 September 2010 by Mark Sproul
21 Modified 14 August 2012 by Alarus
22 Modified 3 December 2013 by Matthijs Kooijman
23 */
24
25 #include "Arduino.h"
26 #include "HardwareSerial.h"
27 #include "HardwareSerial_private.h"
28
29 // Each HardwareSerial is defined in its own file, since the linker pulls
30 // in the entire file when any element inside is used. --gc-sections can
31 // additionally cause unused symbols to be dropped, but ISRs have the
32 // "used" attribute so are never dropped and they keep the
33 // HardwareSerial instance in as well. Putting each instance in its own
34 // file prevents the linker from pulling in any unused instances in the
35 // first place.
36
37 #if defined(HAVE_HWSERIAL3)
38
39 ISR(USART3_RX_vect)
40 {
41 Serial3._rx_complete_irq();
42 }
43
44 ISR(USART3_UDRE_vect)
45 {
46 Serial3._tx_udr_empty_irq();
47 }
48
49 HardwareSerial Serial3(&UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UCSR3C, &UDR3);
50
51 // Function that can be weakly referenced by serialEventRun to prevent
52 // pulling in this file if it's not otherwise used.
53 bool Serial3_available() {
54 return Serial3.available();
55 }
56
57 #endif // HAVE_HWSERIAL3