|
| 1 | +/* |
| 2 | + common.h - Commoon pin definition functions for ESP8266 boards |
| 3 | + Part of Arduino - http://www.arduino.cc/ |
| 4 | +
|
| 5 | + Copyright (c) 2007 David A. Mellis |
| 6 | + Modified for ESP8266 platform by Ivan Grokhotkov, 2014-2016. |
| 7 | +
|
| 8 | + This library is free software; you can redistribute it and/or |
| 9 | + modify it under the terms of the GNU Lesser General Public |
| 10 | + License as published by the Free Software Foundation; either |
| 11 | + version 2.1 of the License, or (at your option) any later version. |
| 12 | +
|
| 13 | + This library is distributed in the hope that it will be useful, |
| 14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | + Lesser General Public License for more details. |
| 17 | +
|
| 18 | + You should have received a copy of the GNU Lesser General |
| 19 | + Public License along with this library; if not, write to the |
| 20 | + Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
| 21 | + Boston, MA 02111-1307 USA |
| 22 | +
|
| 23 | + $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ |
| 24 | +*/ |
| 25 | + |
| 26 | +#ifndef GENERIC_COMMON_H |
| 27 | +#define GENERIC_COMMON_H |
| 28 | + |
| 29 | +#define EXTERNAL_NUM_INTERRUPTS 16 |
| 30 | +#define NUM_DIGITAL_PINS 17 |
| 31 | +#define NUM_ANALOG_INPUTS 1 |
| 32 | + |
| 33 | +// Pins 9 and 10 are available, go to positive logic since it's clearer |
| 34 | +#define isFlashInterfacePin(p) ((p) == 6 || (p) == 7 || (p) == 8 || (p) == 11) |
| 35 | + |
| 36 | +#define analogInputToDigitalPin(p) ((p > 0) ? NOT_A_PIN : 0) |
| 37 | +#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)? (p) : NOT_AN_INTERRUPT) |
| 38 | +#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS && !isFlashInterfacePin(p))? 1 : 0) |
| 39 | + |
| 40 | +#define PIN_SPI_SS (15) |
| 41 | +#define PIN_SPI_MOSI (13) |
| 42 | +#define PIN_SPI_MISO (12) |
| 43 | +#define PIN_SPI_SCK (14) |
| 44 | + |
| 45 | +static const uint8_t SS = PIN_SPI_SS; |
| 46 | +static const uint8_t MOSI = PIN_SPI_MOSI; |
| 47 | +static const uint8_t MISO = PIN_SPI_MISO; |
| 48 | +static const uint8_t SCK = PIN_SPI_SCK; |
| 49 | + |
| 50 | +#ifndef PIN_A0 |
| 51 | +#define PIN_A0 (17) |
| 52 | +#endif /* PIN_A0 */ |
| 53 | + |
| 54 | +static const uint8_t A0 = PIN_A0; |
| 55 | + |
| 56 | +// These serial port names are intended to allow libraries and architecture-neutral |
| 57 | +// sketches to automatically default to the correct port name for a particular type |
| 58 | +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 59 | +// the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 60 | +// |
| 61 | +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 62 | +// |
| 63 | +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 64 | +// |
| 65 | +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 66 | +// |
| 67 | +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 68 | +// |
| 69 | +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 70 | +// pins are NOT connected to anything by default. |
| 71 | +#define SERIAL_PORT_MONITOR Serial |
| 72 | +#define SERIAL_PORT_USBVIRTUAL Serial |
| 73 | +#define SERIAL_PORT_HARDWARE Serial |
| 74 | +#define SERIAL_PORT_HARDWARE_OPEN Serial1 |
| 75 | + |
| 76 | +#ifdef LED_BUILTIN |
| 77 | +#ifdef __cplusplus |
| 78 | +extern "C" |
| 79 | +#endif |
| 80 | +const int BUILTIN_LED __attribute__((deprecated, weak)) = LED_BUILTIN; |
| 81 | +#endif |
| 82 | + |
| 83 | +#endif /* GENERIC_COMMON_H */ |
0 commit comments