/* Copyright (c) 2011 Arduino. 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_ARDUINO_DUE_X_ #define _VARIANT_ARDUINO_DUE_X_ /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ #include "Arduino.h" #ifdef __cplusplus #include "UARTClass.h" #include "USARTClass.h" #endif #ifdef __cplusplus extern "C"{ #endif // __cplusplus /** * Libc porting layers */ #if defined ( __GNUC__ ) /* GCC CS3 */ # include /** RedHat Newlib minimal stub */ #endif /*---------------------------------------------------------------------------- * Definitions *----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ #define ArduinoDueX_DevEd /** Name of the board */ #define VARIANT_NAME "Arduino_DueX_Dev_Ed" /** Frequency of the board main oscillator */ #define VARIANT_MAINOSC 12000000 /** Master clock frequency */ #define VARIANT_MCK 84000000 /*---------------------------------------------------------------------------- * Pins *----------------------------------------------------------------------------*/ // Number of pins defined in PinDescription array #define PINS_COUNT (79u) // LEDs #define PIN_LED_13 (13u) #define PIN_LED_RXL (72u) #define PIN_LED_TXL (73u) #define PIN_LED PIN_LED_13 #define PIN_LED2 PIN_LED_RXL #define PIN_LED3 PIN_LED_TXL /* * SPI Interfaces */ #define SPI_INTERFACES_COUNT 1 #define SPI_INTERFACE SPI0 #define SPI_INTERFACE_ID ID_SPI0 #define SPI_CHANNELS_NUM 4 #define PIN_SPI_SS0 (77u) #define PIN_SPI_SS1 (87u) #define PIN_SPI_SS2 (86u) #define PIN_SPI_SS3 (78u) #define PIN_SPI_MOSI (75u) #define PIN_SPI_MISO (74u) #define PIN_SPI_SCK (76u) #define BOARD_SPI_SS0 (10u) #define BOARD_SPI_SS1 (4u) #define BOARD_SPI_SS2 (52u) #define BOARD_SPI_SS3 PIN_SPI_SS3 #define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS2 #define BOARD_PIN_TO_SPI_PIN(x) \ (x==BOARD_SPI_SS0 ? PIN_SPI_SS0 : \ (x==BOARD_SPI_SS1 ? PIN_SPI_SS1 : \ (x==BOARD_SPI_SS2 ? PIN_SPI_SS2 : PIN_SPI_SS3 ))) #define BOARD_PIN_TO_SPI_CHANNEL(x) \ (x==BOARD_SPI_SS0 ? 0 : \ (x==BOARD_SPI_SS1 ? 1 : \ (x==BOARD_SPI_SS2 ? 2 : 3))) static const uint8_t SS = BOARD_SPI_SS0; static const uint8_t SS1 = BOARD_SPI_SS1; static const uint8_t SS2 = BOARD_SPI_SS2; static const uint8_t SS3 = BOARD_SPI_SS3; 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 2 #define PIN_WIRE_SDA (20u) #define PIN_WIRE_SCL (21u) #define WIRE_INTERFACE TWI1 #define WIRE_INTERFACE_ID ID_TWI1 #define WIRE_ISR_HANDLER TWI1_Handler #define PIN_WIRE1_SDA (70u) #define PIN_WIRE1_SCL (71u) #define WIRE1_INTERFACE TWI0 #define WIRE1_INTERFACE_ID ID_TWI0 #define WIRE1_ISR_HANDLER TWI0_Handler /* * UART/USART Interfaces */ // Serial #define PINS_UART (81u) // Serial1 #define PINS_USART0 (82u) // Serial2 #define PINS_USART1 (83u) // Serial3 #define PINS_USART3 (84u) /* * USB Interfaces */ #define PINS_USB (85u) /* * Analog pins */ static const uint8_t A0 = 54; static const uint8_t A1 = 55; static const uint8_t A2 = 56; static const uint8_t A3 = 57; static const uint8_t A4 = 58; static const uint8_t A5 = 59; static const uint8_t A6 = 60; static const uint8_t A7 = 61; static const uint8_t A8 = 62; static const uint8_t A9 = 63; static const uint8_t A10 = 64; static const uint8_t A11 = 65; static const uint8_t DAC0 = 66; static const uint8_t DAC1 = 67; static const uint8_t CANRX = 68; static const uint8_t CANTX = 69; #define ADC_RESOLUTION 12 /* * DACC */ #define DACC_INTERFACE DACC #define DACC_INTERFACE_ID ID_DACC #define DACC_RESOLUTION 12 #define DACC_ISR_HANDLER DACC_Handler #define DACC_ISR_ID DACC_IRQn /* * PWM */ #define PWM_INTERFACE PWM #define PWM_INTERFACE_ID ID_PWM #define PWM_FREQUENCY 1000 #define PWM_MAX_DUTY_CYCLE 255 #define PWM_MIN_DUTY_CYCLE 0 #define PWM_RESOLUTION 8 /* * TC */ #define TC_INTERFACE TC0 #define TC_INTERFACE_ID ID_TC0 #define TC_FREQUENCY 1000 #define TC_MAX_DUTY_CYCLE 255 #define TC_MIN_DUTY_CYCLE 0 #define TC_RESOLUTION 8 #ifdef __cplusplus } #endif /*---------------------------------------------------------------------------- * Arduino objects - C++ only *----------------------------------------------------------------------------*/ #ifdef __cplusplus extern UARTClass Serial; extern USARTClass Serial1; extern USARTClass Serial2; extern USARTClass Serial3; #endif #endif /* _VARIANT_ARDUINO_DUE_X_ */