Обновление библиотек

This commit is contained in:
gunner47
2019-12-05 10:06:48 +02:00
parent 3ce7db0d97
commit c551a70a5b
205 changed files with 3731 additions and 2176 deletions

View File

@@ -3,8 +3,8 @@
#include "EepromManager.h" #include "EepromManager.h"
#include "Constants.h" #include "Constants.h"
#define DEFAULT_FAVORITES_INTERVAL (300U) // значение по умолчанию для интервала переключения избпранных эффектов в секундах #define DEFAULT_FAVORITES_INTERVAL (300U) // значение по умолчанию для интервала переключения избранных эффектов в секундах
#define DEFAULT_FAVORITES_DISPERSION (0U) // значение по умолчанию для разброса интервала переключения избпранных эффектов в секундах #define DEFAULT_FAVORITES_DISPERSION (0U) // значение по умолчанию для разброса интервала переключения избранных эффектов в секундах
class FavoritesManager class FavoritesManager

View File

@@ -0,0 +1,36 @@
#!/bin/bash
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
echo "Installing ESP32 Arduino Core ..."
script_init_path="$PWD"
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
cd "$ARDUINO_USR_PATH/hardware/espressif"
echo "Installing Python Serial ..."
pip install pyserial > /dev/null
if [ "$OS_IS_WINDOWS" == "1" ]; then
echo "Installing Python Requests ..."
pip install requests > /dev/null
fi
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
echo "Linking Core..."
ln -s $GITHUB_WORKSPACE esp32
else
echo "Cloning Core Repository..."
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
fi
echo "Updating Submodules ..."
cd esp32
git submodule update --init --recursive > /dev/null 2>&1
echo "Installing Platform Tools ..."
cd tools && python get.py
cd $script_init_path
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
echo ""
fi

View File

@@ -0,0 +1,220 @@
#!/bin/bash
#OSTYPE: 'linux-gnu', ARCH: 'x86_64' => linux64
#OSTYPE: 'msys', ARCH: 'x86_64' => win32
#OSTYPE: 'darwin18', ARCH: 'i386' => macos
OSBITS=`arch`
if [[ "$OSTYPE" == "linux"* ]]; then
export OS_IS_LINUX="1"
ARCHIVE_FORMAT="tar.xz"
if [[ "$OSBITS" == "i686" ]]; then
OS_NAME="linux32"
elif [[ "$OSBITS" == "x86_64" ]]; then
OS_NAME="linux64"
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
OS_NAME="linuxarm"
else
OS_NAME="$OSTYPE-$OSBITS"
echo "Unknown OS '$OS_NAME'"
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
export OS_IS_MACOS="1"
ARCHIVE_FORMAT="zip"
OS_NAME="macosx"
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
export OS_IS_WINDOWS="1"
ARCHIVE_FORMAT="zip"
OS_NAME="windows"
else
OS_NAME="$OSTYPE-$OSBITS"
echo "Unknown OS '$OS_NAME'"
exit 1
fi
export OS_NAME
ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
if [ "$OS_IS_MACOS" == "1" ]; then
export ARDUINO_IDE_PATH="/Applications/Arduino.app/Contents/Java"
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
elif [ "$OS_IS_WINDOWS" == "1" ]; then
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
else
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
export ARDUINO_USR_PATH="$HOME/Arduino"
fi
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
echo "Installing Arduino IDE on $OS_NAME ..."
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
if [ "$OS_IS_LINUX" == "1" ]; then
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
mv arduino-nightly "$ARDUINO_IDE_PATH"
else
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
if [ "$OS_IS_MACOS" == "1" ]; then
mv "Arduino.app" "/Applications/Arduino.app"
else
mv arduino-nightly "$ARDUINO_IDE_PATH"
fi
fi
rm -rf "arduino.$ARCHIVE_FORMAT"
mkdir -p "$ARDUINO_USR_PATH/libraries"
mkdir -p "$ARDUINO_USR_PATH/hardware"
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
echo ""
fi
function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_sketch <fqbn> <path-to-ino> [extra-options]"
return 1
fi
local fqbn="$1"
local sketch="$2"
local xtra_opts="$3"
local win_opts=""
if [ "$OS_IS_WINDOWS" == "1" ]; then
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
fi
echo ""
echo "Compiling '"$(basename "$sketch")"' ..."
mkdir -p "$ARDUINO_BUILD_DIR"
mkdir -p "$ARDUINO_CACHE_DIR"
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
-fqbn=$fqbn \
-warnings="all" \
-tools "$ARDUINO_IDE_PATH/tools-builder" \
-tools "$ARDUINO_IDE_PATH/tools" \
-built-in-libraries "$ARDUINO_IDE_PATH/libraries" \
-hardware "$ARDUINO_IDE_PATH/hardware" \
-hardware "$ARDUINO_USR_PATH/hardware" \
-libraries "$ARDUINO_USR_PATH/libraries" \
-build-cache "$ARDUINO_CACHE_DIR" \
-build-path "$ARDUINO_BUILD_DIR" \
$win_opts $xtra_opts "$sketch"
}
function count_sketches() # count_sketches <examples-path>
{
local examples="$1"
rm -rf sketches.txt
if [ ! -d "$examples" ]; then
touch sketches.txt
return 0
fi
local sketches=$(find $examples -name *.ino)
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
continue
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
return $sketchnum
}
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
{
local fqbn=$1
local examples=$2
local chunk_idex=$3
local chunks_num=$4
local xtra_opts=$5
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
return 1
fi
if [ "$#" -lt 4 ]; then
chunk_idex="0"
chunks_num="1"
xtra_opts=$3
fi
if [ "$chunks_num" -le 0 ]; then
echo "ERROR: Chunks count must be positive number"
return 1
fi
if [ "$chunk_idex" -ge "$chunks_num" ]; then
echo "ERROR: Chunk index must be less than chunks count"
return 1
fi
set +e
count_sketches "$examples"
local sketchcount=$?
set -e
local sketches=$(cat sketches.txt)
rm -rf sketches.txt
local chunk_size=$(( $sketchcount / $chunks_num ))
local all_chunks=$(( $chunks_num * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
local start_index=$(( $chunk_idex * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
local start_num=$(( $start_index + 1 ))
echo "Found $sketchcount Sketches";
echo "Chunk Count : $chunks_num"
echo "Chunk Size : $chunk_size"
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|| [ -f "$sketchdir/.test.skip" ]; then
continue
fi
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
build_sketch "$fqbn" "$sketch" "$xtra_opts"
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
done
return 0
}

View File

@@ -0,0 +1,133 @@
#!/bin/bash
echo "Installing Python Wheel ..."
pip install wheel > /dev/null 2>&1
echo "Installing PlatformIO ..."
pip install -U platformio > /dev/null 2>&1
echo "PlatformIO has been installed"
echo ""
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_pio_sketch <board> <path-to-ino>"
return 1
fi
local board="$1"
local sketch="$2"
local sketch_dir=$(dirname "$sketch")
echo ""
echo "Compiling '"$(basename "$sketch")"' ..."
python -m platformio ci -l '.' --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
}
function count_sketches() # count_sketches <examples-path>
{
local examples="$1"
rm -rf sketches.txt
if [ ! -d "$examples" ]; then
touch sketches.txt
return 0
fi
local sketches=$(find $examples -name *.ino)
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
continue
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
return $sketchnum
}
function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chunk> <total-chunks>
{
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_pio_sketches <board> <examples-path> [<chunk> <total-chunks>]"
return 1
fi
local board=$1
local examples=$2
local chunk_idex=$3
local chunks_num=$4
if [ "$#" -lt 4 ]; then
chunk_idex="0"
chunks_num="1"
fi
if [ "$chunks_num" -le 0 ]; then
echo "ERROR: Chunks count must be positive number"
return 1
fi
if [ "$chunk_idex" -ge "$chunks_num" ]; then
echo "ERROR: Chunk index must be less than chunks count"
return 1
fi
set +e
count_sketches "$examples"
local sketchcount=$?
set -e
local sketches=$(cat sketches.txt)
rm -rf sketches.txt
local chunk_size=$(( $sketchcount / $chunks_num ))
local all_chunks=$(( $chunks_num * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
local start_index=$(( $chunk_idex * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
local start_num=$(( $start_index + 1 ))
echo "Found $sketchcount Sketches";
echo "Chunk Count : $chunks_num"
echo "Chunk Size : $chunk_size"
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|| [ -f "$sketchdir/.test.skip" ]; then
continue
fi
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
build_pio_sketch "$board" "$sketch"
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
done
return 0
}

View File

@@ -0,0 +1,64 @@
#!/bin/bash
set -e
if [ ! -z "$TRAVIS_BUILD_DIR" ]; then
export GITHUB_WORKSPACE="$TRAVIS_BUILD_DIR"
export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG"
elif [ -z "$GITHUB_WORKSPACE" ]; then
export GITHUB_WORKSPACE="$PWD"
export GITHUB_REPOSITORY="me-no-dev/AsyncTCP"
fi
CHUNK_INDEX=$1
CHUNKS_CNT=$2
BUILD_PIO=0
if [ "$#" -lt 2 ] || [ "$CHUNKS_CNT" -le 0 ]; then
CHUNK_INDEX=0
CHUNKS_CNT=1
elif [ "$CHUNK_INDEX" -gt "$CHUNKS_CNT" ]; then
CHUNK_INDEX=$CHUNKS_CNT
elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
BUILD_PIO=1
fi
if [ "$BUILD_PIO" -eq 0 ]; then
# ArduinoIDE Test
source ./.github/scripts/install-arduino-ide.sh
source ./.github/scripts/install-arduino-core-esp32.sh
echo "Installing AsyncTCP ..."
cp -rf "$GITHUB_WORKSPACE" "$ARDUINO_USR_PATH/libraries/AsyncTCP"
FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
build_sketches "$FQBN" "$GITHUB_WORKSPACE/examples"
if [ ! "$OS_IS_WINDOWS" == "1" ]; then
echo "Installing ESPAsyncWebServer ..."
git clone https://github.com/me-no-dev/ESPAsyncWebServer "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer" > /dev/null 2>&1
echo "Installing ArduinoJson ..."
git clone https://github.com/bblanchon/ArduinoJson "$ARDUINO_USR_PATH/libraries/ArduinoJson" > /dev/null 2>&1
build_sketches "$FQBN" "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer/examples"
fi
else
# PlatformIO Test
source ./.github/scripts/install-platformio.sh
echo "Installing AsyncTCP ..."
python -m platformio lib --storage-dir "$GITHUB_WORKSPACE" install
BOARD="esp32dev"
build_pio_sketches "$BOARD" "$GITHUB_WORKSPACE/examples"
if [[ "$OSTYPE" != "cygwin" ]] && [[ "$OSTYPE" != "msys" ]] && [[ "$OSTYPE" != "win32" ]]; then
echo "Installing ESPAsyncWebServer ..."
python -m platformio lib -g install https://github.com/me-no-dev/ESPAsyncWebServer.git > /dev/null 2>&1
git clone https://github.com/me-no-dev/ESPAsyncWebServer "$HOME/ESPAsyncWebServer" > /dev/null 2>&1
echo "Installing ArduinoJson ..."
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git > /dev/null 2>&1
build_pio_sketches "$BOARD" "$HOME/ESPAsyncWebServer/examples"
fi
fi

31
libraries/AsyncTCP/.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
# Configuration for probot-stale - https://github.com/probot/stale
daysUntilStale: 60
daysUntilClose: 14
limitPerRun: 30
staleLabel: stale
exemptLabels:
- pinned
- security
- "to be implemented"
- "for reference"
- "move to PR"
- "enhancement"
only: issues
onlyLabels: []
exemptProjects: false
exemptMilestones: false
exemptAssignees: false
markComment: >
[STALE_SET] This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 14 days if no further activity occurs. Thank you
for your contributions.
unmarkComment: >
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
closeComment: >
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

View File

@@ -0,0 +1,32 @@
name: Async TCP CI
on:
push:
branches:
- master
- release/*
pull_request:
jobs:
build-arduino:
name: Arduino on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Build Tests
run: bash ./.github/scripts/on-push.sh 0 1
build-pio:
name: PlatformIO on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Build Tests
run: bash ./.github/scripts/on-push.sh 1 1

View File

@@ -15,12 +15,12 @@ jobs:
- name: "Arduino Build" - name: "Arduino Build"
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
stage: build stage: build
script: bash $TRAVIS_BUILD_DIR/travis/build.sh script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh
- name: "PlatformIO Build" - name: "PlatformIO Build"
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
stage: build stage: build
script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 1 1
notifications: notifications:
email: email:

View File

@@ -12,7 +12,7 @@
"type": "git", "type": "git",
"url": "https://github.com/me-no-dev/AsyncTCP.git" "url": "https://github.com/me-no-dev/AsyncTCP.git"
}, },
"version": "1.1.0", "version": "1.1.1",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"frameworks": "arduino", "frameworks": "arduino",
"platforms": "espressif32", "platforms": "espressif32",

View File

@@ -1,5 +1,5 @@
name=AsyncTCP name=AsyncTCP
version=1.1.0 version=1.1.1
author=Me-No-Dev author=Me-No-Dev
maintainer=Me-No-Dev maintainer=Me-No-Dev
sentence=Async TCP Library for ESP32 sentence=Async TCP Library for ESP32

View File

@@ -78,9 +78,20 @@ typedef struct {
static xQueueHandle _async_queue; static xQueueHandle _async_queue;
static TaskHandle_t _async_service_task_handle = NULL; static TaskHandle_t _async_service_task_handle = NULL;
SemaphoreHandle_t _slots_lock;
const int _number_of_closed_slots = CONFIG_LWIP_MAX_ACTIVE_TCP; const int _number_of_closed_slots = CONFIG_LWIP_MAX_ACTIVE_TCP;
static int _closed_index = 0; static uint32_t _closed_slots[_number_of_closed_slots];
static int _closed_slots[_number_of_closed_slots]; static uint32_t _closed_index = []() {
_slots_lock = xSemaphoreCreateBinary();
xSemaphoreGive(_slots_lock);
for (int i = 0; i < _number_of_closed_slots; ++ i) {
_closed_slots[i] = 1;
}
return 1;
}();
static inline bool _init_async_event_queue(){ static inline bool _init_async_event_queue(){
if(!_async_queue){ if(!_async_queue){
@@ -141,7 +152,10 @@ static bool _remove_events_with_arg(void * arg){
} }
static void _handle_async_event(lwip_event_packet_t * e){ static void _handle_async_event(lwip_event_packet_t * e){
if(e->event == LWIP_TCP_CLEAR){ if(e->arg == NULL){
// do nothing when arg is NULL
//ets_printf("event arg == NULL: 0x%08x\n", e->recv.pcb);
} else if(e->event == LWIP_TCP_CLEAR){
_remove_events_with_arg(e->arg); _remove_events_with_arg(e->arg);
} else if(e->event == LWIP_TCP_RECV){ } else if(e->event == LWIP_TCP_RECV){
//ets_printf("-R: 0x%08x\n", e->recv.pcb); //ets_printf("-R: 0x%08x\n", e->recv.pcb);
@@ -554,23 +568,7 @@ AsyncClient::AsyncClient(tcp_pcb* pcb)
_pcb = pcb; _pcb = pcb;
_closed_slot = -1; _closed_slot = -1;
if(_pcb){ if(_pcb){
_closed_slot = 0; _allocate_closed_slot();
if (_closed_index == 0) {
_closed_index = 1;
for (int i = 0; i < _number_of_closed_slots; ++ i) {
_closed_slots[i] = 1;
}
} else {
int closed_slot_min_index = _closed_slots[0];
for (int i = 0; i < _number_of_closed_slots; ++ i) {
if (_closed_slots[i] <= closed_slot_min_index && _closed_slots[i] != 0) {
closed_slot_min_index = _closed_slots[i];
_closed_slot = i;
}
}
}
_closed_slots[_closed_slot] = 0;
_rx_last_packet = millis(); _rx_last_packet = millis();
tcp_arg(_pcb, this); tcp_arg(_pcb, this);
tcp_recv(_pcb, &_tcp_recv); tcp_recv(_pcb, &_tcp_recv);
@@ -584,6 +582,7 @@ AsyncClient::~AsyncClient(){
if(_pcb) { if(_pcb) {
_close(); _close();
} }
_free_closed_slot();
} }
/* /*
@@ -709,7 +708,6 @@ bool AsyncClient::connect(const char* host, uint16_t port){
ip_addr_t addr; ip_addr_t addr;
if(!_start_async_task()){ if(!_start_async_task()){
Serial.println("failed to start task");
log_e("failed to start task"); log_e("failed to start task");
return false; return false;
} }
@@ -820,6 +818,29 @@ int8_t AsyncClient::_close(){
return err; return err;
} }
void AsyncClient::_allocate_closed_slot(){
xSemaphoreTake(_slots_lock, portMAX_DELAY);
uint32_t closed_slot_min_index = 0;
for (int i = 0; i < _number_of_closed_slots; ++ i) {
if ((_closed_slot == -1 || _closed_slots[i] <= closed_slot_min_index) && _closed_slots[i] != 0) {
closed_slot_min_index = _closed_slots[i];
_closed_slot = i;
}
}
if (_closed_slot != -1) {
_closed_slots[_closed_slot] = 0;
}
xSemaphoreGive(_slots_lock);
}
void AsyncClient::_free_closed_slot(){
if (_closed_slot != -1) {
_closed_slots[_closed_slot] = _closed_index;
_closed_slot = -1;
++ _closed_index;
}
}
/* /*
* Private Callbacks * Private Callbacks
* */ * */
@@ -842,10 +863,12 @@ int8_t AsyncClient::_connected(void* pcb, int8_t err){
void AsyncClient::_error(int8_t err) { void AsyncClient::_error(int8_t err) {
if(_pcb){ if(_pcb){
tcp_arg(_pcb, NULL); tcp_arg(_pcb, NULL);
tcp_sent(_pcb, NULL); if(_pcb->state == LISTEN) {
tcp_recv(_pcb, NULL); tcp_sent(_pcb, NULL);
tcp_err(_pcb, NULL); tcp_recv(_pcb, NULL);
tcp_poll(_pcb, NULL, 0); tcp_err(_pcb, NULL);
tcp_poll(_pcb, NULL, 0);
}
_pcb = NULL; _pcb = NULL;
} }
if(_error_cb) { if(_error_cb) {
@@ -863,15 +886,16 @@ int8_t AsyncClient::_lwip_fin(tcp_pcb* pcb, int8_t err) {
return ERR_OK; return ERR_OK;
} }
tcp_arg(_pcb, NULL); tcp_arg(_pcb, NULL);
tcp_sent(_pcb, NULL); if(_pcb->state == LISTEN) {
tcp_recv(_pcb, NULL); tcp_sent(_pcb, NULL);
tcp_err(_pcb, NULL); tcp_recv(_pcb, NULL);
tcp_poll(_pcb, NULL, 0); tcp_err(_pcb, NULL);
tcp_poll(_pcb, NULL, 0);
}
if(tcp_close(_pcb) != ERR_OK) { if(tcp_close(_pcb) != ERR_OK) {
tcp_abort(_pcb); tcp_abort(_pcb);
} }
_closed_slots[_closed_slot] = _closed_index; _free_closed_slot();
++ _closed_index;
_pcb = NULL; _pcb = NULL;
return ERR_OK; return ERR_OK;
} }

View File

@@ -170,6 +170,8 @@ class AsyncClient {
uint16_t _connect_port; uint16_t _connect_port;
int8_t _close(); int8_t _close();
void _free_closed_slot();
void _allocate_closed_slot();
int8_t _connected(void* pcb, int8_t err); int8_t _connected(void* pcb, int8_t err);
void _error(int8_t err); void _error(int8_t err);
int8_t _poll(tcp_pcb* pcb); int8_t _poll(tcp_pcb* pcb);

View File

@@ -1,40 +0,0 @@
#!/bin/bash
echo -e "travis_fold:start:install_pio"
pip install -U platformio
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_pio"
echo -e "travis_fold:start:install_lib"
python -m platformio lib --storage-dir $TRAVIS_BUILD_DIR install
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_lib"
echo -e "travis_fold:start:test_pio"
if [ -d "$TRAVIS_BUILD_DIR/examples" ]; then
for EXAMPLE in $TRAVIS_BUILD_DIR/examples/*/*.ino; do
python -m platformio ci $EXAMPLE -l '.' -b esp32dev
if [ $? -ne 0 ]; then exit 1; fi
done
fi
echo -e "travis_fold:end:test_pio"
echo -e "travis_fold:start:install_json"
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_json"
cd $HOME/
echo -e "travis_fold:start:install_web_server"
git clone https://github.com/me-no-dev/ESPAsyncWebServer
if [ $? -ne 0 ]; then exit 1; fi
python -m platformio lib --storage-dir $HOME/ESPAsyncWebServer install
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_web_server"
echo -e "travis_fold:start:test_web_server"
for EXAMPLE in $HOME/ESPAsyncWebServer/examples/*/*.ino; do
python -m platformio ci $EXAMPLE -l $TRAVIS_BUILD_DIR -l $HOME/ESPAsyncWebServer -b esp32dev
if [ $? -ne 0 ]; then exit 1; fi
done
echo -e "travis_fold:end:test_web_server"

View File

@@ -1,207 +0,0 @@
#!/bin/bash
CHUNK_INDEX=$1
CHUNKS_CNT=$2
if [ "$#" -lt 2 ]; then
echo "Building all sketches"
CHUNK_INDEX=0
CHUNKS_CNT=1
fi
if [ "$CHUNKS_CNT" -le 0 ]; then
echo "Chunks count must be positive number"
exit 1
fi
if [ "$CHUNK_INDEX" -ge "$CHUNKS_CNT" ]; then
echo "Chunk index must be less than chunks count"
exit 1
fi
echo -e "travis_fold:start:prep_arduino_ide"
# Install Arduino IDE
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
tar xf arduino.tar.xz
mv arduino-nightly $HOME/arduino_ide
mkdir -p $HOME/Arduino/libraries
mkdir -p $HOME/Arduino/hardware
echo -e "travis_fold:end:prep_arduino_ide"
echo -e "travis_fold:start:sketch_test_env_prepare"
cd $HOME/Arduino/libraries
cp -rf $TRAVIS_BUILD_DIR AsyncTCP
PLATFORM_EXAMPLES=$TRAVIS_BUILD_DIR/examples
git clone https://github.com/me-no-dev/ESPAsyncWebServer
git clone https://github.com/bblanchon/ArduinoJson
LIB_EXAMPLES=$HOME/Arduino/libraries/ESPAsyncWebServer/examples
cd $HOME/Arduino/hardware
pip install pyserial
mkdir espressif
cd espressif
git clone https://github.com/espressif/arduino-esp32.git esp32
cd esp32
git submodule update --init --recursive
cd tools
python get.py
PLATFORM_FQBN="espressif:esp32:esp32"
PLATFORM_SIZE_BIN=$HOME/Arduino/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-size
echo -e "travis_fold:end:sketch_test_env_prepare"
cd $TRAVIS_BUILD_DIR
ARDUINO_IDE_PATH=$HOME/arduino_ide
ARDUINO_USR_PATH=$HOME/Arduino
ARDUINO_BUILD_DIR=$HOME/build.tmp
ARDUINO_CACHE_DIR=$HOME/cache.tmp
ARDUINO_BUILD_CMD="$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 -hardware \"$ARDUINO_IDE_PATH/hardware\" -hardware \"$ARDUINO_USR_PATH/hardware\" -tools \"$ARDUINO_IDE_PATH/tools-builder\" -built-in-libraries \"$ARDUINO_IDE_PATH/libraries\" -libraries \"$ARDUINO_USR_PATH/libraries\" -fqbn=$PLATFORM_FQBN -warnings=\"all\" -build-cache \"$ARDUINO_CACHE_DIR\" -build-path \"$ARDUINO_BUILD_DIR\" -verbose"
function print_size_info()
{
elf_file=$1
if [ -z "$elf_file" ]; then
printf "sketch iram0.text flash.text flash.rodata dram0.data dram0.bss dram flash\n"
return 0
fi
elf_name=$(basename $elf_file)
sketch_name="${elf_name%.*}"
declare -A segments
while read -a tokens; do
seg=${tokens[0]}
seg=${seg//./}
size=${tokens[1]}
addr=${tokens[2]}
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
segments[$seg]=$size
fi
done < <($PLATFORM_SIZE_BIN --format=sysv $elf_file)
total_ram=$((${segments[dram0data]} + ${segments[dram0bss]}))
total_flash=$((${segments[iram0text]} + ${segments[flashtext]} + ${segments[dram0data]} + ${segments[flashrodata]}))
printf "%-32s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[iram0text]} ${segments[flashtext]} ${segments[flashrodata]} ${segments[dram0data]} ${segments[dram0bss]} $total_ram $total_flash
return 0
}
function build_sketch()
{
local sketch=$1
echo -e "\n------------ Building $sketch ------------\n";
rm -rf $ARDUINO_BUILD_DIR/*
time ($ARDUINO_BUILD_CMD $sketch >build.log)
local result=$?
if [ $result -ne 0 ]; then
echo "Build failed ($1)"
echo "Build log:"
cat build.log
return $result
fi
rm build.log
return 0
}
function count_sketches()
{
local path=$1
if [ ! -d "$path" ]; then
return 0
fi
local sketches=$(find $path -name *.ino)
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
return $sketchnum
}
function build_sketches()
{
mkdir -p $ARDUINO_BUILD_DIR
mkdir -p $ARDUINO_CACHE_DIR
mkdir -p $ARDUINO_USR_PATH/libraries
mkdir -p $ARDUINO_USR_PATH/hardware
local chunk_idex=$1
local chunks_num=$2
rm -rf sketches.txt
count_sketches $PLATFORM_EXAMPLES
local sketchcount=$?
count_sketches $LIB_EXAMPLES
local libsketchcount=$?
sketchcount=$(($sketchcount + $libsketchcount))
local sketches=$(cat sketches.txt)
local chunk_size=$(( $sketchcount / $chunks_num ))
local all_chunks=$(( $chunks_num * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
local start_index=$(( $chunk_idex * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
local start_num=$(( $start_index + 1 ))
#echo -e "Sketches: \n$sketches\n"
echo "Found $sketchcount Sketches";
echo "Chunk Count : $chunks_num"
echo "Chunk Size : $chunk_size"
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
local sketchnum=0
print_size_info >size.log
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
#echo "Skipping $sketch, beacause it is not the main sketch file";
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
#echo "Skipping $sketch marked";
continue
fi
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ]; then
#echo "Skipping $sketch index low"
continue
fi
if [ "$sketchnum" -gt "$end_index" ]; then
#echo "Skipping $sketch index high"
continue
fi
build_sketch $sketch
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
print_size_info $ARDUINO_BUILD_DIR/*.elf >>size.log
done
return 0
}
echo -e "travis_fold:start:test_arduino_ide"
# Build Examples
build_sketches $CHUNK_INDEX $CHUNKS_CNT
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:test_arduino_ide"
echo -e "travis_fold:start:size_report"
cat size.log
echo -e "travis_fold:end:size_report"

View File

@@ -0,0 +1,29 @@
#!/bin/bash
echo "Installing ESP8266 Arduino Core ..."
script_init_path="$PWD"
mkdir -p "$ARDUINO_USR_PATH/hardware/esp8266com"
cd "$ARDUINO_USR_PATH/hardware/esp8266com"
echo "Installing Python Serial ..."
pip install pyserial > /dev/null
if [ "$OS_IS_WINDOWS" == "1" ]; then
echo "Installing Python Requests ..."
pip install requests > /dev/null
fi
echo "Cloning Core Repository ..."
git clone https://github.com/esp8266/Arduino.git esp8266 > /dev/null 2>&1
echo "Updating submodules ..."
cd esp8266
git submodule update --init --recursive > /dev/null 2>&1
echo "Installing Platform Tools ..."
cd tools
python get.py > /dev/null
cd $script_init_path
echo "ESP8266 Arduino has been installed in '$ARDUINO_USR_PATH/hardware/esp8266com'"
echo ""

View File

@@ -0,0 +1,220 @@
#!/bin/bash
#OSTYPE: 'linux-gnu', ARCH: 'x86_64' => linux64
#OSTYPE: 'msys', ARCH: 'x86_64' => win32
#OSTYPE: 'darwin18', ARCH: 'i386' => macos
OSBITS=`arch`
if [[ "$OSTYPE" == "linux"* ]]; then
export OS_IS_LINUX="1"
ARCHIVE_FORMAT="tar.xz"
if [[ "$OSBITS" == "i686" ]]; then
OS_NAME="linux32"
elif [[ "$OSBITS" == "x86_64" ]]; then
OS_NAME="linux64"
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
OS_NAME="linuxarm"
else
OS_NAME="$OSTYPE-$OSBITS"
echo "Unknown OS '$OS_NAME'"
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
export OS_IS_MACOS="1"
ARCHIVE_FORMAT="zip"
OS_NAME="macosx"
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
export OS_IS_WINDOWS="1"
ARCHIVE_FORMAT="zip"
OS_NAME="windows"
else
OS_NAME="$OSTYPE-$OSBITS"
echo "Unknown OS '$OS_NAME'"
exit 1
fi
export OS_NAME
ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
if [ "$OS_IS_MACOS" == "1" ]; then
export ARDUINO_IDE_PATH="/Applications/Arduino.app/Contents/Java"
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
elif [ "$OS_IS_WINDOWS" == "1" ]; then
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
else
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
export ARDUINO_USR_PATH="$HOME/Arduino"
fi
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
echo "Installing Arduino IDE on $OS_NAME ..."
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
if [ "$OS_IS_LINUX" == "1" ]; then
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
mv arduino-nightly "$ARDUINO_IDE_PATH"
else
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
if [ "$OS_IS_MACOS" == "1" ]; then
mv "Arduino.app" "/Applications/Arduino.app"
else
mv arduino-nightly "$ARDUINO_IDE_PATH"
fi
fi
rm -rf "arduino.$ARCHIVE_FORMAT"
mkdir -p "$ARDUINO_USR_PATH/libraries"
mkdir -p "$ARDUINO_USR_PATH/hardware"
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
echo ""
fi
function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_sketch <fqbn> <path-to-ino> [extra-options]"
return 1
fi
local fqbn="$1"
local sketch="$2"
local xtra_opts="$3"
local win_opts=""
if [ "$OS_IS_WINDOWS" == "1" ]; then
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
fi
echo ""
echo "Compiling '"$(basename "$sketch")"' ..."
mkdir -p "$ARDUINO_BUILD_DIR"
mkdir -p "$ARDUINO_CACHE_DIR"
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
-fqbn=$fqbn \
-warnings="all" \
-tools "$ARDUINO_IDE_PATH/tools-builder" \
-tools "$ARDUINO_IDE_PATH/tools" \
-built-in-libraries "$ARDUINO_IDE_PATH/libraries" \
-hardware "$ARDUINO_IDE_PATH/hardware" \
-hardware "$ARDUINO_USR_PATH/hardware" \
-libraries "$ARDUINO_USR_PATH/libraries" \
-build-cache "$ARDUINO_CACHE_DIR" \
-build-path "$ARDUINO_BUILD_DIR" \
$win_opts $xtra_opts "$sketch"
}
function count_sketches() # count_sketches <examples-path>
{
local examples="$1"
rm -rf sketches.txt
if [ ! -d "$examples" ]; then
touch sketches.txt
return 0
fi
local sketches=$(find $examples -name *.ino)
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
continue
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
return $sketchnum
}
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
{
local fqbn=$1
local examples=$2
local chunk_idex=$3
local chunks_num=$4
local xtra_opts=$5
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
return 1
fi
if [ "$#" -lt 4 ]; then
chunk_idex="0"
chunks_num="1"
xtra_opts=$3
fi
if [ "$chunks_num" -le 0 ]; then
echo "ERROR: Chunks count must be positive number"
return 1
fi
if [ "$chunk_idex" -ge "$chunks_num" ]; then
echo "ERROR: Chunk index must be less than chunks count"
return 1
fi
set +e
count_sketches "$examples"
local sketchcount=$?
set -e
local sketches=$(cat sketches.txt)
rm -rf sketches.txt
local chunk_size=$(( $sketchcount / $chunks_num ))
local all_chunks=$(( $chunks_num * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
local start_index=$(( $chunk_idex * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
local start_num=$(( $start_index + 1 ))
echo "Found $sketchcount Sketches";
echo "Chunk Count : $chunks_num"
echo "Chunk Size : $chunk_size"
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|| [ -f "$sketchdir/.test.skip" ]; then
continue
fi
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
build_sketch "$fqbn" "$sketch" "$xtra_opts"
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
done
return 0
}

View File

@@ -0,0 +1,133 @@
#!/bin/bash
echo "Installing Python Wheel ..."
pip install wheel > /dev/null 2>&1
echo "Installing PlatformIO ..."
pip install -U platformio > /dev/null 2>&1
echo "PlatformIO has been installed"
echo ""
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_pio_sketch <board> <path-to-ino>"
return 1
fi
local board="$1"
local sketch="$2"
local sketch_dir=$(dirname "$sketch")
echo ""
echo "Compiling '"$(basename "$sketch")"' ..."
python -m platformio ci -l '.' --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
}
function count_sketches() # count_sketches <examples-path>
{
local examples="$1"
rm -rf sketches.txt
if [ ! -d "$examples" ]; then
touch sketches.txt
return 0
fi
local sketches=$(find $examples -name *.ino)
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
continue
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
return $sketchnum
}
function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chunk> <total-chunks>
{
if [ "$#" -lt 2 ]; then
echo "ERROR: Illegal number of parameters"
echo "USAGE: build_pio_sketches <board> <examples-path> [<chunk> <total-chunks>]"
return 1
fi
local board=$1
local examples=$2
local chunk_idex=$3
local chunks_num=$4
if [ "$#" -lt 4 ]; then
chunk_idex="0"
chunks_num="1"
fi
if [ "$chunks_num" -le 0 ]; then
echo "ERROR: Chunks count must be positive number"
return 1
fi
if [ "$chunk_idex" -ge "$chunks_num" ]; then
echo "ERROR: Chunk index must be less than chunks count"
return 1
fi
set +e
count_sketches "$examples"
local sketchcount=$?
set -e
local sketches=$(cat sketches.txt)
rm -rf sketches.txt
local chunk_size=$(( $sketchcount / $chunks_num ))
local all_chunks=$(( $chunks_num * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
local start_index=$(( $chunk_idex * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
local start_num=$(( $start_index + 1 ))
echo "Found $sketchcount Sketches";
echo "Chunk Count : $chunks_num"
echo "Chunk Size : $chunk_size"
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|| [ -f "$sketchdir/.test.skip" ]; then
continue
fi
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
continue
fi
build_pio_sketch "$board" "$sketch"
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
done
return 0
}

View File

@@ -0,0 +1,64 @@
#!/bin/bash
set -e
if [ ! -z "$TRAVIS_BUILD_DIR" ]; then
export GITHUB_WORKSPACE="$TRAVIS_BUILD_DIR"
export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG"
elif [ -z "$GITHUB_WORKSPACE" ]; then
export GITHUB_WORKSPACE="$PWD"
export GITHUB_REPOSITORY="me-no-dev/ESPAsyncTCP"
fi
CHUNK_INDEX=$1
CHUNKS_CNT=$2
BUILD_PIO=0
if [ "$#" -lt 2 ] || [ "$CHUNKS_CNT" -le 0 ]; then
CHUNK_INDEX=0
CHUNKS_CNT=1
elif [ "$CHUNK_INDEX" -gt "$CHUNKS_CNT" ]; then
CHUNK_INDEX=$CHUNKS_CNT
elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
BUILD_PIO=1
fi
if [ "$BUILD_PIO" -eq 0 ]; then
# ArduinoIDE Test
source ./.github/scripts/install-arduino-ide.sh
source ./.github/scripts/install-arduino-core-esp8266.sh
echo "Installing ESPAsyncTCP ..."
cp -rf "$GITHUB_WORKSPACE" "$ARDUINO_USR_PATH/libraries/ESPAsyncTCP"
FQBN="esp8266com:esp8266:generic:eesz=4M1M,ip=lm2f"
build_sketches "$FQBN" "$GITHUB_WORKSPACE/examples"
if [ ! "$OS_IS_WINDOWS" == "1" ]; then
echo "Installing ESPAsyncWebServer ..."
git clone https://github.com/me-no-dev/ESPAsyncWebServer "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer" > /dev/null 2>&1
echo "Installing ArduinoJson ..."
git clone https://github.com/bblanchon/ArduinoJson "$ARDUINO_USR_PATH/libraries/ArduinoJson" > /dev/null 2>&1
build_sketches "$FQBN" "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer/examples"
fi
else
# PlatformIO Test
source ./.github/scripts/install-platformio.sh
echo "Installing ESPAsyncTCP ..."
python -m platformio lib --storage-dir "$GITHUB_WORKSPACE" install
BOARD="esp12e"
build_pio_sketches "$BOARD" "$GITHUB_WORKSPACE/examples"
if [[ "$OSTYPE" != "cygwin" ]] && [[ "$OSTYPE" != "msys" ]] && [[ "$OSTYPE" != "win32" ]]; then
echo "Installing ESPAsyncWebServer ..."
python -m platformio lib -g install https://github.com/me-no-dev/ESPAsyncWebServer.git > /dev/null 2>&1
git clone https://github.com/me-no-dev/ESPAsyncWebServer "$HOME/ESPAsyncWebServer" > /dev/null 2>&1
echo "Installing ArduinoJson ..."
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git > /dev/null 2>&1
build_pio_sketches "$BOARD" "$HOME/ESPAsyncWebServer/examples"
fi
fi

31
libraries/ESPAsyncTCP/.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
# Configuration for probot-stale - https://github.com/probot/stale
daysUntilStale: 60
daysUntilClose: 14
limitPerRun: 30
staleLabel: stale
exemptLabels:
- pinned
- security
- "to be implemented"
- "for reference"
- "move to PR"
- "enhancement"
only: issues
onlyLabels: []
exemptProjects: false
exemptMilestones: false
exemptAssignees: false
markComment: >
[STALE_SET] This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 14 days if no further activity occurs. Thank you
for your contributions.
unmarkComment: >
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
closeComment: >
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

View File

@@ -0,0 +1,32 @@
name: ESP Async TCP CI
on:
push:
branches:
- master
- release/*
pull_request:
jobs:
build-arduino:
name: Arduino on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Build Tests
run: bash ./.github/scripts/on-push.sh 0 1
build-pio:
name: PlatformIO on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Build Tests
run: bash ./.github/scripts/on-push.sh 1 1

View File

@@ -15,12 +15,12 @@ jobs:
- name: "Arduino Build" - name: "Arduino Build"
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
stage: build stage: build
script: bash $TRAVIS_BUILD_DIR/travis/build.sh script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh
- name: "PlatformIO Build" - name: "PlatformIO Build"
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
stage: build stage: build
script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 1 1
notifications: notifications:
email: email:

View File

@@ -12,7 +12,7 @@
"type": "git", "type": "git",
"url": "https://github.com/me-no-dev/ESPAsyncTCP.git" "url": "https://github.com/me-no-dev/ESPAsyncTCP.git"
}, },
"version": "1.2.1", "version": "1.2.2",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"frameworks": "arduino", "frameworks": "arduino",
"platforms": "espressif8266", "platforms": "espressif8266",

View File

@@ -1,5 +1,5 @@
name=ESP AsyncTCP name=ESP AsyncTCP
version=1.2.1 version=1.2.2
author=Me-No-Dev author=Me-No-Dev
maintainer=Me-No-Dev maintainer=Me-No-Dev
sentence=Async TCP Library for ESP8266 and ESP31B sentence=Async TCP Library for ESP8266 and ESP31B

View File

@@ -1,38 +0,0 @@
#!/bin/bash
echo -e "travis_fold:start:install_pio"
pip install -U platformio
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_pio"
echo -e "travis_fold:start:install_lib"
python -m platformio lib --storage-dir $TRAVIS_BUILD_DIR install
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_lib"
echo -e "travis_fold:start:test_pio"
for EXAMPLE in $TRAVIS_BUILD_DIR/examples/*/*.ino; do
python -m platformio ci $EXAMPLE -l '.' -b esp12e
if [ $? -ne 0 ]; then exit 1; fi
done
echo -e "travis_fold:end:test_pio"
echo -e "travis_fold:start:install_json"
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_json"
cd $HOME/
echo -e "travis_fold:start:install_web_server"
git clone https://github.com/me-no-dev/ESPAsyncWebServer
if [ $? -ne 0 ]; then exit 1; fi
python -m platformio lib --storage-dir $HOME/ESPAsyncWebServer install
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_web_server"
echo -e "travis_fold:start:test_web_server"
for EXAMPLE in $HOME/ESPAsyncWebServer/examples/*/*.ino; do
python -m platformio ci $EXAMPLE -l $TRAVIS_BUILD_DIR -l $HOME/ESPAsyncWebServer -b esp12e
if [ $? -ne 0 ]; then exit 1; fi
done
echo -e "travis_fold:end:test_web_server"

View File

@@ -1,204 +0,0 @@
#!/bin/bash
CHUNK_INDEX=$1
CHUNKS_CNT=$2
if [ "$#" -lt 2 ]; then
echo "Building all sketches"
CHUNK_INDEX=0
CHUNKS_CNT=1
fi
if [ "$CHUNKS_CNT" -le 0 ]; then
echo "Chunks count must be positive number"
exit 1
fi
if [ "$CHUNK_INDEX" -ge "$CHUNKS_CNT" ]; then
echo "Chunk index must be less than chunks count"
exit 1
fi
echo -e "travis_fold:start:prep_arduino_ide"
# Install Arduino IDE
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
tar xf arduino.tar.xz
mv arduino-nightly $HOME/arduino_ide
mkdir -p $HOME/Arduino/libraries
mkdir -p $HOME/Arduino/hardware
echo -e "travis_fold:end:prep_arduino_ide"
echo -e "travis_fold:start:sketch_test_env_prepare"
cd $HOME/Arduino/libraries
cp -rf $TRAVIS_BUILD_DIR ESPAsyncTCP
PLATFORM_EXAMPLES=$TRAVIS_BUILD_DIR/examples
cd $HOME/Arduino/libraries
git clone https://github.com/me-no-dev/ESPAsyncWebServer
git clone https://github.com/bblanchon/ArduinoJson
LIB_EXAMPLES=$HOME/Arduino/libraries/ESPAsyncWebServer/examples
cd $HOME/Arduino/hardware
mkdir esp8266com
cd esp8266com
git clone https://github.com/esp8266/Arduino.git esp8266
cd esp8266
git submodule update --init --recursive
cd tools
python get.py
PLATFORM_FQBN="esp8266com:esp8266:generic:xtal=80,FlashFreq=40,FlashMode=qio,baud=921600,eesz=4M1M,ip=lm2f,ResetMethod=nodemcu"
PLATFORM_SIZE_BIN=$HOME/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-size
echo -e "travis_fold:end:sketch_test_env_prepare"
cd $TRAVIS_BUILD_DIR
ARDUINO_IDE_PATH=$HOME/arduino_ide
ARDUINO_USR_PATH=$HOME/Arduino
ARDUINO_BUILD_DIR=$HOME/build.tmp
ARDUINO_CACHE_DIR=$HOME/cache.tmp
ARDUINO_BUILD_CMD="$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 -hardware \"$ARDUINO_IDE_PATH/hardware\" -hardware \"$ARDUINO_USR_PATH/hardware\" -tools \"$ARDUINO_IDE_PATH/tools-builder\" -built-in-libraries \"$ARDUINO_IDE_PATH/libraries\" -libraries \"$ARDUINO_USR_PATH/libraries\" -fqbn=$PLATFORM_FQBN -warnings=\"all\" -build-cache \"$ARDUINO_CACHE_DIR\" -build-path \"$ARDUINO_BUILD_DIR\" -verbose"
function print_size_info()
{
elf_file=$1
if [ -z "$elf_file" ]; then
printf "sketch data rodata bss text irom0.text dram flash\n"
return 0
fi
elf_name=$(basename $elf_file)
sketch_name="${elf_name%.*}"
declare -A segments
while read -a tokens; do
seg=${tokens[0]}
seg=${seg//./}
size=${tokens[1]}
addr=${tokens[2]}
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
segments[$seg]=$size
fi
done < <($PLATFORM_SIZE_BIN --format=sysv $elf_file)
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]}))
printf "%-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[data]} ${segments[rodata]} ${segments[bss]} ${segments[text]} ${segments[irom0text]} $total_ram $total_flash
return 0
}
function build_sketch()
{
local sketch=$1
echo -e "\n------------ Building $sketch ------------\n";
rm -rf $ARDUINO_BUILD_DIR/*
time ($ARDUINO_BUILD_CMD $sketch >build.log)
local result=$?
if [ $result -ne 0 ]; then
echo "Build failed ($1)"
echo "Build log:"
cat build.log
return $result
fi
rm build.log
return 0
}
function count_sketches()
{
local path=$1
local sketches=$(find $path -name *.ino)
local sketchnum=0
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
return $sketchnum
}
function build_sketches()
{
mkdir -p $ARDUINO_BUILD_DIR
mkdir -p $ARDUINO_CACHE_DIR
mkdir -p $ARDUINO_USR_PATH/libraries
mkdir -p $ARDUINO_USR_PATH/hardware
local chunk_idex=$1
local chunks_num=$2
rm -rf sketches.txt
count_sketches $PLATFORM_EXAMPLES
local sketchcount=$?
count_sketches $LIB_EXAMPLES
local libsketchcount=$?
sketchcount=$(($sketchcount + $libsketchcount))
local sketches=$(cat sketches.txt)
local chunk_size=$(( $sketchcount / $chunks_num ))
local all_chunks=$(( $chunks_num * $chunk_size ))
if [ "$all_chunks" -lt "$sketchcount" ]; then
chunk_size=$(( $chunk_size + 1 ))
fi
local start_index=$(( $chunk_idex * $chunk_size ))
if [ "$sketchcount" -le "$start_index" ]; then
echo "Skipping job"
return 0
fi
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
if [ "$end_index" -gt "$sketchcount" ]; then
end_index=$sketchcount
fi
local start_num=$(( $start_index + 1 ))
#echo -e "Sketches: \n$sketches\n"
echo "Found $sketchcount Sketches";
echo "Chunk Count : $chunks_num"
echo "Chunk Size : $chunk_size"
echo "Start Sketch: $start_num"
echo "End Sketch : $end_index"
local sketchnum=0
print_size_info >size.log
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
#echo "Skipping $sketch, beacause it is not the main sketch file";
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
#echo "Skipping $sketch marked";
continue
fi
sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ]; then
#echo "Skipping $sketch index low"
continue
fi
if [ "$sketchnum" -gt "$end_index" ]; then
#echo "Skipping $sketch index high"
continue
fi
build_sketch $sketch
local result=$?
if [ $result -ne 0 ]; then
return $result
fi
print_size_info $ARDUINO_BUILD_DIR/*.elf >>size.log
done
return 0
}
echo -e "travis_fold:start:test_arduino_ide"
# Build Examples
build_sketches $CHUNK_INDEX $CHUNKS_CNT
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:test_arduino_ide"
echo -e "travis_fold:start:size_report"
cat size.log
echo -e "travis_fold:end:size_report"

View File

@@ -1,105 +0,0 @@
#include <FastSPI_LED.h>
const char *getPort(void *portPtr) {
#ifdef PORTA
if(portPtr == (void*)&PORTA) { return "PORTA"; }
#endif
#ifdef PORTB
if(portPtr == (void*)&PORTB) { return "PORTB"; }
#endif
#ifdef PORTC
if(portPtr == (void*)&PORTC) { return "PORTC"; }
#endif
#ifdef PORTD
if(portPtr == (void*)&PORTD) { return "PORTD"; }
#endif
#ifdef PORTE
if(portPtr == (void*)&PORTE) { return "PORTE"; }
#endif
#ifdef PORTF
if(portPtr == (void*)&PORTF) { return "PORTF"; }
#endif
#ifdef PORTG
if(portPtr == (void*)&PORTG) { return "PORTG"; }
#endif
#ifdef PORTH
if(portPtr == (void*)&PORTH) { return "PORTH"; }
#endif
#ifdef PORTI
if(portPtr == (void*)&PORTI) { return "PORTI"; }
#endif
#ifdef PORTJ
if(portPtr == (void*)&PORTJ) { return "PORTJ"; }
#endif
#ifdef PORTK
if(portPtr == (void*)&PORTK) { return "PORTK"; }
#endif
#ifdef PORTL
if(portPtr == (void*)&PORTL) { return "PORTL"; }
#endif
#ifdef GPIO_A_PDOR
if(portPtr == (void*)&GPIO_A_PDOR) { return "GPIO_A_PDOR"; }
#endif
#ifdef GPIO_B_PDOR
if(portPtr == (void*)&GPIO_B_PDOR) { return "GPIO_B_PDOR"; }
#endif
#ifdef GPIO_C_PDOR
if(portPtr == (void*)&GPIO_C_PDOR) { return "GPIO_C_PDOR"; }
#endif
#ifdef GPIO_D_PDOR
if(portPtr == (void*)&GPIO_D_PDOR) { return "GPIO_D_PDOR"; }
#endif
#ifdef GPIO_E_PDOR
if(portPtr == (void*)&GPIO_E_PDOR) { return "GPIO_E_PDOR"; }
#endif
#ifdef REG_PIO_A_ODSR
if(portPtr == (void*)&REG_PIO_A_ODSR) { return "REG_PIO_A_ODSR"; }
#endif
#ifdef REG_PIO_B_ODSR
if(portPtr == (void*)&REG_PIO_B_ODSR) { return "REG_PIO_B_ODSR"; }
#endif
#ifdef REG_PIO_C_ODSR
if(portPtr == (void*)&REG_PIO_C_ODSR) { return "REG_PIO_C_ODSR"; }
#endif
#ifdef REG_PIO_D_ODSR
if(portPtr == (void*)&REG_PIO_D_ODSR) { return "REG_PIO_D_ODSR"; }
#endif
return "unknown";
}
template<uint8_t PIN> void CheckPin()
{
CheckPin<PIN - 1>();
RwReg *systemThinksPortIs = portOutputRegister(digitalPinToPort(PIN));
RwReg systemThinksMaskIs = digitalPinToBitMask(PIN);
Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port ");
if(systemThinksPortIs == FastPin<PIN>::port()) {
Serial.print("valid & mask ");
} else {
Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin<PIN>::port())); Serial.print(" should be ");
Serial.print(getPort((void*)systemThinksPortIs));
Serial.print(" & mask ");
}
if(systemThinksMaskIs == FastPin<PIN>::mask()) {
Serial.println("valid.");
} else {
Serial.print("invalid, is "); Serial.print(FastPin<PIN>::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs);
}
}
template<> void CheckPin<-1> () {}
void setup() {
Serial.begin(38400);
Serial.println("resetting!");
}
void loop() {
CheckPin<MAX_PIN>();
delay(10000);
}

View File

@@ -1,216 +0,0 @@
#ifndef __INC_FASTPIN_ARM_SAM_H
#define __INC_FASTPIN_ARM_SAM_H
FASTLED_NAMESPACE_BEGIN
#if defined(FASTLED_FORCE_SOFTWARE_PINS)
#warning "Software pin support forced, pin access will be slightly slower."
#define NO_HARDWARE_PIN_SUPPORT
#undef HAS_HARDWARE_PIN_SUPPORT
#else
/// Template definition for STM32 style ARM pins, providing direct access to the various GPIO registers. Note that this
/// uses the full port GPIO registers. In theory, in some way, bit-band register access -should- be faster, however I have found
/// that something about the way gcc does register allocation results in the bit-band code being slower. It will need more fine tuning.
/// The registers are data output, set output, clear output, toggle output, input, and direction
template<uint8_t PIN, uint8_t _BIT, uint32_t _MASK, int _GRP> class _ARMPIN {
public:
typedef volatile uint32_t * port_ptr_t;
typedef uint32_t port_t;
#if 0
inline static void setOutput() {
if(_BIT<8) {
_CRL::r() = (_CRL::r() & (0xF << (_BIT*4)) | (0x1 << (_BIT*4));
} else {
_CRH::r() = (_CRH::r() & (0xF << ((_BIT-8)*4))) | (0x1 << ((_BIT-8)*4));
}
}
inline static void setInput() { /* TODO */ } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; }
#endif
inline static void setOutput() { pinMode(PIN, OUTPUT); } // TODO: perform MUX config { _PDDR::r() |= _MASK; }
inline static void setInput() { pinMode(PIN, INPUT); } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; }
inline static void hi() __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUTSET.reg = _MASK; }
inline static void lo() __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUTCLR.reg = _MASK; }
inline static void set(register port_t val) __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUT.reg = val; }
inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); }
inline static void toggle() __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUTTGL.reg = _MASK; }
inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); }
inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); }
inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; }
inline static port_t hival() __attribute__ ((always_inline)) { return PORT_IOBUS->Group[_GRP].OUT.reg | _MASK; }
inline static port_t loval() __attribute__ ((always_inline)) { return PORT_IOBUS->Group[_GRP].OUT.reg & ~_MASK; }
inline static port_ptr_t port() __attribute__ ((always_inline)) { return &PORT_IOBUS->Group[_GRP].OUT.reg; }
inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &PORT_IOBUS->Group[_GRP].OUTSET.reg; }
inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &PORT_IOBUS->Group[_GRP].OUTCLR.reg; }
inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; }
};
#define _R(T) struct __gen_struct_ ## T
#define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile PortGroup * r() { return T; } };
#define _IO32(L) _RD32(GPIO ## L)
#define _DEFPIN_ARM(PIN, L, BIT) template<> class FastPin<PIN> : public _ARMPIN<PIN, BIT, 1 << BIT, L> {};
// Actual pin definitions
#if defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
#define MAX_PIN 17
_DEFPIN_ARM( 8,1,23);
_DEFPIN_ARM( 0,1, 9); _DEFPIN_ARM( 1,1, 8); _DEFPIN_ARM( 2,1, 2); _DEFPIN_ARM( 3,1, 3);
_DEFPIN_ARM( 6,0, 5); _DEFPIN_ARM( 9,0, 6); _DEFPIN_ARM(10,0, 7); _DEFPIN_ARM(12,0, 2);
_DEFPIN_ARM(A6,1, 9); _DEFPIN_ARM(A7,1, 8); _DEFPIN_ARM(A5,1, 2); _DEFPIN_ARM(A4,1, 3);
_DEFPIN_ARM(A1,0, 5); _DEFPIN_ARM(A2,0, 6); _DEFPIN_ARM(A3,0, 7); _DEFPIN_ARM(A0,0, 2);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ADAFRUIT_HALLOWING)
#define MAX_PIN 20
// 0 & 1
_DEFPIN_ARM( 0, 0, 9); _DEFPIN_ARM( 1, 0, 10);
// 2, 3, 4
_DEFPIN_ARM( 2, 0, 14); _DEFPIN_ARM( 3, 0, 11); _DEFPIN_ARM( 4, 0, 8);
// 5, 6, 7
_DEFPIN_ARM( 5, 0, 15); _DEFPIN_ARM( 6, 0, 18); _DEFPIN_ARM( 7, 0, 0);
// 8, 9, 10
_DEFPIN_ARM( 8, 0, 12); _DEFPIN_ARM( 9, 0, 19); _DEFPIN_ARM(10, 0, 20);
// 11, 12, 13
_DEFPIN_ARM(11, 0, 21); _DEFPIN_ARM(12, 0, 22); _DEFPIN_ARM(13, 0, 23);
// 14, 15, 16 (A0 - A2)
_DEFPIN_ARM(14, 0, 2); _DEFPIN_ARM(15, 1, 8); _DEFPIN_ARM(16, 1, 9);
// 17, 18, 19 (A3 - A5)
_DEFPIN_ARM(17, 0, 4); _DEFPIN_ARM(18, 0, 5); _DEFPIN_ARM(19, 0, 6);
#define SPI_DATA PIN_SPI_MOSI
#define SPI_CLOCK PIN_SPI_SCK
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_SAMD_ZERO)
#define MAX_PIN 42
_DEFPIN_ARM( 0,0,10); _DEFPIN_ARM( 1,0,11); _DEFPIN_ARM( 2,0, 8); _DEFPIN_ARM( 3,0, 9);
_DEFPIN_ARM( 4,0,14); _DEFPIN_ARM( 5,0,15); _DEFPIN_ARM( 6,0,20); _DEFPIN_ARM( 7,0,21);
_DEFPIN_ARM( 8,0, 6); _DEFPIN_ARM( 9,0, 7); _DEFPIN_ARM(10,0,18); _DEFPIN_ARM(11,0,16);
_DEFPIN_ARM(12,0,19); _DEFPIN_ARM(13,0,17); _DEFPIN_ARM(14,0, 2); _DEFPIN_ARM(15,1, 8);
_DEFPIN_ARM(16,1, 9); _DEFPIN_ARM(17,0, 4); _DEFPIN_ARM(18,0, 5); _DEFPIN_ARM(19,1, 2);
_DEFPIN_ARM(20,0,22); _DEFPIN_ARM(21,0,23); _DEFPIN_ARM(22,0,12); _DEFPIN_ARM(23,1,11);
_DEFPIN_ARM(24,1,10); _DEFPIN_ARM(25,1, 3); _DEFPIN_ARM(26,0,27); _DEFPIN_ARM(27,0,28);
_DEFPIN_ARM(28,0,24); _DEFPIN_ARM(29,0,25); _DEFPIN_ARM(30,1,22); _DEFPIN_ARM(31,1,23);
_DEFPIN_ARM(32,0,22); _DEFPIN_ARM(33,0,23); _DEFPIN_ARM(34,0,19); _DEFPIN_ARM(35,0,16);
_DEFPIN_ARM(36,0,18); _DEFPIN_ARM(37,0,17); _DEFPIN_ARM(38,0,13); _DEFPIN_ARM(39,0,21);
_DEFPIN_ARM(40,0, 6); _DEFPIN_ARM(41,0, 7); _DEFPIN_ARM(42,0, 3);
#define SPI_DATA 24
#define SPI_CLOCK 23
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_SODAQ_AUTONOMO)
#define MAX_PIN 56
_DEFPIN_ARM( 0,0, 9); _DEFPIN_ARM( 1,0,10); _DEFPIN_ARM( 2,0,11); _DEFPIN_ARM( 3,1,10);
_DEFPIN_ARM( 4,1,11); _DEFPIN_ARM( 5,1,12); _DEFPIN_ARM( 6,1,13); _DEFPIN_ARM( 7,1,14);
_DEFPIN_ARM( 8,1,15); _DEFPIN_ARM( 9,0,14); _DEFPIN_ARM(10,0,15); _DEFPIN_ARM(11,0,16);
_DEFPIN_ARM(12,0,17); _DEFPIN_ARM(13,0,18); _DEFPIN_ARM(14,0,19); _DEFPIN_ARM(15,1,16);
_DEFPIN_ARM(16,0, 8); _DEFPIN_ARM(17,0,28); _DEFPIN_ARM(18,1,17); _DEFPIN_ARM(19,0, 2);
_DEFPIN_ARM(20,0, 6); _DEFPIN_ARM(21,0, 5); _DEFPIN_ARM(22,0, 4); _DEFPIN_ARM(23,1, 9);
_DEFPIN_ARM(24,1, 8); _DEFPIN_ARM(25,1, 7); _DEFPIN_ARM(26,1, 6); _DEFPIN_ARM(27,1, 5);
_DEFPIN_ARM(28,1, 4); _DEFPIN_ARM(29,0, 7); _DEFPIN_ARM(30,1, 3); _DEFPIN_ARM(31,1, 2);
_DEFPIN_ARM(32,1, 1); _DEFPIN_ARM(33,1, 0); _DEFPIN_ARM(34,0, 3); _DEFPIN_ARM(35,0, 3);
_DEFPIN_ARM(36,1,30); _DEFPIN_ARM(37,1,31); _DEFPIN_ARM(38,1,22); _DEFPIN_ARM(39,1,23);
_DEFPIN_ARM(40,0,12); _DEFPIN_ARM(41,0,13); _DEFPIN_ARM(42,0,22); _DEFPIN_ARM(43,0,23);
_DEFPIN_ARM(44,0,20); _DEFPIN_ARM(45,0,21); _DEFPIN_ARM(46,0,27); _DEFPIN_ARM(47,0,24);
_DEFPIN_ARM(48,0,25); _DEFPIN_ARM(49,1,13); _DEFPIN_ARM(50,1,14); _DEFPIN_ARM(51,0,17);
_DEFPIN_ARM(52,0,18); _DEFPIN_ARM(53,1,12); _DEFPIN_ARM(54,1,13); _DEFPIN_ARM(55,1,14);
_DEFPIN_ARM(56,1,15);
#define SPI_DATA 44
#define SPI_CLOCK 45
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_SAMD_WINO)
#define MAX_PIN 22
_DEFPIN_ARM( 0, 0, 23); _DEFPIN_ARM( 1, 0, 22); _DEFPIN_ARM( 2, 0, 16); _DEFPIN_ARM( 3, 0, 17);
_DEFPIN_ARM( 4, 0, 18); _DEFPIN_ARM( 5, 0, 19); _DEFPIN_ARM( 6, 0, 24); _DEFPIN_ARM( 7, 0, 25);
_DEFPIN_ARM( 8, 0, 27); _DEFPIN_ARM( 9, 0, 28); _DEFPIN_ARM( 10, 0, 30); _DEFPIN_ARM( 11, 0, 31);
_DEFPIN_ARM( 12, 0, 15); _DEFPIN_ARM( 13, 0, 14); _DEFPIN_ARM( 14, 0, 2); _DEFPIN_ARM( 15, 0, 3);
_DEFPIN_ARM( 16, 0, 4); _DEFPIN_ARM( 17, 0, 5); _DEFPIN_ARM( 18, 0, 6); _DEFPIN_ARM( 19, 0, 7);
_DEFPIN_ARM( 20, 0, 8); _DEFPIN_ARM( 21, 0, 9); _DEFPIN_ARM( 22, 0, 10); _DEFPIN_ARM( 23, 0, 11);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_SAMD_MKR1000)
#define MAX_PIN 22
_DEFPIN_ARM( 0, 0, 22); _DEFPIN_ARM( 1, 0, 23); _DEFPIN_ARM( 2, 0, 10); _DEFPIN_ARM( 3, 0, 11);
_DEFPIN_ARM( 4, 1, 10); _DEFPIN_ARM( 5, 1, 11); _DEFPIN_ARM( 6, 0, 20); _DEFPIN_ARM( 7, 0, 21);
_DEFPIN_ARM( 8, 0, 16); _DEFPIN_ARM( 9, 0, 17); _DEFPIN_ARM( 10, 0, 19); _DEFPIN_ARM( 11, 0, 8);
_DEFPIN_ARM( 12, 0, 9); _DEFPIN_ARM( 13, 1, 23); _DEFPIN_ARM( 14, 1, 22); _DEFPIN_ARM( 15, 0, 2);
_DEFPIN_ARM( 16, 1, 2); _DEFPIN_ARM( 17, 1, 3); _DEFPIN_ARM( 18, 0, 4); _DEFPIN_ARM( 19, 0, 5);
_DEFPIN_ARM( 20, 0, 6); _DEFPIN_ARM( 21, 0, 7);
#define SPI_DATA 8
#define SPI_CLOCK 9
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_GEMMA_M0)
#define MAX_PIN 4
_DEFPIN_ARM( 0, 0, 4); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 5);
_DEFPIN_ARM( 3, 0, 0); _DEFPIN_ARM( 4, 0, 1);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ADAFRUIT_TRINKET_M0)
#define MAX_PIN 7
_DEFPIN_ARM( 0, 0, 8); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 9);
_DEFPIN_ARM( 3, 0, 7); _DEFPIN_ARM( 4, 0, 6); _DEFPIN_ARM( 7, 0, 0); _DEFPIN_ARM( 8, 0, 1);
#define SPI_DATA 4
#define SPI_CLOCK 3
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ADAFRUIT_ITSYBITSY_M0)
#define MAX_PIN 16
_DEFPIN_ARM( 2, 0, 14); _DEFPIN_ARM( 3, 0, 9); _DEFPIN_ARM( 4, 0, 8);
_DEFPIN_ARM( 5, 0, 15); _DEFPIN_ARM( 6, 0, 20); _DEFPIN_ARM( 7, 0, 21);
_DEFPIN_ARM( 8, 0, 6); _DEFPIN_ARM( 9, 0, 7); _DEFPIN_ARM( 10, 0, 18);
_DEFPIN_ARM( 11, 0, 16); _DEFPIN_ARM( 12, 0, 19); _DEFPIN_ARM( 13, 0, 17);
_DEFPIN_ARM( 29, 0, 10); // MOSI
_DEFPIN_ARM( 30, 0, 11); // SCK
_DEFPIN_ARM( 40, 0, 0); //APA102 Clock
_DEFPIN_ARM( 41, 0, 1) //APA102 Data
#define SPI_DATA 29
#define SPI_CLOCK 30
#define HAS_HARDWARE_PIN_SUPPORT 1
#endif
#endif // FASTLED_FORCE_SOFTWARE_PINS
FASTLED_NAMESPACE_END
#endif // __INC_FASTPIN_ARM_SAM_H

View File

@@ -1,579 +0,0 @@
#ifndef __FASTPIN_ARM_NRF52_VARIANTS_H
#define __FASTPIN_ARM_NRF52_VARIANTS_H
// use this to determine if found variant or not (avoid multiple boards at once)
#undef __FASTPIN_ARM_NRF52_VARIANT_FOUND
// Adafruit Bluefruit nRF52832 Feather
// From https://www.adafruit.com/package_adafruit_index.json
#if defined (ARDUINO_NRF52832_FEATHER)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Adafruit Bluefruit nRF52832 Feather is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM_IDENTITY_P0( 0); // xtal 1
_DEFPIN_ARM_IDENTITY_P0( 1); // xtal 2
_DEFPIN_ARM_IDENTITY_P0( 2); // a0
_DEFPIN_ARM_IDENTITY_P0( 3); // a1
_DEFPIN_ARM_IDENTITY_P0( 4); // a2
_DEFPIN_ARM_IDENTITY_P0( 5); // a3
_DEFPIN_ARM_IDENTITY_P0( 6); // TXD
_DEFPIN_ARM_IDENTITY_P0( 7); // GPIO #7
_DEFPIN_ARM_IDENTITY_P0( 8); // RXD
_DEFPIN_ARM_IDENTITY_P0( 9); // NFC1
_DEFPIN_ARM_IDENTITY_P0(10); // NFC2
_DEFPIN_ARM_IDENTITY_P0(11); // GPIO #11
_DEFPIN_ARM_IDENTITY_P0(12); // SCK
_DEFPIN_ARM_IDENTITY_P0(13); // MOSI
_DEFPIN_ARM_IDENTITY_P0(14); // MISO
_DEFPIN_ARM_IDENTITY_P0(15); // GPIO #15
_DEFPIN_ARM_IDENTITY_P0(16); // GPIO #16
_DEFPIN_ARM_IDENTITY_P0(17); // LED #1 (red)
_DEFPIN_ARM_IDENTITY_P0(18); // SWO
_DEFPIN_ARM_IDENTITY_P0(19); // LED #2 (blue)
_DEFPIN_ARM_IDENTITY_P0(20); // DFU
// _DEFPIN_ARM_IDENTITY_P0(21); // Reset -- not valid to use for FastLED?
// _DEFPIN_ARM_IDENTITY_P0(22); // Factory Reset -- not vaild to use for FastLED?
// _DEFPIN_ARM_IDENTITY_P0(23); // N/A
// _DEFPIN_ARM_IDENTITY_P0(24); // N/A
_DEFPIN_ARM_IDENTITY_P0(25); // SDA
_DEFPIN_ARM_IDENTITY_P0(26); // SCL
_DEFPIN_ARM_IDENTITY_P0(27); // GPIO #27
_DEFPIN_ARM_IDENTITY_P0(28); // A4
_DEFPIN_ARM_IDENTITY_P0(29); // A5
_DEFPIN_ARM_IDENTITY_P0(30); // A6
_DEFPIN_ARM_IDENTITY_P0(31); // A7
#endif // defined (ARDUINO_NRF52832_FEATHER)
// Adafruit Bluefruit nRF52840 Feather Express
// From https://www.adafruit.com/package_adafruit_index.json
#if defined (ARDUINO_NRF52840_FEATHER)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#define MAX_PIN (33u) // 34 if wanting to use NFC1 test point
// Arduino pins 0..7
_DEFPIN_ARM( 0, 0, 25); // D0 is P0.25 -- UART TX
//_DEFPIN_ARM( 1, 0, 24); // D1 is P0.24 -- UART RX
_DEFPIN_ARM( 2, 0, 10); // D2 is P0.10 -- NFC2
_DEFPIN_ARM( 3, 1, 47); // D3 is P1.15 -- PIN_LED1 (red)
_DEFPIN_ARM( 4, 1, 42); // D4 is P1.10 -- PIN_LED2 (blue)
_DEFPIN_ARM( 5, 1, 40); // D5 is P1.08 -- SPI/SS
_DEFPIN_ARM( 6, 0, 7); // D6 is P0.07
_DEFPIN_ARM( 7, 1, 34); // D7 is P1.02 -- PIN_DFU (Button)
// Arduino pins 8..15
_DEFPIN_ARM( 8, 0, 16); // D8 is P0.16 -- PIN_NEOPIXEL
_DEFPIN_ARM( 9, 0, 26); // D9 is P0.26
_DEFPIN_ARM(10, 0, 27); // D10 is P0.27
_DEFPIN_ARM(11, 0, 6); // D11 is P0.06
_DEFPIN_ARM(12, 0, 8); // D12 is P0.08
_DEFPIN_ARM(13, 1, 41); // D13 is P1.09
_DEFPIN_ARM(14, 0, 4); // D14 is P0.04 -- A0
_DEFPIN_ARM(15, 0, 5); // D15 is P0.05 -- A1
// Arduino pins 16..23
_DEFPIN_ARM(16, 0, 30); // D16 is P0.30 -- A2
_DEFPIN_ARM(17, 0, 28); // D17 is P0.28 -- A3
_DEFPIN_ARM(18, 0, 2); // D18 is P0.02 -- A4
_DEFPIN_ARM(19, 0, 3); // D19 is P0.03 -- A5
//_DEFPIN_ARM(20, 0, 29); // D20 is P0.29 -- A6 -- Connected to battery!
//_DEFPIN_ARM(21, 0, 31); // D21 is P0.31 -- A7 -- AREF
_DEFPIN_ARM(22, 0, 12); // D22 is P0.12 -- SDA
_DEFPIN_ARM(23, 0, 11); // D23 is P0.11 -- SCL
// Arduino pins 24..31
_DEFPIN_ARM(24, 0, 15); // D24 is P0.15 -- PIN_SPI_MISO
_DEFPIN_ARM(25, 0, 13); // D25 is P0.13 -- PIN_SPI_MOSI
_DEFPIN_ARM(26, 0, 14); // D26 is P0.14 -- PIN_SPI_SCK
//_DEFPIN_ARM(27, 0, 19); // D27 is P0.19 -- PIN_QSPI_SCK
//_DEFPIN_ARM(28, 0, 20); // D28 is P0.20 -- PIN_QSPI_CS
//_DEFPIN_ARM(29, 0, 17); // D29 is P0.17 -- PIN_QSPI_DATA0
//_DEFPIN_ARM(30, 0, 22); // D30 is P0.22 -- PIN_QSPI_DATA1
//_DEFPIN_ARM(31, 0, 23); // D31 is P0.23 -- PIN_QSPI_DATA2
// Arduino pins 32..34
//_DEFPIN_ARM(32, 0, 21); // D32 is P0.21 -- PIN_QSPI_DATA3
//_DEFPIN_ARM(33, 0, 9); // D33 is NFC1, only accessible via test point
#endif // defined (ARDUINO_NRF52840_FEATHER)
// Adafruit Bluefruit nRF52840 Metro Express
// From https://www.adafruit.com/package_adafruit_index.json
#if defined (ARDUINO_NRF52840_METRO)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Adafruit Bluefruit nRF52840 Metro Express is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM( 0, 0, 25); // D0 is P0.25 (UART TX)
_DEFPIN_ARM( 1, 0, 24); // D1 is P0.24 (UART RX)
_DEFPIN_ARM( 2, 1, 10); // D2 is P1.10
_DEFPIN_ARM( 3, 1, 4); // D3 is P1.04
_DEFPIN_ARM( 4, 1, 11); // D4 is P1.11
_DEFPIN_ARM( 5, 1, 12); // D5 is P1.12
_DEFPIN_ARM( 6, 1, 14); // D6 is P1.14
_DEFPIN_ARM( 7, 0, 26); // D7 is P0.26
_DEFPIN_ARM( 8, 0, 27); // D8 is P0.27
_DEFPIN_ARM( 9, 0, 12); // D9 is P0.12
_DEFPIN_ARM(10, 0, 6); // D10 is P0.06
_DEFPIN_ARM(11, 0, 8); // D11 is P0.08
_DEFPIN_ARM(12, 1, 9); // D12 is P1.09
_DEFPIN_ARM(13, 0, 14); // D13 is P0.14
_DEFPIN_ARM(14, 0, 4); // D14 is P0.04 (A0)
_DEFPIN_ARM(15, 0, 5); // D15 is P0.05 (A1)
_DEFPIN_ARM(16, 0, 28); // D16 is P0.28 (A2)
_DEFPIN_ARM(17, 0, 30); // D17 is P0.30 (A3)
_DEFPIN_ARM(18, 0, 2); // D18 is P0.02 (A4)
_DEFPIN_ARM(19, 0, 3); // D19 is P0.03 (A5)
_DEFPIN_ARM(20, 0, 29); // D20 is P0.29 (A6, battery)
_DEFPIN_ARM(21, 0, 31); // D21 is P0.31 (A7, ARef)
_DEFPIN_ARM(22, 0, 15); // D22 is P0.15 (SDA)
_DEFPIN_ARM(23, 0, 16); // D23 is P0.16 (SCL)
_DEFPIN_ARM(24, 0, 11); // D24 is P0.11 (SPI MISO)
_DEFPIN_ARM(25, 1, 8); // D25 is P1.08 (SPI MOSI)
_DEFPIN_ARM(26, 0, 7); // D26 is P0.07 (SPI SCK )
//_DEFPIN_ARM(27, 0, 19); // D27 is P0.19 (QSPI CLK )
//_DEFPIN_ARM(28, 0, 20); // D28 is P0.20 (QSPI CS )
//_DEFPIN_ARM(29, 0, 17); // D29 is P0.17 (QSPI Data 0)
//_DEFPIN_ARM(30, 0, 23); // D30 is P0.23 (QSPI Data 1)
//_DEFPIN_ARM(31, 0, 22); // D31 is P0.22 (QSPI Data 2)
//_DEFPIN_ARM(32, 0, 21); // D32 is P0.21 (QSPI Data 3)
_DEFPIN_ARM(33, 1, 13); // D33 is P1.13 LED1
_DEFPIN_ARM(34, 1, 15); // D34 is P1.15 LED2
_DEFPIN_ARM(35, 0, 13); // D35 is P0.13 NeoPixel
_DEFPIN_ARM(36, 1, 0); // D36 is P1.02 Switch
_DEFPIN_ARM(37, 1, 0); // D37 is P1.00 SWO/DFU
_DEFPIN_ARM(38, 0, 9); // D38 is P0.09 NFC1
_DEFPIN_ARM(39, 0, 10); // D39 is P0.10 NFC2
#endif // defined (ARDUINO_NRF52840_METRO)
// Adafruit Bluefruit on nRF52840DK PCA10056
// From https://www.adafruit.com/package_adafruit_index.json
#if defined (ARDUINO_NRF52840_PCA10056)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Adafruit Bluefruit on nRF52840DK PCA10056 is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
#if defined(USE_ARDUINO_PIN_NUMBERING)
/* pca10056_schematic_and_pcb.pdf
Page 3 shows the Arduino Pin to GPIO Px.xx mapping
*/
_DEFPIN_ARM( 0, 1, 1); // D0 is P1.01
_DEFPIN_ARM( 1, 1, 2); // D1 is P1.02
_DEFPIN_ARM( 2, 1, 3); // D2 is P1.03
_DEFPIN_ARM( 3, 1, 4); // D3 is P1.04
_DEFPIN_ARM( 4, 1, 5); // D4 is P1.05
_DEFPIN_ARM( 5, 1, 6); // D5 is P1.06
_DEFPIN_ARM( 6, 1, 7); // D6 is P1.07 (BUTTON1 option)
_DEFPIN_ARM( 7, 1, 8); // D7 is P1.08 (BUTTON2 option)
_DEFPIN_ARM( 8, 1, 10); // D8 is P1.10
_DEFPIN_ARM( 9, 1, 11); // D9 is P1.11
_DEFPIN_ARM(10, 1, 12); // D10 is P1.12
_DEFPIN_ARM(11, 1, 13); // D11 is P1.13
_DEFPIN_ARM(12, 1, 14); // D12 is P1.14
_DEFPIN_ARM(13, 1, 15); // D13 is P1.15
_DEFPIN_ARM(14, 0, 0); // D14 is P0.00 (if SB4 bridged)
_DEFPIN_ARM(15, 0, 1); // D15 is P0.01 (if SB3 bridged)
_DEFPIN_ARM(16, 0, 5); // D16 is P0.05 (aka AIN3, aka UART RTS)
_DEFPIN_ARM(17, 0, 6); // D17 is P0.06 (UART TxD)
_DEFPIN_ARM(18, 0, 7); // D18 is P0.07 (UART CTS default)
_DEFPIN_ARM(19, 0, 8); // D19 is P0.08 (UART RxD)
_DEFPIN_ARM(20, 0, 9); // D20 is P0.09 (NFC1)
_DEFPIN_ARM(21, 0, 10); // D21 is P0.10 (NFC2)
_DEFPIN_ARM(22, 0, 11); // D22 is P0.11 (TRACEDATA2 / BUTTON1 default)
_DEFPIN_ARM(23, 0, 12); // D23 is P0.12 (TRACEDATA1 / BUTTON2 default)
_DEFPIN_ARM(24, 0, 13); // D24 is P0.13 (LED1)
_DEFPIN_ARM(25, 0, 14); // D25 is P0.14 (LED2)
_DEFPIN_ARM(26, 0, 15); // D26 is P0.15 (LED3)
_DEFPIN_ARM(27, 0, 16); // D27 is P0.16 (LED4)
_DEFPIN_ARM(28, 0, 17); // D28 is P0.17 (QSPI !CS , unless SB13 cut)
// _DEFPIN_ARM(29, 0, 18); // D29 is P0.18 (RESET)
_DEFPIN_ARM(30, 0, 19); // D30 is P0.19 (QSPI CLK , unless SB11 cut)
_DEFPIN_ARM(31, 0, 20); // D31 is P0.20 (QSPI DIO0, unless SB12 cut)
_DEFPIN_ARM(32, 0, 21); // D32 is P0.21 (QSPI DIO1, unless SB14 cut)
_DEFPIN_ARM(33, 0, 22); // D33 is P0.22 (QSPI DIO2, unless SB15 cut)
_DEFPIN_ARM(34, 0, 23); // D34 is P0.23 (QSPI DIO3, unless SB10 cut)
_DEFPIN_ARM(35, 0, 24); // D35 is P0.24 (BUTTON3)
_DEFPIN_ARM(36, 0, 25); // D36 is P0.25 (BUTTON4)
_DEFPIN_ARM(37, 1, 00); // D37 is P1.00 (TRACEDATA0 / SWO)
_DEFPIN_ARM(38, 1, 09); // D38 is P1.09 (TRACEDATA3)
//_DEFPIN_ARM(??, 0, 2); // D?? is P0.02 (AREF, aka AIN0)
//_DEFPIN_ARM(??, 0, 3); // D?? is P0.03 (A0, aka AIN1)
//_DEFPIN_ARM(??, 0, 4); // D?? is P0.04 (A1, aka AIN2, aka UART CTS option)
//_DEFPIN_ARM(??, 0, 28); // D?? is P0.28 (A2, aka AIN4)
//_DEFPIN_ARM(??, 0, 29); // D?? is P0.29 (A3, aka AIN5)
//_DEFPIN_ARM(??, 0, 30); // D?? is P0.30 (A4, aka AIN6)
//_DEFPIN_ARM(??, 0, 31); // D?? is P0.31 (A5, aka AIN7)
#else
/* 48 pins, defined using natural mapping in Adafruit's variant.cpp (!) */
_DEFPIN_ARM_IDENTITY_P0( 0); // P0.00 (XL1 .. ensure SB4 bridged, SB2 cut)
_DEFPIN_ARM_IDENTITY_P0( 1); // P0.01 (XL2 .. ensure SB3 bridged, SB1 cut)
_DEFPIN_ARM_IDENTITY_P0( 2); // P0.02 (AIN0)
_DEFPIN_ARM_IDENTITY_P0( 3); // P0.03 (AIN1)
_DEFPIN_ARM_IDENTITY_P0( 4); // P0.04 (AIN2 / UART CTS option)
_DEFPIN_ARM_IDENTITY_P0( 5); // P0.05 (AIN3 / UART RTS)
_DEFPIN_ARM_IDENTITY_P0( 6); // P0.06 (UART TxD)
_DEFPIN_ARM_IDENTITY_P0( 7); // P0.07 (TRACECLK / UART CTS default)
_DEFPIN_ARM_IDENTITY_P0( 8); // P0.08 (UART RxD)
_DEFPIN_ARM_IDENTITY_P0( 9); // P0.09 (NFC1)
_DEFPIN_ARM_IDENTITY_P0(10); // P0.10 (NFC2)
_DEFPIN_ARM_IDENTITY_P0(11); // P0.11 (TRACEDATA2 / BUTTON1 default)
_DEFPIN_ARM_IDENTITY_P0(12); // P0.12 (TRACEDATA1 / BUTTON2 default)
_DEFPIN_ARM_IDENTITY_P0(13); // P0.13 (LED1)
_DEFPIN_ARM_IDENTITY_P0(14); // P0.14 (LED2)
_DEFPIN_ARM_IDENTITY_P0(15); // P0.15 (LED3)
_DEFPIN_ARM_IDENTITY_P0(16); // P0.16 (LED4)
//_DEFPIN_ARM_IDENTITY_P0(17); // P0.17 (QSPI !CS )
//_DEFPIN_ARM_IDENTITY_P0(18); // P0.18 (RESET)
//_DEFPIN_ARM_IDENTITY_P0(19); // P0.19 (QSPI CLK )
//_DEFPIN_ARM_IDENTITY_P0(20); // P0.20 (QSPI DIO0)
//_DEFPIN_ARM_IDENTITY_P0(21); // P0.21 (QSPI DIO1)
//_DEFPIN_ARM_IDENTITY_P0(22); // P0.22 (QSPI DIO2)
//_DEFPIN_ARM_IDENTITY_P0(23); // P0.23 (QSPI DIO3)
_DEFPIN_ARM_IDENTITY_P0(24); // P0.24 (BUTTON3)
_DEFPIN_ARM_IDENTITY_P0(25); // P0.25 (BUTTON4)
_DEFPIN_ARM_IDENTITY_P0(26); // P0.26
_DEFPIN_ARM_IDENTITY_P0(27); // P0.27
_DEFPIN_ARM_IDENTITY_P0(28); // P0.28 (AIN4)
_DEFPIN_ARM_IDENTITY_P0(29); // P0.29 (AIN5)
_DEFPIN_ARM_IDENTITY_P0(30); // P0.30 (AIN6)
_DEFPIN_ARM_IDENTITY_P0(31); // P0.31 (AIN7)
_DEFPIN_ARM_IDENTITY_P0(32); // P1.00 (SWO / TRACEDATA0)
_DEFPIN_ARM_IDENTITY_P0(33); // P1.01
_DEFPIN_ARM_IDENTITY_P0(34); // P1.02
_DEFPIN_ARM_IDENTITY_P0(35); // P1.03
_DEFPIN_ARM_IDENTITY_P0(36); // P1.04
_DEFPIN_ARM_IDENTITY_P0(37); // P1.05
_DEFPIN_ARM_IDENTITY_P0(38); // P1.06
_DEFPIN_ARM_IDENTITY_P0(39); // P1.07 (BUTTON1 option)
_DEFPIN_ARM_IDENTITY_P0(40); // P1.08 (BUTTON2 option)
_DEFPIN_ARM_IDENTITY_P0(41); // P1.09 (TRACEDATA3)
_DEFPIN_ARM_IDENTITY_P0(42); // P1.10
_DEFPIN_ARM_IDENTITY_P0(43); // P1.11
_DEFPIN_ARM_IDENTITY_P0(44); // P1.12
_DEFPIN_ARM_IDENTITY_P0(45); // P1.13
_DEFPIN_ARM_IDENTITY_P0(46); // P1.14
_DEFPIN_ARM_IDENTITY_P0(47); // P1.15
#endif
#endif // defined (ARDUINO_NRF52840_PCA10056)
// Electronut labs bluey
// See https://github.com/sandeepmistry/arduino-nRF5/blob/master/variants/bluey/variant.cpp
#if defined(ARDUINO_ELECTRONUT_BLUEY)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Electronut labs bluey is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM( 0, 0, 26); // D0 is P0.26
_DEFPIN_ARM( 1, 0, 27); // D1 is P0.27
_DEFPIN_ARM( 2, 0, 22); // D2 is P0.22 (SPI SS )
_DEFPIN_ARM( 3, 0, 23); // D3 is P0.23 (SPI MOSI)
_DEFPIN_ARM( 4, 0, 24); // D4 is P0.24 (SPI MISO, also A3)
_DEFPIN_ARM( 5, 0, 25); // D5 is P0.25 (SPI SCK )
_DEFPIN_ARM( 6, 0, 16); // D6 is P0.16 (Button)
_DEFPIN_ARM( 7, 0, 19); // D7 is P0.19 (R)
_DEFPIN_ARM( 8, 0, 18); // D8 is P0.18 (G)
_DEFPIN_ARM( 9, 0, 17); // D9 is P0.17 (B)
_DEFPIN_ARM(10, 0, 11); // D10 is P0.11 (SCL)
_DEFPIN_ARM(11, 0, 12); // D11 is P0.12 (DRDYn)
_DEFPIN_ARM(12, 0, 13); // D12 is P0.13 (SDA)
_DEFPIN_ARM(13, 0, 14); // D13 is P0.17 (INT)
_DEFPIN_ARM(14, 0, 15); // D14 is P0.15 (INT1)
_DEFPIN_ARM(15, 0, 20); // D15 is P0.20 (INT2)
_DEFPIN_ARM(16, 0, 2); // D16 is P0.02 (A0)
_DEFPIN_ARM(17, 0, 3); // D17 is P0.03 (A1)
_DEFPIN_ARM(18, 0, 4); // D18 is P0.04 (A2)
_DEFPIN_ARM(19, 0, 24); // D19 is P0.24 (A3, also D4/SPI MISO) -- is this right?
_DEFPIN_ARM(20, 0, 29); // D20 is P0.29 (A4)
_DEFPIN_ARM(21, 0, 30); // D21 is P0.30 (A5)
_DEFPIN_ARM(22, 0, 31); // D22 is P0.31 (A6)
_DEFPIN_ARM(23, 0, 8); // D23 is P0.08 (RX)
_DEFPIN_ARM(24, 0, 6); // D24 is P0.06 (TX)
_DEFPIN_ARM(25, 0, 5); // D25 is P0.05 (RTS)
_DEFPIN_ARM(26, 0, 7); // D26 is P0.07 (CTS)
#endif // defined(ARDUINO_ELECTRONUT_BLUEY)
// Electronut labs hackaBLE
// See https://github.com/sandeepmistry/arduino-nRF5/blob/master/variants/hackaBLE/variant.cpp
#if defined(ARDUINO_ELECTRONUT_HACKABLE)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Electronut labs hackaBLE is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM( 0, 0, 14); // D0 is P0.14 (RX)
_DEFPIN_ARM( 1, 0, 13); // D1 is P0.13 (TX)
_DEFPIN_ARM( 2, 0, 12); // D2 is P0.12
_DEFPIN_ARM( 3, 0, 11); // D3 is P0.11 (SPI MOSI)
_DEFPIN_ARM( 4, 0, 8); // D4 is P0.08 (SPI MISO)
_DEFPIN_ARM( 5, 0, 7); // D5 is P0.07 (SPI SCK )
_DEFPIN_ARM( 6, 0, 6); // D6 is P0.06
_DEFPIN_ARM( 7, 0, 27); // D7 is P0.27
_DEFPIN_ARM( 8, 0, 26); // D8 is P0.26
_DEFPIN_ARM( 9, 0, 25); // D9 is P0.25
_DEFPIN_ARM(10, 0, 5); // D10 is P0.05 (A3)
_DEFPIN_ARM(11, 0, 4); // D11 is P0.04 (A2)
_DEFPIN_ARM(12, 0, 3); // D12 is P0.03 (A1)
_DEFPIN_ARM(13, 0, 2); // D13 is P0.02 (A0 / AREF)
_DEFPIN_ARM(14, 0, 23); // D14 is P0.23
_DEFPIN_ARM(15, 0, 22); // D15 is P0.22
_DEFPIN_ARM(16, 0, 18); // D16 is P0.18
_DEFPIN_ARM(17, 0, 16); // D17 is P0.16
_DEFPIN_ARM(18, 0, 15); // D18 is P0.15
_DEFPIN_ARM(19, 0, 24); // D19 is P0.24
_DEFPIN_ARM(20, 0, 28); // D20 is P0.28 (A4)
_DEFPIN_ARM(21, 0, 29); // D21 is P0.29 (A5)
_DEFPIN_ARM(22, 0, 30); // D22 is P0.30 (A6)
_DEFPIN_ARM(23, 0, 31); // D23 is P0.31 (A7)
_DEFPIN_ARM(24, 0, 19); // D24 is P0.19 (RED LED)
_DEFPIN_ARM(25, 0, 20); // D25 is P0.20 (GREEN LED)
_DEFPIN_ARM(26, 0, 17); // D26 is P0.17 (BLUE LED)
#endif // defined(ARDUINO_ELECTRONUT_HACKABLE)
// Electronut labs hackaBLE_v2
// See https://github.com/sandeepmistry/arduino-nRF5/blob/master/variants/hackaBLE_v2/variant.cpp
// (32 pins, natural mapping)
#if defined(ARDUINO_ELECTRONUT_hackaBLE_v2)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Electronut labs hackaBLE_v2 is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM_IDENTITY_P0( 0); // P0.00
_DEFPIN_ARM_IDENTITY_P0( 1); // P0.01
_DEFPIN_ARM_IDENTITY_P0( 2); // P0.02 (A0 / SDA / AREF)
_DEFPIN_ARM_IDENTITY_P0( 3); // P0.03 (A1 / SCL )
_DEFPIN_ARM_IDENTITY_P0( 4); // P0.04 (A2)
_DEFPIN_ARM_IDENTITY_P0( 5); // P0.05 (A3)
_DEFPIN_ARM_IDENTITY_P0( 6); // P0.06
_DEFPIN_ARM_IDENTITY_P0( 7); // P0.07 (RX)
_DEFPIN_ARM_IDENTITY_P0( 8); // P0.08 (TX)
_DEFPIN_ARM_IDENTITY_P0( 9); // P0.09
_DEFPIN_ARM_IDENTITY_P0(10); // P0.10
_DEFPIN_ARM_IDENTITY_P0(11); // P0.11 (SPI MISO)
_DEFPIN_ARM_IDENTITY_P0(12); // P0.12 (SPI MOSI)
_DEFPIN_ARM_IDENTITY_P0(13); // P0.13 (SPI SCK )
_DEFPIN_ARM_IDENTITY_P0(14); // P0.14 (SPI SS )
_DEFPIN_ARM_IDENTITY_P0(15); // P0.15
_DEFPIN_ARM_IDENTITY_P0(16); // P0.16
_DEFPIN_ARM_IDENTITY_P0(17); // P0.17 (BLUE LED)
_DEFPIN_ARM_IDENTITY_P0(18); // P0.18
_DEFPIN_ARM_IDENTITY_P0(19); // P0.19 (RED LED)
_DEFPIN_ARM_IDENTITY_P0(20); // P0.20 (GREEN LED)
// _DEFPIN_ARM_IDENTITY_P0(21); // P0.21 (RESET)
_DEFPIN_ARM_IDENTITY_P0(22); // P0.22
_DEFPIN_ARM_IDENTITY_P0(23); // P0.23
_DEFPIN_ARM_IDENTITY_P0(24); // P0.24
_DEFPIN_ARM_IDENTITY_P0(25); // P0.25
_DEFPIN_ARM_IDENTITY_P0(26); // P0.26
_DEFPIN_ARM_IDENTITY_P0(27); // P0.27
_DEFPIN_ARM_IDENTITY_P0(28); // P0.28 (A4)
_DEFPIN_ARM_IDENTITY_P0(29); // P0.29 (A5)
_DEFPIN_ARM_IDENTITY_P0(30); // P0.30 (A6)
_DEFPIN_ARM_IDENTITY_P0(31); // P0.31 (A7)
#endif // defined(ARDUINO_ELECTRONUT_hackaBLE_v2)
// RedBear Blend 2
// See https://github.com/sandeepmistry/arduino-nRF5/blob/master/variants/RedBear_Blend2/variant.cpp
#if defined(ARDUINO_RB_BLEND_2)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "RedBear Blend 2 is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM( 0, 0, 11); // D0 is P0.11
_DEFPIN_ARM( 1, 0, 12); // D1 is P0.12
_DEFPIN_ARM( 2, 0, 13); // D2 is P0.13
_DEFPIN_ARM( 3, 0, 14); // D3 is P0.14
_DEFPIN_ARM( 4, 0, 15); // D4 is P0.15
_DEFPIN_ARM( 5, 0, 16); // D5 is P0.16
_DEFPIN_ARM( 6, 0, 17); // D6 is P0.17
_DEFPIN_ARM( 7, 0, 18); // D7 is P0.18
_DEFPIN_ARM( 8, 0, 19); // D8 is P0.19
_DEFPIN_ARM( 9, 0, 20); // D9 is P0.20
_DEFPIN_ARM(10, 0, 22); // D10 is P0.22 (SPI SS )
_DEFPIN_ARM(11, 0, 23); // D11 is P0.23 (SPI MOSI)
_DEFPIN_ARM(12, 0, 24); // D12 is P0.24 (SPI MISO)
_DEFPIN_ARM(13, 0, 25); // D13 is P0.25 (SPI SCK / LED)
_DEFPIN_ARM(14, 0, 3); // D14 is P0.03 (A0)
_DEFPIN_ARM(15, 0, 4); // D15 is P0.04 (A1)
_DEFPIN_ARM(16, 0, 28); // D16 is P0.28 (A2)
_DEFPIN_ARM(17, 0, 29); // D17 is P0.29 (A3)
_DEFPIN_ARM(18, 0, 30); // D18 is P0.30 (A4)
_DEFPIN_ARM(19, 0, 31); // D19 is P0.31 (A5)
_DEFPIN_ARM(20, 0, 26); // D20 is P0.26 (SDA)
_DEFPIN_ARM(21, 0, 27); // D21 is P0.27 (SCL)
_DEFPIN_ARM(22, 0, 8); // D22 is P0.08 (RX)
_DEFPIN_ARM(23, 0, 6); // D23 is P0.06 (TX)
_DEFPIN_ARM(24, 0, 2); // D24 is P0.02 (AREF)
#endif // defined(ARDUINO_RB_BLEND_2)
// RedBear BLE Nano 2
// See https://github.com/sandeepmistry/arduino-nRF5/blob/master/variants/RedBear_BLENano2/variant.cpp
#if defined(ARDUINO_RB_BLE_NANO_2)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "RedBear BLE Nano 2 is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM( 0, 0, 30); // D0 is P0.30 (A0 / RX)
_DEFPIN_ARM( 1, 0, 29); // D1 is P0.29 (A1 / TX)
_DEFPIN_ARM( 2, 0, 28); // D2 is P0.28 (A2 / SDA)
_DEFPIN_ARM( 3, 0, 2); // D3 is P0.02 (A3 / SCL)
_DEFPIN_ARM( 4, 0, 5); // D4 is P0.05 (A4)
_DEFPIN_ARM( 5, 0, 4); // D5 is P0.04 (A5)
_DEFPIN_ARM( 6, 0, 3); // D6 is P0.03 (SPI SS )
_DEFPIN_ARM( 7, 0, 6); // D7 is P0.06 (SPI MOSI)
_DEFPIN_ARM( 8, 0, 7); // D8 is P0.07 (SPI MISO)
_DEFPIN_ARM( 9, 0, 8); // D9 is P0.08 (SPI SCK )
// _DEFPIN_ARM(10, 0, 21); // D10 is P0.21 (RESET)
_DEFPIN_ARM(13, 0, 11); // D11 is P0.11 (LED)
#endif // defined(ARDUINO_RB_BLE_NANO_2)
// Nordic Semiconductor nRF52 DK
// See https://github.com/sandeepmistry/arduino-nRF5/blob/master/variants/nRF52DK/variant.cpp
#if defined(ARDUINO_NRF52_DK)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Nordic Semiconductor nRF52 DK is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM( 0, 0, 11); // D0 is P0.11
_DEFPIN_ARM( 1, 0, 12); // D1 is P0.12
_DEFPIN_ARM( 2, 0, 13); // D2 is P0.13 (BUTTON1)
_DEFPIN_ARM( 3, 0, 14); // D3 is P0.14 (BUTTON2)
_DEFPIN_ARM( 4, 0, 15); // D4 is P0.15 (BUTTON3)
_DEFPIN_ARM( 5, 0, 16); // D5 is P0.16 (BUTTON4)
_DEFPIN_ARM( 6, 0, 17); // D6 is P0.17 (LED1)
_DEFPIN_ARM( 7, 0, 18); // D7 is P0.18 (LED2)
_DEFPIN_ARM( 8, 0, 19); // D8 is P0.19 (LED3)
_DEFPIN_ARM( 9, 0, 20); // D9 is P0.20 (LED4)
_DEFPIN_ARM(10, 0, 22); // D10 is P0.22 (SPI SS )
_DEFPIN_ARM(11, 0, 23); // D11 is P0.23 (SPI MOSI)
_DEFPIN_ARM(12, 0, 24); // D12 is P0.24 (SPI MISO)
_DEFPIN_ARM(13, 0, 25); // D13 is P0.25 (SPI SCK / LED)
_DEFPIN_ARM(14, 0, 3); // D14 is P0.03 (A0)
_DEFPIN_ARM(15, 0, 4); // D15 is P0.04 (A1)
_DEFPIN_ARM(16, 0, 28); // D16 is P0.28 (A2)
_DEFPIN_ARM(17, 0, 29); // D17 is P0.29 (A3)
_DEFPIN_ARM(18, 0, 30); // D18 is P0.30 (A4)
_DEFPIN_ARM(19, 0, 31); // D19 is P0.31 (A5)
_DEFPIN_ARM(20, 0, 5); // D20 is P0.05 (A6)
_DEFPIN_ARM(21, 0, 2); // D21 is P0.02 (A7 / AREF)
_DEFPIN_ARM(22, 0, 26); // D22 is P0.26 (SDA)
_DEFPIN_ARM(23, 0, 27); // D23 is P0.27 (SCL)
_DEFPIN_ARM(24, 0, 8); // D24 is P0.08 (RX)
_DEFPIN_ARM(25, 0, 6); // D25 is P0.06 (TX)
#endif // defined(ARDUINO_NRF52_DK)
// Taida Century nRF52 mini board
// https://github.com/sandeepmistry/arduino-nRF5/blob/master/variants/Taida_Century_nRF52_minidev/variant.cpp
#if defined(ARDUINO_STCT_NRF52_minidev)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Taida Century nRF52 mini board is an untested board -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
//_DEFPIN_ARM( 0, 0, 25); // D0 is P0.xx (near radio!)
//_DEFPIN_ARM( 1, 0, 26); // D1 is P0.xx (near radio!)
//_DEFPIN_ARM( 2, 0, 27); // D2 is P0.xx (near radio!)
//_DEFPIN_ARM( 3, 0, 28); // D3 is P0.xx (near radio!)
//_DEFPIN_ARM( 4, 0, 29); // D4 is P0.xx (Not connected, near radio!)
//_DEFPIN_ARM( 5, 0, 30); // D5 is P0.xx (LED1, near radio!)
//_DEFPIN_ARM( 6, 0, 31); // D6 is P0.xx (LED2, near radio!)
_DEFPIN_ARM( 7, 0, 2); // D7 is P0.xx (SDA)
_DEFPIN_ARM( 8, 0, 3); // D8 is P0.xx (SCL)
_DEFPIN_ARM( 9, 0, 4); // D9 is P0.xx (BUTTON1 / NFC1)
_DEFPIN_ARM(10, 0, 5); // D10 is P0.xx
//_DEFPIN_ARM(11, 0, 0); // D11 is P0.xx (Not connected)
//_DEFPIN_ARM(12, 0, 1); // D12 is P0.xx (Not connected)
_DEFPIN_ARM(13, 0, 6); // D13 is P0.xx
_DEFPIN_ARM(14, 0, 7); // D14 is P0.xx
_DEFPIN_ARM(15, 0, 8); // D15 is P0.xx
//_DEFPIN_ARM(16, 0, 9); // D16 is P0.xx (Not connected)
//_DEFPIN_ARM(17, 0, 10); // D17 is P0.xx (NFC2, Not connected)
_DEFPIN_ARM(18, 0, 11); // D18 is P0.xx (RXD)
_DEFPIN_ARM(19, 0, 12); // D19 is P0.xx (TXD)
_DEFPIN_ARM(20, 0, 13); // D20 is P0.xx (SPI SS )
_DEFPIN_ARM(21, 0, 14); // D21 is P0.xx (SPI MISO)
_DEFPIN_ARM(22, 0, 15); // D22 is P0.xx (SPI MOSI)
_DEFPIN_ARM(23, 0, 16); // D23 is P0.xx (SPI SCK )
_DEFPIN_ARM(24, 0, 17); // D24 is P0.xx (A0)
_DEFPIN_ARM(25, 0, 18); // D25 is P0.xx (A1)
_DEFPIN_ARM(26, 0, 19); // D26 is P0.xx (A2)
_DEFPIN_ARM(27, 0, 20); // D27 is P0.xx (A3)
//_DEFPIN_ARM(28, 0, 22); // D28 is P0.xx (A4, near radio!)
//_DEFPIN_ARM(29, 0, 23); // D29 is P0.xx (A5, near radio!)
_DEFPIN_ARM(30, 0, 24); // D30 is P0.xx
// _DEFPIN_ARM(31, 0, 21); // D31 is P0.21 (RESET)
#endif // defined(ARDUINO_STCT_NRF52_minidev)
// Generic nRF52832
// See https://github.com/sandeepmistry/arduino-nRF5/blob/master/boards.txt
#if defined(ARDUINO_GENERIC) && (\
defined(NRF52832_XXAA) || defined(NRF52832_XXAB)\
)
#if defined(__FASTPIN_ARM_NRF52_VARIANT_FOUND)
#error "Cannot define more than one board at a time"
#else
#define __FASTPIN_ARM_NRF52_VARIANT_FOUND
#endif
#warning "Using `generic` NRF52832 board is an untested configuration -- test and let use know your results via https://github.com/FastLED/FastLED/issues"
_DEFPIN_ARM_IDENTITY_P0( 0); // P0.00 ( UART RX
_DEFPIN_ARM_IDENTITY_P0( 1); // P0.01 (A0, UART TX)
_DEFPIN_ARM_IDENTITY_P0( 2); // P0.02 (A1)
_DEFPIN_ARM_IDENTITY_P0( 3); // P0.03 (A2)
_DEFPIN_ARM_IDENTITY_P0( 4); // P0.04 (A3)
_DEFPIN_ARM_IDENTITY_P0( 5); // P0.05 (A4)
_DEFPIN_ARM_IDENTITY_P0( 6); // P0.06 (A5)
_DEFPIN_ARM_IDENTITY_P0( 7); // P0.07
_DEFPIN_ARM_IDENTITY_P0( 8); // P0.08
_DEFPIN_ARM_IDENTITY_P0( 9); // P0.09
_DEFPIN_ARM_IDENTITY_P0(10); // P0.10
_DEFPIN_ARM_IDENTITY_P0(11); // P0.11
_DEFPIN_ARM_IDENTITY_P0(12); // P0.12
_DEFPIN_ARM_IDENTITY_P0(13); // P0.13 (LED)
_DEFPIN_ARM_IDENTITY_P0(14); // P0.14
_DEFPIN_ARM_IDENTITY_P0(15); // P0.15
_DEFPIN_ARM_IDENTITY_P0(16); // P0.16
_DEFPIN_ARM_IDENTITY_P0(17); // P0.17
_DEFPIN_ARM_IDENTITY_P0(18); // P0.18
_DEFPIN_ARM_IDENTITY_P0(19); // P0.19
_DEFPIN_ARM_IDENTITY_P0(20); // P0.20 (I2C SDA)
_DEFPIN_ARM_IDENTITY_P0(21); // P0.21 (I2C SCL)
_DEFPIN_ARM_IDENTITY_P0(22); // P0.22 (SPI MISO)
_DEFPIN_ARM_IDENTITY_P0(23); // P0.23 (SPI MOSI)
_DEFPIN_ARM_IDENTITY_P0(24); // P0.24 (SPI SCK )
_DEFPIN_ARM_IDENTITY_P0(25); // P0.25 (SPI SS )
_DEFPIN_ARM_IDENTITY_P0(26); // P0.26
_DEFPIN_ARM_IDENTITY_P0(27); // P0.27
_DEFPIN_ARM_IDENTITY_P0(28); // P0.28
_DEFPIN_ARM_IDENTITY_P0(29); // P0.29
_DEFPIN_ARM_IDENTITY_P0(30); // P0.30
_DEFPIN_ARM_IDENTITY_P0(31); // P0.31
#endif // defined(ARDUINO_GENERIC)
#endif // __FASTPIN_ARM_NRF52_VARIANTS_H

View File

@@ -1,345 +0,0 @@
#ifndef __INC_FASTPIN_AVR_H
#define __INC_FASTPIN_AVR_H
FASTLED_NAMESPACE_BEGIN
#if defined(FASTLED_FORCE_SOFTWARE_PINS)
#warning "Software pin support forced, pin access will be slightly slower."
#define NO_HARDWARE_PIN_SUPPORT
#undef HAS_HARDWARE_PIN_SUPPORT
#else
#define AVR_PIN_CYCLES(_PIN) ((((int)FastPin<_PIN>::port())-0x20 < 64) ? 1 : 2)
/// Class definition for a Pin where we know the port registers at compile time for said pin. This allows us to make
/// a lot of optimizations, as the inlined hi/lo methods will devolve to a single io register write/bitset.
template<uint8_t PIN, uint8_t _MASK, typename _PORT, typename _DDR, typename _PIN> class _AVRPIN {
public:
typedef volatile uint8_t * port_ptr_t;
typedef uint8_t port_t;
inline static void setOutput() { _DDR::r() |= _MASK; }
inline static void setInput() { _DDR::r() &= ~_MASK; }
inline static void hi() __attribute__ ((always_inline)) { _PORT::r() |= _MASK; }
inline static void lo() __attribute__ ((always_inline)) { _PORT::r() &= ~_MASK; }
inline static void set(register uint8_t val) __attribute__ ((always_inline)) { _PORT::r() = val; }
inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); }
inline static void toggle() __attribute__ ((always_inline)) { _PIN::r() = _MASK; }
inline static void hi(register port_ptr_t /*port*/) __attribute__ ((always_inline)) { hi(); }
inline static void lo(register port_ptr_t /*port*/) __attribute__ ((always_inline)) { lo(); }
inline static void fastset(register port_ptr_t /*port*/, register uint8_t val) __attribute__ ((always_inline)) { set(val); }
inline static port_t hival() __attribute__ ((always_inline)) { return _PORT::r() | _MASK; }
inline static port_t loval() __attribute__ ((always_inline)) { return _PORT::r() & ~_MASK; }
inline static port_ptr_t port() __attribute__ ((always_inline)) { return &_PORT::r(); }
inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; }
};
/// AVR definitions for pins. Getting around the fact that I can't pass GPIO register addresses in as template arguments by instead creating
/// a custom type for each GPIO register with a single, static, aggressively inlined function that returns that specific GPIO register. A similar
/// trick is used a bit further below for the ARM GPIO registers (of which there are far more than on AVR!)
typedef volatile uint8_t & reg8_t;
#define _R(T) struct __gen_struct_ ## T
#define _RD8(T) struct __gen_struct_ ## T { static inline reg8_t r() { return T; }};
#define _IO(L) _RD8(DDR ## L); _RD8(PORT ## L); _RD8(PIN ## L);
#define _DEFPIN_AVR(_PIN, MASK, L) template<> class FastPin<_PIN> : public _AVRPIN<_PIN, MASK, _R(PORT ## L), _R(DDR ## L), _R(PIN ## L)> {};
#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny25__)
_IO(B);
#if defined(__AVR_ATtiny25__)
#pragma message "ATtiny25 has very limited storage. This library could use up to more than 100% of its flash size"
#endif
#define MAX_PIN 5
_DEFPIN_AVR(0, 0x01, B); _DEFPIN_AVR(1, 0x02, B); _DEFPIN_AVR(2, 0x04, B); _DEFPIN_AVR(3, 0x08, B);
_DEFPIN_AVR(4, 0x10, B); _DEFPIN_AVR(5, 0x20, B);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(__AVR_ATtiny841__) || defined(__AVR_ATtiny441__)
#define MAX_PIN 11
_IO(A); _IO(B);
_DEFPIN_AVR(0, 0x01, B); _DEFPIN_AVR(1, 0x02, B); _DEFPIN_AVR(2, 0x04, B);
_DEFPIN_AVR(3, 0x80, A); _DEFPIN_AVR(4, 0x40, A); _DEFPIN_AVR(5, 0x20, A);
_DEFPIN_AVR(6, 0x10, A); _DEFPIN_AVR(7, 0x08, A); _DEFPIN_AVR(8, 0x04, A);
_DEFPIN_AVR(9, 0x02, A); _DEFPIN_AVR(10, 0x01, A); _DEFPIN_AVR(11, 0x08, B);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_AVR_DIGISPARK) // digispark pin layout
#define MAX_PIN 5
#define HAS_HARDWARE_PIN_SUPPORT 1
_IO(A); _IO(B);
_DEFPIN_AVR(0, 0x01, B); _DEFPIN_AVR(1, 0x02, B); _DEFPIN_AVR(2, 0x04, B);
_DEFPIN_AVR(3, 0x80, A); _DEFPIN_AVR(4, 0x40, A); _DEFPIN_AVR(5, 0x20, A);
#elif defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
_IO(A); _IO(B);
#define MAX_PIN 10
_DEFPIN_AVR(0, 0x01, A); _DEFPIN_AVR(1, 0x02, A); _DEFPIN_AVR(2, 0x04, A); _DEFPIN_AVR(3, 0x08, A);
_DEFPIN_AVR(4, 0x10, A); _DEFPIN_AVR(5, 0x20, A); _DEFPIN_AVR(6, 0x40, A); _DEFPIN_AVR(7, 0x80, A);
_DEFPIN_AVR(8, 0x04, B); _DEFPIN_AVR(9, 0x02, B); _DEFPIN_AVR(10, 0x01, B);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_AVR_DIGISPARKPRO)
_IO(A); _IO(B);
#define MAX_PIN 12
_DEFPIN_AVR(0, 0x01, B); _DEFPIN_AVR(1, 0x02, B); _DEFPIN_AVR(2, 0x04, B); _DEFPIN_AVR(3, 0x20, B);
_DEFPIN_AVR(4, 0x08, B); _DEFPIN_AVR(5, 0x80, A); _DEFPIN_AVR(6, 0x01, A); _DEFPIN_AVR(7, 0x02, A);
_DEFPIN_AVR(8, 0x04, A); _DEFPIN_AVR(9, 0x08, A); _DEFPIN_AVR(10, 0x10, A); _DEFPIN_AVR(11, 0x20, A);
_DEFPIN_AVR(12, 0x40, A);
#elif defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__)
_IO(A); _IO(B);
#define MAX_PIN 15
_DEFPIN_AVR(0, 0x01, A); _DEFPIN_AVR(1, 0x02, A); _DEFPIN_AVR(2, 0x04, A); _DEFPIN_AVR(3, 0x08, A);
_DEFPIN_AVR(4, 0x10, A); _DEFPIN_AVR(5, 0x20, A); _DEFPIN_AVR(6, 0x40, A); _DEFPIN_AVR(7, 0x80, A);
_DEFPIN_AVR(8, 0x01, B); _DEFPIN_AVR(9, 0x02, B); _DEFPIN_AVR(10, 0x04, B); _DEFPIN_AVR(11, 0x08, B);
_DEFPIN_AVR(12, 0x10, B); _DEFPIN_AVR(13, 0x20, B); _DEFPIN_AVR(14, 0x40, B); _DEFPIN_AVR(15, 0x80, B);
#define SPI_DATA 4
#define SPI_CLOCK 5
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ARDUINO_HOODLOADER2) && (defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)) || defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__)
_IO(D); _IO(B); _IO(C);
#define MAX_PIN 20
_DEFPIN_AVR( 0, 0x01, B); _DEFPIN_AVR( 1, 0x02, B); _DEFPIN_AVR( 2, 0x04, B); _DEFPIN_AVR( 3, 0x08, B);
_DEFPIN_AVR( 4, 0x10, B); _DEFPIN_AVR( 5, 0x20, B); _DEFPIN_AVR( 6, 0x40, B); _DEFPIN_AVR( 7, 0x80, B);
_DEFPIN_AVR( 8, 0x80, C); _DEFPIN_AVR( 9, 0x40, C); _DEFPIN_AVR( 10, 0x20,C); _DEFPIN_AVR( 11, 0x10, C);
_DEFPIN_AVR( 12, 0x04, C); _DEFPIN_AVR( 13, 0x01, D); _DEFPIN_AVR( 14, 0x02, D); _DEFPIN_AVR(15, 0x04, D);
_DEFPIN_AVR( 16, 0x08, D); _DEFPIN_AVR( 17, 0x10, D); _DEFPIN_AVR( 18, 0x20, D); _DEFPIN_AVR( 19, 0x40, D);
_DEFPIN_AVR( 20, 0x80, D);
#define HAS_HARDWARE_PIN_SUPPORT 1
// #define SPI_DATA 2
// #define SPI_CLOCK 1
// #define AVR_HARDWARE_SPI 1
#elif defined(IS_BEAN)
// Accelerated port definitions for arduino avrs
_IO(D); _IO(B); _IO(C);
#define MAX_PIN 19
_DEFPIN_AVR( 0, 0x40, D); _DEFPIN_AVR( 1, 0x02, B); _DEFPIN_AVR( 2, 0x04, B); _DEFPIN_AVR( 3, 0x08, B);
_DEFPIN_AVR( 4, 0x10, B); _DEFPIN_AVR( 5, 0x20, B); _DEFPIN_AVR( 6, 0x01, D); _DEFPIN_AVR( 7, 0x80, D);
_DEFPIN_AVR( 8, 0x01, B); _DEFPIN_AVR( 9, 0x02, D); _DEFPIN_AVR(10, 0x04, D); _DEFPIN_AVR(11, 0x08, D);
_DEFPIN_AVR(12, 0x10, D); _DEFPIN_AVR(13, 0x20, D); _DEFPIN_AVR(14, 0x01, C); _DEFPIN_AVR(15, 0x02, C);
_DEFPIN_AVR(16, 0x04, C); _DEFPIN_AVR(17, 0x08, C); _DEFPIN_AVR(18, 0x10, C); _DEFPIN_AVR(19, 0x20, C);
#define SPI_DATA 3
#define SPI_CLOCK 5
#define SPI_SELECT 2
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
#ifndef __AVR_ATmega8__
#define SPI_UART0_DATA 9
#define SPI_UART0_CLOCK 12
#endif
#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega8__)
// Accelerated port definitions for arduino avrs
_IO(D); _IO(B); _IO(C);
#define MAX_PIN 19
_DEFPIN_AVR( 0, 0x01, D); _DEFPIN_AVR( 1, 0x02, D); _DEFPIN_AVR( 2, 0x04, D); _DEFPIN_AVR( 3, 0x08, D);
_DEFPIN_AVR( 4, 0x10, D); _DEFPIN_AVR( 5, 0x20, D); _DEFPIN_AVR( 6, 0x40, D); _DEFPIN_AVR( 7, 0x80, D);
_DEFPIN_AVR( 8, 0x01, B); _DEFPIN_AVR( 9, 0x02, B); _DEFPIN_AVR(10, 0x04, B); _DEFPIN_AVR(11, 0x08, B);
_DEFPIN_AVR(12, 0x10, B); _DEFPIN_AVR(13, 0x20, B); _DEFPIN_AVR(14, 0x01, C); _DEFPIN_AVR(15, 0x02, C);
_DEFPIN_AVR(16, 0x04, C); _DEFPIN_AVR(17, 0x08, C); _DEFPIN_AVR(18, 0x10, C); _DEFPIN_AVR(19, 0x20, C);
#define SPI_DATA 11
#define SPI_CLOCK 13
#define SPI_SELECT 10
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
#ifndef __AVR_ATmega8__
#define SPI_UART0_DATA 1
#define SPI_UART0_CLOCK 4
#endif
#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
_IO(A); _IO(B); _IO(C); _IO(D);
#define MAX_PIN 31
_DEFPIN_AVR(0, 1<<0, B); _DEFPIN_AVR(1, 1<<1, B); _DEFPIN_AVR(2, 1<<2, B); _DEFPIN_AVR(3, 1<<3, B);
_DEFPIN_AVR(4, 1<<4, B); _DEFPIN_AVR(5, 1<<5, B); _DEFPIN_AVR(6, 1<<6, B); _DEFPIN_AVR(7, 1<<7, B);
_DEFPIN_AVR(8, 1<<0, D); _DEFPIN_AVR(9, 1<<1, D); _DEFPIN_AVR(10, 1<<2, D); _DEFPIN_AVR(11, 1<<3, D);
_DEFPIN_AVR(12, 1<<4, D); _DEFPIN_AVR(13, 1<<5, D); _DEFPIN_AVR(14, 1<<6, D); _DEFPIN_AVR(15, 1<<7, D);
_DEFPIN_AVR(16, 1<<0, C); _DEFPIN_AVR(17, 1<<1, C); _DEFPIN_AVR(18, 1<<2, C); _DEFPIN_AVR(19, 1<<3, C);
_DEFPIN_AVR(20, 1<<4, C); _DEFPIN_AVR(21, 1<<5, C); _DEFPIN_AVR(22, 1<<6, C); _DEFPIN_AVR(23, 1<<7, C);
_DEFPIN_AVR(24, 1<<0, A); _DEFPIN_AVR(25, 1<<1, A); _DEFPIN_AVR(26, 1<<2, A); _DEFPIN_AVR(27, 1<<3, A);
_DEFPIN_AVR(28, 1<<4, A); _DEFPIN_AVR(29, 1<<5, A); _DEFPIN_AVR(30, 1<<6, A); _DEFPIN_AVR(31, 1<<7, A);
#define SPI_DATA 5
#define SPI_CLOCK 7
#define SPI_SELECT 4
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
// AKA the Pinoccio
_IO(A); _IO(B); _IO(C); _IO(D); _IO(E); _IO(F);
_DEFPIN_AVR( 0, 1<<0, E); _DEFPIN_AVR( 1, 1<<1, E); _DEFPIN_AVR( 2, 1<<7, B); _DEFPIN_AVR( 3, 1<<3, E);
_DEFPIN_AVR( 4, 1<<4, E); _DEFPIN_AVR( 5, 1<<5, E); _DEFPIN_AVR( 6, 1<<2, E); _DEFPIN_AVR( 7, 1<<6, E);
_DEFPIN_AVR( 8, 1<<5, D); _DEFPIN_AVR( 9, 1<<0, B); _DEFPIN_AVR(10, 1<<2, B); _DEFPIN_AVR(11, 1<<3, B);
_DEFPIN_AVR(12, 1<<1, B); _DEFPIN_AVR(13, 1<<2, D); _DEFPIN_AVR(14, 1<<3, D); _DEFPIN_AVR(15, 1<<0, D);
_DEFPIN_AVR(16, 1<<1, D); _DEFPIN_AVR(17, 1<<4, D); _DEFPIN_AVR(18, 1<<7, E); _DEFPIN_AVR(19, 1<<6, D);
_DEFPIN_AVR(20, 1<<7, D); _DEFPIN_AVR(21, 1<<4, B); _DEFPIN_AVR(22, 1<<5, B); _DEFPIN_AVR(23, 1<<6, B);
_DEFPIN_AVR(24, 1<<0, F); _DEFPIN_AVR(25, 1<<1, F); _DEFPIN_AVR(26, 1<<2, F); _DEFPIN_AVR(27, 1<<3, F);
_DEFPIN_AVR(28, 1<<4, F); _DEFPIN_AVR(29, 1<<5, F); _DEFPIN_AVR(30, 1<<6, F); _DEFPIN_AVR(31, 1<<7, F);
#define SPI_DATA 10
#define SPI_CLOCK 12
#define SPI_SELECT 9
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
// megas
_IO(A); _IO(B); _IO(C); _IO(D); _IO(E); _IO(F); _IO(G); _IO(H); _IO(J); _IO(K); _IO(L);
#define MAX_PIN 69
_DEFPIN_AVR(0, 1, E); _DEFPIN_AVR(1, 2, E); _DEFPIN_AVR(2, 16, E); _DEFPIN_AVR(3, 32, E);
_DEFPIN_AVR(4, 32, G); _DEFPIN_AVR(5, 8, E); _DEFPIN_AVR(6, 8, H); _DEFPIN_AVR(7, 16, H);
_DEFPIN_AVR(8, 32, H); _DEFPIN_AVR(9, 64, H); _DEFPIN_AVR(10, 16, B); _DEFPIN_AVR(11, 32, B);
_DEFPIN_AVR(12, 64, B); _DEFPIN_AVR(13, 128, B); _DEFPIN_AVR(14, 2, J); _DEFPIN_AVR(15, 1, J);
_DEFPIN_AVR(16, 2, H); _DEFPIN_AVR(17, 1, H); _DEFPIN_AVR(18, 8, D); _DEFPIN_AVR(19, 4, D);
_DEFPIN_AVR(20, 2, D); _DEFPIN_AVR(21, 1, D); _DEFPIN_AVR(22, 1, A); _DEFPIN_AVR(23, 2, A);
_DEFPIN_AVR(24, 4, A); _DEFPIN_AVR(25, 8, A); _DEFPIN_AVR(26, 16, A); _DEFPIN_AVR(27, 32, A);
_DEFPIN_AVR(28, 64, A); _DEFPIN_AVR(29, 128, A); _DEFPIN_AVR(30, 128, C); _DEFPIN_AVR(31, 64, C);
_DEFPIN_AVR(32, 32, C); _DEFPIN_AVR(33, 16, C); _DEFPIN_AVR(34, 8, C); _DEFPIN_AVR(35, 4, C);
_DEFPIN_AVR(36, 2, C); _DEFPIN_AVR(37, 1, C); _DEFPIN_AVR(38, 128, D); _DEFPIN_AVR(39, 4, G);
_DEFPIN_AVR(40, 2, G); _DEFPIN_AVR(41, 1, G); _DEFPIN_AVR(42, 128, L); _DEFPIN_AVR(43, 64, L);
_DEFPIN_AVR(44, 32, L); _DEFPIN_AVR(45, 16, L); _DEFPIN_AVR(46, 8, L); _DEFPIN_AVR(47, 4, L);
_DEFPIN_AVR(48, 2, L); _DEFPIN_AVR(49, 1, L); _DEFPIN_AVR(50, 8, B); _DEFPIN_AVR(51, 4, B);
_DEFPIN_AVR(52, 2, B); _DEFPIN_AVR(53, 1, B); _DEFPIN_AVR(54, 1, F); _DEFPIN_AVR(55, 2, F);
_DEFPIN_AVR(56, 4, F); _DEFPIN_AVR(57, 8, F); _DEFPIN_AVR(58, 16, F); _DEFPIN_AVR(59, 32, F);
_DEFPIN_AVR(60, 64, F); _DEFPIN_AVR(61, 128, F); _DEFPIN_AVR(62, 1, K); _DEFPIN_AVR(63, 2, K);
_DEFPIN_AVR(64, 4, K); _DEFPIN_AVR(65, 8, K); _DEFPIN_AVR(66, 16, K); _DEFPIN_AVR(67, 32, K);
_DEFPIN_AVR(68, 64, K); _DEFPIN_AVR(69, 128, K);
#define SPI_DATA 51
#define SPI_CLOCK 52
#define SPI_SELECT 53
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
// Leonardo, teensy, blinkm
#elif defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY)
// teensy defs
_IO(B); _IO(C); _IO(D); _IO(E); _IO(F);
#define MAX_PIN 23
_DEFPIN_AVR(0, 1, B); _DEFPIN_AVR(1, 2, B); _DEFPIN_AVR(2, 4, B); _DEFPIN_AVR(3, 8, B);
_DEFPIN_AVR(4, 128, B); _DEFPIN_AVR(5, 1, D); _DEFPIN_AVR(6, 2, D); _DEFPIN_AVR(7, 4, D);
_DEFPIN_AVR(8, 8, D); _DEFPIN_AVR(9, 64, C); _DEFPIN_AVR(10, 128, C); _DEFPIN_AVR(11, 64, D);
_DEFPIN_AVR(12, 128, D); _DEFPIN_AVR(13, 16, B); _DEFPIN_AVR(14, 32, B); _DEFPIN_AVR(15, 64, B);
_DEFPIN_AVR(16, 128, F); _DEFPIN_AVR(17, 64, F); _DEFPIN_AVR(18, 32, F); _DEFPIN_AVR(19, 16, F);
_DEFPIN_AVR(20, 2, F); _DEFPIN_AVR(21, 1, F); _DEFPIN_AVR(22, 16, D); _DEFPIN_AVR(23, 32, D);
#define SPI_DATA 2
#define SPI_CLOCK 1
#define SPI_SELECT 0
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
// PD3/PD5
#define SPI_UART1_DATA 8
#define SPI_UART1_CLOCK 23
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
// teensy++ 2 defs
_IO(A); _IO(B); _IO(C); _IO(D); _IO(E); _IO(F);
#define MAX_PIN 45
_DEFPIN_AVR(0, 1, D); _DEFPIN_AVR(1, 2, D); _DEFPIN_AVR(2, 4, D); _DEFPIN_AVR(3, 8, D);
_DEFPIN_AVR(4, 16, D); _DEFPIN_AVR(5, 32, D); _DEFPIN_AVR(6, 64, D); _DEFPIN_AVR(7, 128, D);
_DEFPIN_AVR(8, 1, E); _DEFPIN_AVR(9, 2, E); _DEFPIN_AVR(10, 1, C); _DEFPIN_AVR(11, 2, C);
_DEFPIN_AVR(12, 4, C); _DEFPIN_AVR(13, 8, C); _DEFPIN_AVR(14, 16, C); _DEFPIN_AVR(15, 32, C);
_DEFPIN_AVR(16, 64, C); _DEFPIN_AVR(17, 128, C); _DEFPIN_AVR(18, 64, E); _DEFPIN_AVR(19, 128, E);
_DEFPIN_AVR(20, 1, B); _DEFPIN_AVR(21, 2, B); _DEFPIN_AVR(22, 4, B); _DEFPIN_AVR(23, 8, B);
_DEFPIN_AVR(24, 16, B); _DEFPIN_AVR(25, 32, B); _DEFPIN_AVR(26, 64, B); _DEFPIN_AVR(27, 128, B);
_DEFPIN_AVR(28, 1, A); _DEFPIN_AVR(29, 2, A); _DEFPIN_AVR(30, 4, A); _DEFPIN_AVR(31, 8, A);
_DEFPIN_AVR(32, 16, A); _DEFPIN_AVR(33, 32, A); _DEFPIN_AVR(34, 64, A); _DEFPIN_AVR(35, 128, A);
_DEFPIN_AVR(36, 16, E); _DEFPIN_AVR(37, 32, E); _DEFPIN_AVR(38, 1, F); _DEFPIN_AVR(39, 2, F);
_DEFPIN_AVR(40, 4, F); _DEFPIN_AVR(41, 8, F); _DEFPIN_AVR(42, 16, F); _DEFPIN_AVR(43, 32, F);
_DEFPIN_AVR(44, 64, F); _DEFPIN_AVR(45, 128, F);
#define SPI_DATA 22
#define SPI_CLOCK 21
#define SPI_SELECT 20
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
// PD3/PD5
#define SPI_UART1_DATA 3
#define SPI_UART1_CLOCK 5
#elif defined(__AVR_ATmega32U4__)
// leonard defs
_IO(B); _IO(C); _IO(D); _IO(E); _IO(F);
#define MAX_PIN 30
_DEFPIN_AVR(0, 4, D); _DEFPIN_AVR(1, 8, D); _DEFPIN_AVR(2, 2, D); _DEFPIN_AVR(3, 1, D);
_DEFPIN_AVR(4, 16, D); _DEFPIN_AVR(5, 64, C); _DEFPIN_AVR(6, 128, D); _DEFPIN_AVR(7, 64, E);
_DEFPIN_AVR(8, 16, B); _DEFPIN_AVR(9, 32, B); _DEFPIN_AVR(10, 64, B); _DEFPIN_AVR(11, 128, B);
_DEFPIN_AVR(12, 64, D); _DEFPIN_AVR(13, 128, C); _DEFPIN_AVR(14, 8, B); _DEFPIN_AVR(15, 2, B);
_DEFPIN_AVR(16, 4, B); _DEFPIN_AVR(17, 1, B); _DEFPIN_AVR(18, 128, F); _DEFPIN_AVR(19, 64, F);
_DEFPIN_AVR(20, 32, F); _DEFPIN_AVR(21, 16, F); _DEFPIN_AVR(22, 2, F); _DEFPIN_AVR(23, 1, F);
_DEFPIN_AVR(24, 16, D); _DEFPIN_AVR(25, 128, D); _DEFPIN_AVR(26, 16, B); _DEFPIN_AVR(27, 32, B);
_DEFPIN_AVR(28, 64, B); _DEFPIN_AVR(29, 64, D); _DEFPIN_AVR(30, 32, D);
#define SPI_DATA 16
#define SPI_CLOCK 15
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
// PD3/PD5
#define SPI_UART1_DATA 1
#define SPI_UART1_CLOCK 30
#endif
#endif // FASTLED_FORCE_SOFTWARE_PINS
FASTLED_NAMESPACE_END
#endif // __INC_FASTPIN_AVR_H

2
libraries/FastLED/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
html/
*.gch

View File

@@ -8,12 +8,12 @@
#define FASTLED_HAS_PRAGMA_MESSAGE #define FASTLED_HAS_PRAGMA_MESSAGE
#endif #endif
#define FASTLED_VERSION 3002009 #define FASTLED_VERSION 3003002
#ifndef FASTLED_INTERNAL #ifndef FASTLED_INTERNAL
# ifdef FASTLED_HAS_PRAGMA_MESSAGE # ifdef FASTLED_HAS_PRAGMA_MESSAGE
# pragma message "FastLED version 3.002.009" # pragma message "FastLED version 3.003.002"
# else # else
# warning FastLED version 3.002.009 (Not really a warning, just telling you here.) # warning FastLED version 3.003.002 (Not really a warning, just telling you here.)
# endif # endif
#endif #endif
@@ -315,6 +315,14 @@ public:
return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
} }
#if defined(__FASTLED_HAS_FIBCC) && (__FASTLED_HAS_FIBCC == 1)
template<uint8_t NUM_LANES, template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB>
static CLEDController &addLeds(struct CRGB *data, int nLeds) {
static __FIBCC<CHIPSET, DATA_PIN, NUM_LANES, RGB_ORDER> c;
return addLeds(&c, data, nLeds);
}
#endif
#ifdef FASTSPI_USE_DMX_SIMPLE #ifdef FASTSPI_USE_DMX_SIMPLE
template<EClocklessChipsets CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB> template<EClocklessChipsets CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB>
static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)

View File

@@ -1,5 +1,31 @@
=New platform porting guide= =New platform porting guide=
== Fast porting for a new board on existing hardware ==
Sometimes "porting" FastLED simply consists of supplying new pin definitions for the given platform. For example, platforms/avr/fastpin_avr.h contains various pin definitions for all the AVR variant chipsets/boards that FastLED supports. Defining a set of pins involves setting up a set of definitions - for example here's one full set from the avr fastpin file:
```
#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
_FL_IO(A); _FL_IO(B); _FL_IO(C); _FL_IO(D);
#define MAX_PIN 31
_FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); _FL_DEFPIN(3, 3, B);
_FL_DEFPIN(4, 4, B); _FL_DEFPIN(5, 5, B); _FL_DEFPIN(6, 6, B); _FL_DEFPIN(7, 7, B);
_FL_DEFPIN(8, 0, D); _FL_DEFPIN(9, 1, D); _FL_DEFPIN(10, 2, D); _FL_DEFPIN(11, 3, D);
_FL_DEFPIN(12, 4, D); _FL_DEFPIN(13, 5, D); _FL_DEFPIN(14, 6, D); _FL_DEFPIN(15, 7, D);
_FL_DEFPIN(16, 0, C); _FL_DEFPIN(17, 1, C); _FL_DEFPIN(18, 2, C); _FL_DEFPIN(19, 3, C);
_FL_DEFPIN(20, 4, C); _FL_DEFPIN(21, 5, C); _FL_DEFPIN(22, 6, C); _FL_DEFPIN(23, 7, C);
_FL_DEFPIN(24, 0, A); _FL_DEFPIN(25, 1, A); _FL_DEFPIN(26, 2, A); _FL_DEFPIN(27, 3, A);
_FL_DEFPIN(28, 4, A); _FL_DEFPIN(29, 5, A); _FL_DEFPIN(30, 6, A); _FL_DEFPIN(31, 7, A);
#define HAS_HARDWARE_PIN_SUPPORT 1
```
The ```_FL_IO``` macro is used to define the port registers for the platform while the ```_FL_DEFPIN``` macro is used to define pins. The parameters to the macro are the pin number, the bit on the port that represents that pin, and the port identifier itself. On some platforms, like the AVR, ports are identified by letter. On other platforms, like arm, ports are identified by number.
The ```HAS_HARDWARE_PIN_SUPPORT``` define tells the rest of the FastLED library that there is hardware pin support available. There may be other platform specific defines for things like hardware SPI ports and such.
== Setting up the basic files/folders == == Setting up the basic files/folders ==
* Create platform directory (e.g. platforms/arm/kl26) * Create platform directory (e.g. platforms/arm/kl26)

View File

@@ -4,7 +4,7 @@
IMPORTANT NOTE: For AVR based systems, avr-gcc 4.8.x is supported and tested. This means Arduino 1.6.5 and later. IMPORTANT NOTE: For AVR based systems, avr-gcc 4.8.x is supported and tested. This means Arduino 1.6.5 and later.
FastLED 3.2 FastLED 3.3
=========== ===========
This is a library for easily & efficiently controlling a wide variety of LED chipsets, like the ones This is a library for easily & efficiently controlling a wide variety of LED chipsets, like the ones
@@ -68,13 +68,14 @@ Right now the library is supported on a variety of arduino compatable platforms.
* Arduino & compatibles - straight up arduino devices, uno, duo, leonardo, mega, nano, etc... * Arduino & compatibles - straight up arduino devices, uno, duo, leonardo, mega, nano, etc...
* Arduino Yún * Arduino Yún
* Adafruit Trinket & Gemma - Trinket Pro may be supported, but haven't tested to confirm yet * Adafruit Trinket & Gemma - Trinket Pro may be supported, but haven't tested to confirm yet
* Teensy 2, Teensy++ 2, Teensy 3.0, Teensy 3.1/3.2, Teensy LC - arduino compataible from pjrc.com with some extra goodies (note the teensy 3, 3.1, and LC are ARM, not AVR!) * Teensy 2, Teensy++ 2, Teensy 3.0, Teensy 3.1/3.2, Teensy LC, Teensy 3.5, Teensy 3.6, and Teensy 4.0 - arduino compataible from pjrc.com with some extra goodies (note the teensy 3, 3.1, and LC are ARM, not AVR!)
* Arduino Due and the digistump DigiX * Arduino Due and the digistump DigiX
* RFDuino * RFDuino
* SparkCore * SparkCore
* Arduino Zero * Arduino Zero
* ESP8266 using the arduino board definitions from http://arduino.esp8266.com/stable/package_esp8266com_index.json - please be sure to also read https://github.com/FastLED/FastLED/wiki/ESP8266-notes for information specific to the 8266. * ESP8266 using the arduino board definitions from http://arduino.esp8266.com/stable/package_esp8266com_index.json - please be sure to also read https://github.com/FastLED/FastLED/wiki/ESP8266-notes for information specific to the 8266.
* The wino board - http://wino-board.com * The wino board - http://wino-board.com
* ESP32 based boards
What types of platforms are we thinking about supporting in the future? Here's a short list: ChipKit32, Maple, Beagleboard What types of platforms are we thinking about supporting in the future? Here's a short list: ChipKit32, Maple, Beagleboard

View File

@@ -77,7 +77,7 @@ protected:
/// @tparam CLOCK_PIN the clock pin for these leds /// @tparam CLOCK_PIN the clock pin for these leds
/// @tparam RGB_ORDER the RGB ordering for these leds /// @tparam RGB_ORDER the RGB ordering for these leds
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(12) /// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(12)
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(12) > template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(12) >
class LPD8806Controller : public CPixelLEDController<RGB_ORDER> { class LPD8806Controller : public CPixelLEDController<RGB_ORDER> {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
@@ -118,7 +118,7 @@ protected:
/// @tparam CLOCK_PIN the clock pin for these leds /// @tparam CLOCK_PIN the clock pin for these leds
/// @tparam RGB_ORDER the RGB ordering for these leds /// @tparam RGB_ORDER the RGB ordering for these leds
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(1) /// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(1)
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(1)> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(1)>
class WS2801Controller : public CPixelLEDController<RGB_ORDER> { class WS2801Controller : public CPixelLEDController<RGB_ORDER> {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
SPI mSPI; SPI mSPI;
@@ -140,7 +140,7 @@ protected:
} }
}; };
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(25)> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(25)>
class WS2803Controller : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {}; class WS2803Controller : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {};
/// LPD6803 controller class (LPD1101). /// LPD6803 controller class (LPD1101).
@@ -151,7 +151,7 @@ class WS2803Controller : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER,
/// @tparam CLOCK_PIN the clock pin for these leds /// @tparam CLOCK_PIN the clock pin for these leds
/// @tparam RGB_ORDER the RGB ordering for these leds /// @tparam RGB_ORDER the RGB ordering for these leds
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(12) /// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(12)
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(12)> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(12)>
class LPD6803Controller : public CPixelLEDController<RGB_ORDER> { class LPD6803Controller : public CPixelLEDController<RGB_ORDER> {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
SPI mSPI; SPI mSPI;
@@ -201,7 +201,7 @@ protected:
/// @tparam CLOCK_PIN the clock pin for these leds /// @tparam CLOCK_PIN the clock pin for these leds
/// @tparam RGB_ORDER the RGB ordering for these leds /// @tparam RGB_ORDER the RGB ordering for these leds
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(12) /// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(12)
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(12)> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(12)>
class APA102Controller : public CPixelLEDController<RGB_ORDER> { class APA102Controller : public CPixelLEDController<RGB_ORDER> {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
SPI mSPI; SPI mSPI;
@@ -266,7 +266,7 @@ protected:
/// @tparam CLOCK_PIN the clock pin for these leds /// @tparam CLOCK_PIN the clock pin for these leds
/// @tparam RGB_ORDER the RGB ordering for these leds /// @tparam RGB_ORDER the RGB ordering for these leds
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(24) /// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(24)
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(24)> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(24)>
class SK9822Controller : public CPixelLEDController<RGB_ORDER> { class SK9822Controller : public CPixelLEDController<RGB_ORDER> {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
SPI mSPI; SPI mSPI;
@@ -340,7 +340,7 @@ protected:
/// @tparam CLOCK_PIN the clock pin for these leds /// @tparam CLOCK_PIN the clock pin for these leds
/// @tparam RGB_ORDER the RGB ordering for these leds /// @tparam RGB_ORDER the RGB ordering for these leds
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(10) /// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(10)
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(10)> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(10)>
class P9813Controller : public CPixelLEDController<RGB_ORDER> { class P9813Controller : public CPixelLEDController<RGB_ORDER> {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
SPI mSPI; SPI mSPI;
@@ -390,7 +390,7 @@ protected:
/// @tparam CLOCK_PIN the clock pin for these leds /// @tparam CLOCK_PIN the clock pin for these leds
/// @tparam RGB_ORDER the RGB ordering for these leds /// @tparam RGB_ORDER the RGB ordering for these leds
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(16) /// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(16)
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(16)> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(16)>
class SM16716Controller : public CPixelLEDController<RGB_ORDER> { class SM16716Controller : public CPixelLEDController<RGB_ORDER> {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
SPI mSPI; SPI mSPI;
@@ -398,10 +398,15 @@ class SM16716Controller : public CPixelLEDController<RGB_ORDER> {
void writeHeader() { void writeHeader() {
// Write out 50 zeros to the spi line (6 blocks of 8 followed by two single bit writes) // Write out 50 zeros to the spi line (6 blocks of 8 followed by two single bit writes)
mSPI.select(); mSPI.select();
mSPI.writeBytesValueRaw(0, 6); mSPI.template writeBit<0>(0);
mSPI.writeByte(0);
mSPI.writeByte(0);
mSPI.writeByte(0);
mSPI.template writeBit<0>(0);
mSPI.writeByte(0);
mSPI.writeByte(0);
mSPI.writeByte(0);
mSPI.waitFully(); mSPI.waitFully();
mSPI.template writeBit<0>(0);
mSPI.template writeBit<0>(0);
mSPI.release(); mSPI.release();
} }
@@ -524,7 +529,13 @@ class PL9823Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL
// Similar to NS() macro, this calculates the number of cycles for // Similar to NS() macro, this calculates the number of cycles for
// the clockless chipset (which may differ from CPU cycles) // the clockless chipset (which may differ from CPU cycles)
#ifdef FASTLED_TEENSY4
// just use raw nanosecond values for the teensy4
#define C_NS(_NS) _NS
#else
#define C_NS(_NS) (((_NS * ((CLOCKLESS_FREQUENCY / 1000000L)) + 999)) / 1000) #define C_NS(_NS) (((_NS * ((CLOCKLESS_FREQUENCY / 1000000L)) + 999)) / 1000)
#endif
// GE8822 - 350ns 660ns 350ns // GE8822 - 350ns 660ns 350ns
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB> template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>

View File

@@ -1,6 +1,6 @@
#include <FastLED.h> #include <FastLED.h>
#define NUM_LEDS_PER_STRIP 64 #define NUM_LEDS_PER_STRIP 16
// Note: this can be 12 if you're using a teensy 3 and don't mind soldering the pads on the back // Note: this can be 12 if you're using a teensy 3 and don't mind soldering the pads on the back
#define NUM_STRIPS 16 #define NUM_STRIPS 16
@@ -17,15 +17,24 @@ CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
// WS2811_PORTD: 25,26,27,28,14,15,29,11 // WS2811_PORTD: 25,26,27,28,14,15,29,11
// //
// IBCC<WS2811, 1, 16> outputs;
void setup() { void setup() {
delay(5000);
Serial.begin(57600);
Serial.println("Starting...");
// LEDS.addLeds<WS2811_PORTA,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); // LEDS.addLeds<WS2811_PORTA,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP);
// LEDS.addLeds<WS2811_PORTB,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); // LEDS.addLeds<WS2811_PORTB,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP);
// LEDS.addLeds<WS2811_PORTD,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); // LEDS.addLeds<WS2811_PORTD,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);
LEDS.addLeds<WS2811_PORTDC,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP); LEDS.addLeds<WS2811_PORTDC,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP);
LEDS.setBrightness(32);
// Teensy 4 parallel output example
// LEDS.addLeds<NUM_STRIPS, WS2811, 1>(leds,NUM_LEDS_PER_STRIP);
} }
void loop() { void loop() {
Serial.println("Loop....");
static uint8_t hue = 0; static uint8_t hue = 0;
for(int i = 0; i < NUM_STRIPS; i++) { for(int i = 0; i < NUM_STRIPS; i++) {
for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) {
@@ -43,5 +52,5 @@ void loop() {
hue++; hue++;
LEDS.show(); LEDS.show();
LEDS.delay(10); // LEDS.delay(100);
} }

View File

@@ -0,0 +1,199 @@
#include <FastLED.h>
char fullstrBuffer[64];
const char *getPort(void *portPtr) {
// AVR port checks
#ifdef PORTA
if(portPtr == (void*)&PORTA) { return "PORTA"; }
#endif
#ifdef PORTB
if(portPtr == (void*)&PORTB) { return "PORTB"; }
#endif
#ifdef PORTC
if(portPtr == (void*)&PORTC) { return "PORTC"; }
#endif
#ifdef PORTD
if(portPtr == (void*)&PORTD) { return "PORTD"; }
#endif
#ifdef PORTE
if(portPtr == (void*)&PORTE) { return "PORTE"; }
#endif
#ifdef PORTF
if(portPtr == (void*)&PORTF) { return "PORTF"; }
#endif
#ifdef PORTG
if(portPtr == (void*)&PORTG) { return "PORTG"; }
#endif
#ifdef PORTH
if(portPtr == (void*)&PORTH) { return "PORTH"; }
#endif
#ifdef PORTI
if(portPtr == (void*)&PORTI) { return "PORTI"; }
#endif
#ifdef PORTJ
if(portPtr == (void*)&PORTJ) { return "PORTJ"; }
#endif
#ifdef PORTK
if(portPtr == (void*)&PORTK) { return "PORTK"; }
#endif
#ifdef PORTL
if(portPtr == (void*)&PORTL) { return "PORTL"; }
#endif
// Teensy 3.x port checks
#ifdef GPIO_A_PDOR
if(portPtr == (void*)&GPIO_A_PDOR) { return "GPIO_A_PDOR"; }
#endif
#ifdef GPIO_B_PDOR
if(portPtr == (void*)&GPIO_B_PDOR) { return "GPIO_B_PDOR"; }
#endif
#ifdef GPIO_C_PDOR
if(portPtr == (void*)&GPIO_C_PDOR) { return "GPIO_C_PDOR"; }
#endif
#ifdef GPIO_D_PDOR
if(portPtr == (void*)&GPIO_D_PDOR) { return "GPIO_D_PDOR"; }
#endif
#ifdef GPIO_E_PDOR
if(portPtr == (void*)&GPIO_E_PDOR) { return "GPIO_E_PDOR"; }
#endif
#ifdef REG_PIO_A_ODSR
if(portPtr == (void*)&REG_PIO_A_ODSR) { return "REG_PIO_A_ODSR"; }
#endif
#ifdef REG_PIO_B_ODSR
if(portPtr == (void*)&REG_PIO_B_ODSR) { return "REG_PIO_B_ODSR"; }
#endif
#ifdef REG_PIO_C_ODSR
if(portPtr == (void*)&REG_PIO_C_ODSR) { return "REG_PIO_C_ODSR"; }
#endif
#ifdef REG_PIO_D_ODSR
if(portPtr == (void*)&REG_PIO_D_ODSR) { return "REG_PIO_D_ODSR"; }
#endif
// Teensy 4 port checks
#ifdef GPIO1_DR
if(portPtr == (void*)&GPIO1_DR) { return "GPIO1_DR"; }
#endif
#ifdef GPIO2_DR
if(portPtr == (void*)&GPIO2_DR) { return "GPIO21_DR"; }
#endif
#ifdef GPIO3_DR
if(portPtr == (void*)&GPIO3_DR) { return "GPIO3_DR"; }
#endif
#ifdef GPIO4_DR
if(portPtr == (void*)&GPIO4_DR) { return "GPIO4_DR"; }
#endif
String unknown_str = "Unknown: " + String((size_t)portPtr, HEX);
strncpy(fullstrBuffer, unknown_str.c_str(), unknown_str.length());
fullstrBuffer[sizeof(fullstrBuffer)-1] = '\0';
return fullstrBuffer;
}
template<uint8_t PIN> void CheckPin()
{
CheckPin<PIN - 1>();
void *systemThinksPortIs = (void*)portOutputRegister(digitalPinToPort(PIN));
RwReg systemThinksMaskIs = digitalPinToBitMask(PIN);
Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port ");
if(systemThinksPortIs == (void*)FastPin<PIN>::port()) {
Serial.print("valid & mask ");
} else {
Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin<PIN>::port())); Serial.print(" should be ");
Serial.print(getPort((void*)systemThinksPortIs));
Serial.print(" & mask ");
}
if(systemThinksMaskIs == FastPin<PIN>::mask()) {
Serial.println("valid.");
} else {
Serial.print("invalid, is "); Serial.print(FastPin<PIN>::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs);
}
}
template<> void CheckPin<255> () {}
template<uint8_t _PORT> const char *_GetPinPort(void *ptr) {
if (__FL_PORT_INFO<_PORT>::hasPort() && (ptr == (void*)__FL_PORT_INFO<_PORT>::portAddr())) {
return __FL_PORT_INFO<_PORT>::portName();
} else {
return _GetPinPort<_PORT - 1>(ptr);
}
}
template<> const char *_GetPinPort<-1>(void *ptr) {
return NULL;
}
const char *GetPinPort(void *ptr) {
return _GetPinPort<'Z'>(ptr);
}
static uint8_t pcount = 0;
template<uint8_t PIN> void PrintPins() {
PrintPins<PIN - 1>();
RwReg *systemThinksPortIs = portOutputRegister(digitalPinToPort(PIN));
RwReg systemThinksMaskIs = digitalPinToBitMask(PIN);
int maskBit = 0;
while(systemThinksMaskIs > 1) { systemThinksMaskIs >>= 1; maskBit++; }
const char *pinport = GetPinPort((void*)systemThinksPortIs);
if (pinport) {
Serial.print("__FL_DEFPIN("); Serial.print(PIN);
Serial.print(","); Serial.print(maskBit);
Serial.print(","); Serial.print(pinport);
Serial.print("); ");
pcount++;
if(pcount == 4) { pcount = 0; Serial.println(""); }
} else {
// Serial.print("Not found for pin "); Serial.println(PIN);
}
}
template<> void PrintPins<0>() {
RwReg *systemThinksPortIs = portOutputRegister(digitalPinToPort(0));
RwReg systemThinksMaskIs = digitalPinToBitMask(0);
int maskBit = 0;
while(systemThinksMaskIs > 1) { systemThinksMaskIs >>= 1; maskBit++; }
const char *pinport = GetPinPort((void*)systemThinksPortIs);
if (pinport) {
Serial.print("__FL_DEFPIN("); Serial.print(0);
Serial.print(","); Serial.print(maskBit);
Serial.print(","); Serial.print(pinport);
Serial.print("); ");
pcount++;
if(pcount == 4) { pcount = 0; Serial.println(""); }
}
}
int counter = 0;
void setup() {
delay(5000);
Serial.begin(38400);
Serial.println("resetting!");
}
void loop() {
Serial.println(counter);
#ifdef MAX_PIN
CheckPin<MAX_PIN>();
#endif
Serial.println("-----");
#ifdef NUM_DIGITAL_PINS
PrintPins<NUM_DIGITAL_PINS>();
#endif
Serial.println("------");
delay(100000);
}

View File

@@ -69,7 +69,7 @@ FASTLED_NAMESPACE_BEGIN
// force 4-byte alignment as needed. The FastLED gradient // force 4-byte alignment as needed. The FastLED gradient
// palette code uses 'read dword', and now uses this macro // palette code uses 'read dword', and now uses this macro
// to make sure that gradient palettes are 4-byte aligned. // to make sure that gradient palettes are 4-byte aligned.
#if defined(FASTLED_ARM) || defined(ESP32) #if defined(FASTLED_ARM) || defined(ESP32) || defined(ESP8266)
#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4))) #define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
#else #else
#define FL_ALIGN_PROGMEM #define FL_ALIGN_PROGMEM

View File

@@ -241,6 +241,28 @@ template<uint8_t PIN> class FastPinBB : public FastPin<PIN> {};
typedef volatile uint32_t & reg32_t; typedef volatile uint32_t & reg32_t;
typedef volatile uint32_t * ptr_reg32_t; typedef volatile uint32_t * ptr_reg32_t;
// Utility templates for tracking down information about pins and ports
template<uint8_t port> struct __FL_PORT_INFO {
static bool hasPort() { return 0; }
static const char *portName() { return "--"; }
static const void *portAddr() { return NULL; }
};
// Give us our instantiations for defined ports - we're going to abuse this later for
// auto discovery of pin/port mappings for new variants. Use _FL_DEFINE_PORT for ports that
// are numeric in nature, e.g. GPIO0, GPIO1. Use _FL_DEFINE_PORT3 for ports that are letters.
// The first parameter will be the letter, the second parameter will be an integer/counter of smoe kind
// (this is because attempts to turn macro parameters into character constants break in some compilers)
#define _FL_DEFINE_PORT(L, BASE) template<> struct __FL_PORT_INFO<L> { static bool hasPort() { return 1; } \
static const char *portName() { return #L; } \
typedef BASE __t_baseType; \
static const void *portAddr() { return (void*)&__t_baseType::r(); } };
#define _FL_DEFINE_PORT3(L, LC, BASE) template<> struct __FL_PORT_INFO<LC> { static bool hasPort() { return 1; } \
static const char *portName() { return #L; } \
typedef BASE __t_baseType; \
static const void *portAddr() { return (void*)&__t_baseType::r(); } };
FASTLED_NAMESPACE_END FASTLED_NAMESPACE_END
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View File

@@ -13,6 +13,10 @@ FASTLED_NAMESPACE_BEGIN
#if defined(FASTLED_TEENSY3) && (F_CPU > 48000000) #if defined(FASTLED_TEENSY3) && (F_CPU > 48000000)
#define DATA_RATE_MHZ(X) (((48000000L / 1000000L) / X)) #define DATA_RATE_MHZ(X) (((48000000L / 1000000L) / X))
#define DATA_RATE_KHZ(X) (((48000000L / 1000L) / X)) #define DATA_RATE_KHZ(X) (((48000000L / 1000L) / X))
#elif defined(FASTLED_TEENSY4) // && (ARM_HARDWARE_SPI)
// just use clocks
#define DATA_RATE_MHZ(X) (1000000 * (X))
#define DATA_RATE_KHZ(X) (1000 * (X))
#else #else
#define DATA_RATE_MHZ(X) ((F_CPU / 1000000L) / X) #define DATA_RATE_MHZ(X) ((F_CPU / 1000000L) / X)
#define DATA_RATE_KHZ(X) ((F_CPU / 1000L) / X) #define DATA_RATE_KHZ(X) ((F_CPU / 1000L) / X)
@@ -26,22 +30,22 @@ FASTLED_NAMESPACE_BEGIN
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#if !defined(FASTLED_ALL_PINS_HARDWARE_SPI) #if !defined(FASTLED_ALL_PINS_HARDWARE_SPI)
template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER> template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint32_t _SPI_CLOCK_DIVIDER>
class SPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; class SPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
#endif #endif
template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER> template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint32_t _SPI_CLOCK_DIVIDER>
class SoftwareSPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; class SoftwareSPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
#ifndef FASTLED_FORCE_SOFTWARE_SPI #ifndef FASTLED_FORCE_SOFTWARE_SPI
#if defined(NRF51) && defined(FASTLED_ALL_PINS_HARDWARE_SPI) #if defined(NRF51) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER> template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint32_t _SPI_CLOCK_DIVIDER>
class SPIOutput : public NRF51SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; class SPIOutput : public NRF51SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
#endif #endif
#if defined(NRF52_SERIES) && defined(FASTLED_ALL_PINS_HARDWARE_SPI) #if defined(NRF52_SERIES) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER> template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint32_t _SPI_CLOCK_DIVIDER>
class SPIOutput : public NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; class SPIOutput : public NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
#endif #endif
@@ -49,26 +53,37 @@ class SPIOutput : public NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDE
#if defined(FASTLED_TEENSY3) && defined(ARM_HARDWARE_SPI) #if defined(FASTLED_TEENSY3) && defined(ARM_HARDWARE_SPI)
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED, 0x4002C000> {}; class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED, 0x4002C000> {};
#if defined(SPI2_DATA) #if defined(SPI2_DATA)
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED, 0x4002C000> {}; class SPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED, 0x4002C000> {};
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI_DATA, SPI2_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI_DATA, SPI2_CLOCK, SPI_SPEED, 0x4002C000> {}; class SPIOutput<SPI_DATA, SPI2_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI_DATA, SPI2_CLOCK, SPI_SPEED, 0x4002C000> {};
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI2_DATA, SPI_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI2_DATA, SPI_CLOCK, SPI_SPEED, 0x4002C000> {}; class SPIOutput<SPI2_DATA, SPI_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI2_DATA, SPI_CLOCK, SPI_SPEED, 0x4002C000> {};
#endif #endif
#elif defined(FASTLED_TEENSY4) && defined(ARM_HARDWARE_SPI)
template<uint32_t SPI_SPEED>
class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public Teesy4HardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED, SPI, 0> {};
template<uint32_t SPI_SPEED>
class SPIOutput<SPI1_DATA, SPI_CLOCK, SPI_SPEED> : public Teesy4HardwareSPIOutput<SPI1_DATA, SPI1_CLOCK, SPI_SPEED, SPI1, 1> {};
template<uint32_t SPI_SPEED>
class SPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED> : public Teesy4HardwareSPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED, SPI2, 2> {};
#elif defined(FASTLED_TEENSYLC) && defined(ARM_HARDWARE_SPI) #elif defined(FASTLED_TEENSYLC) && defined(ARM_HARDWARE_SPI)
#define DECLARE_SPI0(__DATA,__CLOCK) template<uint8_t SPI_SPEED>\ #define DECLARE_SPI0(__DATA,__CLOCK) template<uint32_t SPI_SPEED>\
class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40076000> {}; class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40076000> {};
#define DECLARE_SPI1(__DATA,__CLOCK) template<uint8_t SPI_SPEED>\ #define DECLARE_SPI1(__DATA,__CLOCK) template<uint32_t SPI_SPEED>\
class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40077000> {}; class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40077000> {};
DECLARE_SPI0(7,13); DECLARE_SPI0(7,13);
@@ -85,24 +100,24 @@ DECLARE_SPI1(21,20);
#elif defined(__SAM3X8E__) #elif defined(__SAM3X8E__)
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public SAMHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> {}; class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public SAMHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> {};
#elif defined(AVR_HARDWARE_SPI) #elif defined(AVR_HARDWARE_SPI)
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public AVRHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> {}; class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public AVRHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> {};
#if defined(SPI_UART0_DATA) #if defined(SPI_UART0_DATA)
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI_UART0_DATA, SPI_UART0_CLOCK, SPI_SPEED> : public AVRUSART0SPIOutput<SPI_UART0_DATA, SPI_UART0_CLOCK, SPI_SPEED> {}; class SPIOutput<SPI_UART0_DATA, SPI_UART0_CLOCK, SPI_SPEED> : public AVRUSART0SPIOutput<SPI_UART0_DATA, SPI_UART0_CLOCK, SPI_SPEED> {};
#endif #endif
#if defined(SPI_UART1_DATA) #if defined(SPI_UART1_DATA)
template<uint8_t SPI_SPEED> template<uint32_t SPI_SPEED>
class SPIOutput<SPI_UART1_DATA, SPI_UART1_CLOCK, SPI_SPEED> : public AVRUSART1SPIOutput<SPI_UART1_DATA, SPI_UART1_CLOCK, SPI_SPEED> {}; class SPIOutput<SPI_UART1_DATA, SPI_UART1_CLOCK, SPI_SPEED> : public AVRUSART1SPIOutput<SPI_UART1_DATA, SPI_UART1_CLOCK, SPI_SPEED> {};
#endif #endif
@@ -120,7 +135,7 @@ class SPIOutput<SPI_UART1_DATA, SPI_UART1_CLOCK, SPI_SPEED> : public AVRUSART1SP
#endif #endif
// #if defined(USART_DATA) && defined(USART_CLOCK) // #if defined(USART_DATA) && defined(USART_CLOCK)
// template<uint8_t SPI_SPEED> // template<uint32_t SPI_SPEED>
// class AVRSPIOutput<USART_DATA, USART_CLOCK, SPI_SPEED> : public AVRUSARTSPIOutput<USART_DATA, USART_CLOCK, SPI_SPEED> {}; // class AVRSPIOutput<USART_DATA, USART_CLOCK, SPI_SPEED> : public AVRUSARTSPIOutput<USART_DATA, USART_CLOCK, SPI_SPEED> {};
// #endif // #endif

View File

@@ -15,7 +15,7 @@ FASTLED_NAMESPACE_BEGIN
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint8_t SPI_SPEED> template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint32_t SPI_SPEED>
class AVRSoftwareSPIOutput { class AVRSoftwareSPIOutput {
// The data types for pointers to the pin port - typedef'd here from the Pin definition because on avr these // The data types for pointers to the pin port - typedef'd here from the Pin definition because on avr these
// are pointers to 8 bit values, while on arm they are 32 bit // are pointers to 8 bit values, while on arm they are 32 bit
@@ -113,10 +113,16 @@ private:
public: public:
// We want to make sure that the clock pulse is held high for a nininum of 35ns. // We want to make sure that the clock pulse is held high for a nininum of 35ns.
#define MIN_DELAY (NS(35) - 3) #if defined(FASTLED_TEENSY4)
#define DELAY_NS (1000 / (SPI_SPEED/1000000))
#define CLOCK_HI_DELAY do { delayNanoseconds((DELAY_NS/4)); } while(0);
#define CLOCK_LO_DELAY do { delayNanoseconds((DELAY_NS/4)); } while(0);
#else
#define MIN_DELAY ((NS(35)>3) ? (NS(35) - 3) : 1)
#define CLOCK_HI_DELAY delaycycles<MIN_DELAY>(); delaycycles<(((SPI_SPEED-6) / 2) - MIN_DELAY)>(); #define CLOCK_HI_DELAY do { delaycycles<MIN_DELAY>(); delaycycles<((SPI_SPEED > 10) ? (((SPI_SPEED-6) / 2) - MIN_DELAY) : (SPI_SPEED))>(); } while(0);
#define CLOCK_LO_DELAY delaycycles<(((SPI_SPEED-6) / 4))>(); #define CLOCK_LO_DELAY do { delaycycles<((SPI_SPEED > 10) ? ((SPI_SPEED-6) / 2) : (SPI_SPEED))>(); } while(0);
#endif
// write the BIT'th bit out via spi, setting the data pin then strobing the clcok // write the BIT'th bit out via spi, setting the data pin then strobing the clcok
template <uint8_t BIT> __attribute__((always_inline, hot)) inline static void writeBit(uint8_t b) { template <uint8_t BIT> __attribute__((always_inline, hot)) inline static void writeBit(uint8_t b) {
@@ -126,8 +132,8 @@ public:
#ifdef ESP32 #ifdef ESP32
// try to ensure we never have adjacent write opcodes to the same register // try to ensure we never have adjacent write opcodes to the same register
FastPin<CLOCK_PIN>::lo(); FastPin<CLOCK_PIN>::lo();
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY; FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
FastPin<CLOCK_PIN>::toggle(); CLOCK_LO_DELAY; FastPin<CLOCK_PIN>::toggle(); CLOCK_LO_DELAY;
#else #else
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY; FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY; FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
@@ -137,7 +143,7 @@ public:
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY; FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
#ifdef ESP32 #ifdef ESP32
// try to ensure we never have adjacent write opcodes to the same register // try to ensure we never have adjacent write opcodes to the same register
FastPin<CLOCK_PIN>::toggle(); CLOCK_HI_DELAY; FastPin<CLOCK_PIN>::toggle(); CLOCK_HI_DELAY;
#else #else
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY; FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
#endif #endif

View File

@@ -10,7 +10,7 @@ FASTLED_NAMESPACE_BEGIN
/// A nop/stub class, mostly to show the SPI methods that are needed/used by the various SPI chipset implementations. Should /// A nop/stub class, mostly to show the SPI methods that are needed/used by the various SPI chipset implementations. Should
/// be used as a definition for the set of methods that the spi implementation classes should use (since C++ doesn't support the /// be used as a definition for the set of methods that the spi implementation classes should use (since C++ doesn't support the
/// idea of interfaces - it's possible this could be done with virtual classes, need to decide if i want that overhead) /// idea of interfaces - it's possible this could be done with virtual classes, need to decide if i want that overhead)
template <uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER> template <uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint32_t _SPI_CLOCK_DIVIDER>
class NOPSPIOutput { class NOPSPIOutput {
Selectable *m_pSelect; Selectable *m_pSelect;

View File

@@ -8,7 +8,7 @@ FASTLED_NAMESPACE_BEGIN
// A skeletal implementation of hardware SPI support. Fill in the necessary code for init, waiting, and writing. The rest of // A skeletal implementation of hardware SPI support. Fill in the necessary code for init, waiting, and writing. The rest of
// the method implementations should provide a starting point, even if not hte most efficient to start with // the method implementations should provide a starting point, even if not hte most efficient to start with
template <uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER> template <uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint32_t _SPI_CLOCK_DIVIDER>
class REFHardwareSPIOutput { class REFHardwareSPIOutput {
Selectable *m_pSelect; Selectable *m_pSelect;
public: public:

View File

@@ -294,41 +294,52 @@ CRGB::YellowGreen KEYWORD2
####################################### #######################################
# Chipsets # Chipsets
LPD6803 LITERAL1
LPD8806 LITERAL1
WS2801 LITERAL1
WS2803 LITERAL1
P9813 LITERAL1
SM16716 LITERAL1
APA102 LITERAL1 APA102 LITERAL1
APA104 LITERAL1
APA106 LITERAL1
DMXSERIAL LITERAL1 DMXSERIAL LITERAL1
DMXSIMPLE LITERAL1 DMXSIMPLE LITERAL1
TM1829 LITERAL1 DOTSTAR LITERAL1
TM1809 LITERAL1 GE8822 LITERAL1
TM1804 LITERAL1 GS1903 LITERAL1
TM1803 LITERAL1
APA104 LITERAL1
WS2811 LITERAL1
WS2812 LITERAL1
WS2812B LITERAL1
WS2811_400 LITERAL1
WS2813 LITERAL1
NEOPIXEL LITERAL1
UCS1903 LITERAL1
UCS1903B LITERAL1
GW6205 LITERAL1 GW6205 LITERAL1
GW6205B LITERAL1 GW6205B LITERAL1
GW6205_400 LITERAL1
LPD1886 LITERAL1 LPD1886 LITERAL1
LPD1886_8BIT LITERAL1
LPD6803 LITERAL1
LPD8806 LITERAL1
NEOPIXEL LITERAL1
OCTOWS2811 LITERAL1 OCTOWS2811 LITERAL1
OCTOWS2811_400 LITERAL1 OCTOWS2811_400 LITERAL1
OCTOWS2813 LITERAL1 OCTOWS2813 LITERAL1
WS2812SERIAL LITERAL1 P9813 LITERAL1
SMART_MATRIX LITERAL1 PIXIE LITERAL1
GE8822 LITERAL1 PL9823 LITERAL1
SK6812 LITERAL1
SK6822 LITERAL1
SK9822 LITERAL1
SM16703 LITERAL1 SM16703 LITERAL1
GS1903 LITERAL1 SM16716 LITERAL1
LPD6803 LITERAL1 SMART_MATRIX LITERAL1
TM1803 LITERAL1
TM1804 LITERAL1
TM1809 LITERAL1
TM1812 LITERAL1
TM1829 LITERAL1
UCS1903 LITERAL1
UCS1903B LITERAL1
UCS1904 LITERAL1
UCS2903 LITERAL1
WS2801 LITERAL1
WS2803 LITERAL1
WS2811 LITERAL1
WS2811_400 LITERAL1
WS2812 LITERAL1
WS2812B LITERAL1
WS2812SERIAL LITERAL1
WS2813 LITERAL1
WS2852 LITERAL1
# RGB orderings # RGB orderings
RGB LITERAL1 RGB LITERAL1

View File

@@ -18,6 +18,9 @@
#elif defined(__MKL26Z64__) #elif defined(__MKL26Z64__)
// Include kl26/T-LC headers // Include kl26/T-LC headers
#include "platforms/arm/kl26/led_sysdefs_arm_kl26.h" #include "platforms/arm/kl26/led_sysdefs_arm_kl26.h"
#elif defined(__IMXRT1062__)
// teensy4
#include "platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h"
#elif defined(__SAM3X8E__) #elif defined(__SAM3X8E__)
// Include sam/due headers // Include sam/due headers
#include "platforms/arm/sam/led_sysdefs_arm_sam.h" #include "platforms/arm/sam/led_sysdefs_arm_sam.h"

View File

@@ -18,7 +18,7 @@
"type": "git", "type": "git",
"url": "https://github.com/FastLED/FastLED.git" "url": "https://github.com/FastLED/FastLED.git"
}, },
"version": "3.2.9", "version": "3.3.2",
"license": "MIT", "license": "MIT",
"homepage": "http://fastled.io", "homepage": "http://fastled.io",
"frameworks": "arduino", "frameworks": "arduino",

View File

@@ -1,5 +1,5 @@
name=FastLED name=FastLED
version=3.2.9 version=3.3.2
author=Daniel Garcia author=Daniel Garcia
maintainer=Daniel Garcia <dgarcia@fastled.io> maintainer=Daniel Garcia <dgarcia@fastled.io>
sentence=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions. sentence=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions.

Some files were not shown because too many files have changed in this diff Show More