Merge branch 'refactor'
This commit is contained in:
commit
4883b4c030
77 changed files with 555 additions and 14998 deletions
7
.gitmodules
vendored
7
.gitmodules
vendored
|
|
@ -1,7 +0,0 @@
|
|||
[submodule "hardware/adafruit/sam"]
|
||||
path = hardware/adafruit/samd
|
||||
url = git@github.com:adafruit/ArduinoCore-samd.git
|
||||
[submodule "hardware/teeonardu"]
|
||||
path = hardware/teeonardu/avr
|
||||
url = https://github.com/adafruit/TeeOnArdu.git
|
||||
branch = 1.6.x
|
||||
68
README.md
68
README.md
|
|
@ -1,70 +1,22 @@
|
|||
# Adafruit Arduino Boards
|
||||
|
||||
Configuration and other support files to use Adafruit's boards like Trinket,
|
||||
Configuration and other support files to use Adafruit's boards like Trinket,
|
||||
Pro Trinket, Gemma, Flora, and more with the Arduino IDE. This is provided as
|
||||
a reference for modifying the Arduino IDE to support Adafruit's boards. If you
|
||||
just want to program one of Adafruit's boards you probably want one of the
|
||||
just want to program one of Adafruit's boards you probably want one of the
|
||||
preconfigured Arduino IDEs that Adafruit provides--see the learn system guide for
|
||||
your board for more details!
|
||||
|
||||
NOTE: If you want to setup the Arduino IDE to work with these boards you probably
|
||||
want to follow this guide that shows an easy method using the board manager:
|
||||
https://learn.adafruit.com/add-boards-arduino-v164/overview This repository is
|
||||
only for manually configuring Arduino to work with Adafruit's AVR boards (and for
|
||||
building new packages for the board manager).
|
||||
|
||||
These files are only compatible with the 1.6.x series of Arduino IDE and NOT the
|
||||
earlier 1.0.x series. Starting from a fresh Arduino 1.6.x IDE install navigate
|
||||
to the Arduino IDE folder and copy in files as follows:
|
||||
|
||||
- hardware/adafruit: This hiearchy of files should be copied into the hardware
|
||||
folder.
|
||||
|
||||
- hardware/tools/avr/etc/avrdude.conf: This is a customized avrdude.conf that
|
||||
should be copied directly over the hardware/tools/avr/etc/avrdude.conf file
|
||||
in the Arduino IDE. The modified configuration increases the delays when
|
||||
programming the ATtiny85 used in the Gemma and Trinket boards.
|
||||
|
||||
- drivers: This folder contains USB drivers for Windows 8, 7, and XP. The USB
|
||||
drivers should be installed when a Flora board is connected to the computer.
|
||||
earlier 1.0.x series. The contents of this repository should be cloned/copied
|
||||
into an Arduino/hardware/adafruit/avr folder.
|
||||
|
||||
NOTE: Arduino IDE version 1.6.2 has a bug with supporting external cores and
|
||||
DOES NOT work with these files. Use Arduino 1.6.3+, or an earlier version like
|
||||
1.6.1.
|
||||
|
||||
## Easy Install Scripts
|
||||
|
||||
Three shell scripts exist in the root that can simplify the creation of
|
||||
modified Arduino IDEs with Adafruit's boards. The scripts are build_linux.sh,
|
||||
build_windows.sh, and build_macosx.h and they require bash, tar, zip, and unzip
|
||||
(so they should really be run on Linux or OSX, however they have only been
|
||||
tested on Linux). Each script takes two parameters, the first it the name of
|
||||
an input file that should be the Arduino IDE download for that platform, and
|
||||
the second is the output file.
|
||||
|
||||
For example the IDE builds Adafruit publishes were built with commands like:
|
||||
|
||||
./build_linux.sh arduino-1.6.4-linux32.tar.xz adafruit-arduino-1.6.4-linux32.tar.xz
|
||||
|
||||
./build_linux.sh arduino-1.6.4-linux64.tar.xz adafruit-arduino-1.6.4-linux64.tar.xz
|
||||
|
||||
./build_windows.sh arduino-1.6.4-windows.zip adafruit-arduino-1.6.4-windows.zip
|
||||
|
||||
./build_macosx.sh arduino-1.6.4-macosx.zip adafruit-arduino-1.6.4-macosx.zip
|
||||
|
||||
## Running a Package Build
|
||||
|
||||
Run the `build_package.sh` script and enter a new version:
|
||||
```
|
||||
$ git clone git@github.com:adafruit/Adafruit_Arduino_Boards.git && cd Adafruit_Arduino_Boards
|
||||
$ git submodule init && git submodule update
|
||||
$ ./build_package.sh
|
||||
AVR VERSION: 1.4.1
|
||||
building adafruit-avr-1.4.1.tar.bz2...
|
||||
SAMD VERSION: 1.0.0
|
||||
building adafruit-samd-1.0.0.tar.bz2...
|
||||
```
|
||||
|
||||
The resulting `tar.bz2` archives will then be available in the `build/` folder along with the JSON output needed to add the new versions to the package index file in the [adafruit/arduino-board-index](https://github.com/adafruit/arduino-board-index) repo:
|
||||
|
||||
```
|
||||
├── build
|
||||
│ ├── adafruit-avr-1.4.1.tar.bz2
|
||||
│ ├── adafruit-samd-1.0.0.tar.bz2
|
||||
│ ├── avr_package.json
|
||||
│ └── samd_package.json
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Shell script to take a normal Arduino Linux build and create a new version
|
||||
# that has Adafruit's board built in to it.
|
||||
#
|
||||
# Takes 2 command line parameters, like:
|
||||
# ./build_linux.sh arduino-1.6.4-linux32.tar.xz adafruit-arduino-1.6.4-linux32.tar.xz
|
||||
#
|
||||
# Where the first parameter is the input file and the second parameter is the new
|
||||
# file to create. The script will decompress the input, add Adafruit's boards,
|
||||
# and compress the file back into a .tar.xz file with the output name.
|
||||
#
|
||||
set -e
|
||||
|
||||
# Location to use as a staging are for decompressing files.
|
||||
STAGING=/tmp/adafruit_boards
|
||||
# Expected extension of the input and output files.
|
||||
EXTENSION=.tar.xz
|
||||
|
||||
# Check that there are two command line parameters.
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Error! Expected an input and output file as parameters. Usage:"
|
||||
echo "./build_linux.sh <input Arduino build> <output modified Arduino build>"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Building Arduino download for Linux using:"
|
||||
echo "Input: $1"
|
||||
echo "Output: $2"
|
||||
|
||||
# Check that input has expected extension.
|
||||
if [[ ! $1 == *$EXTENSION ]]; then
|
||||
echo "Error! Expected input to be of type $EXTENSION"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Delete working area in /tmp/adafruit_boards if it exists.
|
||||
if [[ -d "$STAGING" ]]; then
|
||||
echo "Deleting temporary staging area $STAGING..."
|
||||
rm -rf --preserve-root "$STAGING"
|
||||
fi
|
||||
|
||||
# Create working area in /tmp/adafruit_boards
|
||||
mkdir -p "$STAGING"
|
||||
|
||||
# Decompress the input to the staging area.
|
||||
echo "Decompressing input..."
|
||||
tar xfC "$1" "$STAGING"
|
||||
|
||||
# Check only one subfolder exists and get is values.
|
||||
if [[ $(find "$STAGING" -maxdepth 1 -mindepth 1 -type d | wc -l) -ne 1 ]]; then
|
||||
echo "Error! Expected one subdirectory in staging area!"
|
||||
exit -1
|
||||
fi
|
||||
SUBDIR=$(find "$STAGING" -maxdepth 1 -mindepth 1 -type d -printf %f)
|
||||
|
||||
# Check a hardware subfolder exists.
|
||||
if [[ ! -d "$STAGING/$SUBDIR/hardware" ]]; then
|
||||
echo "Error! Expected hardware subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Copy Adafruit boards into hardware subfolder.
|
||||
echo "Copying Adafruit boards into staging area..."
|
||||
cp -rf hardware "$STAGING/$SUBDIR"
|
||||
|
||||
# Create output archive by compressing staging area.
|
||||
echo "Compressing modified IDE..."
|
||||
tar cfJC "$2" "$STAGING" "$SUBDIR"
|
||||
|
||||
echo "Done!"
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Shell script to take a normal Arduino Mac OSX build and create a new version
|
||||
# that has Adafruit's board built in to it.
|
||||
#
|
||||
# Takes 2 command line parameters, like:
|
||||
# ./build_windows.sh arduino-1.6.4-macosx.zip adafruit-arduino-1.6.4-macosx.zip
|
||||
#
|
||||
# Where the first parameter is the input file and the second parameter is the new
|
||||
# file to create. The script will decompress the input, add Adafruit's boards,
|
||||
# and compress the file back into a .zip file with the output name.
|
||||
#
|
||||
set -e
|
||||
|
||||
# Location to use as a staging are for decompressing files.
|
||||
STAGING=/tmp/adafruit_boards
|
||||
# Expected extension of the input and output files.
|
||||
EXTENSION=.zip
|
||||
|
||||
# Check that there are two command line parameters.
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Error! Expected an input and output file as parameters. Usage:"
|
||||
echo "./build_windows.sh <input Arduino build> <output modified Arduino build>"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Building Arduino download for Mac OSX using:"
|
||||
echo "Input: $1"
|
||||
echo "Output: $2"
|
||||
|
||||
# Check that input has expected extension.
|
||||
if [[ ! $1 == *$EXTENSION ]]; then
|
||||
echo "Error! Expected input to be of type $EXTENSION"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Delete working area in /tmp/adafruit_boards if it exists.
|
||||
if [[ -d "$STAGING" ]]; then
|
||||
echo "Deleting temporary staging area $STAGING..."
|
||||
rm -rf --preserve-root "$STAGING"
|
||||
fi
|
||||
|
||||
# Create working area in /tmp/adafruit_boards
|
||||
mkdir -p "$STAGING"
|
||||
|
||||
# Decompress the input to the staging area.
|
||||
echo "Decompressing input..."
|
||||
unzip -qq "$1" -d "$STAGING"
|
||||
|
||||
# Check Arduino.app/Contents/Java folder exists.
|
||||
if [[ ! -d "$STAGING/Arduino.app/Contents/Java" ]]; then
|
||||
echo "Error! Expected Arduino.app/Contents/Java in staging area!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Check a hardware subfolder exists.
|
||||
if [[ ! -d "$STAGING/Arduino.app/Contents/Java/hardware" ]]; then
|
||||
echo "Error! Expected hardware subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Copy Adafruit boards into hardware subfolder.
|
||||
echo "Copying Adafruit boards into staging area..."
|
||||
cp -rf hardware "$STAGING/Arduino.app/Contents/Java"
|
||||
|
||||
# Create output archive by compressing staging area.
|
||||
echo "Compressing modified IDE..."
|
||||
cd "$STAGING"
|
||||
zip -rqq "$2" "Arduino.app"
|
||||
cd -
|
||||
mv -f "$STAGING/$2" .
|
||||
|
||||
echo "Done!"
|
||||
280
build_package.sh
280
build_package.sh
|
|
@ -1,280 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Author: Todd Treece <todd@uniontownlabs.org>
|
||||
# Copyright (c) 2015 Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
PACKAGE_VERSION="1.3.0"
|
||||
|
||||
# boards are served via github pages
|
||||
BOARD_DOWNLOAD_URL="https:\/\/adafruit.github.io\/arduino-board-index\/boards"
|
||||
|
||||
# get package script directory
|
||||
REPO_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
read -r -d '' TEEJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit TeeOnArdu",
|
||||
"architecture":"avr",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-teeonardu-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-teeonardu-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"TeeOnArdu (Leo on TeensyCore)"
|
||||
},
|
||||
{
|
||||
"name":"Flora (TeensyCore)"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": []
|
||||
}
|
||||
EOF
|
||||
|
||||
read -r -d '' SAMDJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit SAMD Boards",
|
||||
"architecture":"samd",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"Adafruit Feather M0"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": [
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "arm-none-eabi-gcc",
|
||||
"version": "4.8.3-2014q1"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "bossac",
|
||||
"version": "1.6.1-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "openocd",
|
||||
"version": "0.9.0-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "CMSIS",
|
||||
"version": "4.0.0-atmel"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
read -r -d '' SAMDJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit SAMD Boards",
|
||||
"architecture":"samd",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-samd-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"Adafruit Feather M0"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": [
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "arm-none-eabi-gcc",
|
||||
"version": "4.8.3-2014q1"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "bossac",
|
||||
"version": "1.6.1-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "openocd",
|
||||
"version": "0.9.0-arduino"
|
||||
},
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "CMSIS",
|
||||
"version": "4.0.0-atmel"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
read -r -d '' AVRJSON <<'EOF'
|
||||
{
|
||||
"name":"Adafruit AVR Boards",
|
||||
"architecture":"avr",
|
||||
"version":"PACKAGEVERSION",
|
||||
"category":"Adafruit",
|
||||
"url":"DOWNLOADURL/adafruit-avr-PACKAGEVERSION.tar.bz2",
|
||||
"archiveFileName":"adafruit-avr-PACKAGEVERSION.tar.bz2",
|
||||
"checksum":"SHA-256:PACKAGESHA",
|
||||
"size":"PACKAGESIZE",
|
||||
"help":{
|
||||
"online":"https://forums.adafruit.com"
|
||||
},
|
||||
"boards":[
|
||||
{
|
||||
"name":"Adafruit Flora"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Gemma 8MHz"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Bluefruit Micro"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Feather 32u4"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Metro"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 5V/16MHz (USB)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 3V/12MHz (USB)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 5V/16MHz (FTDI)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Pro Trinket 3V/12MHz (FTDI)"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Trinket 8MHz"
|
||||
},
|
||||
{
|
||||
"name":"Adafruit Trinket 16MHz"
|
||||
}
|
||||
],
|
||||
"toolsDependencies":[]
|
||||
}
|
||||
EOF
|
||||
|
||||
# clean build dir
|
||||
cd $REPO_DIR
|
||||
rm -r build
|
||||
mkdir build
|
||||
|
||||
function archive() {
|
||||
|
||||
# args: archive_name source_path sha_return size_return
|
||||
|
||||
local __sha=$3
|
||||
local __size=$4
|
||||
|
||||
echo "building $1.tar.bz2..."
|
||||
cd $REPO_DIR
|
||||
cp -a $2 build/$1
|
||||
cd build
|
||||
tar -jcf $1.tar.bz2 $1
|
||||
rm -r $1
|
||||
|
||||
local sha=$(openssl dgst -sha256 $1.tar.bz2 | awk '{print $2}')
|
||||
local size=$(ls -l | grep $1 | awk '{print $5}')
|
||||
|
||||
eval $__sha="'$sha'"
|
||||
eval $__size="'$size'"
|
||||
|
||||
}
|
||||
|
||||
read -p "AVR VERSION: " input
|
||||
PACKAGE_VERSION=$input
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
#update platform version
|
||||
sed -i .bak -e "s/^version=.*/version=$PACKAGE_VERSION/" hardware/adafruit/avr/platform.txt
|
||||
|
||||
# create archives and get sha & size
|
||||
archive "adafruit-avr-$PACKAGE_VERSION" hardware/adafruit/avr PACKAGESHA PACKAGESIZE
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
# fill in board json templatee
|
||||
echo $AVRJSON | sed -e "s/PACKAGEVERSION/$PACKAGE_VERSION/g" \
|
||||
-e "s/DOWNLOADURL/$BOARD_DOWNLOAD_URL/g" \
|
||||
-e "s/PACKAGESHA/$PACKAGESHA/g" \
|
||||
-e "s/PACKAGESIZE/$PACKAGESIZE/g" > build/avr_package.json
|
||||
|
||||
read -p "SAMD VERSION: " input
|
||||
PACKAGE_VERSION=$input
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
#update platform version
|
||||
sed -i .bak -e "s/^version=.*/version=$PACKAGE_VERSION/" hardware/adafruit/samd/platform.txt
|
||||
sed -i .bak -e "s/^name=.*/name=Adafruit SAMD Boards/" hardware/adafruit/samd/platform.txt
|
||||
|
||||
# create archives and get sha & size
|
||||
archive "adafruit-samd-$PACKAGE_VERSION" hardware/adafruit/samd PACKAGESHA PACKAGESIZE
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
# fill in board json templatee
|
||||
echo $SAMDJSON | sed -e "s/PACKAGEVERSION/$PACKAGE_VERSION/g" \
|
||||
-e "s/DOWNLOADURL/$BOARD_DOWNLOAD_URL/g" \
|
||||
-e "s/PACKAGESHA/$PACKAGESHA/g" \
|
||||
-e "s/PACKAGESIZE/$PACKAGESIZE/g" > build/samd_package.json
|
||||
|
||||
read -p "TeeOnArdu VERSION: " input
|
||||
PACKAGE_VERSION=$input
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
#update platform version
|
||||
sed -i .bak -e "s/^version=.*/version=$PACKAGE_VERSION/" hardware/teeonardu/avr/platform.txt
|
||||
|
||||
# create archives and get sha & size
|
||||
archive "adafruit-teeonardu-$PACKAGE_VERSION" hardware/teeonardu/avr PACKAGESHA PACKAGESIZE
|
||||
|
||||
cd $REPO_DIR
|
||||
|
||||
# fill in board json templatee
|
||||
echo $TEEJSON | sed -e "s/PACKAGEVERSION/$PACKAGE_VERSION/g" \
|
||||
-e "s/DOWNLOADURL/$BOARD_DOWNLOAD_URL/g" \
|
||||
-e "s/PACKAGESHA/$PACKAGESHA/g" \
|
||||
-e "s/PACKAGESIZE/$PACKAGESIZE/g" > build/tee_package.json
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Shell script to take a normal Arduino Windows build and create a new version
|
||||
# that has Adafruit's board built in to it.
|
||||
#
|
||||
# Takes 2 command line parameters, like:
|
||||
# ./build_windows.sh arduino-1.6.4-windows.zip adafruit-arduino-1.6.4-windows.zip
|
||||
#
|
||||
# Where the first parameter is the input file and the second parameter is the new
|
||||
# file to create. The script will decompress the input, add Adafruit's boards,
|
||||
# and compress the file back into a .zip file with the output name.
|
||||
#
|
||||
set -e
|
||||
|
||||
# Location to use as a staging are for decompressing files.
|
||||
STAGING=/tmp/adafruit_boards
|
||||
# Expected extension of the input and output files.
|
||||
EXTENSION=.zip
|
||||
|
||||
# Check that there are two command line parameters.
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Error! Expected an input and output file as parameters. Usage:"
|
||||
echo "./build_windows.sh <input Arduino build> <output modified Arduino build>"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Building Arduino download for Windows using:"
|
||||
echo "Input: $1"
|
||||
echo "Output: $2"
|
||||
|
||||
# Check that input has expected extension.
|
||||
if [[ ! $1 == *$EXTENSION ]]; then
|
||||
echo "Error! Expected input to be of type $EXTENSION"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Delete working area in /tmp/adafruit_boards if it exists.
|
||||
if [[ -d "$STAGING" ]]; then
|
||||
echo "Deleting temporary staging area $STAGING..."
|
||||
rm -rf --preserve-root "$STAGING"
|
||||
fi
|
||||
|
||||
# Create working area in /tmp/adafruit_boards
|
||||
mkdir -p "$STAGING"
|
||||
|
||||
# Decompress the input to the staging area.
|
||||
echo "Decompressing input..."
|
||||
unzip -qq "$1" -d "$STAGING"
|
||||
|
||||
# Check only one subfolder exists and get is values.
|
||||
if [[ $(find "$STAGING" -maxdepth 1 -mindepth 1 -type d | wc -l) -ne 1 ]]; then
|
||||
echo "Error! Expected one subdirectory in staging area!"
|
||||
exit -1
|
||||
fi
|
||||
SUBDIR=$(find "$STAGING" -maxdepth 1 -mindepth 1 -type d -printf %f)
|
||||
|
||||
# Check a hardware subfolder exists.
|
||||
if [[ ! -d "$STAGING/$SUBDIR/hardware" ]]; then
|
||||
echo "Error! Expected hardware subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Check a drivers subfolder exits.
|
||||
if [[ ! -d "$STAGING/$SUBDIR/drivers" ]]; then
|
||||
echo "Error! Expected drivers subfolder but could not find it!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Copy Adafruit boards into hardware subfolder.
|
||||
echo "Copying Adafruit boards and drivers into staging area..."
|
||||
cp -rf hardware "$STAGING/$SUBDIR"
|
||||
cp -rf drivers "$STAGING/$SUBDIR"
|
||||
|
||||
# Create output archive by compressing staging area.
|
||||
echo "Compressing modified IDE..."
|
||||
cd "$STAGING"
|
||||
zip -rqq "$2" "$SUBDIR"
|
||||
cd -
|
||||
mv -f "$STAGING/$2" .
|
||||
|
||||
echo "Done!"
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 83834c322d5f2e41bfde143894a2d8dfb05c5a0b
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 177e057684472728aee12c2a647a76acaefe5c84
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -27,15 +27,81 @@
|
|||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
// Workaround for wrong definitions in "iom32u4.h".
|
||||
// This should be fixed in the AVR toolchain.
|
||||
#undef UHCON
|
||||
#undef UHINT
|
||||
#undef UHIEN
|
||||
#undef UHADDR
|
||||
#undef UHFNUM
|
||||
#undef UHFNUML
|
||||
#undef UHFNUMH
|
||||
#undef UHFLEN
|
||||
#undef UPINRQX
|
||||
#undef UPINTX
|
||||
#undef UPNUM
|
||||
#undef UPRST
|
||||
#undef UPCONX
|
||||
#undef UPCFG0X
|
||||
#undef UPCFG1X
|
||||
#undef UPSTAX
|
||||
#undef UPCFG2X
|
||||
#undef UPIENX
|
||||
#undef UPDATX
|
||||
#undef TCCR2A
|
||||
#undef WGM20
|
||||
#undef WGM21
|
||||
#undef COM2B0
|
||||
#undef COM2B1
|
||||
#undef COM2A0
|
||||
#undef COM2A1
|
||||
#undef TCCR2B
|
||||
#undef CS20
|
||||
#undef CS21
|
||||
#undef CS22
|
||||
#undef WGM22
|
||||
#undef FOC2B
|
||||
#undef FOC2A
|
||||
#undef TCNT2
|
||||
#undef TCNT2_0
|
||||
#undef TCNT2_1
|
||||
#undef TCNT2_2
|
||||
#undef TCNT2_3
|
||||
#undef TCNT2_4
|
||||
#undef TCNT2_5
|
||||
#undef TCNT2_6
|
||||
#undef TCNT2_7
|
||||
#undef OCR2A
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
#undef OCR2B
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
|
||||
#define NUM_DIGITAL_PINS 31
|
||||
#define NUM_ANALOG_INPUTS 12
|
||||
|
||||
#define TXLED0 0
|
||||
#define TXLED1 0
|
||||
#define RXLED0 0
|
||||
#define RXLED1 0
|
||||
#define TX_RX_LED_INIT 0
|
||||
#define TX_RX_LED_INIT 0
|
||||
|
||||
static const uint8_t SDA = 2;
|
||||
static const uint8_t SCL = 3;
|
||||
#define LED_BUILTIN 13
|
||||
|
||||
// Map SPI port to 'new' pins D14..D17
|
||||
static const uint8_t SS = 17;
|
||||
|
|
@ -67,9 +133,8 @@ static const uint8_t A11 = 29; // D12
|
|||
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
||||
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
|
||||
|
||||
#define NUM_DIGITAL_PINS 31
|
||||
#define NUM_ANALOG_INPUTS 12
|
||||
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 13)
|
||||
|
||||
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
|
||||
|
||||
#ifdef ARDUINO_MAIN
|
||||
|
|
@ -147,7 +212,7 @@ const uint16_t PROGMEM port_to_input_PGM[] = {
|
|||
(uint16_t) &PINF,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[31] = {
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
|
||||
PD, // D0 - PD2
|
||||
PD, // D1 - PD3
|
||||
PD, // D2 - PD1
|
||||
|
|
@ -182,11 +247,10 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[31] = {
|
|||
PB, // D27 / D9 - A9 - PB5
|
||||
PB, // D28 / D10 - A10 - PB6
|
||||
PD, // D29 / D12 - A11 - PD6
|
||||
|
||||
PD, // D30 - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[31] = {
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
|
||||
_BV(2), // D0 - PD2
|
||||
_BV(3), // D1 - PD3
|
||||
_BV(1), // D2 - PD1
|
||||
|
|
@ -221,11 +285,10 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[31] = {
|
|||
_BV(5), // D27 / D9 - A9 - PB5
|
||||
_BV(6), // D28 / D10 - A10 - PB6
|
||||
_BV(6), // D29 / D12 - A11 - PD6
|
||||
|
||||
_BV(5), // D30 - PD5 (TXLED)
|
||||
_BV(5), // D30 - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
|
@ -245,9 +308,25 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
|||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
|
||||
7, // A0 PF7 ADC7
|
||||
6, // A1 PF6 ADC6
|
||||
5, // A2 PF5 ADC5
|
||||
|
|
@ -263,4 +342,46 @@ const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
|||
};
|
||||
|
||||
#endif /* ARDUINO_MAIN */
|
||||
|
||||
// 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 Serial
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
|
||||
// Alias SerialUSB to Serial
|
||||
#define SerialUSB SERIAL_PORT_USBVIRTUAL
|
||||
|
||||
// Bootloader related fields
|
||||
// Old Caterina bootloader places the MAGIC key into unsafe RAM locations (it can be rewritten
|
||||
// by the running sketch before to actual reboot).
|
||||
// Newer bootloaders, recognizable by the LUFA "signature" at the end of the flash, can handle both
|
||||
// the usafe and the safe location. Check once (in USBCore.cpp) if the bootloader in new, then set the global
|
||||
// _updatedLUFAbootloader variable to true/false and place the magic key consequently
|
||||
#ifndef MAGIC_KEY
|
||||
#define MAGIC_KEY 0x7777
|
||||
#endif
|
||||
|
||||
#ifndef MAGIC_KEY_POS
|
||||
#define MAGIC_KEY_POS 0x0800
|
||||
#endif
|
||||
|
||||
#ifndef NEW_LUFA_SIGNATURE
|
||||
#define NEW_LUFA_SIGNATURE 0xDCFB
|
||||
#endif
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
|
|
@ -27,18 +27,81 @@
|
|||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
// Workaround for wrong definitions in "iom32u4.h".
|
||||
// This should be fixed in the AVR toolchain.
|
||||
#undef UHCON
|
||||
#undef UHINT
|
||||
#undef UHIEN
|
||||
#undef UHADDR
|
||||
#undef UHFNUM
|
||||
#undef UHFNUML
|
||||
#undef UHFNUMH
|
||||
#undef UHFLEN
|
||||
#undef UPINRQX
|
||||
#undef UPINTX
|
||||
#undef UPNUM
|
||||
#undef UPRST
|
||||
#undef UPCONX
|
||||
#undef UPCFG0X
|
||||
#undef UPCFG1X
|
||||
#undef UPSTAX
|
||||
#undef UPCFG2X
|
||||
#undef UPIENX
|
||||
#undef UPDATX
|
||||
#undef TCCR2A
|
||||
#undef WGM20
|
||||
#undef WGM21
|
||||
#undef COM2B0
|
||||
#undef COM2B1
|
||||
#undef COM2A0
|
||||
#undef COM2A1
|
||||
#undef TCCR2B
|
||||
#undef CS20
|
||||
#undef CS21
|
||||
#undef CS22
|
||||
#undef WGM22
|
||||
#undef FOC2B
|
||||
#undef FOC2A
|
||||
#undef TCNT2
|
||||
#undef TCNT2_0
|
||||
#undef TCNT2_1
|
||||
#undef TCNT2_2
|
||||
#undef TCNT2_3
|
||||
#undef TCNT2_4
|
||||
#undef TCNT2_5
|
||||
#undef TCNT2_6
|
||||
#undef TCNT2_7
|
||||
#undef OCR2A
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
#undef OCR2B
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
|
||||
#define NUM_DIGITAL_PINS 31
|
||||
#define NUM_ANALOG_INPUTS 12
|
||||
|
||||
#define TXLED0 0
|
||||
#define TXLED1 0
|
||||
#define RXLED0 0
|
||||
#define RXLED1 0
|
||||
#define TX_RX_LED_INIT 0
|
||||
|
||||
#define NUM_DIGITAL_PINS 24
|
||||
#define NUM_ANALOG_INPUTS 12
|
||||
#define TX_RX_LED_INIT 0
|
||||
|
||||
static const uint8_t SDA = 2;
|
||||
static const uint8_t SCL = 3;
|
||||
#define LED_BUILTIN 13
|
||||
|
||||
// Map SPI port to 'new' pins D14..D17
|
||||
static const uint8_t SS = 17;
|
||||
|
|
@ -69,7 +132,9 @@ static const uint8_t A11 = 29; // D12
|
|||
// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
|
||||
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
||||
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
|
||||
|
||||
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 13)
|
||||
|
||||
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
|
||||
|
||||
#ifdef ARDUINO_MAIN
|
||||
|
|
@ -110,8 +175,8 @@ extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
|||
// MOSI D16 PB2 MOSI,PCINT2
|
||||
// SS D17 PB0 RXLED,SS/PCINT0
|
||||
//
|
||||
// TXLED PD5
|
||||
// RXLED PB0
|
||||
// TXLED D30 PD5
|
||||
// RXLED PB0
|
||||
// HWB PE2 HWB
|
||||
|
||||
// these arrays map port names (e.g. port B) to the
|
||||
|
|
@ -147,7 +212,7 @@ const uint16_t PROGMEM port_to_input_PGM[] = {
|
|||
(uint16_t) &PINF,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[30] = {
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
|
||||
PD, // D0 - PD2
|
||||
PD, // D1 - PD3
|
||||
PD, // D2 - PD1
|
||||
|
|
@ -182,9 +247,10 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[30] = {
|
|||
PB, // D27 / D9 - A9 - PB5
|
||||
PB, // D28 / D10 - A10 - PB6
|
||||
PD, // D29 / D12 - A11 - PD6
|
||||
PD, // D30 - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = {
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
|
||||
_BV(2), // D0 - PD2
|
||||
_BV(3), // D1 - PD3
|
||||
_BV(1), // D2 - PD1
|
||||
|
|
@ -219,9 +285,10 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = {
|
|||
_BV(5), // D27 / D9 - A9 - PB5
|
||||
_BV(6), // D28 / D10 - A10 - PB6
|
||||
_BV(6), // D29 / D12 - A11 - PD6
|
||||
_BV(5), // D30 - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
|
@ -241,9 +308,25 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
|||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
|
||||
7, // A0 PF7 ADC7
|
||||
6, // A1 PF6 ADC6
|
||||
5, // A2 PF5 ADC5
|
||||
|
|
@ -259,4 +342,46 @@ const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
|||
};
|
||||
|
||||
#endif /* ARDUINO_MAIN */
|
||||
|
||||
// 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 Serial
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
|
||||
// Alias SerialUSB to Serial
|
||||
#define SerialUSB SERIAL_PORT_USBVIRTUAL
|
||||
|
||||
// Bootloader related fields
|
||||
// Old Caterina bootloader places the MAGIC key into unsafe RAM locations (it can be rewritten
|
||||
// by the running sketch before to actual reboot).
|
||||
// Newer bootloaders, recognizable by the LUFA "signature" at the end of the flash, can handle both
|
||||
// the usafe and the safe location. Check once (in USBCore.cpp) if the bootloader in new, then set the global
|
||||
// _updatedLUFAbootloader variable to true/false and place the magic key consequently
|
||||
#ifndef MAGIC_KEY
|
||||
#define MAGIC_KEY 0x7777
|
||||
#endif
|
||||
|
||||
#ifndef MAGIC_KEY_POS
|
||||
#define MAGIC_KEY_POS 0x0800
|
||||
#endif
|
||||
|
||||
#ifndef NEW_LUFA_SIGNATURE
|
||||
#define NEW_LUFA_SIGNATURE 0xDCFB
|
||||
#endif
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
|
|
@ -27,15 +27,81 @@
|
|||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
// Workaround for wrong definitions in "iom32u4.h".
|
||||
// This should be fixed in the AVR toolchain.
|
||||
#undef UHCON
|
||||
#undef UHINT
|
||||
#undef UHIEN
|
||||
#undef UHADDR
|
||||
#undef UHFNUM
|
||||
#undef UHFNUML
|
||||
#undef UHFNUMH
|
||||
#undef UHFLEN
|
||||
#undef UPINRQX
|
||||
#undef UPINTX
|
||||
#undef UPNUM
|
||||
#undef UPRST
|
||||
#undef UPCONX
|
||||
#undef UPCFG0X
|
||||
#undef UPCFG1X
|
||||
#undef UPSTAX
|
||||
#undef UPCFG2X
|
||||
#undef UPIENX
|
||||
#undef UPDATX
|
||||
#undef TCCR2A
|
||||
#undef WGM20
|
||||
#undef WGM21
|
||||
#undef COM2B0
|
||||
#undef COM2B1
|
||||
#undef COM2A0
|
||||
#undef COM2A1
|
||||
#undef TCCR2B
|
||||
#undef CS20
|
||||
#undef CS21
|
||||
#undef CS22
|
||||
#undef WGM22
|
||||
#undef FOC2B
|
||||
#undef FOC2A
|
||||
#undef TCNT2
|
||||
#undef TCNT2_0
|
||||
#undef TCNT2_1
|
||||
#undef TCNT2_2
|
||||
#undef TCNT2_3
|
||||
#undef TCNT2_4
|
||||
#undef TCNT2_5
|
||||
#undef TCNT2_6
|
||||
#undef TCNT2_7
|
||||
#undef OCR2A
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
#undef OCR2B
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
|
||||
#define NUM_DIGITAL_PINS 31
|
||||
#define NUM_ANALOG_INPUTS 12
|
||||
|
||||
#define TXLED0 0
|
||||
#define TXLED1 0
|
||||
#define RXLED0 0
|
||||
#define RXLED1 0
|
||||
#define TX_RX_LED_INIT 0
|
||||
#define TX_RX_LED_INIT 0
|
||||
|
||||
static const uint8_t SDA = 2;
|
||||
static const uint8_t SCL = 3;
|
||||
#define LED_BUILTIN 13
|
||||
|
||||
// Map SPI port to 'new' pins D14..D17
|
||||
static const uint8_t SS = 17;
|
||||
|
|
@ -67,9 +133,8 @@ static const uint8_t A11 = 29; // D12
|
|||
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
||||
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
|
||||
|
||||
#define NUM_DIGITAL_PINS 24
|
||||
#define NUM_ANALOG_INPUTS 12
|
||||
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 13)
|
||||
|
||||
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
|
||||
|
||||
#ifdef ARDUINO_MAIN
|
||||
|
|
@ -110,8 +175,8 @@ extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
|||
// MOSI D16 PB2 MOSI,PCINT2
|
||||
// SS D17 PB0 RXLED,SS/PCINT0
|
||||
//
|
||||
// TXLED PD5
|
||||
// RXLED PB0
|
||||
// TXLED D30 PD5
|
||||
// RXLED PB0
|
||||
// HWB PE2 HWB
|
||||
|
||||
// these arrays map port names (e.g. port B) to the
|
||||
|
|
@ -147,7 +212,7 @@ const uint16_t PROGMEM port_to_input_PGM[] = {
|
|||
(uint16_t) &PINF,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[30] = {
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
|
||||
PD, // D0 - PD2
|
||||
PD, // D1 - PD3
|
||||
PD, // D2 - PD1
|
||||
|
|
@ -182,9 +247,10 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[30] = {
|
|||
PB, // D27 / D9 - A9 - PB5
|
||||
PB, // D28 / D10 - A10 - PB6
|
||||
PD, // D29 / D12 - A11 - PD6
|
||||
PD, // D30 - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = {
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
|
||||
_BV(2), // D0 - PD2
|
||||
_BV(3), // D1 - PD3
|
||||
_BV(1), // D2 - PD1
|
||||
|
|
@ -219,9 +285,10 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = {
|
|||
_BV(5), // D27 / D9 - A9 - PB5
|
||||
_BV(6), // D28 / D10 - A10 - PB6
|
||||
_BV(6), // D29 / D12 - A11 - PD6
|
||||
_BV(5), // D30 - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
|
@ -241,9 +308,25 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
|||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
|
||||
7, // A0 PF7 ADC7
|
||||
6, // A1 PF6 ADC6
|
||||
5, // A2 PF5 ADC5
|
||||
|
|
@ -259,4 +342,46 @@ const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
|||
};
|
||||
|
||||
#endif /* ARDUINO_MAIN */
|
||||
|
||||
// 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 Serial
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
|
||||
// Alias SerialUSB to Serial
|
||||
#define SerialUSB SERIAL_PORT_USBVIRTUAL
|
||||
|
||||
// Bootloader related fields
|
||||
// Old Caterina bootloader places the MAGIC key into unsafe RAM locations (it can be rewritten
|
||||
// by the running sketch before to actual reboot).
|
||||
// Newer bootloaders, recognizable by the LUFA "signature" at the end of the flash, can handle both
|
||||
// the usafe and the safe location. Check once (in USBCore.cpp) if the bootloader in new, then set the global
|
||||
// _updatedLUFAbootloader variable to true/false and place the magic key consequently
|
||||
#ifndef MAGIC_KEY
|
||||
#define MAGIC_KEY 0x7777
|
||||
#endif
|
||||
|
||||
#ifndef MAGIC_KEY_POS
|
||||
#define MAGIC_KEY_POS 0x0800
|
||||
#endif
|
||||
|
||||
#ifndef NEW_LUFA_SIGNATURE
|
||||
#define NEW_LUFA_SIGNATURE 0xDCFB
|
||||
#endif
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
|
|
@ -27,15 +27,83 @@
|
|||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
// Workaround for wrong definitions in "iom32u4.h".
|
||||
// This should be fixed in the AVR toolchain.
|
||||
#undef UHCON
|
||||
#undef UHINT
|
||||
#undef UHIEN
|
||||
#undef UHADDR
|
||||
#undef UHFNUM
|
||||
#undef UHFNUML
|
||||
#undef UHFNUMH
|
||||
#undef UHFLEN
|
||||
#undef UPINRQX
|
||||
#undef UPINTX
|
||||
#undef UPNUM
|
||||
#undef UPRST
|
||||
#undef UPCONX
|
||||
#undef UPCFG0X
|
||||
#undef UPCFG1X
|
||||
#undef UPSTAX
|
||||
#undef UPCFG2X
|
||||
#undef UPIENX
|
||||
#undef UPDATX
|
||||
#undef TCCR2A
|
||||
#undef WGM20
|
||||
#undef WGM21
|
||||
#undef COM2B0
|
||||
#undef COM2B1
|
||||
#undef COM2A0
|
||||
#undef COM2A1
|
||||
#undef TCCR2B
|
||||
#undef CS20
|
||||
#undef CS21
|
||||
#undef CS22
|
||||
#undef WGM22
|
||||
#undef FOC2B
|
||||
#undef FOC2A
|
||||
#undef TCNT2
|
||||
#undef TCNT2_0
|
||||
#undef TCNT2_1
|
||||
#undef TCNT2_2
|
||||
#undef TCNT2_3
|
||||
#undef TCNT2_4
|
||||
#undef TCNT2_5
|
||||
#undef TCNT2_6
|
||||
#undef TCNT2_7
|
||||
#undef OCR2A
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
#undef OCR2B
|
||||
#undef OCR2_0
|
||||
#undef OCR2_1
|
||||
#undef OCR2_2
|
||||
#undef OCR2_3
|
||||
#undef OCR2_4
|
||||
#undef OCR2_5
|
||||
#undef OCR2_6
|
||||
#undef OCR2_7
|
||||
|
||||
#define NUM_DIGITAL_PINS 31
|
||||
#define NUM_ANALOG_INPUTS 12
|
||||
|
||||
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
|
||||
#define TXLED0 PORTD &= ~(1<<5)
|
||||
#define TXLED1 PORTD |= (1<<5)
|
||||
#define RXLED0 PORTB &= ~(1<<0)
|
||||
#define RXLED1 PORTB |= (1<<0)
|
||||
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0), TXLED0, RXLED0
|
||||
|
||||
static const uint8_t SDA = 2;
|
||||
static const uint8_t SCL = 3;
|
||||
#define LED_BUILTIN 13
|
||||
#define LED_BUILTIN_RX 17
|
||||
#define LED_BUILTIN_TX 30
|
||||
|
||||
// Map SPI port to 'new' pins D14..D17
|
||||
static const uint8_t SS = 17;
|
||||
|
|
@ -66,7 +134,9 @@ static const uint8_t A11 = 29; // D12
|
|||
// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
|
||||
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
||||
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
|
||||
|
||||
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 13)
|
||||
|
||||
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
|
||||
|
||||
#ifdef ARDUINO_MAIN
|
||||
|
|
@ -107,8 +177,8 @@ extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
|||
// MOSI D16 PB2 MOSI,PCINT2
|
||||
// SS D17 PB0 RXLED,SS/PCINT0
|
||||
//
|
||||
// TXLED PD5
|
||||
// RXLED PB0
|
||||
// TXLED D30 PD5 XCK1
|
||||
// RXLED D17 PB0
|
||||
// HWB PE2 HWB
|
||||
|
||||
// these arrays map port names (e.g. port B) to the
|
||||
|
|
@ -144,7 +214,7 @@ const uint16_t PROGMEM port_to_input_PGM[] = {
|
|||
(uint16_t) &PINF,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[30] = {
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
|
||||
PD, // D0 - PD2
|
||||
PD, // D1 - PD3
|
||||
PD, // D2 - PD1
|
||||
|
|
@ -153,35 +223,36 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[30] = {
|
|||
PC, // D5 - PC6
|
||||
PD, // D6 - PD7
|
||||
PE, // D7 - PE6
|
||||
|
||||
|
||||
PB, // D8 - PB4
|
||||
PB, // D9 - PB5
|
||||
PB, // D10 - PB6
|
||||
PB, // D11 - PB7
|
||||
PD, // D12 - PD6
|
||||
PC, // D13 - PC7
|
||||
|
||||
|
||||
PB, // D14 - MISO - PB3
|
||||
PB, // D15 - SCK - PB1
|
||||
PB, // D16 - MOSI - PB2
|
||||
PB, // D17 - SS - PB0
|
||||
|
||||
|
||||
PF, // D18 - A0 - PF7
|
||||
PF, // D19 - A1 - PF6
|
||||
PF, // D20 - A2 - PF5
|
||||
PF, // D21 - A3 - PF4
|
||||
PF, // D22 - A4 - PF1
|
||||
PF, // D23 - A5 - PF0
|
||||
|
||||
|
||||
PD, // D24 / D4 - A6 - PD4
|
||||
PD, // D25 / D6 - A7 - PD7
|
||||
PB, // D26 / D8 - A8 - PB4
|
||||
PB, // D27 / D9 - A9 - PB5
|
||||
PB, // D28 / D10 - A10 - PB6
|
||||
PD, // D29 / D12 - A11 - PD6
|
||||
PD, // D30 / TX Led - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = {
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
|
||||
_BV(2), // D0 - PD2
|
||||
_BV(3), // D1 - PD3
|
||||
_BV(1), // D2 - PD1
|
||||
|
|
@ -190,35 +261,36 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = {
|
|||
_BV(6), // D5 - PC6
|
||||
_BV(7), // D6 - PD7
|
||||
_BV(6), // D7 - PE6
|
||||
|
||||
|
||||
_BV(4), // D8 - PB4
|
||||
_BV(5), // D9 - PB5
|
||||
_BV(6), // D10 - PB6
|
||||
_BV(7), // D11 - PB7
|
||||
_BV(6), // D12 - PD6
|
||||
_BV(7), // D13 - PC7
|
||||
|
||||
|
||||
_BV(3), // D14 - MISO - PB3
|
||||
_BV(1), // D15 - SCK - PB1
|
||||
_BV(2), // D16 - MOSI - PB2
|
||||
_BV(0), // D17 - SS - PB0
|
||||
|
||||
|
||||
_BV(7), // D18 - A0 - PF7
|
||||
_BV(6), // D19 - A1 - PF6
|
||||
_BV(5), // D20 - A2 - PF5
|
||||
_BV(4), // D21 - A3 - PF4
|
||||
_BV(1), // D22 - A4 - PF1
|
||||
_BV(0), // D23 - A5 - PF0
|
||||
|
||||
|
||||
_BV(4), // D24 / D4 - A6 - PD4
|
||||
_BV(7), // D25 / D6 - A7 - PD7
|
||||
_BV(4), // D26 / D8 - A8 - PB4
|
||||
_BV(5), // D27 / D9 - A9 - PB5
|
||||
_BV(6), // D28 / D10 - A10 - PB6
|
||||
_BV(6), // D29 / D12 - A11 - PD6
|
||||
_BV(5), // D30 / TX Led - PD5
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
|
@ -238,9 +310,25 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
|
|||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
NOT_ON_TIMER,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
|
||||
7, // A0 PF7 ADC7
|
||||
6, // A1 PF6 ADC6
|
||||
5, // A2 PF5 ADC5
|
||||
|
|
@ -256,4 +344,46 @@ const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = {
|
|||
};
|
||||
|
||||
#endif /* ARDUINO_MAIN */
|
||||
|
||||
// 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 Serial
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
|
||||
// Alias SerialUSB to Serial
|
||||
#define SerialUSB SERIAL_PORT_USBVIRTUAL
|
||||
|
||||
// Bootloader related fields
|
||||
// Old Caterina bootloader places the MAGIC key into unsafe RAM locations (it can be rewritten
|
||||
// by the running sketch before to actual reboot).
|
||||
// Newer bootloaders, recognizable by the LUFA "signature" at the end of the flash, can handle both
|
||||
// the usafe and the safe location. Check once (in USBCore.cpp) if the bootloader in new, then set the global
|
||||
// _updatedLUFAbootloader variable to true/false and place the magic key consequently
|
||||
#ifndef MAGIC_KEY
|
||||
#define MAGIC_KEY 0x7777
|
||||
#endif
|
||||
|
||||
#ifndef MAGIC_KEY_POS
|
||||
#define MAGIC_KEY_POS 0x0800
|
||||
#endif
|
||||
|
||||
#ifndef NEW_LUFA_SIGNATURE
|
||||
#define NEW_LUFA_SIGNATURE 0xDCFB
|
||||
#endif
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
Loading…
Reference in a new issue