Index

auto-plow / 6cafdd8

A wheelchair motor-propelled battery-powered ESP32-driven remote control snow plow.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
630 Nov 2018 18:364a63c8cInclude Arduino core filesJoshua1570N

Blob @ auto-plow / include / arduino / HardwareSerial2.cpp

text/plain1975 bytesdownload raw
1/*
2 HardwareSerial2.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, sine 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_HWSERIAL2)
38
39ISR(USART2_RX_vect)
40{
41 Serial2._rx_complete_irq();
42}
43
44ISR(USART2_UDRE_vect)
45{
46 Serial2._tx_udr_empty_irq();
47}
48
49HardwareSerial Serial2(&UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UCSR2C, &UDR2);
50
51// Function that can be weakly referenced by serialEventRun to prevent
52// pulling in this file if it's not otherwise used.
53bool Serial2_available() {
54 return Serial2.available();
55}
56
57#endif // HAVE_HWSERIAL2
58