| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 | /*  Copyright (c) 2014-2015 Arduino LLC.  All right reserved.  This library is free software; you can redistribute it and/or  modify it under the terms of the GNU Lesser General Public  License as published by the Free Software Foundation; either  version 2.1 of the License, or (at your option) any later version.  This library is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.  You should have received a copy of the GNU Lesser General Public  License along with this library; if not, write to the Free Software  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA*/#ifndef _VARIANT_CURRENT_RANGER_NEXTION_#define _VARIANT_CURRENT_RANGER_NEXTION_// The definitions here needs a SAMD core >=1.6.10#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610/*---------------------------------------------------------------------------- *        Definitions *----------------------------------------------------------------------------*//** Frequency of the board main oscillator */#define VARIANT_MAINOSC		(32768ul)/** Master clock frequency */#define VARIANT_MCK	(F_CPU)/*---------------------------------------------------------------------------- *        Headers *----------------------------------------------------------------------------*/#include "WVariant.h"#ifdef __cplusplus#include "SERCOM.h"#include "Uart.h"#endif // __cplusplus#ifdef __cplusplusextern "C"{#endif // __cplusplus/*---------------------------------------------------------------------------- *        Pins *----------------------------------------------------------------------------*/// Number of pins defined in PinDescription array#ifdef __cplusplusextern "C" unsigned int PINCOUNT_fn();#endif#define PINS_COUNT           (PINCOUNT_fn())#define NUM_DIGITAL_PINS     (20u)#define NUM_ANALOG_INPUTS    (7u)#define NUM_ANALOG_OUTPUTS   (1u)#define analogInputToDigitalPin(p)  ((p < 6u) ? (p) + 14u : -1)#define digitalPinToPort(P)        ( &(PORT->Group[g_APinDescription[P].ulPort]) )#define digitalPinToBitMask(P)     ( 1 << g_APinDescription[P].ulPin )//#define analogInPinToBit(P)        ( )#define portOutputRegister(port)   ( &(port->OUT.reg) )#define portInputRegister(port)    ( &(port->IN.reg) )#define portModeRegister(port)     ( &(port->DIR.reg) )#define digitalPinHasPWM(P)        ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER )/* * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD * architecture. If you need to check if a pin supports PWM you must * use digitalPinHasPWM(..). * * https://github.com/arduino/Arduino/issues/1833 */// #define digitalPinToTimer(P)// LEDs#define PIN_LED_13           (13u)//#define PIN_LED_RXL          (25u)#define PIN_LED_TXL          (26u)#define PIN_LED              PIN_LED_13//#define PIN_LED2             PIN_LED_RXL#define PIN_LED3             PIN_LED_TXL#define LED_BUILTIN          PIN_LED_13#define SS_FLASHMEM          (8u)/* * Analog pins */#define PIN_A0               (14ul)#define PIN_A1               (15ul)#define PIN_A2               (16ul)#define PIN_A3               (17ul)#define PIN_A4               (18ul)#define PIN_A5               (19ul)#define PIN_A6               (25ul)#define PIN_DAC0             (14ul)static const uint8_t A0  = PIN_A0;static const uint8_t A1  = PIN_A1;static const uint8_t A2  = PIN_A2;static const uint8_t A3  = PIN_A3;static const uint8_t A4  = PIN_A4;static const uint8_t A5  = PIN_A5;static const uint8_t A6  = PIN_A6;static const uint8_t DAC0 = PIN_DAC0;#define ADC_RESOLUTION		12// Other pins#define PIN_ATN              (38ul)static const uint8_t ATN = PIN_ATN;/* * Serial interfaces */// SerialBT#define PIN_SERIAL0_RX       (31ul)#define PIN_SERIAL0_TX       (30ul)#define PAD_SERIAL0_TX       (UART_TX_PAD_2)#define PAD_SERIAL0_RX       (SERCOM_RX_PAD_3)// Serial1#define PIN_SERIAL1_RX       (0ul)#define PIN_SERIAL1_TX       (1ul)#define PAD_SERIAL1_TX       (UART_TX_PAD_2)#define PAD_SERIAL1_RX       (SERCOM_RX_PAD_3)//Serial2#define PIN_SERIAL2_RX       (21ul)#define PIN_SERIAL2_TX       (20ul)#define PAD_SERIAL2_TX       (UART_TX_PAD_0)#define PAD_SERIAL2_RX       (SERCOM_RX_PAD_1)/* * SPI Interfaces */#define SPI_INTERFACES_COUNT 1#define PIN_SPI_MISO         (22u)#define PIN_SPI_MOSI         (23u)#define PIN_SPI_SCK          (24u)#define PERIPH_SPI           sercom4#define PAD_SPI_TX           SPI_PAD_2_SCK_3#define PAD_SPI_RX           SERCOM_RX_PAD_0static const uint8_t SS	  = PIN_A2 ;	// SERCOM4 last PAD is present on A2 but HW SS isn't used. Set here only for reference.static const uint8_t MOSI = PIN_SPI_MOSI ;static const uint8_t MISO = PIN_SPI_MISO ;static const uint8_t SCK  = PIN_SPI_SCK ;/* * Wire Interfaces */#define WIRE_INTERFACES_COUNT 0/*#define PIN_WIRE_SDA         (20u)#define PIN_WIRE_SCL         (21u)#define PERIPH_WIRE          sercom3#define WIRE_IT_HANDLER      SERCOM3_Handlerstatic const uint8_t SDA = PIN_WIRE_SDA;static const uint8_t SCL = PIN_WIRE_SCL;*//* * USB */#define PIN_USB_HOST_ENABLE (27ul)#define PIN_USB_DM          (28ul)#define PIN_USB_DP          (29ul)#define USB_HOST_EN         PIN_USB_HOST_ENABLE#define USB_HOST_ENABLE     PIN_USB_HOST_ENABLE#define PIN_AUTO_OFF        PIN_USB_HOST_ENABLE/* * I2S Interfaces */#define I2S_INTERFACES_COUNT 1#define I2S_DEVICE          0#define I2S_CLOCK_GENERATOR 3#define PIN_I2S_SD          (9u)#define PIN_I2S_SCK         (1u)#define PIN_I2S_FS          (0u)#ifdef __cplusplus}#endif/*---------------------------------------------------------------------------- *        Arduino objects - C++ only *----------------------------------------------------------------------------*/#ifdef __cplusplus/*	========================= *	===== SERCOM DEFINITION *	=========================*/extern SERCOM sercom0;extern SERCOM sercom1;extern SERCOM sercom2;extern SERCOM sercom3;extern SERCOM sercom4;extern SERCOM sercom5;extern Uart SerialBT;extern Uart SerialNextion;//extern Uart Serial1;#endif#ifdef __cplusplusextern "C" {#endifunsigned int PINCOUNT_fn();#ifdef __cplusplus}#endif// These serial port names are intended to allow libraries and architecture-neutral// sketches to automatically default to the correct port name for a particular type// of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,// the first hardware serial port whose RX/TX pins are not dedicated to another use.//// SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor//// SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial//// SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library//// SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.//// SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX//                            pins are NOT connected to anything by default.#define SERIAL_PORT_USBVIRTUAL      Serial#define SerialUSB                   Serial //for compatibility with v1.4.0 and prior#define SERIAL_PORT_MONITOR         Serial// Serial has no physical pins broken out, so it's not listed as HARDWARE port#define SERIAL_PORT_HARDWARE        SerialBT#define SERIAL_PORT_HARDWARE_OPEN   SerialBT#endif
 |