Skip to content

Commit 501f437

Browse files
Merge pull request #58 from soundanalogous/due-and-teensy3
Adds support for Arduino Due and Teensy 3.0 boards
2 parents 753512b + 8930211 commit 501f437

File tree

2 files changed

+66
-11
lines changed

2 files changed

+66
-11
lines changed

Boards.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,22 @@ writePort(port, value, bitmask): Write an 8 bit port.
200200
#define PIN_TO_SERVO(p) ((p) - 2)
201201

202202

203+
// Arduino DUE
204+
#elif defined(__SAM3X8E__)
205+
#define TOTAL_ANALOG_PINS 12
206+
#define TOTAL_PINS 66 // 54 digital + 12 analog
207+
#define VERSION_BLINK_PIN 13
208+
#define IS_PIN_DIGITAL(p) ((p) >= 2 && (p) < TOTAL_PINS)
209+
#define IS_PIN_ANALOG(p) ((p) >= 54 && (p) < TOTAL_PINS)
210+
#define IS_PIN_PWM(p) digitalPinHasPWM(p)
211+
#define IS_PIN_SERVO(p) ((p) >= 2 && (p) - 2 < MAX_SERVOS)
212+
#define IS_PIN_I2C(p) ((p) == 20 || (p) == 21) // 70 71
213+
#define PIN_TO_DIGITAL(p) (p)
214+
#define PIN_TO_ANALOG(p) ((p) - 54)
215+
#define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)
216+
#define PIN_TO_SERVO(p) ((p) - 2)
217+
218+
203219
// Teensy 1.0
204220
#elif defined(__AVR_AT90USB162__)
205221
#define TOTAL_ANALOG_PINS 0
@@ -234,6 +250,22 @@ writePort(port, value, bitmask): Write an 8 bit port.
234250
#define PIN_TO_SERVO(p) (p)
235251

236252

253+
// Teensy 3.0
254+
#elif defined(__MK20DX128__)
255+
#define TOTAL_ANALOG_PINS 14
256+
#define TOTAL_PINS 38 // 24 digital + 10 analog-digital + 4 analog
257+
#define VERSION_BLINK_PIN 13
258+
#define IS_PIN_DIGITAL(p) ((p) >= 0 && (p) <= 34)
259+
#define IS_PIN_ANALOG(p) (((p) >= 14 && (p) <= 23) || ((p) >= 34 && (p) <= 38))
260+
#define IS_PIN_PWM(p) digitalPinHasPWM(p)
261+
#define IS_PIN_SERVO(p) ((p) >= 0 && (p) < MAX_SERVOS)
262+
#define IS_PIN_I2C(p) ((p) == 18 || (p) == 19)
263+
#define PIN_TO_DIGITAL(p) (p)
264+
#define PIN_TO_ANALOG(p) (((p)<=23)?(p)-14:(p)-24)
265+
#define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)
266+
#define PIN_TO_SERVO(p) (p)
267+
268+
237269
// Teensy++ 1.0 and 2.0
238270
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
239271
#define TOTAL_ANALOG_PINS 8

readme.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ Most of the time you will be interacting with arduino with a client library on t
4242

4343
Note: The above libraries may support various versions of the Firmata protocol and therefore may not support all features of the latest Firmata spec nor all arduino and arduino-compatible boards. Refer to the respective projects for details.
4444

45-
##Updating Firmata in the Arduino IDE
45+
##Updating Firmata in the Arduino IDE (< Arduino 1.5)
4646
The version of firmata in the Arduino IDE contains an outdated version of Firmata. To update Firmata, clone the repo into the location of firmata in the arduino IDE or download the latest [tagged version](https://github.com/firmata/arduino/tags) (stable), rename the folder to "Firmata" and replace the existing Firmata folder in your Ardino application.
4747

4848
**Mac OSX**:
4949

50-
```
51-
rm -r /Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata
52-
git clone [email protected]:firmata/arduino.git /Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata
50+
```bash
51+
$ rm -r /Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata
52+
$ git clone [email protected]:firmata/arduino.git /Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata
5353
```
5454

5555
If you are downloading the latest tagged version of Firmata, rename it to "Firmata" and copy to /Applications/Arduino.app/Contents/Resources/Java/libraries/ overwriting the existing Firmata directory. Right-click (or conrol + click) on the Arduino application and choose "Show Package Contents" and navigate to the libraries directory.
@@ -58,20 +58,43 @@ If you are downloading the latest tagged version of Firmata, rename it to "Firma
5858

5959
Using the Git Shell application installed with [GitHub for Windows](http://windows.github.com/) (set default shell in options to Git Bash) or other command line based git tool:
6060

61-
```
62-
# update the path and arduino version as necessary
63-
rm -r c:/Program\ Files/arduino-1.x/libraries/Firmata
64-
git clone [email protected]:firmata/arduino.git c:/Program\ Files/arduino-1.x/libraries/Firmata
61+
update the path and arduino version as necessary
62+
```bash
63+
$ rm -r c:/Program\ Files/arduino-1.x/libraries/Firmata
64+
$ git clone [email protected]:firmata/arduino.git c:/Program\ Files/arduino-1.x/libraries/Firmata
6565
```
6666

6767
Note: If you use GitHub for Windows, you must clone the firmata/arduino repository using the Git Shell application as described above. You can use the Github for Windows GUI only after you have cloned the repository. Drag the Firmata file into the Github for Windows GUI to track it.
6868

6969
**Linux**:
7070

71+
update the path and arduino version as necessary
72+
```bash
73+
$ rm -r ~/arduino-1.x/libraries/Firmata
74+
$ git clone [email protected]:firmata/arduino.git ~/arduino-1.x/libraries/Firmata
75+
```
76+
77+
##Updating Firmata in the Arduino IDE (>= Arduino 1.5.2)
78+
As of Arduino 1.5.2 and there are separate library directories for the sam and
79+
avr architectures. To update Firmata in Arduino 1.5.2 or higher, follow the
80+
instructions above for pre Arduino 1.5 versions but update the path as follows:
81+
82+
**Mac OSX**:
83+
```
84+
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/libraries/Firmata
85+
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/sam/libraries/Firmata
86+
```
87+
88+
**Windows**:
89+
```
90+
/Program\ Files/arduino-1.5.x/hardware/arduino/avr/libraries/Firmata
91+
/Program\ Files/arduino-1.5.x/hardware/arduino/sam/libraries/Firmata
92+
```
93+
94+
**Linux**
7195
```
72-
# update the path and arduino version as necessary
73-
rm -r ~/arduino-1.x/libraries/Firmata
74-
git clone [email protected]:firmata/arduino.git ~/arduino-1.x/libraries/Firmata
96+
~/arduino-1.5.x/hardware/arduino/avr/libraries/Firmata
97+
~/arduino-1.5.x/hardware/arduino/sam/libraries/Firmata
7598
```
7699

77100
<a name="contributing" />

0 commit comments

Comments
 (0)