2011-10-25 16:19:43 +02:00
|
|
|
/*
|
|
|
|
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
|
2012-04-28 11:49:28 +02:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2011-10-25 16:19:43 +02:00
|
|
|
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
|
|
|
|
*/
|
2011-09-13 17:01:32 +02:00
|
|
|
|
2012-04-28 17:36:57 +02:00
|
|
|
#ifndef _VARIANT_ARDUINO_DUE_X_
|
|
|
|
#define _VARIANT_ARDUINO_DUE_X_
|
2011-09-13 17:01:32 +02:00
|
|
|
|
2013-02-13 15:37:13 +01:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
* Definitions
|
|
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/** Frequency of the board main oscillator */
|
|
|
|
#define VARIANT_MAINOSC 12000000
|
|
|
|
|
|
|
|
/** Master clock frequency */
|
|
|
|
#define VARIANT_MCK 84000000
|
|
|
|
|
2011-09-13 17:01:32 +02:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
* Headers
|
|
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
2011-11-06 14:00:02 +01:00
|
|
|
#ifdef __cplusplus
|
2011-10-16 19:49:47 +02:00
|
|
|
#include "UARTClass.h"
|
|
|
|
#include "USARTClass.h"
|
2011-11-06 14:00:02 +01:00
|
|
|
#endif
|
2011-09-13 17:01:32 +02:00
|
|
|
|
2012-05-02 17:00:55 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"{
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
2011-09-13 17:01:32 +02:00
|
|
|
/**
|
|
|
|
* Libc porting layers
|
|
|
|
*/
|
|
|
|
#if defined ( __GNUC__ ) /* GCC CS3 */
|
|
|
|
# include <syscalls.h> /** RedHat Newlib minimal stub */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
* Pins
|
|
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
|
2011-12-07 00:22:03 +01:00
|
|
|
// Number of pins defined in PinDescription array
|
2012-10-09 16:43:38 +02:00
|
|
|
#define PINS_COUNT (79u)
|
2013-09-28 21:11:33 +02:00
|
|
|
#define NUM_DIGITAL_PINS (53u)
|
|
|
|
#define NUM_ANALOG_INPUTS (12u)
|
|
|
|
|
|
|
|
// Interrupts
|
|
|
|
#define digitalPinToInterrupt(p) ((p) < NUM_DIGITAL_PINS ? (p) : -1)
|
2011-12-07 00:22:03 +01:00
|
|
|
|
|
|
|
// LEDs
|
2011-10-27 18:27:19 +02:00
|
|
|
#define PIN_LED_13 (13u)
|
2012-03-20 13:48:44 +01:00
|
|
|
#define PIN_LED_RXL (72u)
|
|
|
|
#define PIN_LED_TXL (73u)
|
2011-09-13 18:12:51 +02:00
|
|
|
#define PIN_LED PIN_LED_13
|
|
|
|
#define PIN_LED2 PIN_LED_RXL
|
|
|
|
#define PIN_LED3 PIN_LED_TXL
|
2013-11-03 18:29:34 +01:00
|
|
|
#define LED_BUILTIN 13
|
2011-09-13 17:01:32 +02:00
|
|
|
|
2011-12-07 00:22:03 +01:00
|
|
|
/*
|
|
|
|
* SPI Interfaces
|
|
|
|
*/
|
2011-12-02 16:29:50 +01:00
|
|
|
#define SPI_INTERFACES_COUNT 1
|
|
|
|
|
2012-04-23 15:50:30 +02:00
|
|
|
#define SPI_INTERFACE SPI0
|
|
|
|
#define SPI_INTERFACE_ID ID_SPI0
|
2012-04-24 09:31:50 +02:00
|
|
|
#define SPI_CHANNELS_NUM 4
|
|
|
|
#define PIN_SPI_SS0 (77u)
|
2012-06-08 22:34:38 +02:00
|
|
|
#define PIN_SPI_SS1 (87u)
|
|
|
|
#define PIN_SPI_SS2 (86u)
|
2012-04-24 09:31:50 +02:00
|
|
|
#define PIN_SPI_SS3 (78u)
|
2012-03-20 13:48:44 +01:00
|
|
|
#define PIN_SPI_MOSI (75u)
|
|
|
|
#define PIN_SPI_MISO (74u)
|
|
|
|
#define PIN_SPI_SCK (76u)
|
2012-06-08 22:34:38 +02:00
|
|
|
#define BOARD_SPI_SS0 (10u)
|
|
|
|
#define BOARD_SPI_SS1 (4u)
|
|
|
|
#define BOARD_SPI_SS2 (52u)
|
|
|
|
#define BOARD_SPI_SS3 PIN_SPI_SS3
|
2013-06-21 19:58:08 +02:00
|
|
|
#define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS3
|
2012-06-08 22:34:38 +02:00
|
|
|
|
|
|
|
#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)))
|
|
|
|
|
2013-12-13 15:13:18 +01:00
|
|
|
#define SS BOARD_SPI_SS0
|
|
|
|
#define SS1 BOARD_SPI_SS1
|
|
|
|
#define SS2 BOARD_SPI_SS2
|
|
|
|
#define SS3 BOARD_SPI_SS3
|
|
|
|
#define MOSI PIN_SPI_MOSI
|
|
|
|
#define MISO PIN_SPI_MISO
|
|
|
|
#define SCK PIN_SPI_SCK
|
2011-12-07 00:22:03 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Wire Interfaces
|
|
|
|
*/
|
2011-11-06 14:00:02 +01:00
|
|
|
#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
|
2012-10-10 17:35:34 +02:00
|
|
|
#define WIRE_ISR_HANDLER TWI1_Handler
|
2011-11-06 14:00:02 +01:00
|
|
|
|
2012-03-20 13:48:44 +01:00
|
|
|
#define PIN_WIRE1_SDA (70u)
|
|
|
|
#define PIN_WIRE1_SCL (71u)
|
2011-11-06 14:00:02 +01:00
|
|
|
#define WIRE1_INTERFACE TWI0
|
|
|
|
#define WIRE1_INTERFACE_ID ID_TWI0
|
2012-10-10 17:35:34 +02:00
|
|
|
#define WIRE1_ISR_HANDLER TWI0_Handler
|
2011-11-06 14:00:02 +01:00
|
|
|
|
2011-12-07 00:22:03 +01:00
|
|
|
/*
|
|
|
|
* UART/USART Interfaces
|
|
|
|
*/
|
2012-10-15 13:34:01 +02:00
|
|
|
// Serial
|
2012-03-20 13:48:44 +01:00
|
|
|
#define PINS_UART (81u)
|
2012-10-15 13:34:01 +02:00
|
|
|
// Serial1
|
2012-03-20 13:48:44 +01:00
|
|
|
#define PINS_USART0 (82u)
|
2012-10-15 13:34:01 +02:00
|
|
|
// Serial2
|
2012-03-20 13:48:44 +01:00
|
|
|
#define PINS_USART1 (83u)
|
2012-10-15 13:34:01 +02:00
|
|
|
// Serial3
|
|
|
|
#define PINS_USART3 (84u)
|
2011-10-27 18:27:19 +02:00
|
|
|
|
2012-04-28 11:49:28 +02:00
|
|
|
/*
|
|
|
|
* USB Interfaces
|
|
|
|
*/
|
|
|
|
#define PINS_USB (85u)
|
|
|
|
|
2011-12-07 00:22:03 +01:00
|
|
|
/*
|
|
|
|
* Analog pins
|
|
|
|
*/
|
2013-12-13 15:13:18 +01:00
|
|
|
#define A0 54
|
|
|
|
#define A1 55
|
|
|
|
#define A2 56
|
|
|
|
#define A3 57
|
|
|
|
#define A4 58
|
|
|
|
#define A5 59
|
|
|
|
#define A6 60
|
|
|
|
#define A7 61
|
|
|
|
#define A8 62
|
|
|
|
#define A9 63
|
|
|
|
#define A10 64
|
|
|
|
#define A11 65
|
|
|
|
#define DAC0 66
|
|
|
|
#define DAC1 67
|
|
|
|
#define CANRX 68
|
|
|
|
#define CANTX 69
|
2012-08-01 13:40:41 +02:00
|
|
|
#define ADC_RESOLUTION 12
|
2012-06-13 13:30:43 +02:00
|
|
|
|
2012-12-20 17:22:56 +01:00
|
|
|
/*
|
|
|
|
* Complementary CAN pins
|
|
|
|
*/
|
2013-12-13 15:13:18 +01:00
|
|
|
#define CAN1RX 88
|
|
|
|
#define CAN1TX 89
|
2012-12-20 17:22:56 +01:00
|
|
|
|
|
|
|
// CAN0
|
|
|
|
#define PINS_CAN0 (90u)
|
|
|
|
// CAN1
|
|
|
|
#define PINS_CAN1 (91u)
|
|
|
|
|
|
|
|
|
2012-06-13 13:30:43 +02:00
|
|
|
/*
|
|
|
|
* DACC
|
|
|
|
*/
|
|
|
|
#define DACC_INTERFACE DACC
|
|
|
|
#define DACC_INTERFACE_ID ID_DACC
|
2012-08-01 13:40:41 +02:00
|
|
|
#define DACC_RESOLUTION 12
|
2012-07-29 01:57:12 +02:00
|
|
|
#define DACC_ISR_HANDLER DACC_Handler
|
|
|
|
#define DACC_ISR_ID DACC_IRQn
|
2011-09-13 17:01:32 +02:00
|
|
|
|
2011-12-07 00:22:03 +01:00
|
|
|
/*
|
|
|
|
* PWM
|
|
|
|
*/
|
2012-08-04 11:27:46 +02:00
|
|
|
#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
|
2011-12-07 00:22:03 +01:00
|
|
|
|
2011-12-14 13:35:58 +01:00
|
|
|
/*
|
|
|
|
* 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
|
2012-08-04 11:27:46 +02:00
|
|
|
#define TC_RESOLUTION 8
|
2011-12-14 13:35:58 +01:00
|
|
|
|
2012-05-02 17:00:55 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-13 17:01:32 +02:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
* Arduino objects - C++ only
|
|
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2012-10-15 13:34:01 +02:00
|
|
|
extern UARTClass Serial;
|
|
|
|
extern USARTClass Serial1;
|
|
|
|
extern USARTClass Serial2;
|
|
|
|
extern USARTClass Serial3;
|
2011-09-13 17:01:32 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-11-11 13:25:20 +01:00
|
|
|
// 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_MONITOR Serial
|
|
|
|
#define SERIAL_PORT_USBVIRTUAL SerialUSB
|
|
|
|
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
|
|
|
#define SERIAL_PORT_HARDWARE_OPEN1 Serial2
|
|
|
|
#define SERIAL_PORT_HARDWARE_OPEN2 Serial3
|
|
|
|
#define SERIAL_PORT_HARDWARE Serial
|
|
|
|
#define SERIAL_PORT_HARDWARE1 Serial1
|
|
|
|
#define SERIAL_PORT_HARDWARE2 Serial2
|
|
|
|
#define SERIAL_PORT_HARDWARE3 Serial3
|
|
|
|
|
2012-04-28 17:36:57 +02:00
|
|
|
#endif /* _VARIANT_ARDUINO_DUE_X_ */
|
2011-09-13 17:01:32 +02:00
|
|
|
|