19 #ifndef _VARIANT_ARDUINO_DUE_X_ 20 #define _VARIANT_ARDUINO_DUE_X_ 27 #define VARIANT_MAINOSC 12000000 30 #define VARIANT_MCK 84000000 38 #include "UARTClass.h" 39 #include "USARTClass.h" 49 #if defined ( __GNUC__ ) 50 # include <syscalls.h> 58 #define PINS_COUNT (79u) 59 #define NUM_DIGITAL_PINS (66u) 60 #define NUM_ANALOG_INPUTS (12u) 61 #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1) 63 #define digitalPinToPort(P) ( g_APinDescription[P].pPort ) 64 #define digitalPinToBitMask(P) ( g_APinDescription[P].ulPin ) 66 #define portOutputRegister(port) ( &(port->PIO_ODSR) ) 67 #define portInputRegister(port) ( &(port->PIO_PDSR) ) 68 #define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER ) 89 #define digitalPinToInterrupt(p) ((p) < NUM_DIGITAL_PINS ? (p) : -1) 92 #define PIN_LED_13 (13u) 93 #define PIN_LED_RXL (72u) 94 #define PIN_LED_TXL (73u) 95 #define PIN_LED PIN_LED_13 96 #define PIN_LED2 PIN_LED_RXL 97 #define PIN_LED3 PIN_LED_TXL 98 #define LED_BUILTIN 13 103 #define SPI_INTERFACES_COUNT 1 105 #define SPI_INTERFACE SPI0 106 #define SPI_INTERFACE_ID ID_SPI0 107 #define SPI_CHANNELS_NUM 4 108 #define PIN_SPI_SS0 (77u) 109 #define PIN_SPI_SS1 (87u) 110 #define PIN_SPI_SS2 (86u) 111 #define PIN_SPI_SS3 (78u) 112 #define PIN_SPI_MOSI (75u) 113 #define PIN_SPI_MISO (74u) 114 #define PIN_SPI_SCK (76u) 115 #define BOARD_SPI_SS0 (10u) 116 #define BOARD_SPI_SS1 (4u) 117 #define BOARD_SPI_SS2 (52u) 118 #define BOARD_SPI_SS3 PIN_SPI_SS3 119 #define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS3 121 #define BOARD_PIN_TO_SPI_PIN(x) \ 122 (x==BOARD_SPI_SS0 ? PIN_SPI_SS0 : \ 123 (x==BOARD_SPI_SS1 ? PIN_SPI_SS1 : \ 124 (x==BOARD_SPI_SS2 ? PIN_SPI_SS2 : PIN_SPI_SS3 ))) 125 #define BOARD_PIN_TO_SPI_CHANNEL(x) \ 126 (x==BOARD_SPI_SS0 ? 0 : \ 127 (x==BOARD_SPI_SS1 ? 1 : \ 128 (x==BOARD_SPI_SS2 ? 2 : 3))) 130 static const uint8_t SS = BOARD_SPI_SS0;
131 static const uint8_t SS1 = BOARD_SPI_SS1;
132 static const uint8_t SS2 = BOARD_SPI_SS2;
133 static const uint8_t SS3 = BOARD_SPI_SS3;
134 static const uint8_t MOSI = PIN_SPI_MOSI;
135 static const uint8_t MISO = PIN_SPI_MISO;
136 static const uint8_t SCK = PIN_SPI_SCK;
141 #define WIRE_INTERFACES_COUNT 2 143 #define PIN_WIRE_SDA (20u) 144 #define PIN_WIRE_SCL (21u) 145 #define WIRE_INTERFACE TWI1 146 #define WIRE_INTERFACE_ID ID_TWI1 147 #define WIRE_ISR_HANDLER TWI1_Handler 148 #define WIRE_ISR_ID TWI1_IRQn 150 #define PIN_WIRE1_SDA (70u) 151 #define PIN_WIRE1_SCL (71u) 152 #define WIRE1_INTERFACE TWI0 153 #define WIRE1_INTERFACE_ID ID_TWI0 154 #define WIRE1_ISR_HANDLER TWI0_Handler 155 #define WIRE1_ISR_ID TWI0_IRQn 157 static const uint8_t SDA = PIN_WIRE_SDA;
158 static const uint8_t SCL = PIN_WIRE_SCL;
159 static const uint8_t SDA1 = PIN_WIRE1_SDA;
160 static const uint8_t SCL1 = PIN_WIRE1_SCL;
166 #define PINS_UART (81u) 168 #define PINS_USART0 (82u) 170 #define PINS_USART1 (83u) 172 #define PINS_USART3 (84u) 177 #define PINS_USB (85u) 182 static const uint8_t A0 = 54;
183 static const uint8_t A1 = 55;
184 static const uint8_t A2 = 56;
185 static const uint8_t A3 = 57;
186 static const uint8_t A4 = 58;
187 static const uint8_t A5 = 59;
188 static const uint8_t A6 = 60;
189 static const uint8_t A7 = 61;
190 static const uint8_t A8 = 62;
191 static const uint8_t A9 = 63;
192 static const uint8_t A10 = 64;
193 static const uint8_t A11 = 65;
194 static const uint8_t DAC0 = 66;
195 static const uint8_t DAC1 = 67;
196 static const uint8_t CANRX = 68;
197 static const uint8_t CANTX = 69;
198 #define ADC_RESOLUTION 12 203 static const uint8_t CAN1RX = 88;
204 static const uint8_t CAN1TX = 89;
207 #define PINS_CAN0 (90u) 209 #define PINS_CAN1 (91u) 215 #define DACC_INTERFACE DACC 216 #define DACC_INTERFACE_ID ID_DACC 217 #define DACC_RESOLUTION 12 218 #define DACC_ISR_HANDLER DACC_Handler 219 #define DACC_ISR_ID DACC_IRQn 224 #define PWM_INTERFACE PWM 225 #define PWM_INTERFACE_ID ID_PWM 226 #define PWM_FREQUENCY 1000 227 #define PWM_MAX_DUTY_CYCLE 255 228 #define PWM_MIN_DUTY_CYCLE 0 229 #define PWM_RESOLUTION 8 234 #define TC_INTERFACE TC0 235 #define TC_INTERFACE_ID ID_TC0 236 #define TC_FREQUENCY 1000 237 #define TC_MAX_DUTY_CYCLE 255 238 #define TC_MIN_DUTY_CYCLE 0 239 #define TC_RESOLUTION 8 251 extern UARTClass Serial;
252 extern USARTClass Serial1;
253 extern USARTClass Serial2;
254 extern USARTClass Serial3;
273 #define SERIAL_PORT_MONITOR Serial 274 #define SERIAL_PORT_USBVIRTUAL SerialUSB 275 #define SERIAL_PORT_HARDWARE_OPEN Serial1 276 #define SERIAL_PORT_HARDWARE_OPEN1 Serial2 277 #define SERIAL_PORT_HARDWARE_OPEN2 Serial3 278 #define SERIAL_PORT_HARDWARE Serial 279 #define SERIAL_PORT_HARDWARE1 Serial1 280 #define SERIAL_PORT_HARDWARE2 Serial2 281 #define SERIAL_PORT_HARDWARE3 Serial3