Skip to content

Commit 5a3ba13

Browse files
committed
Initial Commit
0 parents  commit 5a3ba13

File tree

2,982 files changed

+3822344
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,982 files changed

+3822344
-0
lines changed

boards.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
arduino_due_x.name=M2
2+
arduino_due_x.vid.0=0x2341
3+
arduino_due_x.pid.0=0x003e
4+
arduino_due_x.vid.1=0x2A03
5+
arduino_due_x.pid.1=0x003e
6+
arduino_due_x.upload.tool=bossac
7+
arduino_due_x.upload.protocol=sam-ba
8+
arduino_due_x.upload.maximum_size=524288
9+
arduino_due_x.upload.use_1200bps_touch=true
10+
arduino_due_x.upload.wait_for_upload_port=true
11+
arduino_due_x.upload.native_usb=true
12+
arduino_due_x.build.mcu=cortex-m3
13+
arduino_due_x.build.f_cpu=84000000L
14+
arduino_due_x.build.usb_manufacturer="Arduino LLC"
15+
arduino_due_x.build.usb_product="Arduino Due"
16+
arduino_due_x.build.board=SAM_DUE
17+
arduino_due_x.build.core=arduino
18+
arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}
19+
arduino_due_x.build.ldscript=linker_scripts/gcc/flash.ld
20+
arduino_due_x.build.variant=arduino_due_x
21+
arduino_due_x.build.variant_system_lib=libsam_sam3x8e_gcc_rel.a
22+
arduino_due_x.build.vid=0x2341
23+
arduino_due_x.build.pid=0x003e
24+

cores/arduino/Arduino.h

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef Arduino_h
21+
#define Arduino_h
22+
23+
#include <stdint.h>
24+
#include <stdlib.h>
25+
#include <string.h>
26+
#include <math.h>
27+
28+
// some libraries and sketches depend on this
29+
// AVR stuff, assuming Arduino.h or WProgram.h
30+
// automatically includes it...
31+
#include <avr/pgmspace.h>
32+
#include <avr/interrupt.h>
33+
34+
#include "binary.h"
35+
#include "itoa.h"
36+
37+
#ifdef __cplusplus
38+
extern "C"{
39+
#endif // __cplusplus
40+
41+
// Includes Atmel CMSIS
42+
#include <chip.h>
43+
44+
#include "wiring_constants.h"
45+
46+
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
47+
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
48+
#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
49+
50+
void yield(void);
51+
52+
/* sketch */
53+
extern void setup( void ) ;
54+
extern void loop( void ) ;
55+
56+
//#define NOT_A_PIN 0 // defined in pio.h/EPioType
57+
#define NOT_A_PORT 0
58+
59+
#define NOT_AN_INTERRUPT -1
60+
61+
typedef enum _EExt_Interrupts
62+
{
63+
EXTERNAL_INT_0=0,
64+
EXTERNAL_INT_1=1,
65+
EXTERNAL_INT_2=2,
66+
EXTERNAL_INT_3=3,
67+
EXTERNAL_INT_4=4,
68+
EXTERNAL_INT_5=5,
69+
EXTERNAL_INT_6=6,
70+
EXTERNAL_INT_7=7,
71+
EXTERNAL_NUM_INTERRUPTS
72+
} EExt_Interrupts ;
73+
74+
typedef void (*voidFuncPtr)( void ) ;
75+
76+
/* Define attribute */
77+
#if defined ( __CC_ARM ) /* Keil uVision 4 */
78+
#define WEAK (__attribute__ ((weak)))
79+
#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
80+
#define WEAK __weak
81+
#elif defined ( __GNUC__ ) /* GCC CS */
82+
#define WEAK __attribute__ ((weak))
83+
#endif
84+
85+
/* Definitions and types for pins */
86+
typedef enum _EAnalogChannel
87+
{
88+
NO_ADC=-1,
89+
ADC0=0,
90+
ADC1,
91+
ADC2,
92+
ADC3,
93+
ADC4,
94+
ADC5,
95+
ADC6,
96+
ADC7,
97+
ADC8,
98+
ADC9,
99+
ADC10,
100+
ADC11,
101+
ADC12,
102+
ADC13,
103+
ADC14,
104+
ADC15,
105+
DA0,
106+
DA1
107+
} EAnalogChannel ;
108+
109+
#define ADC_CHANNEL_NUMBER_NONE 0xffffffff
110+
111+
// Definitions for PWM channels
112+
typedef enum _EPWMChannel
113+
{
114+
NOT_ON_PWM=-1,
115+
PWM_CH0=0,
116+
PWM_CH1,
117+
PWM_CH2,
118+
PWM_CH3,
119+
PWM_CH4,
120+
PWM_CH5,
121+
PWM_CH6,
122+
PWM_CH7
123+
} EPWMChannel ;
124+
125+
// Definitions for TC channels
126+
typedef enum _ETCChannel
127+
{
128+
NOT_ON_TIMER=-1,
129+
TC0_CHA0=0,
130+
TC0_CHB0,
131+
TC0_CHA1,
132+
TC0_CHB1,
133+
TC0_CHA2,
134+
TC0_CHB2,
135+
TC1_CHA3,
136+
TC1_CHB3,
137+
TC1_CHA4,
138+
TC1_CHB4,
139+
TC1_CHA5,
140+
TC1_CHB5,
141+
TC2_CHA6,
142+
TC2_CHB6,
143+
TC2_CHA7,
144+
TC2_CHB7,
145+
TC2_CHA8,
146+
TC2_CHB8
147+
} ETCChannel ;
148+
149+
/**
150+
* Pin Attributes to be OR-ed
151+
*/
152+
#define PIN_ATTR_COMBO (1UL<<0)
153+
#define PIN_ATTR_ANALOG (1UL<<1)
154+
#define PIN_ATTR_DIGITAL (1UL<<2)
155+
#define PIN_ATTR_PWM (1UL<<3)
156+
#define PIN_ATTR_TIMER (1UL<<4)
157+
158+
#define PIN_STATUS_DIGITAL_INPUT_PULLUP (0x01)
159+
#define PIN_STATUS_DIGITAL_INPUT (0x02)
160+
#define PIN_STATUS_DIGITAL_OUTPUT (0x03)
161+
#define PIN_STATUS_ANALOG (0x04)
162+
#define PIN_STATUS_PWM (0x05)
163+
#define PIN_STATUS_TIMER (0x06)
164+
#define PIN_STATUS_SERIAL (0x07)
165+
#define PIN_STATUS_DW_LOW (0x10)
166+
#define PIN_STATUS_DW_HIGH (0x11)
167+
168+
/* Types used for the tables below */
169+
typedef struct _PinDescription
170+
{
171+
Pio* pPort ;
172+
uint32_t ulPin ;
173+
uint32_t ulPeripheralId ;
174+
EPioType ulPinType ;
175+
uint32_t ulPinConfiguration ;
176+
uint32_t ulPinAttribute ;
177+
EAnalogChannel ulAnalogChannel ; /* Analog pin in the Arduino context (label on the board) */
178+
EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */
179+
EPWMChannel ulPWMChannel ;
180+
ETCChannel ulTCChannel ;
181+
} PinDescription ;
182+
183+
extern uint8_t g_pinStatus[];
184+
185+
/* Pins table to be instanciated into variant.cpp */
186+
extern const PinDescription g_APinDescription[] ;
187+
188+
#ifdef __cplusplus
189+
} // extern "C"
190+
191+
#include "WCharacter.h"
192+
#include "WString.h"
193+
#include "Tone.h"
194+
#include "WMath.h"
195+
#include "HardwareSerial.h"
196+
#include "wiring_pulse.h"
197+
198+
#endif // __cplusplus
199+
200+
// Include board variant
201+
#include "variant.h"
202+
203+
#include "wiring.h"
204+
#include "wiring_digital.h"
205+
#include "wiring_analog.h"
206+
#include "wiring_shift.h"
207+
#include "WInterrupts.h"
208+
209+
#include "watchdog.h"
210+
211+
// USB Device
212+
#ifndef USB_VID
213+
#define USB_VID 0x2341 // arduino LLC vid
214+
#endif
215+
216+
#ifndef USB_PID
217+
#define USB_PID 0x003E // arduino Due pid
218+
#endif
219+
220+
#include "USB/USBDesc.h"
221+
#include "USB/USBCore.h"
222+
#include "USB/USBAPI.h"
223+
224+
#endif // Arduino_h

cores/arduino/Client.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
Client.h - Base class that provides Client
3+
Copyright (c) 2011 Adrian McEwen. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef client_h
21+
#define client_h
22+
#include "Print.h"
23+
#include "Stream.h"
24+
#include "IPAddress.h"
25+
26+
class Client : public Stream {
27+
28+
public:
29+
virtual int connect(IPAddress ip, uint16_t port) =0;
30+
virtual int connect(const char *host, uint16_t port) =0;
31+
virtual size_t write(uint8_t) =0;
32+
virtual size_t write(const uint8_t *buf, size_t size) =0;
33+
virtual int available() = 0;
34+
virtual int read() = 0;
35+
virtual int read(uint8_t *buf, size_t size) = 0;
36+
virtual int peek() = 0;
37+
virtual void flush() = 0;
38+
virtual void stop() = 0;
39+
virtual uint8_t connected() = 0;
40+
virtual operator bool() = 0;
41+
protected:
42+
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
43+
};
44+
45+
#endif

cores/arduino/HardwareSerial.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
Copyright (c) 2011 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#ifndef HardwareSerial_h
20+
#define HardwareSerial_h
21+
22+
#include <inttypes.h>
23+
24+
#include "Stream.h"
25+
26+
class HardwareSerial : public Stream
27+
{
28+
public:
29+
virtual void begin(unsigned long);
30+
virtual void end();
31+
virtual int available(void) = 0;
32+
virtual int peek(void) = 0;
33+
virtual int read(void) = 0;
34+
virtual void flush(void) = 0;
35+
virtual size_t write(uint8_t) = 0;
36+
using Print::write; // pull in write(str) and write(buf, size) from Print
37+
virtual operator bool() = 0;
38+
};
39+
40+
extern void serialEventRun(void) __attribute__((weak));
41+
42+
#endif

0 commit comments

Comments
 (0)