diff --git a/firmware/GyverLamp_v1.4/FavoritesManager.h b/firmware/GyverLamp_v1.4/FavoritesManager.h index 2ad7467..64c077e 100644 --- a/firmware/GyverLamp_v1.4/FavoritesManager.h +++ b/firmware/GyverLamp_v1.4/FavoritesManager.h @@ -3,8 +3,8 @@ #include "EepromManager.h" #include "Constants.h" -#define DEFAULT_FAVORITES_INTERVAL (300U) // значение по умолчанию для интервала переключения избпранных эффектов в секундах -#define DEFAULT_FAVORITES_DISPERSION (0U) // значение по умолчанию для разброса интервала переключения избпранных эффектов в секундах +#define DEFAULT_FAVORITES_INTERVAL (300U) // значение по умолчанию для интервала переключения избранных эффектов в секундах +#define DEFAULT_FAVORITES_DISPERSION (0U) // значение по умолчанию для разброса интервала переключения избранных эффектов в секундах class FavoritesManager diff --git a/libraries/AsyncTCP/.github/scripts/install-arduino-core-esp32.sh b/libraries/AsyncTCP/.github/scripts/install-arduino-core-esp32.sh new file mode 100644 index 0000000..cf1026d --- /dev/null +++ b/libraries/AsyncTCP/.github/scripts/install-arduino-core-esp32.sh @@ -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 diff --git a/libraries/AsyncTCP/.github/scripts/install-arduino-ide.sh b/libraries/AsyncTCP/.github/scripts/install-arduino-ide.sh new file mode 100644 index 0000000..7e268b1 --- /dev/null +++ b/libraries/AsyncTCP/.github/scripts/install-arduino-ide.sh @@ -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 [extra-options] + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_sketch [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 +{ + 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 [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 [ ] [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 +} diff --git a/libraries/AsyncTCP/.github/scripts/install-platformio.sh b/libraries/AsyncTCP/.github/scripts/install-platformio.sh new file mode 100644 index 0000000..61c94fe --- /dev/null +++ b/libraries/AsyncTCP/.github/scripts/install-platformio.sh @@ -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 + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_pio_sketch " + 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 +{ + 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 +{ + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_pio_sketches [ ]" + 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 +} diff --git a/libraries/AsyncTCP/.github/scripts/on-push.sh b/libraries/AsyncTCP/.github/scripts/on-push.sh new file mode 100644 index 0000000..ece5d7a --- /dev/null +++ b/libraries/AsyncTCP/.github/scripts/on-push.sh @@ -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 diff --git a/libraries/AsyncTCP/.github/stale.yml b/libraries/AsyncTCP/.github/stale.yml new file mode 100644 index 0000000..ce7a8e3 --- /dev/null +++ b/libraries/AsyncTCP/.github/stale.yml @@ -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. + diff --git a/libraries/AsyncTCP/.github/workflows/push.yml b/libraries/AsyncTCP/.github/workflows/push.yml new file mode 100644 index 0000000..15cd441 --- /dev/null +++ b/libraries/AsyncTCP/.github/workflows/push.yml @@ -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 diff --git a/libraries/AsyncTCP/.travis.yml b/libraries/AsyncTCP/.travis.yml index bc36dba..dbfc064 100644 --- a/libraries/AsyncTCP/.travis.yml +++ b/libraries/AsyncTCP/.travis.yml @@ -15,12 +15,12 @@ jobs: - name: "Arduino Build" if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) stage: build - script: bash $TRAVIS_BUILD_DIR/travis/build.sh + script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh - name: "PlatformIO Build" if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) stage: build - script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh + script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 1 1 notifications: email: diff --git a/libraries/AsyncTCP/library.json b/libraries/AsyncTCP/library.json index e542ab1..89f90e4 100644 --- a/libraries/AsyncTCP/library.json +++ b/libraries/AsyncTCP/library.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/me-no-dev/AsyncTCP.git" }, - "version": "1.1.0", + "version": "1.1.1", "license": "LGPL-3.0", "frameworks": "arduino", "platforms": "espressif32", diff --git a/libraries/AsyncTCP/library.properties b/libraries/AsyncTCP/library.properties index 88cf013..eb4e26e 100644 --- a/libraries/AsyncTCP/library.properties +++ b/libraries/AsyncTCP/library.properties @@ -1,5 +1,5 @@ name=AsyncTCP -version=1.1.0 +version=1.1.1 author=Me-No-Dev maintainer=Me-No-Dev sentence=Async TCP Library for ESP32 diff --git a/libraries/AsyncTCP/src/AsyncTCP.cpp b/libraries/AsyncTCP/src/AsyncTCP.cpp index 5259400..89ff6ee 100644 --- a/libraries/AsyncTCP/src/AsyncTCP.cpp +++ b/libraries/AsyncTCP/src/AsyncTCP.cpp @@ -78,9 +78,20 @@ typedef struct { static xQueueHandle _async_queue; static TaskHandle_t _async_service_task_handle = NULL; + + +SemaphoreHandle_t _slots_lock; const int _number_of_closed_slots = CONFIG_LWIP_MAX_ACTIVE_TCP; -static int _closed_index = 0; -static int _closed_slots[_number_of_closed_slots]; +static uint32_t _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(){ 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){ - 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); } else if(e->event == LWIP_TCP_RECV){ //ets_printf("-R: 0x%08x\n", e->recv.pcb); @@ -554,23 +568,7 @@ AsyncClient::AsyncClient(tcp_pcb* pcb) _pcb = pcb; _closed_slot = -1; if(_pcb){ - _closed_slot = 0; - 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; - + _allocate_closed_slot(); _rx_last_packet = millis(); tcp_arg(_pcb, this); tcp_recv(_pcb, &_tcp_recv); @@ -584,6 +582,7 @@ AsyncClient::~AsyncClient(){ if(_pcb) { _close(); } + _free_closed_slot(); } /* @@ -709,7 +708,6 @@ bool AsyncClient::connect(const char* host, uint16_t port){ ip_addr_t addr; if(!_start_async_task()){ - Serial.println("failed to start task"); log_e("failed to start task"); return false; } @@ -820,6 +818,29 @@ int8_t AsyncClient::_close(){ 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 * */ @@ -842,10 +863,12 @@ int8_t AsyncClient::_connected(void* pcb, int8_t err){ void AsyncClient::_error(int8_t err) { if(_pcb){ tcp_arg(_pcb, NULL); - tcp_sent(_pcb, NULL); - tcp_recv(_pcb, NULL); - tcp_err(_pcb, NULL); - tcp_poll(_pcb, NULL, 0); + if(_pcb->state == LISTEN) { + tcp_sent(_pcb, NULL); + tcp_recv(_pcb, NULL); + tcp_err(_pcb, NULL); + tcp_poll(_pcb, NULL, 0); + } _pcb = NULL; } if(_error_cb) { @@ -863,15 +886,16 @@ int8_t AsyncClient::_lwip_fin(tcp_pcb* pcb, int8_t err) { return ERR_OK; } tcp_arg(_pcb, NULL); - tcp_sent(_pcb, NULL); - tcp_recv(_pcb, NULL); - tcp_err(_pcb, NULL); - tcp_poll(_pcb, NULL, 0); + if(_pcb->state == LISTEN) { + tcp_sent(_pcb, NULL); + tcp_recv(_pcb, NULL); + tcp_err(_pcb, NULL); + tcp_poll(_pcb, NULL, 0); + } if(tcp_close(_pcb) != ERR_OK) { tcp_abort(_pcb); } - _closed_slots[_closed_slot] = _closed_index; - ++ _closed_index; + _free_closed_slot(); _pcb = NULL; return ERR_OK; } diff --git a/libraries/AsyncTCP/src/AsyncTCP.h b/libraries/AsyncTCP/src/AsyncTCP.h index fef890b..ac87ded 100644 --- a/libraries/AsyncTCP/src/AsyncTCP.h +++ b/libraries/AsyncTCP/src/AsyncTCP.h @@ -170,6 +170,8 @@ class AsyncClient { uint16_t _connect_port; int8_t _close(); + void _free_closed_slot(); + void _allocate_closed_slot(); int8_t _connected(void* pcb, int8_t err); void _error(int8_t err); int8_t _poll(tcp_pcb* pcb); diff --git a/libraries/AsyncTCP/travis/build-pio.sh b/libraries/AsyncTCP/travis/build-pio.sh deleted file mode 100644 index 083b473..0000000 --- a/libraries/AsyncTCP/travis/build-pio.sh +++ /dev/null @@ -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" diff --git a/libraries/AsyncTCP/travis/build.sh b/libraries/AsyncTCP/travis/build.sh deleted file mode 100644 index 4992310..0000000 --- a/libraries/AsyncTCP/travis/build.sh +++ /dev/null @@ -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" diff --git a/libraries/ESPAsyncTCP/.github/scripts/install-arduino-core-esp8266.sh b/libraries/ESPAsyncTCP/.github/scripts/install-arduino-core-esp8266.sh new file mode 100644 index 0000000..048cd02 --- /dev/null +++ b/libraries/ESPAsyncTCP/.github/scripts/install-arduino-core-esp8266.sh @@ -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 "" diff --git a/libraries/ESPAsyncTCP/.github/scripts/install-arduino-ide.sh b/libraries/ESPAsyncTCP/.github/scripts/install-arduino-ide.sh new file mode 100644 index 0000000..7e268b1 --- /dev/null +++ b/libraries/ESPAsyncTCP/.github/scripts/install-arduino-ide.sh @@ -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 [extra-options] + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_sketch [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 +{ + 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 [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 [ ] [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 +} diff --git a/libraries/ESPAsyncTCP/.github/scripts/install-platformio.sh b/libraries/ESPAsyncTCP/.github/scripts/install-platformio.sh new file mode 100644 index 0000000..61c94fe --- /dev/null +++ b/libraries/ESPAsyncTCP/.github/scripts/install-platformio.sh @@ -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 + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_pio_sketch " + 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 +{ + 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 +{ + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_pio_sketches [ ]" + 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 +} diff --git a/libraries/ESPAsyncTCP/.github/scripts/on-push.sh b/libraries/ESPAsyncTCP/.github/scripts/on-push.sh new file mode 100644 index 0000000..7ae8c43 --- /dev/null +++ b/libraries/ESPAsyncTCP/.github/scripts/on-push.sh @@ -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 diff --git a/libraries/ESPAsyncTCP/.github/stale.yml b/libraries/ESPAsyncTCP/.github/stale.yml new file mode 100644 index 0000000..ce7a8e3 --- /dev/null +++ b/libraries/ESPAsyncTCP/.github/stale.yml @@ -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. + diff --git a/libraries/ESPAsyncTCP/.github/workflows/push.yml b/libraries/ESPAsyncTCP/.github/workflows/push.yml new file mode 100644 index 0000000..6b35afa --- /dev/null +++ b/libraries/ESPAsyncTCP/.github/workflows/push.yml @@ -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 diff --git a/libraries/ESPAsyncTCP/.travis.yml b/libraries/ESPAsyncTCP/.travis.yml index bc36dba..dbfc064 100644 --- a/libraries/ESPAsyncTCP/.travis.yml +++ b/libraries/ESPAsyncTCP/.travis.yml @@ -15,12 +15,12 @@ jobs: - name: "Arduino Build" if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) stage: build - script: bash $TRAVIS_BUILD_DIR/travis/build.sh + script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh - name: "PlatformIO Build" if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) stage: build - script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh + script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 1 1 notifications: email: diff --git a/libraries/ESPAsyncTCP/library.json b/libraries/ESPAsyncTCP/library.json index d71d3fc..deeb9ff 100644 --- a/libraries/ESPAsyncTCP/library.json +++ b/libraries/ESPAsyncTCP/library.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/me-no-dev/ESPAsyncTCP.git" }, - "version": "1.2.1", + "version": "1.2.2", "license": "LGPL-3.0", "frameworks": "arduino", "platforms": "espressif8266", diff --git a/libraries/ESPAsyncTCP/library.properties b/libraries/ESPAsyncTCP/library.properties index 2059535..42b23fa 100644 --- a/libraries/ESPAsyncTCP/library.properties +++ b/libraries/ESPAsyncTCP/library.properties @@ -1,5 +1,5 @@ name=ESP AsyncTCP -version=1.2.1 +version=1.2.2 author=Me-No-Dev maintainer=Me-No-Dev sentence=Async TCP Library for ESP8266 and ESP31B diff --git a/libraries/ESPAsyncTCP/travis/build-pio.sh b/libraries/ESPAsyncTCP/travis/build-pio.sh deleted file mode 100644 index dc918d7..0000000 --- a/libraries/ESPAsyncTCP/travis/build-pio.sh +++ /dev/null @@ -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" diff --git a/libraries/ESPAsyncTCP/travis/build.sh b/libraries/ESPAsyncTCP/travis/build.sh deleted file mode 100644 index 329b6cc..0000000 --- a/libraries/ESPAsyncTCP/travis/build.sh +++ /dev/null @@ -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" diff --git a/libraries/FastLED-3.2.9/examples/Pintest/Pintest.ino b/libraries/FastLED-3.2.9/examples/Pintest/Pintest.ino deleted file mode 100644 index a63f0d4..0000000 --- a/libraries/FastLED-3.2.9/examples/Pintest/Pintest.ino +++ /dev/null @@ -1,105 +0,0 @@ - -#include - -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*)®_PIO_A_ODSR) { return "REG_PIO_A_ODSR"; } -#endif -#ifdef REG_PIO_B_ODSR - if(portPtr == (void*)®_PIO_B_ODSR) { return "REG_PIO_B_ODSR"; } -#endif -#ifdef REG_PIO_C_ODSR - if(portPtr == (void*)®_PIO_C_ODSR) { return "REG_PIO_C_ODSR"; } -#endif -#ifdef REG_PIO_D_ODSR - if(portPtr == (void*)®_PIO_D_ODSR) { return "REG_PIO_D_ODSR"; } -#endif - return "unknown"; -} - -template void CheckPin() -{ - CheckPin(); - - RwReg *systemThinksPortIs = portOutputRegister(digitalPinToPort(PIN)); - RwReg systemThinksMaskIs = digitalPinToBitMask(PIN); - - Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port "); - - if(systemThinksPortIs == FastPin::port()) { - Serial.print("valid & mask "); - } else { - Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin::port())); Serial.print(" should be "); - Serial.print(getPort((void*)systemThinksPortIs)); - Serial.print(" & mask "); - } - - if(systemThinksMaskIs == FastPin::mask()) { - Serial.println("valid."); - } else { - Serial.print("invalid, is "); Serial.print(FastPin::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs); - } -} - -template<> void CheckPin<-1> () {} - -void setup() { - Serial.begin(38400); - Serial.println("resetting!"); -} - -void loop() { - CheckPin(); - delay(10000); -} diff --git a/libraries/FastLED-3.2.9/platforms/arm/d21/fastpin_arm_d21.h b/libraries/FastLED-3.2.9/platforms/arm/d21/fastpin_arm_d21.h deleted file mode 100644 index 1606d65..0000000 --- a/libraries/FastLED-3.2.9/platforms/arm/d21/fastpin_arm_d21.h +++ /dev/null @@ -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 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 : public _ARMPIN {}; - -// 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 diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h b/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h deleted file mode 100644 index b3b9ff9..0000000 --- a/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/libraries/FastLED-3.2.9/platforms/avr/fastpin_avr.h b/libraries/FastLED-3.2.9/platforms/avr/fastpin_avr.h deleted file mode 100644 index 4e25cf8..0000000 --- a/libraries/FastLED-3.2.9/platforms/avr/fastpin_avr.h +++ /dev/null @@ -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 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 diff --git a/libraries/FastLED/.gitignore b/libraries/FastLED/.gitignore new file mode 100644 index 0000000..60b7a71 --- /dev/null +++ b/libraries/FastLED/.gitignore @@ -0,0 +1,2 @@ +html/ +*.gch diff --git a/libraries/FastLED-3.2.9/FastLED.cpp b/libraries/FastLED/FastLED.cpp similarity index 100% rename from libraries/FastLED-3.2.9/FastLED.cpp rename to libraries/FastLED/FastLED.cpp diff --git a/libraries/FastLED-3.2.9/FastLED.h b/libraries/FastLED/FastLED.h similarity index 98% rename from libraries/FastLED-3.2.9/FastLED.h rename to libraries/FastLED/FastLED.h index 8fe2b55..d2d4b64 100644 --- a/libraries/FastLED-3.2.9/FastLED.h +++ b/libraries/FastLED/FastLED.h @@ -8,12 +8,12 @@ #define FASTLED_HAS_PRAGMA_MESSAGE #endif -#define FASTLED_VERSION 3002009 +#define FASTLED_VERSION 3003002 #ifndef FASTLED_INTERNAL # ifdef FASTLED_HAS_PRAGMA_MESSAGE -# pragma message "FastLED version 3.002.009" +# pragma message "FastLED version 3.003.002" # 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 @@ -315,6 +315,14 @@ public: return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); } +#if defined(__FASTLED_HAS_FIBCC) && (__FASTLED_HAS_FIBCC == 1) + template class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB> + static CLEDController &addLeds(struct CRGB *data, int nLeds) { + static __FIBCC c; + return addLeds(&c, data, nLeds); + } +#endif + #ifdef FASTSPI_USE_DMX_SIMPLE template static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) diff --git a/libraries/FastLED-3.2.9/LICENSE b/libraries/FastLED/LICENSE similarity index 100% rename from libraries/FastLED-3.2.9/LICENSE rename to libraries/FastLED/LICENSE diff --git a/libraries/FastLED-3.2.9/PORTING.md b/libraries/FastLED/PORTING.md similarity index 53% rename from libraries/FastLED-3.2.9/PORTING.md rename to libraries/FastLED/PORTING.md index 2b4ade2..2f925ab 100644 --- a/libraries/FastLED-3.2.9/PORTING.md +++ b/libraries/FastLED/PORTING.md @@ -1,5 +1,31 @@ =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 == * Create platform directory (e.g. platforms/arm/kl26) diff --git a/libraries/FastLED-3.2.9/README.md b/libraries/FastLED/README.md similarity index 96% rename from libraries/FastLED-3.2.9/README.md rename to libraries/FastLED/README.md index 11a4fd7..0069329 100644 --- a/libraries/FastLED-3.2.9/README.md +++ b/libraries/FastLED/README.md @@ -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. -FastLED 3.2 +FastLED 3.3 =========== 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 Yún * 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 * RFDuino * SparkCore * 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. * 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 diff --git a/libraries/FastLED-3.2.9/bitswap.cpp b/libraries/FastLED/bitswap.cpp similarity index 100% rename from libraries/FastLED-3.2.9/bitswap.cpp rename to libraries/FastLED/bitswap.cpp diff --git a/libraries/FastLED-3.2.9/bitswap.h b/libraries/FastLED/bitswap.h similarity index 100% rename from libraries/FastLED-3.2.9/bitswap.h rename to libraries/FastLED/bitswap.h diff --git a/libraries/FastLED-3.2.9/chipsets.h b/libraries/FastLED/chipsets.h similarity index 97% rename from libraries/FastLED-3.2.9/chipsets.h rename to libraries/FastLED/chipsets.h index d452abf..8e9051d 100644 --- a/libraries/FastLED-3.2.9/chipsets.h +++ b/libraries/FastLED/chipsets.h @@ -77,7 +77,7 @@ protected: /// @tparam CLOCK_PIN the clock pin 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) -template +template class LPD8806Controller : public CPixelLEDController { typedef SPIOutput SPI; @@ -118,7 +118,7 @@ protected: /// @tparam CLOCK_PIN the clock pin 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) -template +template class WS2801Controller : public CPixelLEDController { typedef SPIOutput SPI; SPI mSPI; @@ -140,7 +140,7 @@ protected: } }; -template +template class WS2803Controller : public WS2801Controller {}; /// LPD6803 controller class (LPD1101). @@ -151,7 +151,7 @@ class WS2803Controller : public WS2801Controller +template class LPD6803Controller : public CPixelLEDController { typedef SPIOutput SPI; SPI mSPI; @@ -201,7 +201,7 @@ protected: /// @tparam CLOCK_PIN the clock pin 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) -template +template class APA102Controller : public CPixelLEDController { typedef SPIOutput SPI; SPI mSPI; @@ -266,7 +266,7 @@ protected: /// @tparam CLOCK_PIN the clock pin 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) -template +template class SK9822Controller : public CPixelLEDController { typedef SPIOutput SPI; SPI mSPI; @@ -340,7 +340,7 @@ protected: /// @tparam CLOCK_PIN the clock pin 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) -template +template class P9813Controller : public CPixelLEDController { typedef SPIOutput SPI; SPI mSPI; @@ -390,7 +390,7 @@ protected: /// @tparam CLOCK_PIN the clock pin 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) -template +template class SM16716Controller : public CPixelLEDController { typedef SPIOutput SPI; SPI mSPI; @@ -398,10 +398,15 @@ class SM16716Controller : public CPixelLEDController { void writeHeader() { // Write out 50 zeros to the spi line (6 blocks of 8 followed by two single bit writes) 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.template writeBit<0>(0); - mSPI.template writeBit<0>(0); mSPI.release(); } @@ -524,7 +529,13 @@ class PL9823Controller : public ClocklessController diff --git a/libraries/FastLED-3.2.9/color.h b/libraries/FastLED/color.h similarity index 100% rename from libraries/FastLED-3.2.9/color.h rename to libraries/FastLED/color.h diff --git a/libraries/FastLED-3.2.9/colorpalettes.cpp b/libraries/FastLED/colorpalettes.cpp similarity index 100% rename from libraries/FastLED-3.2.9/colorpalettes.cpp rename to libraries/FastLED/colorpalettes.cpp diff --git a/libraries/FastLED-3.2.9/colorpalettes.h b/libraries/FastLED/colorpalettes.h similarity index 100% rename from libraries/FastLED-3.2.9/colorpalettes.h rename to libraries/FastLED/colorpalettes.h diff --git a/libraries/FastLED-3.2.9/colorutils.cpp b/libraries/FastLED/colorutils.cpp similarity index 100% rename from libraries/FastLED-3.2.9/colorutils.cpp rename to libraries/FastLED/colorutils.cpp diff --git a/libraries/FastLED-3.2.9/colorutils.h b/libraries/FastLED/colorutils.h similarity index 100% rename from libraries/FastLED-3.2.9/colorutils.h rename to libraries/FastLED/colorutils.h diff --git a/libraries/FastLED-3.2.9/component.mk b/libraries/FastLED/component.mk similarity index 100% rename from libraries/FastLED-3.2.9/component.mk rename to libraries/FastLED/component.mk diff --git a/libraries/FastLED-3.2.9/controller.h b/libraries/FastLED/controller.h similarity index 100% rename from libraries/FastLED-3.2.9/controller.h rename to libraries/FastLED/controller.h diff --git a/libraries/FastLED-3.2.9/cpp_compat.h b/libraries/FastLED/cpp_compat.h similarity index 100% rename from libraries/FastLED-3.2.9/cpp_compat.h rename to libraries/FastLED/cpp_compat.h diff --git a/libraries/FastLED-3.2.9/dmx.h b/libraries/FastLED/dmx.h similarity index 100% rename from libraries/FastLED-3.2.9/dmx.h rename to libraries/FastLED/dmx.h diff --git a/libraries/FastLED-3.2.9/docs/Doxyfile b/libraries/FastLED/docs/Doxyfile similarity index 100% rename from libraries/FastLED-3.2.9/docs/Doxyfile rename to libraries/FastLED/docs/Doxyfile diff --git a/libraries/FastLED-3.2.9/docs/mainpage.dox b/libraries/FastLED/docs/mainpage.dox similarity index 100% rename from libraries/FastLED-3.2.9/docs/mainpage.dox rename to libraries/FastLED/docs/mainpage.dox diff --git a/libraries/FastLED-3.2.9/examples/AnalogOutput/AnalogOutput.ino b/libraries/FastLED/examples/AnalogOutput/AnalogOutput.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/AnalogOutput/AnalogOutput.ino rename to libraries/FastLED/examples/AnalogOutput/AnalogOutput.ino diff --git a/libraries/FastLED-3.2.9/examples/Blink/Blink.ino b/libraries/FastLED/examples/Blink/Blink.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Blink/Blink.ino rename to libraries/FastLED/examples/Blink/Blink.ino diff --git a/libraries/FastLED-3.2.9/examples/ColorPalette/ColorPalette.ino b/libraries/FastLED/examples/ColorPalette/ColorPalette.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/ColorPalette/ColorPalette.ino rename to libraries/FastLED/examples/ColorPalette/ColorPalette.ino diff --git a/libraries/FastLED-3.2.9/examples/ColorTemperature/ColorTemperature.ino b/libraries/FastLED/examples/ColorTemperature/ColorTemperature.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/ColorTemperature/ColorTemperature.ino rename to libraries/FastLED/examples/ColorTemperature/ColorTemperature.ino diff --git a/libraries/FastLED-3.2.9/examples/Cylon/Cylon.ino b/libraries/FastLED/examples/Cylon/Cylon.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Cylon/Cylon.ino rename to libraries/FastLED/examples/Cylon/Cylon.ino diff --git a/libraries/FastLED-3.2.9/examples/DemoReel100/DemoReel100.ino b/libraries/FastLED/examples/DemoReel100/DemoReel100.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/DemoReel100/DemoReel100.ino rename to libraries/FastLED/examples/DemoReel100/DemoReel100.ino diff --git a/libraries/FastLED-3.2.9/examples/Fire2012/Fire2012.ino b/libraries/FastLED/examples/Fire2012/Fire2012.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Fire2012/Fire2012.ino rename to libraries/FastLED/examples/Fire2012/Fire2012.ino diff --git a/libraries/FastLED-3.2.9/examples/Fire2012WithPalette/Fire2012WithPalette.ino b/libraries/FastLED/examples/Fire2012WithPalette/Fire2012WithPalette.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Fire2012WithPalette/Fire2012WithPalette.ino rename to libraries/FastLED/examples/Fire2012WithPalette/Fire2012WithPalette.ino diff --git a/libraries/FastLED-3.2.9/examples/FirstLight/FirstLight.ino b/libraries/FastLED/examples/FirstLight/FirstLight.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/FirstLight/FirstLight.ino rename to libraries/FastLED/examples/FirstLight/FirstLight.ino diff --git a/libraries/FastLED-3.2.9/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino b/libraries/FastLED/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino rename to libraries/FastLED/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino diff --git a/libraries/FastLED-3.2.9/examples/Multiple/MirroringSample/MirroringSample.ino b/libraries/FastLED/examples/Multiple/MirroringSample/MirroringSample.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Multiple/MirroringSample/MirroringSample.ino rename to libraries/FastLED/examples/Multiple/MirroringSample/MirroringSample.ino diff --git a/libraries/FastLED-3.2.9/examples/Multiple/MultiArrays/MultiArrays.ino b/libraries/FastLED/examples/Multiple/MultiArrays/MultiArrays.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Multiple/MultiArrays/MultiArrays.ino rename to libraries/FastLED/examples/Multiple/MultiArrays/MultiArrays.ino diff --git a/libraries/FastLED-3.2.9/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino b/libraries/FastLED/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino rename to libraries/FastLED/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino diff --git a/libraries/FastLED-3.2.9/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino b/libraries/FastLED/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino rename to libraries/FastLED/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino diff --git a/libraries/FastLED-3.2.9/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino b/libraries/FastLED/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino similarity index 83% rename from libraries/FastLED-3.2.9/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino rename to libraries/FastLED/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino index fc7c9e7..8c447b5 100644 --- a/libraries/FastLED-3.2.9/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino +++ b/libraries/FastLED/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino @@ -1,6 +1,6 @@ #include -#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 #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 // + +// IBCC outputs; + void setup() { + delay(5000); + Serial.begin(57600); + Serial.println("Starting..."); // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); - LEDS.setBrightness(32); + + // Teensy 4 parallel output example + // LEDS.addLeds(leds,NUM_LEDS_PER_STRIP); } void loop() { + Serial.println("Loop...."); static uint8_t hue = 0; for(int i = 0; i < NUM_STRIPS; i++) { for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { @@ -43,5 +52,5 @@ void loop() { hue++; LEDS.show(); - LEDS.delay(10); + // LEDS.delay(100); } diff --git a/libraries/FastLED-3.2.9/examples/Noise/Noise.ino b/libraries/FastLED/examples/Noise/Noise.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Noise/Noise.ino rename to libraries/FastLED/examples/Noise/Noise.ino diff --git a/libraries/FastLED-3.2.9/examples/NoisePlayground/NoisePlayground.ino b/libraries/FastLED/examples/NoisePlayground/NoisePlayground.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/NoisePlayground/NoisePlayground.ino rename to libraries/FastLED/examples/NoisePlayground/NoisePlayground.ino diff --git a/libraries/FastLED-3.2.9/examples/NoisePlusPalette/NoisePlusPalette.ino b/libraries/FastLED/examples/NoisePlusPalette/NoisePlusPalette.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/NoisePlusPalette/NoisePlusPalette.ino rename to libraries/FastLED/examples/NoisePlusPalette/NoisePlusPalette.ino diff --git a/libraries/FastLED/examples/Pintest/Pintest.ino b/libraries/FastLED/examples/Pintest/Pintest.ino new file mode 100644 index 0000000..a814152 --- /dev/null +++ b/libraries/FastLED/examples/Pintest/Pintest.ino @@ -0,0 +1,199 @@ + +#include + +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*)®_PIO_A_ODSR) { return "REG_PIO_A_ODSR"; } +#endif +#ifdef REG_PIO_B_ODSR + if(portPtr == (void*)®_PIO_B_ODSR) { return "REG_PIO_B_ODSR"; } +#endif +#ifdef REG_PIO_C_ODSR + if(portPtr == (void*)®_PIO_C_ODSR) { return "REG_PIO_C_ODSR"; } +#endif +#ifdef REG_PIO_D_ODSR + if(portPtr == (void*)®_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 void CheckPin() +{ + CheckPin(); + + void *systemThinksPortIs = (void*)portOutputRegister(digitalPinToPort(PIN)); + RwReg systemThinksMaskIs = digitalPinToBitMask(PIN); + + Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port "); + + if(systemThinksPortIs == (void*)FastPin::port()) { + Serial.print("valid & mask "); + } else { + Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin::port())); Serial.print(" should be "); + Serial.print(getPort((void*)systemThinksPortIs)); + Serial.print(" & mask "); + } + + if(systemThinksMaskIs == FastPin::mask()) { + Serial.println("valid."); + } else { + Serial.print("invalid, is "); Serial.print(FastPin::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs); + } +} + +template<> void CheckPin<255> () {} + + +template 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 void PrintPins() { + PrintPins(); + + 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(); +#endif + + Serial.println("-----"); +#ifdef NUM_DIGITAL_PINS + PrintPins(); +#endif + Serial.println("------"); + + delay(100000); +} diff --git a/libraries/FastLED-3.2.9/examples/Ports/PJRCSpectrumAnalyzer/PJRCSpectrumAnalyzer.ino b/libraries/FastLED/examples/Ports/PJRCSpectrumAnalyzer/PJRCSpectrumAnalyzer.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/Ports/PJRCSpectrumAnalyzer/PJRCSpectrumAnalyzer.ino rename to libraries/FastLED/examples/Ports/PJRCSpectrumAnalyzer/PJRCSpectrumAnalyzer.ino diff --git a/libraries/FastLED-3.2.9/examples/RGBCalibrate/RGBCalibrate.ino b/libraries/FastLED/examples/RGBCalibrate/RGBCalibrate.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/RGBCalibrate/RGBCalibrate.ino rename to libraries/FastLED/examples/RGBCalibrate/RGBCalibrate.ino diff --git a/libraries/FastLED-3.2.9/examples/RGBSetDemo/RGBSetDemo.ino b/libraries/FastLED/examples/RGBSetDemo/RGBSetDemo.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/RGBSetDemo/RGBSetDemo.ino rename to libraries/FastLED/examples/RGBSetDemo/RGBSetDemo.ino diff --git a/libraries/FastLED-3.2.9/examples/SmartMatrix/SmartMatrix.ino b/libraries/FastLED/examples/SmartMatrix/SmartMatrix.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/SmartMatrix/SmartMatrix.ino rename to libraries/FastLED/examples/SmartMatrix/SmartMatrix.ino diff --git a/libraries/FastLED-3.2.9/examples/XYMatrix/XYMatrix.ino b/libraries/FastLED/examples/XYMatrix/XYMatrix.ino similarity index 100% rename from libraries/FastLED-3.2.9/examples/XYMatrix/XYMatrix.ino rename to libraries/FastLED/examples/XYMatrix/XYMatrix.ino diff --git a/libraries/FastLED-3.2.9/extras/AppleII.s65 b/libraries/FastLED/extras/AppleII.s65 similarity index 100% rename from libraries/FastLED-3.2.9/extras/AppleII.s65 rename to libraries/FastLED/extras/AppleII.s65 diff --git a/libraries/FastLED-3.2.9/extras/FastLED6502.s65 b/libraries/FastLED/extras/FastLED6502.s65 similarity index 100% rename from libraries/FastLED-3.2.9/extras/FastLED6502.s65 rename to libraries/FastLED/extras/FastLED6502.s65 diff --git a/libraries/FastLED-3.2.9/extras/RainbowDemo.bin.zip b/libraries/FastLED/extras/RainbowDemo.bin.zip similarity index 100% rename from libraries/FastLED-3.2.9/extras/RainbowDemo.bin.zip rename to libraries/FastLED/extras/RainbowDemo.bin.zip diff --git a/libraries/FastLED-3.2.9/extras/RainbowDemo.s65 b/libraries/FastLED/extras/RainbowDemo.s65 similarity index 100% rename from libraries/FastLED-3.2.9/extras/RainbowDemo.s65 rename to libraries/FastLED/extras/RainbowDemo.s65 diff --git a/libraries/FastLED-3.2.9/fastled_config.h b/libraries/FastLED/fastled_config.h similarity index 100% rename from libraries/FastLED-3.2.9/fastled_config.h rename to libraries/FastLED/fastled_config.h diff --git a/libraries/FastLED-3.2.9/fastled_delay.h b/libraries/FastLED/fastled_delay.h similarity index 100% rename from libraries/FastLED-3.2.9/fastled_delay.h rename to libraries/FastLED/fastled_delay.h diff --git a/libraries/FastLED-3.2.9/fastled_progmem.h b/libraries/FastLED/fastled_progmem.h similarity index 97% rename from libraries/FastLED-3.2.9/fastled_progmem.h rename to libraries/FastLED/fastled_progmem.h index 5527c62..dfcb9ef 100644 --- a/libraries/FastLED-3.2.9/fastled_progmem.h +++ b/libraries/FastLED/fastled_progmem.h @@ -69,7 +69,7 @@ FASTLED_NAMESPACE_BEGIN // force 4-byte alignment as needed. The FastLED gradient // palette code uses 'read dword', and now uses this macro // 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))) #else #define FL_ALIGN_PROGMEM diff --git a/libraries/FastLED-3.2.9/fastpin.h b/libraries/FastLED/fastpin.h similarity index 87% rename from libraries/FastLED-3.2.9/fastpin.h rename to libraries/FastLED/fastpin.h index beb3a2d..ed2b8e7 100644 --- a/libraries/FastLED-3.2.9/fastpin.h +++ b/libraries/FastLED/fastpin.h @@ -241,6 +241,28 @@ template class FastPinBB : public FastPin {}; typedef volatile uint32_t & reg32_t; typedef volatile uint32_t * ptr_reg32_t; +// Utility templates for tracking down information about pins and ports +template 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 { 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 { 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 #pragma GCC diagnostic pop diff --git a/libraries/FastLED-3.2.9/fastspi.h b/libraries/FastLED/fastspi.h similarity index 75% rename from libraries/FastLED-3.2.9/fastspi.h rename to libraries/FastLED/fastspi.h index fc0843b..38e8eab 100644 --- a/libraries/FastLED-3.2.9/fastspi.h +++ b/libraries/FastLED/fastspi.h @@ -13,6 +13,10 @@ FASTLED_NAMESPACE_BEGIN #if defined(FASTLED_TEENSY3) && (F_CPU > 48000000) #define DATA_RATE_MHZ(X) (((48000000L / 1000000L) / 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 #define DATA_RATE_MHZ(X) ((F_CPU / 1000000L) / X) #define DATA_RATE_KHZ(X) ((F_CPU / 1000L) / X) @@ -26,22 +30,22 @@ FASTLED_NAMESPACE_BEGIN ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #if !defined(FASTLED_ALL_PINS_HARDWARE_SPI) -template +template class SPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; #endif -template +template class SoftwareSPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; #ifndef FASTLED_FORCE_SOFTWARE_SPI #if defined(NRF51) && defined(FASTLED_ALL_PINS_HARDWARE_SPI) -template +template class SPIOutput : public NRF51SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; #endif #if defined(NRF52_SERIES) && defined(FASTLED_ALL_PINS_HARDWARE_SPI) -template +template class SPIOutput : public NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; #endif @@ -49,26 +53,37 @@ class SPIOutput : public NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDE #if defined(FASTLED_TEENSY3) && defined(ARM_HARDWARE_SPI) -template +template class SPIOutput : public ARMHardwareSPIOutput {}; #if defined(SPI2_DATA) -template +template class SPIOutput : public ARMHardwareSPIOutput {}; -template +template class SPIOutput : public ARMHardwareSPIOutput {}; -template +template class SPIOutput : public ARMHardwareSPIOutput {}; #endif +#elif defined(FASTLED_TEENSY4) && defined(ARM_HARDWARE_SPI) + +template +class SPIOutput : public Teesy4HardwareSPIOutput {}; + +template +class SPIOutput : public Teesy4HardwareSPIOutput {}; + +template +class SPIOutput : public Teesy4HardwareSPIOutput {}; + #elif defined(FASTLED_TEENSYLC) && defined(ARM_HARDWARE_SPI) -#define DECLARE_SPI0(__DATA,__CLOCK) template\ +#define DECLARE_SPI0(__DATA,__CLOCK) template\ class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40076000> {}; - #define DECLARE_SPI1(__DATA,__CLOCK) template\ + #define DECLARE_SPI1(__DATA,__CLOCK) template\ class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40077000> {}; DECLARE_SPI0(7,13); @@ -85,24 +100,24 @@ DECLARE_SPI1(21,20); #elif defined(__SAM3X8E__) -template +template class SPIOutput : public SAMHardwareSPIOutput {}; #elif defined(AVR_HARDWARE_SPI) -template +template class SPIOutput : public AVRHardwareSPIOutput {}; #if defined(SPI_UART0_DATA) -template +template class SPIOutput : public AVRUSART0SPIOutput {}; #endif #if defined(SPI_UART1_DATA) -template +template class SPIOutput : public AVRUSART1SPIOutput {}; #endif @@ -120,7 +135,7 @@ class SPIOutput : public AVRUSART1SP #endif // #if defined(USART_DATA) && defined(USART_CLOCK) -// template +// template // class AVRSPIOutput : public AVRUSARTSPIOutput {}; // #endif diff --git a/libraries/FastLED-3.2.9/fastspi_bitbang.h b/libraries/FastLED/fastspi_bitbang.h similarity index 95% rename from libraries/FastLED-3.2.9/fastspi_bitbang.h rename to libraries/FastLED/fastspi_bitbang.h index d48e32b..019b6dc 100644 --- a/libraries/FastLED-3.2.9/fastspi_bitbang.h +++ b/libraries/FastLED/fastspi_bitbang.h @@ -15,7 +15,7 @@ FASTLED_NAMESPACE_BEGIN // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -template +template class AVRSoftwareSPIOutput { // 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 @@ -113,10 +113,16 @@ private: public: // 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(); delaycycles<(((SPI_SPEED-6) / 2) - MIN_DELAY)>(); - #define CLOCK_LO_DELAY delaycycles<(((SPI_SPEED-6) / 4))>(); + #define CLOCK_HI_DELAY do { delaycycles(); delaycycles<((SPI_SPEED > 10) ? (((SPI_SPEED-6) / 2) - MIN_DELAY) : (SPI_SPEED))>(); } while(0); + #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 template __attribute__((always_inline, hot)) inline static void writeBit(uint8_t b) { @@ -126,8 +132,8 @@ public: #ifdef ESP32 // try to ensure we never have adjacent write opcodes to the same register FastPin::lo(); - FastPin::hi(); CLOCK_HI_DELAY; - FastPin::toggle(); CLOCK_LO_DELAY; + FastPin::hi(); CLOCK_HI_DELAY; + FastPin::toggle(); CLOCK_LO_DELAY; #else FastPin::hi(); CLOCK_HI_DELAY; FastPin::lo(); CLOCK_LO_DELAY; @@ -137,7 +143,7 @@ public: FastPin::hi(); CLOCK_HI_DELAY; #ifdef ESP32 // try to ensure we never have adjacent write opcodes to the same register - FastPin::toggle(); CLOCK_HI_DELAY; + FastPin::toggle(); CLOCK_HI_DELAY; #else FastPin::lo(); CLOCK_LO_DELAY; #endif diff --git a/libraries/FastLED-3.2.9/fastspi_dma.h b/libraries/FastLED/fastspi_dma.h similarity index 100% rename from libraries/FastLED-3.2.9/fastspi_dma.h rename to libraries/FastLED/fastspi_dma.h diff --git a/libraries/FastLED-3.2.9/fastspi_nop.h b/libraries/FastLED/fastspi_nop.h similarity index 96% rename from libraries/FastLED-3.2.9/fastspi_nop.h rename to libraries/FastLED/fastspi_nop.h index 5c5da01..1dcd296 100644 --- a/libraries/FastLED-3.2.9/fastspi_nop.h +++ b/libraries/FastLED/fastspi_nop.h @@ -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 /// 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) -template +template class NOPSPIOutput { Selectable *m_pSelect; diff --git a/libraries/FastLED-3.2.9/fastspi_ref.h b/libraries/FastLED/fastspi_ref.h similarity index 97% rename from libraries/FastLED-3.2.9/fastspi_ref.h rename to libraries/FastLED/fastspi_ref.h index f68e63e..00c41d3 100644 --- a/libraries/FastLED-3.2.9/fastspi_ref.h +++ b/libraries/FastLED/fastspi_ref.h @@ -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 // the method implementations should provide a starting point, even if not hte most efficient to start with -template +template class REFHardwareSPIOutput { Selectable *m_pSelect; public: diff --git a/libraries/FastLED-3.2.9/fastspi_types.h b/libraries/FastLED/fastspi_types.h similarity index 100% rename from libraries/FastLED-3.2.9/fastspi_types.h rename to libraries/FastLED/fastspi_types.h diff --git a/libraries/FastLED-3.2.9/hsv2rgb.cpp b/libraries/FastLED/hsv2rgb.cpp similarity index 100% rename from libraries/FastLED-3.2.9/hsv2rgb.cpp rename to libraries/FastLED/hsv2rgb.cpp diff --git a/libraries/FastLED-3.2.9/hsv2rgb.h b/libraries/FastLED/hsv2rgb.h similarity index 100% rename from libraries/FastLED-3.2.9/hsv2rgb.h rename to libraries/FastLED/hsv2rgb.h diff --git a/libraries/FastLED-3.2.9/keywords.txt b/libraries/FastLED/keywords.txt similarity index 97% rename from libraries/FastLED-3.2.9/keywords.txt rename to libraries/FastLED/keywords.txt index c30552d..75df500 100644 --- a/libraries/FastLED-3.2.9/keywords.txt +++ b/libraries/FastLED/keywords.txt @@ -294,41 +294,52 @@ CRGB::YellowGreen KEYWORD2 ####################################### # Chipsets -LPD6803 LITERAL1 -LPD8806 LITERAL1 -WS2801 LITERAL1 -WS2803 LITERAL1 -P9813 LITERAL1 -SM16716 LITERAL1 APA102 LITERAL1 +APA104 LITERAL1 +APA106 LITERAL1 DMXSERIAL LITERAL1 DMXSIMPLE LITERAL1 -TM1829 LITERAL1 -TM1809 LITERAL1 -TM1804 LITERAL1 -TM1803 LITERAL1 -APA104 LITERAL1 -WS2811 LITERAL1 -WS2812 LITERAL1 -WS2812B LITERAL1 -WS2811_400 LITERAL1 -WS2813 LITERAL1 -NEOPIXEL LITERAL1 -UCS1903 LITERAL1 -UCS1903B LITERAL1 +DOTSTAR LITERAL1 +GE8822 LITERAL1 +GS1903 LITERAL1 GW6205 LITERAL1 GW6205B LITERAL1 +GW6205_400 LITERAL1 LPD1886 LITERAL1 +LPD1886_8BIT LITERAL1 +LPD6803 LITERAL1 +LPD8806 LITERAL1 +NEOPIXEL LITERAL1 OCTOWS2811 LITERAL1 OCTOWS2811_400 LITERAL1 OCTOWS2813 LITERAL1 -WS2812SERIAL LITERAL1 -SMART_MATRIX LITERAL1 -GE8822 LITERAL1 +P9813 LITERAL1 +PIXIE LITERAL1 +PL9823 LITERAL1 +SK6812 LITERAL1 +SK6822 LITERAL1 +SK9822 LITERAL1 SM16703 LITERAL1 -GS1903 LITERAL1 -LPD6803 LITERAL1 - +SM16716 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 LITERAL1 diff --git a/libraries/FastLED-3.2.9/led_sysdefs.h b/libraries/FastLED/led_sysdefs.h similarity index 94% rename from libraries/FastLED-3.2.9/led_sysdefs.h rename to libraries/FastLED/led_sysdefs.h index 7abcd15..27da24a 100644 --- a/libraries/FastLED-3.2.9/led_sysdefs.h +++ b/libraries/FastLED/led_sysdefs.h @@ -18,6 +18,9 @@ #elif defined(__MKL26Z64__) // Include kl26/T-LC headers #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__) // Include sam/due headers #include "platforms/arm/sam/led_sysdefs_arm_sam.h" diff --git a/libraries/FastLED-3.2.9/lib8tion.cpp b/libraries/FastLED/lib8tion.cpp similarity index 100% rename from libraries/FastLED-3.2.9/lib8tion.cpp rename to libraries/FastLED/lib8tion.cpp diff --git a/libraries/FastLED-3.2.9/lib8tion.h b/libraries/FastLED/lib8tion.h similarity index 100% rename from libraries/FastLED-3.2.9/lib8tion.h rename to libraries/FastLED/lib8tion.h diff --git a/libraries/FastLED-3.2.9/lib8tion/math8.h b/libraries/FastLED/lib8tion/math8.h similarity index 100% rename from libraries/FastLED-3.2.9/lib8tion/math8.h rename to libraries/FastLED/lib8tion/math8.h diff --git a/libraries/FastLED-3.2.9/lib8tion/random8.h b/libraries/FastLED/lib8tion/random8.h similarity index 100% rename from libraries/FastLED-3.2.9/lib8tion/random8.h rename to libraries/FastLED/lib8tion/random8.h diff --git a/libraries/FastLED-3.2.9/lib8tion/scale8.h b/libraries/FastLED/lib8tion/scale8.h similarity index 100% rename from libraries/FastLED-3.2.9/lib8tion/scale8.h rename to libraries/FastLED/lib8tion/scale8.h diff --git a/libraries/FastLED-3.2.9/lib8tion/trig8.h b/libraries/FastLED/lib8tion/trig8.h similarity index 100% rename from libraries/FastLED-3.2.9/lib8tion/trig8.h rename to libraries/FastLED/lib8tion/trig8.h diff --git a/libraries/FastLED-3.2.9/library.json b/libraries/FastLED/library.json similarity index 98% rename from libraries/FastLED-3.2.9/library.json rename to libraries/FastLED/library.json index ca8f09e..c7075be 100644 --- a/libraries/FastLED-3.2.9/library.json +++ b/libraries/FastLED/library.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/FastLED/FastLED.git" }, - "version": "3.2.9", + "version": "3.3.2", "license": "MIT", "homepage": "http://fastled.io", "frameworks": "arduino", diff --git a/libraries/FastLED-3.2.9/library.properties b/libraries/FastLED/library.properties similarity index 96% rename from libraries/FastLED-3.2.9/library.properties rename to libraries/FastLED/library.properties index 25460b1..31175c5 100644 --- a/libraries/FastLED-3.2.9/library.properties +++ b/libraries/FastLED/library.properties @@ -1,5 +1,5 @@ name=FastLED -version=3.2.9 +version=3.3.2 author=Daniel Garcia maintainer=Daniel Garcia sentence=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions. diff --git a/libraries/FastLED-3.2.9/noise.cpp b/libraries/FastLED/noise.cpp similarity index 100% rename from libraries/FastLED-3.2.9/noise.cpp rename to libraries/FastLED/noise.cpp diff --git a/libraries/FastLED-3.2.9/noise.h b/libraries/FastLED/noise.h similarity index 100% rename from libraries/FastLED-3.2.9/noise.h rename to libraries/FastLED/noise.h diff --git a/libraries/FastLED-3.2.9/pixelset.h b/libraries/FastLED/pixelset.h similarity index 100% rename from libraries/FastLED-3.2.9/pixelset.h rename to libraries/FastLED/pixelset.h diff --git a/libraries/FastLED-3.2.9/pixeltypes.h b/libraries/FastLED/pixeltypes.h similarity index 100% rename from libraries/FastLED-3.2.9/pixeltypes.h rename to libraries/FastLED/pixeltypes.h diff --git a/libraries/FastLED-3.2.9/platforms.cpp b/libraries/FastLED/platforms.cpp similarity index 100% rename from libraries/FastLED-3.2.9/platforms.cpp rename to libraries/FastLED/platforms.cpp diff --git a/libraries/FastLED-3.2.9/platforms.h b/libraries/FastLED/platforms.h similarity index 93% rename from libraries/FastLED-3.2.9/platforms.h rename to libraries/FastLED/platforms.h index 82d7d99..f66599f 100644 --- a/libraries/FastLED-3.2.9/platforms.h +++ b/libraries/FastLED/platforms.h @@ -18,6 +18,9 @@ #elif defined(__MKL26Z64__) // Include kl26/T-LC headers #include "platforms/arm/kl26/fastled_arm_kl26.h" +#elif defined(__IMXRT1062__) +// teensy4 +#include "platforms/arm/mxrt1062/fastled_arm_mxrt1062.h" #elif defined(__SAM3X8E__) // Include sam/due headers #include "platforms/arm/sam/fastled_arm_sam.h" diff --git a/libraries/FastLED-3.2.9/platforms/arm/common/m0clockless.h b/libraries/FastLED/platforms/arm/common/m0clockless.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/common/m0clockless.h rename to libraries/FastLED/platforms/arm/common/m0clockless.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/d21/clockless_arm_d21.h b/libraries/FastLED/platforms/arm/d21/clockless_arm_d21.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/d21/clockless_arm_d21.h rename to libraries/FastLED/platforms/arm/d21/clockless_arm_d21.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/d21/fastled_arm_d21.h b/libraries/FastLED/platforms/arm/d21/fastled_arm_d21.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/d21/fastled_arm_d21.h rename to libraries/FastLED/platforms/arm/d21/fastled_arm_d21.h diff --git a/libraries/FastLED/platforms/arm/d21/fastpin_arm_d21.h b/libraries/FastLED/platforms/arm/d21/fastpin_arm_d21.h new file mode 100644 index 0000000..84b0738 --- /dev/null +++ b/libraries/FastLED/platforms/arm/d21/fastpin_arm_d21.h @@ -0,0 +1,232 @@ +#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 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 _FL_IO(L) _RD32(GPIO ## L) + +#define _FL_DEFPIN(PIN, BIT, L) template<> class FastPin : public _ARMPIN {}; + +// Actual pin definitions +#if defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) + +#define MAX_PIN 17 +_FL_DEFPIN( 8,23,1); +_FL_DEFPIN( 0, 9,1); _FL_DEFPIN( 1, 8,1); _FL_DEFPIN( 2, 2,1); _FL_DEFPIN( 3, 3,1); +_FL_DEFPIN( 6, 5,0); _FL_DEFPIN( 9, 6,0); _FL_DEFPIN(10, 7,0); _FL_DEFPIN(12, 2,0); +_FL_DEFPIN(A6, 9,1); _FL_DEFPIN(A7, 8,1); _FL_DEFPIN(A5, 2,1); _FL_DEFPIN(A4, 3,1); +_FL_DEFPIN(A1, 5,0); _FL_DEFPIN(A2, 6,0); _FL_DEFPIN(A3, 7,0); _FL_DEFPIN(A0, 2,0); + +#define HAS_HARDWARE_PIN_SUPPORT 1 + + +#elif defined(ADAFRUIT_HALLOWING) + +#define MAX_PIN 20 +// 0 & 1 +_FL_DEFPIN( 0, 9, 0); _FL_DEFPIN( 1, 10, 0); +// 2, 3, 4 +_FL_DEFPIN( 2, 14, 0); _FL_DEFPIN( 3, 11, 0); _FL_DEFPIN( 4, 8, 0); +// 5, 6, 7 +_FL_DEFPIN( 5, 15, 0); _FL_DEFPIN( 6, 18, 0); _FL_DEFPIN( 7, 0, 0); +// 8, 9, 10 +_FL_DEFPIN( 8, 12, 0); _FL_DEFPIN( 9, 19, 0); _FL_DEFPIN(10, 20, 0); +// 11, 12, 13 +_FL_DEFPIN(11, 21, 0); _FL_DEFPIN(12, 22, 0); _FL_DEFPIN(13, 23, 0); +// 14, 15, 16 (A0 - A2) +_FL_DEFPIN(14, 2, 0); _FL_DEFPIN(15, 8, 1); _FL_DEFPIN(16, 9, 1); +// 17, 18, 19 (A3 - A5) +_FL_DEFPIN(17, 4, 0); _FL_DEFPIN(18, 5, 0); _FL_DEFPIN(19, 6, 0); + +#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 +_FL_DEFPIN( 0,10,0); _FL_DEFPIN( 1,11,0); _FL_DEFPIN( 2, 8,0); _FL_DEFPIN( 3, 9,0); +_FL_DEFPIN( 4,14,0); _FL_DEFPIN( 5,15,0); _FL_DEFPIN( 6,20,0); _FL_DEFPIN( 7,21,0); +_FL_DEFPIN( 8, 6,0); _FL_DEFPIN( 9, 7,0); _FL_DEFPIN(10,18,0); _FL_DEFPIN(11,16,0); +_FL_DEFPIN(12,19,0); _FL_DEFPIN(13,17,0); _FL_DEFPIN(14, 2,0); _FL_DEFPIN(15, 8,1); +_FL_DEFPIN(16, 9,1); _FL_DEFPIN(17, 4,0); _FL_DEFPIN(18, 5,0); _FL_DEFPIN(19, 2,1); +_FL_DEFPIN(20,22,0); _FL_DEFPIN(21,23,0); _FL_DEFPIN(22,12,0); _FL_DEFPIN(23,11,1); +_FL_DEFPIN(24,10,1); _FL_DEFPIN(25, 3,1); _FL_DEFPIN(26,27,0); _FL_DEFPIN(27,28,0); +_FL_DEFPIN(28,24,0); _FL_DEFPIN(29,25,0); _FL_DEFPIN(30,22,1); _FL_DEFPIN(31,23,1); +_FL_DEFPIN(32,22,0); _FL_DEFPIN(33,23,0); _FL_DEFPIN(34,19,0); _FL_DEFPIN(35,16,0); +_FL_DEFPIN(36,18,0); _FL_DEFPIN(37,17,0); _FL_DEFPIN(38,13,0); _FL_DEFPIN(39,21,0); +_FL_DEFPIN(40, 6,0); _FL_DEFPIN(41, 7,0); _FL_DEFPIN(42, 3,0); + +#define SPI_DATA 24 +#define SPI_CLOCK 23 + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ARDUINO_SODAQ_AUTONOMO) + +#define MAX_PIN 56 +_FL_DEFPIN( 0, 9,0); _FL_DEFPIN( 1,10,0); _FL_DEFPIN( 2,11,0); _FL_DEFPIN( 3,10,1); +_FL_DEFPIN( 4,11,1); _FL_DEFPIN( 5,12,1); _FL_DEFPIN( 6,13,1); _FL_DEFPIN( 7,14,1); +_FL_DEFPIN( 8,15,1); _FL_DEFPIN( 9,14,0); _FL_DEFPIN(10,15,0); _FL_DEFPIN(11,16,0); +_FL_DEFPIN(12,17,0); _FL_DEFPIN(13,18,0); _FL_DEFPIN(14,19,0); _FL_DEFPIN(15,16,1); +_FL_DEFPIN(16, 8,0); _FL_DEFPIN(17,28,0); _FL_DEFPIN(18,17,1); _FL_DEFPIN(19, 2,0); +_FL_DEFPIN(20, 6,0); _FL_DEFPIN(21, 5,0); _FL_DEFPIN(22, 4,0); _FL_DEFPIN(23, 9,1); +_FL_DEFPIN(24, 8,1); _FL_DEFPIN(25, 7,1); _FL_DEFPIN(26, 6,1); _FL_DEFPIN(27, 5,1); +_FL_DEFPIN(28, 4,1); _FL_DEFPIN(29, 7,0); _FL_DEFPIN(30, 3,1); _FL_DEFPIN(31, 2,1); +_FL_DEFPIN(32, 1,1); _FL_DEFPIN(33, 0,1); _FL_DEFPIN(34, 3,0); _FL_DEFPIN(35, 3,0); +_FL_DEFPIN(36,30,1); _FL_DEFPIN(37,31,1); _FL_DEFPIN(38,22,1); _FL_DEFPIN(39,23,1); +_FL_DEFPIN(40,12,0); _FL_DEFPIN(41,13,0); _FL_DEFPIN(42,22,0); _FL_DEFPIN(43,23,0); +_FL_DEFPIN(44,20,0); _FL_DEFPIN(45,21,0); _FL_DEFPIN(46,27,0); _FL_DEFPIN(47,24,0); +_FL_DEFPIN(48,25,0); _FL_DEFPIN(49,13,1); _FL_DEFPIN(50,14,1); _FL_DEFPIN(51,17,0); +_FL_DEFPIN(52,18,0); _FL_DEFPIN(53,12,1); _FL_DEFPIN(54,13,1); _FL_DEFPIN(55,14,1); +_FL_DEFPIN(56,15,1); + +#define SPI_DATA 44 +#define SPI_CLOCK 45 + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ARDUINO_SAMD_WINO) + +#define MAX_PIN 22 +_FL_DEFPIN( 0, 23, 0); _FL_DEFPIN( 1, 22, 0); _FL_DEFPIN( 2, 16, 0); _FL_DEFPIN( 3, 17, 0); +_FL_DEFPIN( 4, 18, 0); _FL_DEFPIN( 5, 19, 0); _FL_DEFPIN( 6, 24, 0); _FL_DEFPIN( 7, 25, 0); +_FL_DEFPIN( 8, 27, 0); _FL_DEFPIN( 9, 28, 0); _FL_DEFPIN( 10, 30, 0); _FL_DEFPIN( 11, 31, 0); +_FL_DEFPIN( 12, 15, 0); _FL_DEFPIN( 13, 14, 0); _FL_DEFPIN( 14, 2, 0); _FL_DEFPIN( 15, 3, 0); +_FL_DEFPIN( 16, 4, 0); _FL_DEFPIN( 17, 5, 0); _FL_DEFPIN( 18, 6, 0); _FL_DEFPIN( 19, 7, 0); +_FL_DEFPIN( 20, 8, 0); _FL_DEFPIN( 21, 9, 0); _FL_DEFPIN( 22, 10, 0); _FL_DEFPIN( 23, 11, 0); + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ARDUINO_SAMD_MKR1000) + +#define MAX_PIN 22 +_FL_DEFPIN( 0, 22, 0); _FL_DEFPIN( 1, 23, 0); _FL_DEFPIN( 2, 10, 0); _FL_DEFPIN( 3, 11, 0); +_FL_DEFPIN( 4, 10, 1); _FL_DEFPIN( 5, 11, 1); _FL_DEFPIN( 6, 20, 0); _FL_DEFPIN( 7, 21, 0); +_FL_DEFPIN( 8, 16, 0); _FL_DEFPIN( 9, 17, 0); _FL_DEFPIN( 10, 19, 0); _FL_DEFPIN( 11, 8, 0); +_FL_DEFPIN( 12, 9, 0); _FL_DEFPIN( 13, 23, 1); _FL_DEFPIN( 14, 22, 1); _FL_DEFPIN( 15, 2, 0); +_FL_DEFPIN( 16, 2, 1); _FL_DEFPIN( 17, 3, 1); _FL_DEFPIN( 18, 4, 0); _FL_DEFPIN( 19, 5, 0); +_FL_DEFPIN( 20, 6, 0); _FL_DEFPIN( 21, 7, 0); + +#define SPI_DATA 8 +#define SPI_CLOCK 9 + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ARDUINO_SAMD_NANO_33_IOT) + +#define MAX_PIN 25 +_FL_DEFPIN( 0, 11, 0); _FL_DEFPIN( 1, 10, 0); _FL_DEFPIN( 2, 14, 0); _FL_DEFPIN( 3, 9, 0); +_FL_DEFPIN( 4, 8, 0); _FL_DEFPIN( 5, 15, 0); _FL_DEFPIN( 6, 20, 0); _FL_DEFPIN( 7, 21, 0); +_FL_DEFPIN( 8, 6, 0); _FL_DEFPIN( 9, 7, 0); _FL_DEFPIN( 10, 18, 0); _FL_DEFPIN( 11, 16, 0); +_FL_DEFPIN( 12, 19, 0); _FL_DEFPIN( 13, 17, 0); _FL_DEFPIN( 14, 2, 0); _FL_DEFPIN( 15, 8, 1); +_FL_DEFPIN( 16, 9, 1); _FL_DEFPIN( 17, 4, 0); _FL_DEFPIN( 18, 5, 0); _FL_DEFPIN( 19, 2, 1); +_FL_DEFPIN( 20, 22, 0); _FL_DEFPIN( 21, 23, 0); _FL_DEFPIN( 22, 12, 0); _FL_DEFPIN( 23, 10, 1); +_FL_DEFPIN( 24, 11, 1); + +#define SPI_DATA 23 +#define SPI_CLOCK 24 + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ARDUINO_GEMMA_M0) + +#define MAX_PIN 4 +_FL_DEFPIN( 0, 4, 0); _FL_DEFPIN( 1, 2, 0); _FL_DEFPIN( 2, 5, 0); +_FL_DEFPIN( 3, 0, 0); _FL_DEFPIN( 4, 1, 0); + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ADAFRUIT_TRINKET_M0) + +#define MAX_PIN 7 +_FL_DEFPIN( 0, 8, 0); _FL_DEFPIN( 1, 2, 0); _FL_DEFPIN( 2, 9, 0); +_FL_DEFPIN( 3, 7, 0); _FL_DEFPIN( 4, 6, 0); _FL_DEFPIN( 7, 0, 0); _FL_DEFPIN( 8, 1, 0); + +#define SPI_DATA 4 +#define SPI_CLOCK 3 + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ADAFRUIT_ITSYBITSY_M0) + +#define MAX_PIN 16 +_FL_DEFPIN( 2, 14, 0); _FL_DEFPIN( 3, 9, 0); _FL_DEFPIN( 4, 8, 0); +_FL_DEFPIN( 5, 15, 0); _FL_DEFPIN( 6, 20, 0); _FL_DEFPIN( 7, 21, 0); +_FL_DEFPIN( 8, 6, 0); _FL_DEFPIN( 9, 7, 0); _FL_DEFPIN( 10, 18, 0); +_FL_DEFPIN( 11, 16, 0); _FL_DEFPIN( 12, 19, 0); _FL_DEFPIN( 13, 17, 0); +_FL_DEFPIN( 29, 10, 0); // MOSI +_FL_DEFPIN( 30, 11, 0); // SCK +_FL_DEFPIN( 40, 0, 0); //APA102 Clock +_FL_DEFPIN( 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 diff --git a/libraries/FastLED-3.2.9/platforms/arm/d21/led_sysdefs_arm_d21.h b/libraries/FastLED/platforms/arm/d21/led_sysdefs_arm_d21.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/d21/led_sysdefs_arm_d21.h rename to libraries/FastLED/platforms/arm/d21/led_sysdefs_arm_d21.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/d51/README.txt b/libraries/FastLED/platforms/arm/d51/README.txt similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/d51/README.txt rename to libraries/FastLED/platforms/arm/d51/README.txt diff --git a/libraries/FastLED-3.2.9/platforms/arm/d51/clockless_arm_d51.h b/libraries/FastLED/platforms/arm/d51/clockless_arm_d51.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/d51/clockless_arm_d51.h rename to libraries/FastLED/platforms/arm/d51/clockless_arm_d51.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/d51/fastled_arm_d51.h b/libraries/FastLED/platforms/arm/d51/fastled_arm_d51.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/d51/fastled_arm_d51.h rename to libraries/FastLED/platforms/arm/d51/fastled_arm_d51.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/d51/fastpin_arm_d51.h b/libraries/FastLED/platforms/arm/d51/fastpin_arm_d51.h similarity index 62% rename from libraries/FastLED-3.2.9/platforms/arm/d51/fastpin_arm_d51.h rename to libraries/FastLED/platforms/arm/d51/fastpin_arm_d51.h index 6d14c63..dd40dbf 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/d51/fastpin_arm_d51.h +++ b/libraries/FastLED/platforms/arm/d51/fastpin_arm_d51.h @@ -57,48 +57,71 @@ public: #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 _FL_IO(L) _RD32(GPIO ## L) -#define _DEFPIN_ARM(PIN, L, BIT) template<> class FastPin : public _ARMPIN {}; +#define _FL_DEFPIN(PIN, BIT, L) template<> class FastPin : public _ARMPIN {}; // Actual pin definitions #if defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) #define MAX_PIN 19 // D0-D13, including D6+D8 (DotStar CLK + DATA) -_DEFPIN_ARM( 0, 0, 16); _DEFPIN_ARM( 1, 0, 17); _DEFPIN_ARM( 2, 0, 7); _DEFPIN_ARM( 3, 1, 22); -_DEFPIN_ARM( 4, 0, 14); _DEFPIN_ARM( 5, 0, 15); _DEFPIN_ARM( 6, 1, 2); _DEFPIN_ARM( 7, 0, 18); -_DEFPIN_ARM( 8, 1, 3); _DEFPIN_ARM( 9, 0, 19); _DEFPIN_ARM(10, 0, 20); _DEFPIN_ARM(11, 0, 21); -_DEFPIN_ARM(12, 0, 23); _DEFPIN_ARM(13, 0, 22); +_FL_DEFPIN( 0, 16, 0); _FL_DEFPIN( 1, 17, 0); _FL_DEFPIN( 2, 7, 0); _FL_DEFPIN( 3, 22, 1); +_FL_DEFPIN( 4, 14, 0); _FL_DEFPIN( 5, 15, 0); _FL_DEFPIN( 6, 2, 1); _FL_DEFPIN( 7, 18, 0); +_FL_DEFPIN( 8, 3, 1); _FL_DEFPIN( 9, 19, 0); _FL_DEFPIN(10, 20, 0); _FL_DEFPIN(11, 21, 0); +_FL_DEFPIN(12, 23, 0); _FL_DEFPIN(13, 22, 0); // A0-A5 -_DEFPIN_ARM(14, 0, 2); _DEFPIN_ARM(15, 0, 5); _DEFPIN_ARM(16, 1, 8); _DEFPIN_ARM(17, 1, 9); -_DEFPIN_ARM(18, 0, 4); _DEFPIN_ARM(19, 0, 6); /* A6 is present in variant.h but couldn't find it on the schematic */ +_FL_DEFPIN(14, 2, 0); _FL_DEFPIN(15, 5, 0); _FL_DEFPIN(16, 8, 1); _FL_DEFPIN(17, 9, 1); +_FL_DEFPIN(18, 4, 0); _FL_DEFPIN(19, 6, 0); /* A6 is present in variant.h but couldn't find it on the schematic */ // SDA/SCL -_DEFPIN_ARM(21, 0, 12); _DEFPIN_ARM(22, 0, 13); +_FL_DEFPIN(21, 12, 0); _FL_DEFPIN(22, 13, 0); // 23..25 MISO/SCK/MOSI -_DEFPIN_ARM(23, 1, 23); _DEFPIN_ARM(24, 0, 1); _DEFPIN_ARM(25, 0, 0); +_FL_DEFPIN(23, 23, 1); _FL_DEFPIN(24, 1, 0); _FL_DEFPIN(25, 0, 0); #define SPI_DATA 25 #define SPI_CLOCK 24 #define HAS_HARDWARE_PIN_SUPPORT 1 +// Actual pin definitions +#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) + +#define MAX_PIN 20 +// D0-D13, including D6+D8 (DotStar CLK + DATA) +_FL_DEFPIN( 0, 23, 0); _FL_DEFPIN( 1, 22, 0); _FL_DEFPIN( 2, 17, 1); _FL_DEFPIN( 3, 16, 1); +_FL_DEFPIN( 4, 13, 1); _FL_DEFPIN( 5, 14, 1); _FL_DEFPIN( 6, 15, 1); _FL_DEFPIN( 7, 12, 1); +_FL_DEFPIN( 8, 21, 0); _FL_DEFPIN( 9, 20, 0); _FL_DEFPIN(10, 18, 0); _FL_DEFPIN(11, 19, 0); +_FL_DEFPIN(12, 17, 0); _FL_DEFPIN(13, 16, 0); +// A0-A5 +_FL_DEFPIN(14, 2, 0); _FL_DEFPIN(15, 5, 0); _FL_DEFPIN(16, 6, 0); _FL_DEFPIN(17, 0, 1); +_FL_DEFPIN(18, 8, 1); _FL_DEFPIN(19, 9, 1); +// SDA/SCL +_FL_DEFPIN(22, 2, 1); _FL_DEFPIN(23, 3, 1); + +// 23..25 MISO/SCK/MOSI +_FL_DEFPIN(24, 14, 0); _FL_DEFPIN(25, 13, 0); _FL_DEFPIN(26, 12, 0); + +#define SPI_DATA 26 +#define SPI_CLOCK 25 + +#define HAS_HARDWARE_PIN_SUPPORT 1 + #elif defined(ADAFRUIT_FEATHER_M4_EXPRESS) #define MAX_PIN 19 // D0-D13, including D8 (neopixel) no pins 2 3 -_DEFPIN_ARM( 0, 1, 17); _DEFPIN_ARM( 1, 1, 16); -_DEFPIN_ARM( 4, 0, 14); _DEFPIN_ARM( 5, 0, 16); _DEFPIN_ARM( 6, 0, 18); -_DEFPIN_ARM( 8, 1, 3); _DEFPIN_ARM( 9, 0, 19); _DEFPIN_ARM(10, 0, 20); _DEFPIN_ARM(11, 0, 21); -_DEFPIN_ARM(12, 0, 22); _DEFPIN_ARM(13, 0, 23); +_FL_DEFPIN( 0, 17, 1); _FL_DEFPIN( 1, 16, 1); +_FL_DEFPIN( 4, 14, 0); _FL_DEFPIN( 5, 16, 0); _FL_DEFPIN( 6, 18, 0); +_FL_DEFPIN( 8, 3, 1); _FL_DEFPIN( 9, 19, 0); _FL_DEFPIN(10, 20, 0); _FL_DEFPIN(11, 21, 0); +_FL_DEFPIN(12, 22, 0); _FL_DEFPIN(13, 23, 0); // A0-A5 -_DEFPIN_ARM(14, 0, 2); _DEFPIN_ARM(15, 0, 5); _DEFPIN_ARM(16, 1, 8); _DEFPIN_ARM(17, 1, 9); -_DEFPIN_ARM(18, 0, 4); _DEFPIN_ARM(19, 0, 6); /* A6 is present in variant.h but couldn't find it on the schematic */ +_FL_DEFPIN(14, 2, 0); _FL_DEFPIN(15, 5, 0); _FL_DEFPIN(16, 8, 1); _FL_DEFPIN(17, 9, 1); +_FL_DEFPIN(18, 4, 0); _FL_DEFPIN(19, 6, 0); /* A6 is present in variant.h but couldn't find it on the schematic */ // SDA/SCL -_DEFPIN_ARM(21, 0, 12); _DEFPIN_ARM(22, 0, 13); +_FL_DEFPIN(21, 12, 0); _FL_DEFPIN(22, 13, 0); // 23..25 MISO/MOSI/SCK -_DEFPIN_ARM(23, 1, 22); _DEFPIN_ARM(24, 1, 23); _DEFPIN_ARM(25, 0, 17); +_FL_DEFPIN(23, 22, 1); _FL_DEFPIN(24, 23, 1); _FL_DEFPIN(25, 17, 0); #define SPI_DATA 24 #define SPI_CLOCK 25 diff --git a/libraries/FastLED-3.2.9/platforms/arm/d51/led_sysdefs_arm_d51.h b/libraries/FastLED/platforms/arm/d51/led_sysdefs_arm_d51.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/d51/led_sysdefs_arm_d51.h rename to libraries/FastLED/platforms/arm/d51/led_sysdefs_arm_d51.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/clockless_arm_k20.h b/libraries/FastLED/platforms/arm/k20/clockless_arm_k20.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k20/clockless_arm_k20.h rename to libraries/FastLED/platforms/arm/k20/clockless_arm_k20.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/clockless_block_arm_k20.h b/libraries/FastLED/platforms/arm/k20/clockless_block_arm_k20.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k20/clockless_block_arm_k20.h rename to libraries/FastLED/platforms/arm/k20/clockless_block_arm_k20.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/fastled_arm_k20.h b/libraries/FastLED/platforms/arm/k20/fastled_arm_k20.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k20/fastled_arm_k20.h rename to libraries/FastLED/platforms/arm/k20/fastled_arm_k20.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/fastpin_arm_k20.h b/libraries/FastLED/platforms/arm/k20/fastpin_arm_k20.h similarity index 82% rename from libraries/FastLED-3.2.9/platforms/arm/k20/fastpin_arm_k20.h rename to libraries/FastLED/platforms/arm/k20/fastpin_arm_k20.h index b26e560..736bd46 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/k20/fastpin_arm_k20.h +++ b/libraries/FastLED/platforms/arm/k20/fastpin_arm_k20.h @@ -78,28 +78,28 @@ public: #define _R(T) struct __gen_struct_ ## T #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline reg32_t r() { return T; } \ template static __attribute__((always_inline)) inline ptr_reg32_t rx() { return GPIO_BITBAND_PTR(T, BIT); } }; -#define _IO32(L) _RD32(GPIO ## L ## _PDOR); _RD32(GPIO ## L ## _PSOR); _RD32(GPIO ## L ## _PCOR); _RD32(GPIO ## L ## _PTOR); _RD32(GPIO ## L ## _PDIR); _RD32(GPIO ## L ## _PDDR); +#define _FL_IO(L,C) _RD32(GPIO ## L ## _PDOR); _RD32(GPIO ## L ## _PSOR); _RD32(GPIO ## L ## _PCOR); _RD32(GPIO ## L ## _PTOR); _RD32(GPIO ## L ## _PDIR); _RD32(GPIO ## L ## _PDDR); _FL_DEFINE_PORT3(L,C,_R(GPIO ## L ## _PDOR)); -#define _DEFPIN_ARM(PIN, BIT, L) template<> class FastPin : public _ARMPIN class FastPin : public _ARMPIN {}; \ template<> class FastPinBB : public _ARMPIN_BITBAND {}; // Actual pin definitions +_FL_IO(A,0); _FL_IO(B,1); _FL_IO(C,2); _FL_IO(D,3); _FL_IO(E,4); + #if defined(FASTLED_TEENSY3) && defined(CORE_TEENSY) -_IO32(A); _IO32(B); _IO32(C); _IO32(D); _IO32(E); - #define MAX_PIN 33 -_DEFPIN_ARM(0, 16, B); _DEFPIN_ARM(1, 17, B); _DEFPIN_ARM(2, 0, D); _DEFPIN_ARM(3, 12, A); -_DEFPIN_ARM(4, 13, A); _DEFPIN_ARM(5, 7, D); _DEFPIN_ARM(6, 4, D); _DEFPIN_ARM(7, 2, D); -_DEFPIN_ARM(8, 3, D); _DEFPIN_ARM(9, 3, C); _DEFPIN_ARM(10, 4, C); _DEFPIN_ARM(11, 6, C); -_DEFPIN_ARM(12, 7, C); _DEFPIN_ARM(13, 5, C); _DEFPIN_ARM(14, 1, D); _DEFPIN_ARM(15, 0, C); -_DEFPIN_ARM(16, 0, B); _DEFPIN_ARM(17, 1, B); _DEFPIN_ARM(18, 3, B); _DEFPIN_ARM(19, 2, B); -_DEFPIN_ARM(20, 5, D); _DEFPIN_ARM(21, 6, D); _DEFPIN_ARM(22, 1, C); _DEFPIN_ARM(23, 2, C); -_DEFPIN_ARM(24, 5, A); _DEFPIN_ARM(25, 19, B); _DEFPIN_ARM(26, 1, E); _DEFPIN_ARM(27, 9, C); -_DEFPIN_ARM(28, 8, C); _DEFPIN_ARM(29, 10, C); _DEFPIN_ARM(30, 11, C); _DEFPIN_ARM(31, 0, E); -_DEFPIN_ARM(32, 18, B); _DEFPIN_ARM(33, 4, A); +_FL_DEFPIN(0, 16, B); _FL_DEFPIN(1, 17, B); _FL_DEFPIN(2, 0, D); _FL_DEFPIN(3, 12, A); +_FL_DEFPIN(4, 13, A); _FL_DEFPIN(5, 7, D); _FL_DEFPIN(6, 4, D); _FL_DEFPIN(7, 2, D); +_FL_DEFPIN(8, 3, D); _FL_DEFPIN(9, 3, C); _FL_DEFPIN(10, 4, C); _FL_DEFPIN(11, 6, C); +_FL_DEFPIN(12, 7, C); _FL_DEFPIN(13, 5, C); _FL_DEFPIN(14, 1, D); _FL_DEFPIN(15, 0, C); +_FL_DEFPIN(16, 0, B); _FL_DEFPIN(17, 1, B); _FL_DEFPIN(18, 3, B); _FL_DEFPIN(19, 2, B); +_FL_DEFPIN(20, 5, D); _FL_DEFPIN(21, 6, D); _FL_DEFPIN(22, 1, C); _FL_DEFPIN(23, 2, C); +_FL_DEFPIN(24, 5, A); _FL_DEFPIN(25, 19, B); _FL_DEFPIN(26, 1, E); _FL_DEFPIN(27, 9, C); +_FL_DEFPIN(28, 8, C); _FL_DEFPIN(29, 10, C); _FL_DEFPIN(30, 11, C); _FL_DEFPIN(31, 0, E); +_FL_DEFPIN(32, 18, B); _FL_DEFPIN(33, 4, A); #define SPI_DATA 11 #define SPI_CLOCK 13 diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/fastspi_arm_k20.h b/libraries/FastLED/platforms/arm/k20/fastspi_arm_k20.h similarity index 99% rename from libraries/FastLED-3.2.9/platforms/arm/k20/fastspi_arm_k20.h rename to libraries/FastLED/platforms/arm/k20/fastspi_arm_k20.h index 70210a3..0512324 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/k20/fastspi_arm_k20.h +++ b/libraries/FastLED/platforms/arm/k20/fastspi_arm_k20.h @@ -94,7 +94,7 @@ template void getScalars(uint32_t & preScalar, uint32_t & scalar, uint #define SPIX (*(SPI_t*)pSPIX) -template +template class ARMHardwareSPIOutput { Selectable *m_pSelect; SPIState gState; diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/led_sysdefs_arm_k20.h b/libraries/FastLED/platforms/arm/k20/led_sysdefs_arm_k20.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k20/led_sysdefs_arm_k20.h rename to libraries/FastLED/platforms/arm/k20/led_sysdefs_arm_k20.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/octows2811_controller.h b/libraries/FastLED/platforms/arm/k20/octows2811_controller.h similarity index 96% rename from libraries/FastLED-3.2.9/platforms/arm/k20/octows2811_controller.h rename to libraries/FastLED/platforms/arm/k20/octows2811_controller.h index 63f6d8f..84c2866 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/k20/octows2811_controller.h +++ b/libraries/FastLED/platforms/arm/k20/octows2811_controller.h @@ -28,7 +28,7 @@ class COctoWS2811Controller : public CPixelLEDController { } public: COctoWS2811Controller() { pocto = NULL; } - + virtual int size() { return CLEDController::size() * 8; } virtual void init() { /* do nothing yet */ } diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/smartmatrix_t3.h b/libraries/FastLED/platforms/arm/k20/smartmatrix_t3.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k20/smartmatrix_t3.h rename to libraries/FastLED/platforms/arm/k20/smartmatrix_t3.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k20/ws2812serial_controller.h b/libraries/FastLED/platforms/arm/k20/ws2812serial_controller.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k20/ws2812serial_controller.h rename to libraries/FastLED/platforms/arm/k20/ws2812serial_controller.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k66/clockless_arm_k66.h b/libraries/FastLED/platforms/arm/k66/clockless_arm_k66.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k66/clockless_arm_k66.h rename to libraries/FastLED/platforms/arm/k66/clockless_arm_k66.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k66/clockless_block_arm_k66.h b/libraries/FastLED/platforms/arm/k66/clockless_block_arm_k66.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k66/clockless_block_arm_k66.h rename to libraries/FastLED/platforms/arm/k66/clockless_block_arm_k66.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k66/fastled_arm_k66.h b/libraries/FastLED/platforms/arm/k66/fastled_arm_k66.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k66/fastled_arm_k66.h rename to libraries/FastLED/platforms/arm/k66/fastled_arm_k66.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/k66/fastpin_arm_k66.h b/libraries/FastLED/platforms/arm/k66/fastpin_arm_k66.h similarity index 74% rename from libraries/FastLED-3.2.9/platforms/arm/k66/fastpin_arm_k66.h rename to libraries/FastLED/platforms/arm/k66/fastpin_arm_k66.h index e201096..ef48396 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/k66/fastpin_arm_k66.h +++ b/libraries/FastLED/platforms/arm/k66/fastpin_arm_k66.h @@ -78,35 +78,35 @@ public: #define _R(T) struct __gen_struct_ ## T #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline reg32_t r() { return T; } \ template static __attribute__((always_inline)) inline ptr_reg32_t rx() { return GPIO_BITBAND_PTR(T, BIT); } }; -#define _IO32(L) _RD32(GPIO ## L ## _PDOR); _RD32(GPIO ## L ## _PSOR); _RD32(GPIO ## L ## _PCOR); _RD32(GPIO ## L ## _PTOR); _RD32(GPIO ## L ## _PDIR); _RD32(GPIO ## L ## _PDDR); +#define _FL_IO(L,C) _RD32(GPIO ## L ## _PDOR); _RD32(GPIO ## L ## _PSOR); _RD32(GPIO ## L ## _PCOR); _RD32(GPIO ## L ## _PTOR); _RD32(GPIO ## L ## _PDIR); _RD32(GPIO ## L ## _PDDR); _FL_DEFINE_PORT3(L,C,_R(GPIO ## L ## _PDOR)); -#define _DEFPIN_ARM(PIN, BIT, L) template<> class FastPin : public _ARMPIN class FastPin : public _ARMPIN {}; \ template<> class FastPinBB : public _ARMPIN_BITBAND {}; +_FL_IO(A,0); _FL_IO(B,1); _FL_IO(C,2); _FL_IO(D,3); _FL_IO(E,4); + // Actual pin definitions #if defined(FASTLED_TEENSY3) && defined(CORE_TEENSY) -_IO32(A); _IO32(B); _IO32(C); _IO32(D); _IO32(E); - #define MAX_PIN 63 -_DEFPIN_ARM( 0, 16, B); _DEFPIN_ARM( 1, 17, B); _DEFPIN_ARM( 2, 0, D); _DEFPIN_ARM( 3, 12, A); -_DEFPIN_ARM( 4, 13, A); _DEFPIN_ARM( 5, 7, D); _DEFPIN_ARM( 6, 4, D); _DEFPIN_ARM( 7, 2, D); -_DEFPIN_ARM( 8, 3, D); _DEFPIN_ARM( 9, 3, C); _DEFPIN_ARM(10, 4, C); _DEFPIN_ARM(11, 6, C); -_DEFPIN_ARM(12, 7, C); _DEFPIN_ARM(13, 5, C); _DEFPIN_ARM(14, 1, D); _DEFPIN_ARM(15, 0, C); -_DEFPIN_ARM(16, 0, B); _DEFPIN_ARM(17, 1, B); _DEFPIN_ARM(18, 3, B); _DEFPIN_ARM(19, 2, B); -_DEFPIN_ARM(20, 5, D); _DEFPIN_ARM(21, 6, D); _DEFPIN_ARM(22, 1, C); _DEFPIN_ARM(23, 2, C); -_DEFPIN_ARM(24, 26, E); _DEFPIN_ARM(25, 5, A); _DEFPIN_ARM(26, 14, A); _DEFPIN_ARM(27, 15, A); -_DEFPIN_ARM(28, 16, A); _DEFPIN_ARM(29, 18, B); _DEFPIN_ARM(30, 19, B); _DEFPIN_ARM(31, 10, B); -_DEFPIN_ARM(32, 11, B); _DEFPIN_ARM(33, 24, E); _DEFPIN_ARM(34, 25, E); _DEFPIN_ARM(35, 8, C); -_DEFPIN_ARM(36, 9, C); _DEFPIN_ARM(37, 10, C); _DEFPIN_ARM(38, 11, C); _DEFPIN_ARM(39, 17, A); -_DEFPIN_ARM(40, 28, A); _DEFPIN_ARM(41, 29, A); _DEFPIN_ARM(42, 26, A); _DEFPIN_ARM(43, 20, B); -_DEFPIN_ARM(44, 22, B); _DEFPIN_ARM(45, 23, B); _DEFPIN_ARM(46, 21, B); _DEFPIN_ARM(47, 8, D); -_DEFPIN_ARM(48, 9, D); _DEFPIN_ARM(49, 4, B); _DEFPIN_ARM(50, 5, B); _DEFPIN_ARM(51, 14, D); -_DEFPIN_ARM(52, 13, D); _DEFPIN_ARM(53, 12, D); _DEFPIN_ARM(54, 15, D); _DEFPIN_ARM(55, 11, D); -_DEFPIN_ARM(56, 10, E); _DEFPIN_ARM(57, 11, E); _DEFPIN_ARM(58, 0, E); _DEFPIN_ARM(59, 1, E); -_DEFPIN_ARM(60, 2, E); _DEFPIN_ARM(61, 3, E); _DEFPIN_ARM(62, 4, E); _DEFPIN_ARM(63, 5, E); +_FL_DEFPIN( 0, 16, B); _FL_DEFPIN( 1, 17, B); _FL_DEFPIN( 2, 0, D); _FL_DEFPIN( 3, 12, A); +_FL_DEFPIN( 4, 13, A); _FL_DEFPIN( 5, 7, D); _FL_DEFPIN( 6, 4, D); _FL_DEFPIN( 7, 2, D); +_FL_DEFPIN( 8, 3, D); _FL_DEFPIN( 9, 3, C); _FL_DEFPIN(10, 4, C); _FL_DEFPIN(11, 6, C); +_FL_DEFPIN(12, 7, C); _FL_DEFPIN(13, 5, C); _FL_DEFPIN(14, 1, D); _FL_DEFPIN(15, 0, C); +_FL_DEFPIN(16, 0, B); _FL_DEFPIN(17, 1, B); _FL_DEFPIN(18, 3, B); _FL_DEFPIN(19, 2, B); +_FL_DEFPIN(20, 5, D); _FL_DEFPIN(21, 6, D); _FL_DEFPIN(22, 1, C); _FL_DEFPIN(23, 2, C); +_FL_DEFPIN(24, 26, E); _FL_DEFPIN(25, 5, A); _FL_DEFPIN(26, 14, A); _FL_DEFPIN(27, 15, A); +_FL_DEFPIN(28, 16, A); _FL_DEFPIN(29, 18, B); _FL_DEFPIN(30, 19, B); _FL_DEFPIN(31, 10, B); +_FL_DEFPIN(32, 11, B); _FL_DEFPIN(33, 24, E); _FL_DEFPIN(34, 25, E); _FL_DEFPIN(35, 8, C); +_FL_DEFPIN(36, 9, C); _FL_DEFPIN(37, 10, C); _FL_DEFPIN(38, 11, C); _FL_DEFPIN(39, 17, A); +_FL_DEFPIN(40, 28, A); _FL_DEFPIN(41, 29, A); _FL_DEFPIN(42, 26, A); _FL_DEFPIN(43, 20, B); +_FL_DEFPIN(44, 22, B); _FL_DEFPIN(45, 23, B); _FL_DEFPIN(46, 21, B); _FL_DEFPIN(47, 8, D); +_FL_DEFPIN(48, 9, D); _FL_DEFPIN(49, 4, B); _FL_DEFPIN(50, 5, B); _FL_DEFPIN(51, 14, D); +_FL_DEFPIN(52, 13, D); _FL_DEFPIN(53, 12, D); _FL_DEFPIN(54, 15, D); _FL_DEFPIN(55, 11, D); +_FL_DEFPIN(56, 10, E); _FL_DEFPIN(57, 11, E); _FL_DEFPIN(58, 0, E); _FL_DEFPIN(59, 1, E); +_FL_DEFPIN(60, 2, E); _FL_DEFPIN(61, 3, E); _FL_DEFPIN(62, 4, E); _FL_DEFPIN(63, 5, E); diff --git a/libraries/FastLED-3.2.9/platforms/arm/k66/fastspi_arm_k66.h b/libraries/FastLED/platforms/arm/k66/fastspi_arm_k66.h similarity index 99% rename from libraries/FastLED-3.2.9/platforms/arm/k66/fastspi_arm_k66.h rename to libraries/FastLED/platforms/arm/k66/fastspi_arm_k66.h index 7e598cf..a40e598 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/k66/fastspi_arm_k66.h +++ b/libraries/FastLED/platforms/arm/k66/fastspi_arm_k66.h @@ -102,7 +102,7 @@ template void getScalars(uint32_t & preScalar, uint32_t & scalar, uint #define SPIX (*(SPI_t*)pSPIX) -template +template class ARMHardwareSPIOutput { Selectable *m_pSelect; SPIState gState; diff --git a/libraries/FastLED-3.2.9/platforms/arm/k66/led_sysdefs_arm_k66.h b/libraries/FastLED/platforms/arm/k66/led_sysdefs_arm_k66.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/k66/led_sysdefs_arm_k66.h rename to libraries/FastLED/platforms/arm/k66/led_sysdefs_arm_k66.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/kl26/clockless_arm_kl26.h b/libraries/FastLED/platforms/arm/kl26/clockless_arm_kl26.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/kl26/clockless_arm_kl26.h rename to libraries/FastLED/platforms/arm/kl26/clockless_arm_kl26.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/kl26/fastled_arm_kl26.h b/libraries/FastLED/platforms/arm/kl26/fastled_arm_kl26.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/kl26/fastled_arm_kl26.h rename to libraries/FastLED/platforms/arm/kl26/fastled_arm_kl26.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/kl26/fastpin_arm_kl26.h b/libraries/FastLED/platforms/arm/kl26/fastpin_arm_kl26.h similarity index 77% rename from libraries/FastLED-3.2.9/platforms/arm/kl26/fastpin_arm_kl26.h rename to libraries/FastLED/platforms/arm/kl26/fastpin_arm_kl26.h index 4c30cd7..8b3cbdf 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/kl26/fastpin_arm_kl26.h +++ b/libraries/FastLED/platforms/arm/kl26/fastpin_arm_kl26.h @@ -50,26 +50,26 @@ public: #define _R(T) struct __gen_struct_ ## T #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline reg32_t r() { return T; } \ template static __attribute__((always_inline)) inline ptr_reg32_t rx() { return GPIO_BITBAND_PTR(T, BIT); } }; -#define _IO32(L) _RD32(FGPIO ## L ## _PDOR); _RD32(FGPIO ## L ## _PSOR); _RD32(FGPIO ## L ## _PCOR); _RD32(GPIO ## L ## _PTOR); _RD32(FGPIO ## L ## _PDIR); _RD32(FGPIO ## L ## _PDDR); +#define _FL_IO(L,C) _RD32(FGPIO ## L ## _PDOR); _RD32(FGPIO ## L ## _PSOR); _RD32(FGPIO ## L ## _PCOR); _RD32(GPIO ## L ## _PTOR); _RD32(FGPIO ## L ## _PDIR); _RD32(FGPIO ## L ## _PDDR); _FL_DEFINE_PORT3(L,C,_R(FGPIO ## L ## _PDOR)); -#define _DEFPIN_ARM(PIN, BIT, L) template<> class FastPin : public _ARMPIN class FastPin : public _ARMPIN {}; \ /* template<> class FastPinBB : public _ARMPIN_BITBAND {}; */ +_FL_IO(A,0); _FL_IO(B,1); _FL_IO(C,2); _FL_IO(D,3); _FL_IO(E,4); + // Actual pin definitions #if defined(FASTLED_TEENSYLC) && defined(CORE_TEENSY) -_IO32(A); _IO32(B); _IO32(C); _IO32(D); _IO32(E); - #define MAX_PIN 26 -_DEFPIN_ARM(0, 16, B); _DEFPIN_ARM(1, 17, B); _DEFPIN_ARM(2, 0, D); _DEFPIN_ARM(3, 1, A); -_DEFPIN_ARM(4, 2, A); _DEFPIN_ARM(5, 7, D); _DEFPIN_ARM(6, 4, D); _DEFPIN_ARM(7, 2, D); -_DEFPIN_ARM(8, 3, D); _DEFPIN_ARM(9, 3, C); _DEFPIN_ARM(10, 4, C); _DEFPIN_ARM(11, 6, C); -_DEFPIN_ARM(12, 7, C); _DEFPIN_ARM(13, 5, C); _DEFPIN_ARM(14, 1, D); _DEFPIN_ARM(15, 0, C); -_DEFPIN_ARM(16, 0, B); _DEFPIN_ARM(17, 1, B); _DEFPIN_ARM(18, 3, B); _DEFPIN_ARM(19, 2, B); -_DEFPIN_ARM(20, 5, D); _DEFPIN_ARM(21, 6, D); _DEFPIN_ARM(22, 1, C); _DEFPIN_ARM(23, 2, C); -_DEFPIN_ARM(24, 20, E); _DEFPIN_ARM(25, 21, E); _DEFPIN_ARM(26, 30, E); +_FL_DEFPIN(0, 16, B); _FL_DEFPIN(1, 17, B); _FL_DEFPIN(2, 0, D); _FL_DEFPIN(3, 1, A); +_FL_DEFPIN(4, 2, A); _FL_DEFPIN(5, 7, D); _FL_DEFPIN(6, 4, D); _FL_DEFPIN(7, 2, D); +_FL_DEFPIN(8, 3, D); _FL_DEFPIN(9, 3, C); _FL_DEFPIN(10, 4, C); _FL_DEFPIN(11, 6, C); +_FL_DEFPIN(12, 7, C); _FL_DEFPIN(13, 5, C); _FL_DEFPIN(14, 1, D); _FL_DEFPIN(15, 0, C); +_FL_DEFPIN(16, 0, B); _FL_DEFPIN(17, 1, B); _FL_DEFPIN(18, 3, B); _FL_DEFPIN(19, 2, B); +_FL_DEFPIN(20, 5, D); _FL_DEFPIN(21, 6, D); _FL_DEFPIN(22, 1, C); _FL_DEFPIN(23, 2, C); +_FL_DEFPIN(24, 20, E); _FL_DEFPIN(25, 21, E); _FL_DEFPIN(26, 30, E); #define SPI_DATA 11 #define SPI_CLOCK 13 diff --git a/libraries/FastLED-3.2.9/platforms/arm/kl26/fastspi_arm_kl26.h b/libraries/FastLED/platforms/arm/kl26/fastspi_arm_kl26.h similarity index 98% rename from libraries/FastLED-3.2.9/platforms/arm/kl26/fastspi_arm_kl26.h rename to libraries/FastLED/platforms/arm/kl26/fastspi_arm_kl26.h index 869b605..b1e7667 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/kl26/fastspi_arm_kl26.h +++ b/libraries/FastLED/platforms/arm/kl26/fastspi_arm_kl26.h @@ -82,7 +82,7 @@ template void getScalars(uint8_t & sppr, uint8_t & spr) { #define SPIX (*(KINETISL_SPI_t*)pSPIX) #define ARM_HARDWARE_SPI -template +template class ARMHardwareSPIOutput { Selectable *m_pSelect; diff --git a/libraries/FastLED-3.2.9/platforms/arm/kl26/led_sysdefs_arm_kl26.h b/libraries/FastLED/platforms/arm/kl26/led_sysdefs_arm_kl26.h similarity index 96% rename from libraries/FastLED-3.2.9/platforms/arm/kl26/led_sysdefs_arm_kl26.h rename to libraries/FastLED/platforms/arm/kl26/led_sysdefs_arm_kl26.h index 466d729..575e639 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/kl26/led_sysdefs_arm_kl26.h +++ b/libraries/FastLED/platforms/arm/kl26/led_sysdefs_arm_kl26.h @@ -13,7 +13,7 @@ // Default to allowing interrupts #ifndef FASTLED_ALLOW_INTERRUPTS -#define FASTLED_ALLOW_INTERRUPTS 1 +// #define FASTLED_ALLOW_INTERRUPTS 1 #endif #if FASTLED_ALLOW_INTERRUPTS == 1 diff --git a/libraries/FastLED/platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h b/libraries/FastLED/platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h new file mode 100644 index 0000000..694297e --- /dev/null +++ b/libraries/FastLED/platforms/arm/mxrt1062/block_clockless_arm_mxrt1062.h @@ -0,0 +1,214 @@ +#ifndef __INC_BLOCK_CLOCKLESS_ARM_MXRT1062_H +#define __INC_BLOCK_CLOCKLESS_ARM_MXRT1062_H + +FASTLED_NAMESPACE_BEGIN + +// Definition for a single channel clockless controller for the teensy4 +// See clockless.h for detailed info on how the template parameters are used. +#if defined(FASTLED_TEENSY4) + +#define __FL_T4_MASK ((1<<(LANES))-1) +template +class FlexibleInlineBlockClocklessController : public CPixelLEDController { + + uint8_t m_bitOffsets[16]; + uint8_t m_nActualLanes; + uint8_t m_nLowBit; + uint8_t m_nHighBit; + uint32_t m_nWriteMask; + uint8_t m_nOutBlocks; + uint32_t m_offsets[3]; + CMinWait mWait; +public: + + virtual int size() { return CLEDController::size() * m_nActualLanes; } + +// For each pin, if we've hit our lane count, break, otherwise set the pin to output, +// store the bit offset in our offset array, add this pin to the write mask, and if this +// pin ends a block sequence, then break out of the switch as well +#define _BLOCK_PIN(P) case P: { \ + if(m_nActualLanes == LANES) break; \ + FastPin

::setOutput(); \ + m_bitOffsets[m_nActualLanes++] = FastPin

::pinbit(); \ + m_nWriteMask |= FastPin

::mask(); \ + if( P == 27 || P == 7 || P == 30) break; \ +} + + virtual void init() { + // pre-initialize + memset(m_bitOffsets,0,16); + m_nActualLanes = 0; + m_nLowBit = 33; + m_nHighBit = 0; + m_nWriteMask = 0; + + // setup the bits and data tracking for parallel output + switch(FIRST_PIN) { + // GPIO6 block output + _BLOCK_PIN( 1); + _BLOCK_PIN( 0); + _BLOCK_PIN(24); + _BLOCK_PIN(25); + _BLOCK_PIN(19); + _BLOCK_PIN(18); + _BLOCK_PIN(14); + _BLOCK_PIN(15); + _BLOCK_PIN(17); + _BLOCK_PIN(16); + _BLOCK_PIN(22); + _BLOCK_PIN(23); + _BLOCK_PIN(20); + _BLOCK_PIN(21); + _BLOCK_PIN(26); + _BLOCK_PIN(27); + // GPIO7 block output + _BLOCK_PIN(10); + _BLOCK_PIN(12); + _BLOCK_PIN(11); + _BLOCK_PIN(13); + _BLOCK_PIN( 6); + _BLOCK_PIN( 9); + _BLOCK_PIN(32); + _BLOCK_PIN( 8); + _BLOCK_PIN( 7); + // GPIO 37 block output + _BLOCK_PIN(37); + _BLOCK_PIN(36); + _BLOCK_PIN(35); + _BLOCK_PIN(34); + _BLOCK_PIN(39); + _BLOCK_PIN(38); + _BLOCK_PIN(28); + _BLOCK_PIN(31); + _BLOCK_PIN(30); + } + + for(int i = 0; i < m_nActualLanes; i++) { + if(m_bitOffsets[i] < m_nLowBit) { m_nLowBit = m_bitOffsets[i]; } + if(m_bitOffsets[i] > m_nHighBit) { m_nHighBit = m_bitOffsets[i]; } + } + + m_nOutBlocks = (m_nHighBit + 8)/8; + + } + + + virtual void showPixels(PixelController & pixels) { + mWait.wait(); + #if FASTLED_ALLOW_INTERRUPTS == 0 + uint32_t clocks = showRGBInternal(pixels); + // Adjust the timer + long microsTaken = CLKS_TO_MICROS(clocks); + MS_COUNTER += (1 + (microsTaken / 1000)); + #else + showRGBInternal(pixels); + #endif + + mWait.mark(); + } + + typedef union { + uint8_t bytes[32]; + uint8_t bg[4][8]; + uint16_t shorts[16]; + uint32_t raw[8]; + } _outlines; + + + template __attribute__ ((always_inline)) inline void writeBits(register uint32_t & next_mark, register _outlines & b, PixelController &pixels) { + _outlines b2; + transpose8x1(b.bg[3], b2.bg[3]); + transpose8x1(b.bg[2], b2.bg[2]); + transpose8x1(b.bg[1], b2.bg[1]); + transpose8x1(b.bg[0], b2.bg[0]); + + register uint8_t d = pixels.template getd(pixels); + register uint8_t scale = pixels.template getscale(pixels); + + int x = 0; + for(uint32_t i = 8; i > 0;) { + i--; + while(ARM_DWT_CYCCNT < next_mark); + *FastPin::sport() = m_nWriteMask; + next_mark = ARM_DWT_CYCCNT + m_offsets[0]; + + uint32_t out = (b2.bg[3][i] << 24) | (b2.bg[2][i] << 16) | (b2.bg[1][i] << 8) | b2.bg[0][i]; + + out = ((~out) & m_nWriteMask); + while((next_mark - ARM_DWT_CYCCNT) > m_offsets[1]); + *FastPin::cport() = out; + + out = m_nWriteMask; + while((next_mark - ARM_DWT_CYCCNT) > m_offsets[2]); + *FastPin::cport() = out; + + // Read and store up to two bytes + if (x < m_nActualLanes) { + b.bytes[m_bitOffsets[x]] = pixels.template loadAndScale(pixels,x,d,scale); + x++; + if (x < m_nActualLanes) { + b.bytes[m_bitOffsets[x]] = pixels.template loadAndScale(pixels,x,d,scale); + x++; + } + } + } + } + + uint32_t showRGBInternal(PixelController &allpixels) { + allpixels.preStepFirstByteDithering(); + _outlines b0; + uint32_t start = ARM_DWT_CYCCNT; + + for(int i = 0; i < m_nActualLanes; i++) { + b0.bytes[m_bitOffsets[i]] = allpixels.loadAndScale0(i); + } + + cli(); + m_offsets[0] = _FASTLED_NS_TO_DWT(T1+T2+T3); + m_offsets[1] = _FASTLED_NS_TO_DWT(T2+T3); + m_offsets[2] = _FASTLED_NS_TO_DWT(T3); + uint32_t wait_off = _FASTLED_NS_TO_DWT((WAIT_TIME-INTERRUPT_THRESHOLD)); + + uint32_t next_mark = ARM_DWT_CYCCNT + m_offsets[0]; + + while(allpixels.has(1)) { + allpixels.stepDithering(); + #if (FASTLED_ALLOW_INTERRUPTS == 1) + cli(); + // if interrupts took longer than 45µs, punt on the current frame + if(ARM_DWT_CYCCNT > next_mark) { + if((ARM_DWT_CYCCNT-next_mark) > wait_off) { sei(); return ARM_DWT_CYCCNT - start; } + } + #endif + + // Write first byte, read next byte + writeBits<8+XTRA0,1>(next_mark, b0, allpixels); + + // Write second byte, read 3rd byte + writeBits<8+XTRA0,2>(next_mark, b0, allpixels); + allpixels.advanceData(); + + // Write third byte + writeBits<8+XTRA0,0>(next_mark, b0, allpixels); + + #if (FASTLED_ALLOW_INTERRUPTS == 1) + sei(); + #endif + } + + sei(); + + return ARM_DWT_CYCCNT - start; + } +}; + +template class CHIPSET, uint8_t DATA_PIN, int NUM_LANES, EOrder RGB_ORDER=GRB> +class __FIBCC : public FlexibleInlineBlockClocklessController::__T1(),CHIPSET::__T2(),CHIPSET::__T3(),RGB_ORDER,CHIPSET::__XTRA0(),CHIPSET::__FLIP(),CHIPSET::__WAIT_TIME()> {}; + +#define __FASTLED_HAS_FIBCC 1 + +#endif //defined(FASTLED_TEENSY4) + +FASTLED_NAMESPACE_END + +#endif diff --git a/libraries/FastLED/platforms/arm/mxrt1062/clockless_arm_mxrt1062.h b/libraries/FastLED/platforms/arm/mxrt1062/clockless_arm_mxrt1062.h new file mode 100644 index 0000000..468c15d --- /dev/null +++ b/libraries/FastLED/platforms/arm/mxrt1062/clockless_arm_mxrt1062.h @@ -0,0 +1,128 @@ +#ifndef __INC_CLOCKLESS_ARM_MXRT1062_H +#define __INC_CLOCKLESS_ARM_MXRT1062_H + +FASTLED_NAMESPACE_BEGIN + +// Definition for a single channel clockless controller for the teensy4 +// See clockless.h for detailed info on how the template parameters are used. +#if defined(FASTLED_TEENSY4) + +#define FASTLED_HAS_CLOCKLESS 1 + +#define _FASTLED_NS_TO_DWT(_NS) (((F_CPU_ACTUAL>>16)*(_NS)) / (1000000000UL>>16)) + +template +class ClocklessController : public CPixelLEDController { + typedef typename FastPin::port_ptr_t data_ptr_t; + typedef typename FastPin::port_t data_t; + + data_t mPinMask; + data_ptr_t mPort; + CMinWait mWait; + uint32_t off[3]; + +public: + static constexpr int __DATA_PIN() { return DATA_PIN; } + static constexpr int __T1() { return T1; } + static constexpr int __T2() { return T2; } + static constexpr int __T3() { return T3; } + static constexpr EOrder __RGB_ORDER() { return RGB_ORDER; } + static constexpr int __XTRA0() { return XTRA0; } + static constexpr bool __FLIP() { return FLIP; } + static constexpr int __WAIT_TIME() { return WAIT_TIME; } + + virtual void init() { + FastPin::setOutput(); + mPinMask = FastPin::mask(); + mPort = FastPin::port(); + FastPin::lo(); + } + +protected: + + virtual void showPixels(PixelController & pixels) { + mWait.wait(); + if(!showRGBInternal(pixels)) { + sei(); delayMicroseconds(WAIT_TIME); cli(); + showRGBInternal(pixels); + } + mWait.mark(); + } + + template __attribute__ ((always_inline)) inline void writeBits(register uint32_t & next_mark, register uint32_t & b) { + for(register uint32_t i = BITS-1; i > 0; i--) { + while(ARM_DWT_CYCCNT < next_mark); + next_mark = ARM_DWT_CYCCNT + off[0]; + FastPin::hi(); + if(b&0x80) { + while((next_mark - ARM_DWT_CYCCNT) > off[1]); + FastPin::lo(); + } else { + while((next_mark - ARM_DWT_CYCCNT) > off[2]); + FastPin::lo(); + } + b <<= 1; + } + + while(ARM_DWT_CYCCNT < next_mark); + next_mark = ARM_DWT_CYCCNT + off[1]; + FastPin::hi(); + + if(b&0x80) { + while((next_mark - ARM_DWT_CYCCNT) > off[2]); + FastPin::lo(); + } else { + while((next_mark - ARM_DWT_CYCCNT) > off[2]); + FastPin::lo(); + } + } + + uint32_t showRGBInternal(PixelController pixels) { + uint32_t start = ARM_DWT_CYCCNT; + + // Setup the pixel controller and load/scale the first byte + pixels.preStepFirstByteDithering(); + register uint32_t b = pixels.loadAndScale0(); + + cli(); + off[0] = _FASTLED_NS_TO_DWT(T1+T2+T3); + off[1] = _FASTLED_NS_TO_DWT(T2+T3); + off[2] = _FASTLED_NS_TO_DWT(T3); + uint32_t wait_off = _FASTLED_NS_TO_DWT((WAIT_TIME-INTERRUPT_THRESHOLD)); + + uint32_t next_mark = ARM_DWT_CYCCNT + off[0]; + + while(pixels.has(1)) { + pixels.stepDithering(); + #if (FASTLED_ALLOW_INTERRUPTS == 1) + cli(); + // if interrupts took longer than 45µs, punt on the current frame + if(ARM_DWT_CYCCNT > next_mark) { + if((ARM_DWT_CYCCNT-next_mark) > wait_off) { sei(); return ARM_DWT_CYCCNT - start; } + } + #endif + // Write first byte, read next byte + writeBits<8+XTRA0>(next_mark, b); + b = pixels.loadAndScale1(); + + // Write second byte, read 3rd byte + writeBits<8+XTRA0>(next_mark, b); + b = pixels.loadAndScale2(); + + // Write third byte, read 1st byte of next pixel + writeBits<8+XTRA0>(next_mark, b); + b = pixels.advanceAndLoadAndScale0(); + #if (FASTLED_ALLOW_INTERRUPTS == 1) + sei(); + #endif + }; + + sei(); + return ARM_DWT_CYCCNT - start; + } +}; +#endif + +FASTLED_NAMESPACE_END + +#endif diff --git a/libraries/FastLED/platforms/arm/mxrt1062/fastled_arm_mxrt1062.h b/libraries/FastLED/platforms/arm/mxrt1062/fastled_arm_mxrt1062.h new file mode 100644 index 0000000..0814c7f --- /dev/null +++ b/libraries/FastLED/platforms/arm/mxrt1062/fastled_arm_mxrt1062.h @@ -0,0 +1,9 @@ +#ifndef __INC_FASTLED_ARM_MXRT1062_H +#define __INC_FASTLED_ARM_MXRT1062_H + +#include "fastpin_arm_mxrt1062.h" +#include "fastspi_arm_mxrt1062.h" +#include "clockless_arm_mxrt1062.h" +#include "block_clockless_arm_mxrt1062.h" + +#endif diff --git a/libraries/FastLED/platforms/arm/mxrt1062/fastpin_arm_mxrt1062.h b/libraries/FastLED/platforms/arm/mxrt1062/fastpin_arm_mxrt1062.h new file mode 100644 index 0000000..38c8841 --- /dev/null +++ b/libraries/FastLED/platforms/arm/mxrt1062/fastpin_arm_mxrt1062.h @@ -0,0 +1,91 @@ +#ifndef __FASTPIN_ARM_MXRT1062_H +#define __FASTPIN_ARM_MXRT1062_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 teensy 4.0 style ARM pins, providing direct access to the various GPIO registers. Note that this +/// uses the full port GPIO registers. It calls through to pinMode for setting input/output on pins +/// The registers are data output, set output, clear output, toggle output, input, and direction +template class _ARMPIN { +public: + typedef volatile uint32_t * port_ptr_t; + typedef uint32_t port_t; + + 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)) { _GPIO_DR_SET::r() = _MASK; } + inline static void lo() __attribute__ ((always_inline)) { _GPIO_DR_CLEAR::r() = _MASK; } + inline static void set(register port_t val) __attribute__ ((always_inline)) { _GPIO_DR::r() = val; } + + inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } + + inline static void toggle() __attribute__ ((always_inline)) { _GPIO_DR_TOGGLE::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 port_t val) __attribute__ ((always_inline)) { *port = val; } + + inline static port_t hival() __attribute__ ((always_inline)) { return _GPIO_DR::r() | _MASK; } + inline static port_t loval() __attribute__ ((always_inline)) { return _GPIO_DR::r() & ~_MASK; } + inline static port_ptr_t port() __attribute__ ((always_inline)) { return &_GPIO_DR::r(); } + inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &_GPIO_DR_SET::r(); } + inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &_GPIO_DR_CLEAR::r(); } + inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; } + inline static uint32_t pinbit() __attribute__ ((always_inline)) { return _BIT; } +}; + + +#define _R(T) struct __gen_struct_ ## T +#define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline reg32_t r() { return T; } }; +#define _FL_IO(L) _RD32(GPIO ## L ## _DR); _RD32(GPIO ## L ## _DR_SET); _RD32(GPIO ## L ## _DR_CLEAR); _RD32(GPIO ## L ## _DR_TOGGLE); _FL_DEFINE_PORT(L, _R(GPIO ## L ## _DR)); + +// From the teensy core - it looks like there's the "default set" of port registers at GPIO1-5 - but then there +// are a mirrored set for GPIO1-4 at GPIO6-9, which in the teensy core is referred to as "fast" - while the pin definitiosn +// at https://forum.pjrc.com/threads/54711-Teensy-4-0-First-Beta-Test?p=193716&viewfull=1#post193716 +// refer to GPIO1-4, we're going to use GPIO6-9 in the definitions below because the fast registers are what +// the teensy core is using internally +#define _FL_DEFPIN(PIN, BIT, L) template<> class FastPin : public _ARMPIN {}; + +#if defined(FASTLED_TEENSY4) && defined(CORE_TEENSY) +_FL_IO(1); _FL_IO(2); _FL_IO(3); _FL_IO(4); _FL_IO(5); +_FL_IO(6); _FL_IO(7); _FL_IO(8); _FL_IO(9); + +#define MAX_PIN 39 +_FL_DEFPIN( 0, 3,6); _FL_DEFPIN( 1, 2,6); _FL_DEFPIN( 2, 4,9); _FL_DEFPIN( 3, 5,9); +_FL_DEFPIN( 4, 6,9); _FL_DEFPIN( 5, 8,9); _FL_DEFPIN( 6,10,7); _FL_DEFPIN( 7,17,7); +_FL_DEFPIN( 8,16,7); _FL_DEFPIN( 9,11,7); _FL_DEFPIN(10, 0,7); _FL_DEFPIN(11, 2,7); +_FL_DEFPIN(12, 1,7); _FL_DEFPIN(13, 3,7); _FL_DEFPIN(14,18,6); _FL_DEFPIN(15,19,6); +_FL_DEFPIN(16,23,6); _FL_DEFPIN(17,22,6); _FL_DEFPIN(18,17,6); _FL_DEFPIN(19,16,6); +_FL_DEFPIN(20,26,6); _FL_DEFPIN(21,27,6); _FL_DEFPIN(22,24,6); _FL_DEFPIN(23,25,6); +_FL_DEFPIN(24,12,6); _FL_DEFPIN(25,13,6); _FL_DEFPIN(26,30,6); _FL_DEFPIN(27,31,6); +_FL_DEFPIN(28,18,8); _FL_DEFPIN(29,31,9); _FL_DEFPIN(30,23,8); _FL_DEFPIN(31,22,8); +_FL_DEFPIN(32,12,7); _FL_DEFPIN(33, 7,9); _FL_DEFPIN(34,15,8); _FL_DEFPIN(35,14,8); +_FL_DEFPIN(36,13,8); _FL_DEFPIN(37,12,8); _FL_DEFPIN(38,17,8); _FL_DEFPIN(39,16,8); + +#define HAS_HARDWARE_PIN_SUPPORT + +#define ARM_HARDWARE_SPI +#define SPI_DATA 11 +#define SPI_CLOCK 13 + +#define SPI1_DATA 26 +#define SPI1_CLOCK 27 + +#define SPI2_DATA 35 +#define SPI2_CLOCK 37 + +#endif // defined FASTLED_TEENSY4 + +#endif // FASTLED_FORCE_SOFTWARE_PINSs + +FASTLED_NAMESPACE_END + +#endif diff --git a/libraries/FastLED/platforms/arm/mxrt1062/fastspi_arm_mxrt1062.h b/libraries/FastLED/platforms/arm/mxrt1062/fastspi_arm_mxrt1062.h new file mode 100644 index 0000000..fa6b81f --- /dev/null +++ b/libraries/FastLED/platforms/arm/mxrt1062/fastspi_arm_mxrt1062.h @@ -0,0 +1,140 @@ +#ifndef __INC_FASTSPI_ARM_MXRT1062_H +#define __INC_FASTSPI_ARM_MXRT1062_H + +FASTLED_NAMESPACE_BEGIN + +#if defined (FASTLED_TEENSY4) && defined(ARM_HARDWARE_SPI) +#include + +template +class Teesy4HardwareSPIOutput { + Selectable *m_pSelect; + uint32_t m_bitCount; + uint32_t m_bitData; + inline IMXRT_LPSPI_t & port() __attribute__((always_inline)) { + switch(_SPI_INDEX) { + case 0: + return IMXRT_LPSPI4_S; + case 1: + return IMXRT_LPSPI3_S; + case 2: + return IMXRT_LPSPI1_S; + } + } + +public: + Teesy4HardwareSPIOutput() { m_pSelect = NULL; m_bitCount = 0;} + Teesy4HardwareSPIOutput(Selectable *pSelect) { m_pSelect = pSelect; m_bitCount = 0;} + + // set the object representing the selectable -- ignore for now + void setSelect(Selectable *pSelect) { /* TODO */ } + + // initialize the SPI subssytem + void init() { _SPIObject.begin(); } + + // latch the CS select + void inline select() __attribute__((always_inline)) { + // begin the SPI transaction + _SPIObject.beginTransaction(SPISettings(_SPI_CLOCK_RATE, MSBFIRST, SPI_MODE0)); + if(m_pSelect != NULL) { m_pSelect->select(); } + } + + // release the CS select + void inline release() __attribute__((always_inline)) { + if(m_pSelect != NULL) { m_pSelect->release(); } + _SPIObject.endTransaction(); + } + + // wait until all queued up data has been written + static void waitFully() { /* TODO */ } + + // write a byte out via SPI (returns immediately on writing register) - + void inline writeByte(uint8_t b) __attribute__((always_inline)) { + if(m_bitCount == 0) { + _SPIObject.transfer(b); + } else { + // There's been a bit of data written, add that to the output as well + uint32_t outData = (m_bitData << 8) | b; + uint32_t tcr = port().TCR; + port().TCR = (tcr & 0xfffff000) | LPSPI_TCR_FRAMESZ((8+m_bitCount) - 1); // turn on 9 bit mode + port().TDR = outData; // output 9 bit data. + while ((port().RSR & LPSPI_RSR_RXEMPTY)) ; // wait while the RSR fifo is empty... + port().TCR = (tcr & 0xfffff000) | LPSPI_TCR_FRAMESZ((8) - 1); // turn back on 8 bit mode + port().RDR; + m_bitCount = 0; + } + } + + // write a word out via SPI (returns immediately on writing register) + void inline writeWord(uint16_t w) __attribute__((always_inline)) { + writeByte(((w>>8) & 0xFF)); + _SPIObject.transfer(w & 0xFF); + } + + // A raw set of writing byte values, assumes setup/init/waiting done elsewhere + static void writeBytesValueRaw(uint8_t value, int len) { + while(len--) { _SPIObject.transfer(value); } + } + + // A full cycle of writing a value for len bytes, including select, release, and waiting + void writeBytesValue(uint8_t value, int len) { + select(); writeBytesValueRaw(value, len); release(); + } + + // A full cycle of writing a value for len bytes, including select, release, and waiting + template void writeBytes(register uint8_t *data, int len) { + uint8_t *end = data + len; + select(); + // could be optimized to write 16bit words out instead of 8bit bytes + while(data != end) { + writeByte(D::adjust(*data++)); + } + D::postBlock(len); + waitFully(); + release(); + } + + // A full cycle of writing a value for len bytes, including select, release, and waiting + void writeBytes(register uint8_t *data, int len) { writeBytes(data, len); } + + // write a single bit out, which bit from the passed in byte is determined by template parameter + template inline void writeBit(uint8_t b) { + m_bitData = (m_bitData<<1) | ((b&(1< void writePixels(PixelController pixels) { + select(); + int len = pixels.mLen; + + while(pixels.has(1)) { + if(FLAGS & FLAG_START_BIT) { + writeBit<0>(1); + } + writeByte(D::adjust(pixels.loadAndScale0())); + writeByte(D::adjust(pixels.loadAndScale1())); + writeByte(D::adjust(pixels.loadAndScale2())); + + pixels.advanceData(); + pixels.stepDithering(); + } + D::postBlock(len); + release(); + } + +}; + + +#endif + +FASTLED_NAMESPACE_END +#endif diff --git a/libraries/FastLED/platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h b/libraries/FastLED/platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h new file mode 100644 index 0000000..ac49082 --- /dev/null +++ b/libraries/FastLED/platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h @@ -0,0 +1,43 @@ +#ifndef __INC_LED_SYSDEFS_ARM_MXRT1062_H +#define __INC_LED_SYSDEFS_ARM_MXRT1062_H + +#define FASTLED_TEENSY4 +#define FASTLED_ARM + +#ifndef INTERRUPT_THRESHOLD +#define INTERRUPT_THRESHOLD 1 +#endif + +// Default to allowing interrupts +#ifndef FASTLED_ALLOW_INTERRUPTS +#define FASTLED_ALLOW_INTERRUPTS 1 +#endif + +#if FASTLED_ALLOW_INTERRUPTS == 1 +#define FASTLED_ACCURATE_CLOCK +#endif + +#if (F_CPU == 96000000) +#define CLK_DBL 1 +#endif + +// Get some system include files +#include +#include // for cli/se definitions + +// Define the register types +#if defined(ARDUINO) // && ARDUINO < 150 +typedef volatile uint32_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ +typedef volatile uint32_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ +#endif + +// extern volatile uint32_t systick_millis_count; +// # define MS_COUNTER systick_millis_count + +// Teensy4 provides progmem +#ifndef FASTLED_USE_PROGMEM +#define FASTLED_USE_PROGMEM 1 +#endif + + +#endif diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf51/clockless_arm_nrf51.h b/libraries/FastLED/platforms/arm/nrf51/clockless_arm_nrf51.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/nrf51/clockless_arm_nrf51.h rename to libraries/FastLED/platforms/arm/nrf51/clockless_arm_nrf51.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf51/fastled_arm_nrf51.h b/libraries/FastLED/platforms/arm/nrf51/fastled_arm_nrf51.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/nrf51/fastled_arm_nrf51.h rename to libraries/FastLED/platforms/arm/nrf51/fastled_arm_nrf51.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf51/fastpin_arm_nrf51.h b/libraries/FastLED/platforms/arm/nrf51/fastpin_arm_nrf51.h similarity index 89% rename from libraries/FastLED-3.2.9/platforms/arm/nrf51/fastpin_arm_nrf51.h rename to libraries/FastLED/platforms/arm/nrf51/fastpin_arm_nrf51.h index 4125f9a..3d02edc 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/nrf51/fastpin_arm_nrf51.h +++ b/libraries/FastLED/platforms/arm/nrf51/fastpin_arm_nrf51.h @@ -49,7 +49,7 @@ _RD32_NRF(NR_OUTSET); _RD32_NRF(NR_OUTCLR); _RD32_NRF(NR_OUT); -#define _DEFPIN_ARM(PIN) template<> class FastPin : public _ARMPIN class FastPin : public _ARMPIN {}; #else @@ -98,19 +98,19 @@ public: }; -#define _DEFPIN_ARM(PIN) template<> class FastPin : public _ARMPIN {}; +#define _FL_DEFPIN(PIN) template<> class FastPin : public _ARMPIN {}; #endif // Actual pin definitions #define MAX_PIN 31 -_DEFPIN_ARM(0); _DEFPIN_ARM(1); _DEFPIN_ARM(2); _DEFPIN_ARM(3); -_DEFPIN_ARM(4); _DEFPIN_ARM(5); _DEFPIN_ARM(6); _DEFPIN_ARM(7); -_DEFPIN_ARM(8); _DEFPIN_ARM(9); _DEFPIN_ARM(10); _DEFPIN_ARM(11); -_DEFPIN_ARM(12); _DEFPIN_ARM(13); _DEFPIN_ARM(14); _DEFPIN_ARM(15); -_DEFPIN_ARM(16); _DEFPIN_ARM(17); _DEFPIN_ARM(18); _DEFPIN_ARM(19); -_DEFPIN_ARM(20); _DEFPIN_ARM(21); _DEFPIN_ARM(22); _DEFPIN_ARM(23); -_DEFPIN_ARM(24); _DEFPIN_ARM(25); _DEFPIN_ARM(26); _DEFPIN_ARM(27); -_DEFPIN_ARM(28); _DEFPIN_ARM(29); _DEFPIN_ARM(30); _DEFPIN_ARM(31); +_FL_DEFPIN(0); _FL_DEFPIN(1); _FL_DEFPIN(2); _FL_DEFPIN(3); +_FL_DEFPIN(4); _FL_DEFPIN(5); _FL_DEFPIN(6); _FL_DEFPIN(7); +_FL_DEFPIN(8); _FL_DEFPIN(9); _FL_DEFPIN(10); _FL_DEFPIN(11); +_FL_DEFPIN(12); _FL_DEFPIN(13); _FL_DEFPIN(14); _FL_DEFPIN(15); +_FL_DEFPIN(16); _FL_DEFPIN(17); _FL_DEFPIN(18); _FL_DEFPIN(19); +_FL_DEFPIN(20); _FL_DEFPIN(21); _FL_DEFPIN(22); _FL_DEFPIN(23); +_FL_DEFPIN(24); _FL_DEFPIN(25); _FL_DEFPIN(26); _FL_DEFPIN(27); +_FL_DEFPIN(28); _FL_DEFPIN(29); _FL_DEFPIN(30); _FL_DEFPIN(31); #define HAS_HARDWARE_PIN_SUPPORT diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf51/fastspi_arm_nrf51.h b/libraries/FastLED/platforms/arm/nrf51/fastspi_arm_nrf51.h similarity index 98% rename from libraries/FastLED-3.2.9/platforms/arm/nrf51/fastspi_arm_nrf51.h rename to libraries/FastLED/platforms/arm/nrf51/fastspi_arm_nrf51.h index 539fd65..6299e89 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/nrf51/fastspi_arm_nrf51.h +++ b/libraries/FastLED/platforms/arm/nrf51/fastspi_arm_nrf51.h @@ -9,7 +9,7 @@ // 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 // idea of interfaces - it's possible this could be done with virtual classes, need to decide if i want that overhead) -template +template class NRF51SPIOutput { struct saveData { diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf51/led_sysdefs_arm_nrf51.h b/libraries/FastLED/platforms/arm/nrf51/led_sysdefs_arm_nrf51.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/nrf51/led_sysdefs_arm_nrf51.h rename to libraries/FastLED/platforms/arm/nrf51/led_sysdefs_arm_nrf51.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf52/arbiter_nrf52.h b/libraries/FastLED/platforms/arm/nrf52/arbiter_nrf52.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/nrf52/arbiter_nrf52.h rename to libraries/FastLED/platforms/arm/nrf52/arbiter_nrf52.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf52/clockless_arm_nrf52.h b/libraries/FastLED/platforms/arm/nrf52/clockless_arm_nrf52.h similarity index 93% rename from libraries/FastLED-3.2.9/platforms/arm/nrf52/clockless_arm_nrf52.h rename to libraries/FastLED/platforms/arm/nrf52/clockless_arm_nrf52.h index d8a5da9..56a1dbe 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/nrf52/clockless_arm_nrf52.h +++ b/libraries/FastLED/platforms/arm/nrf52/clockless_arm_nrf52.h @@ -46,7 +46,7 @@ private: // may as well be static, as can only attach one LED string per _DATA_PIN.... static uint16_t s_SequenceBuffer[_PWM_BUFFER_COUNT]; static uint16_t s_SequenceBufferValidElements; - static uint32_t s_SequenceBufferInUse; + static volatile uint32_t s_SequenceBufferInUse; static CMinWait<_WAIT_TIME_MICROSECONDS> mWait; // ensure data has time to latch FASTLED_NRF52_INLINE_ATTRIBUTE static void startPwmPlayback_InitializePinState() { @@ -123,6 +123,18 @@ private: FASTLED_NRF52_INLINE_ATTRIBUTE static void startPwmPlayback_StartTask(NRF_PWM_Type * pwm) { nrf_pwm_task_trigger(pwm, NRF_PWM_TASK_SEQSTART0); } + FASTLED_NRF52_INLINE_ATTRIBUTE static void spinAcquireSequenceBuffer() { + while (!tryAcquireSequenceBuffer()); + } + FASTLED_NRF52_INLINE_ATTRIBUTE static bool tryAcquireSequenceBuffer() { + return __sync_bool_compare_and_swap(&s_SequenceBufferInUse, 0, 1); + } + FASTLED_NRF52_INLINE_ATTRIBUTE static void releaseSequenceBuffer() { + uint32_t tmp = __sync_val_compare_and_swap(&s_SequenceBufferInUse, 1, 0); + if (tmp != 1) { + // TODO: Error / Assert / log ? + } + } public: static void isr_handler() { @@ -134,8 +146,10 @@ public: if (nrf_pwm_event_check(pwm,NRF_PWM_EVENT_STOPPED)) { nrf_pwm_event_clear(pwm,NRF_PWM_EVENT_STOPPED); + // update the minimum time to next call + mWait.mark(); // mark the sequence as no longer in use -- pointer, comparator, exchange value - __sync_fetch_and_and(&s_SequenceBufferInUse, 0); + releaseSequenceBuffer(); // prevent further interrupts from PWM events nrf_pwm_int_set(pwm, 0); // disable PWM interrupts - None of the PWM IRQs are shared @@ -156,14 +170,20 @@ public: FASTLED_NRF52_DEBUGPRINT(" T0H == %d", _T0H); FASTLED_NRF52_DEBUGPRINT(" T1H == %d", _T1H); FASTLED_NRF52_DEBUGPRINT(" TOP == %d\n", _TOP); + // to avoid pin initialization from causing first LED to have invalid color, + // call mWait.mark() to ensure data latches before color data gets sent. + startPwmPlayback_InitializePinState(); + mWait.mark(); + } virtual uint16_t getMaxRefreshRate() const { return 800; } virtual void showPixels(PixelController<_RGB_ORDER> & pixels) { // wait for the only sequence buffer to become available - while (s_SequenceBufferInUse != 0); + spinAcquireSequenceBuffer(); prepareSequenceBuffers(pixels); - mWait.wait(); // ensure min time between updates + // ensure any prior data had time to latch + mWait.wait(); startPwmPlayback(s_SequenceBufferValidElements); return; } @@ -302,7 +322,7 @@ public: template uint16_t ClocklessController<_DATA_PIN, _T1, _T2, _T3, _RGB_ORDER, _XTRA0, _FLIP, _WAIT_TIME_MICROSECONDS>::s_SequenceBufferValidElements = 0; template -uint32_t ClocklessController<_DATA_PIN, _T1, _T2, _T3, _RGB_ORDER, _XTRA0, _FLIP, _WAIT_TIME_MICROSECONDS>::s_SequenceBufferInUse = 0; +uint32_t volatile ClocklessController<_DATA_PIN, _T1, _T2, _T3, _RGB_ORDER, _XTRA0, _FLIP, _WAIT_TIME_MICROSECONDS>::s_SequenceBufferInUse = 0; template uint16_t ClocklessController<_DATA_PIN, _T1, _T2, _T3, _RGB_ORDER, _XTRA0, _FLIP, _WAIT_TIME_MICROSECONDS>::s_SequenceBuffer[_PWM_BUFFER_COUNT]; template diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastled_arm_nrf52.h b/libraries/FastLED/platforms/arm/nrf52/fastled_arm_nrf52.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/nrf52/fastled_arm_nrf52.h rename to libraries/FastLED/platforms/arm/nrf52/fastled_arm_nrf52.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastpin_arm_nrf52.h b/libraries/FastLED/platforms/arm/nrf52/fastpin_arm_nrf52.h similarity index 87% rename from libraries/FastLED-3.2.9/platforms/arm/nrf52/fastpin_arm_nrf52.h rename to libraries/FastLED/platforms/arm/nrf52/fastpin_arm_nrf52.h index a868466..7526000 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastpin_arm_nrf52.h +++ b/libraries/FastLED/platforms/arm/nrf52/fastpin_arm_nrf52.h @@ -1,13 +1,13 @@ #ifndef __FASTPIN_ARM_NRF52_H #define __FASTPIN_ARM_NRF52_H - + /* // // Background: // =========== // the nRF52 has more than 32 ports, and thus must support -// two distinct GPIO port registers. +// two distinct GPIO port registers. // // For the nRF52 series, the structure to control the port is // `NRF_GPIO_Type`, with separate addresses mapped for set, clear, etc. @@ -18,18 +18,18 @@ // #define NRF_P0 ((NRF_GPIO_Type*)NRF_P0_BASE) // #define NRF_P1 ((NRF_GPIO_Type*)NRF_P1_BASE) // -// Therefore, ideally, the _DEFPIN_ARM() macro would simply +// Therefore, ideally, the _FL_DEFPIN() macro would simply // conditionally pass either NRF_P0 or NRF_P1 to the underlying // FastPin<> template class class. // // The "pin" provided to the FastLED<> template (and which -// the _DEFPIN_ARM() macro specializes for valid pins) is NOT +// the _FL_DEFPIN() macro specializes for valid pins) is NOT // the microcontroller port.pin, but the Arduino digital pin. // Some boards have an identity mapping (e.g., nRF52832 Feather) -// but most do not. Therefore, the _DEFPIN_ARM() macro +// but most do not. Therefore, the _FL_DEFPIN() macro // must translate the Arduino pin to the mcu port.pin. // -// +// // Difficulties: // ============= // The goal is to avoid any such lookups, using compile-time @@ -73,13 +73,13 @@ // manually define two structures, to avoid fighting with preprocessor macros struct __generated_struct_NRF_P0 { - FASTLED_NRF52_INLINE_ATTRIBUTE constexpr static NRF_GPIO_Type * r() { - return NRF_P0; + FASTLED_NRF52_INLINE_ATTRIBUTE constexpr static uintptr_t r() { + return NRF_P0_BASE; } }; struct __generated_struct_NRF_P1 { - FASTLED_NRF52_INLINE_ATTRIBUTE constexpr static NRF_GPIO_Type * r() { - return NRF_P1; + FASTLED_NRF52_INLINE_ATTRIBUTE constexpr static uintptr_t r() { + return NRF_P1_BASE; } }; @@ -112,19 +112,19 @@ public: NRF_GPIO_PIN_NOSENSE // pin sense level disabled ); } - FASTLED_NRF52_INLINE_ATTRIBUTE static void hi() { _PORT::r()->OUTSET = _MASK; } // sets _MASK in the SET OUTPUT register (output set high) - FASTLED_NRF52_INLINE_ATTRIBUTE static void lo() { _PORT::r()->OUTCLR = _MASK; } // sets _MASK in the CLEAR OUTPUT register (output set low) - FASTLED_NRF52_INLINE_ATTRIBUTE static void toggle() { _PORT::r()->OUT ^= _MASK; } // toggles _MASK bits in the OUTPUT GPIO port directly + FASTLED_NRF52_INLINE_ATTRIBUTE static void hi() { (reinterpret_cast(_PORT::r()))->OUTSET = _MASK; } // sets _MASK in the SET OUTPUT register (output set high) + FASTLED_NRF52_INLINE_ATTRIBUTE static void lo() { (reinterpret_cast(_PORT::r()))->OUTCLR = _MASK; } // sets _MASK in the CLEAR OUTPUT register (output set low) + FASTLED_NRF52_INLINE_ATTRIBUTE static void toggle() { (reinterpret_cast(_PORT::r()))->OUT ^= _MASK; } // toggles _MASK bits in the OUTPUT GPIO port directly FASTLED_NRF52_INLINE_ATTRIBUTE static void strobe() { toggle(); toggle(); } // BUGBUG -- Is this used by FastLED? Without knowing (for example) SPI Speed? - FASTLED_NRF52_INLINE_ATTRIBUTE static port_t hival() { return _PORT::r()->OUT | _MASK; } // sets all _MASK bit(s) in the OUTPUT GPIO port to 1 - FASTLED_NRF52_INLINE_ATTRIBUTE static port_t loval() { return _PORT::r()->OUT & ~_MASK; } // sets all _MASK bit(s) in the OUTPUT GPIO port to 0 - FASTLED_NRF52_INLINE_ATTRIBUTE static port_ptr_t port() { return &(_PORT::r()->OUT); } // gets raw pointer to OUTPUT GPIO port - FASTLED_NRF52_INLINE_ATTRIBUTE static port_ptr_t cport() { return &(_PORT::r()->OUTCLR); } // gets raw pointer to SET DIRECTION GPIO port - FASTLED_NRF52_INLINE_ATTRIBUTE static port_ptr_t sport() { return &(_PORT::r()->OUTSET); } // gets raw pointer to CLEAR DIRECTION GPIO port + FASTLED_NRF52_INLINE_ATTRIBUTE static port_t hival() { return (reinterpret_cast(_PORT::r()))->OUT | _MASK; } // sets all _MASK bit(s) in the OUTPUT GPIO port to 1 + FASTLED_NRF52_INLINE_ATTRIBUTE static port_t loval() { return (reinterpret_cast(_PORT::r()))->OUT & ~_MASK; } // sets all _MASK bit(s) in the OUTPUT GPIO port to 0 + FASTLED_NRF52_INLINE_ATTRIBUTE static port_ptr_t port() { return &((reinterpret_cast(_PORT::r()))->OUT); } // gets raw pointer to OUTPUT GPIO port + FASTLED_NRF52_INLINE_ATTRIBUTE static port_ptr_t cport() { return &((reinterpret_cast(_PORT::r()))->OUTCLR); } // gets raw pointer to SET DIRECTION GPIO port + FASTLED_NRF52_INLINE_ATTRIBUTE static port_ptr_t sport() { return &((reinterpret_cast(_PORT::r()))->OUTSET); } // gets raw pointer to CLEAR DIRECTION GPIO port FASTLED_NRF52_INLINE_ATTRIBUTE static port_t mask() { return _MASK; } // gets the value of _MASK FASTLED_NRF52_INLINE_ATTRIBUTE static void hi (register port_ptr_t port) { hi(); } // sets _MASK in the SET OUTPUT register (output set high) FASTLED_NRF52_INLINE_ATTRIBUTE static void lo (register port_ptr_t port) { lo(); } // sets _MASK in the CLEAR OUTPUT register (output set low) - FASTLED_NRF52_INLINE_ATTRIBUTE static void set(register port_t val ) { _PORT::r()->OUT = val; } // sets entire port's value (optimization used by FastLED) + FASTLED_NRF52_INLINE_ATTRIBUTE static void set(register port_t val ) { (reinterpret_cast(_PORT::r()))->OUT = val; } // sets entire port's value (optimization used by FastLED) FASTLED_NRF52_INLINE_ATTRIBUTE static void fastset(register port_ptr_t port, register port_t val) { *port = val; } constexpr static uint32_t nrf_pin2() { return NRF_GPIO_PIN_MAP(_PORT_NUMBER, _PIN_NUMBER); } constexpr static bool LowSpeedOnlyRecommended() { @@ -269,7 +269,7 @@ public: ); #endif #if !defined(_FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT) - #warning "Unknown board / package, ... caller must pins support high-speed" + #warning "Unknown board / package, ... caller must determine pins that support high-speed" return false; // choosing default to be FALSE, to allow users to ATTEMPT to use high-speed on pins where support is not known #endif } @@ -281,16 +281,16 @@ public: // // BOARD_PIN can be either the pin portion of a port.pin, or the combined NRF_GPIO_PIN_MAP() number. // For example both the following two defines refer to P1.15 (pin 47) as Arduino pin 3: -// _DEFPIN_ARM(3, 1, 15); -// _DEFPIN_ARM(3, 1, 47); +// _FL_DEFPIN(3, 15, 1); +// _FL_DEFPIN(3, 47, 1); // // Similarly, the following defines are all equivalent: // _DEFPIN_ARM_IDENTITY_P1(47); -// _DEFPIN_ARM(47, 1, 15); -// _DEFPIN_ARM(47, 1, 47); +// _FL_DEFPIN(47, 15, 1); +// _FL_DEFPIN(47, 47, 1); // -#define _DEFPIN_ARM(ARDUINO_PIN, BOARD_PORT, BOARD_PIN) \ +#define FL_DEFPIN(ARDUINO_PIN, BOARD_PIN, BOARD_PORT) \ template<> class FastPin : \ public _ARMPIN< \ 1u << (BOARD_PIN & 31u), \ diff --git a/libraries/FastLED/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h b/libraries/FastLED/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h new file mode 100644 index 0000000..9bb0772 --- /dev/null +++ b/libraries/FastLED/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h @@ -0,0 +1,579 @@ +#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 + _FL_DEFPIN( 0, 25, 0); // D0 is P0.25 -- UART TX + //_FL_DEFPIN( 1, 24, 0); // D1 is P0.24 -- UART RX + _FL_DEFPIN( 2, 10, 0); // D2 is P0.10 -- NFC2 + _FL_DEFPIN( 3, 47, 1); // D3 is P1.15 -- PIN_LED1 (red) + _FL_DEFPIN( 4, 42, 1); // D4 is P1.10 -- PIN_LED2 (blue) + _FL_DEFPIN( 5, 40, 1); // D5 is P1.08 -- SPI/SS + _FL_DEFPIN( 6, 7, 0); // D6 is P0.07 + _FL_DEFPIN( 7, 34, 1); // D7 is P1.02 -- PIN_DFU (Button) + + // Arduino pins 8..15 + _FL_DEFPIN( 8, 16, 0); // D8 is P0.16 -- PIN_NEOPIXEL + _FL_DEFPIN( 9, 26, 0); // D9 is P0.26 + _FL_DEFPIN(10, 27, 0); // D10 is P0.27 + _FL_DEFPIN(11, 6, 0); // D11 is P0.06 + _FL_DEFPIN(12, 8, 0); // D12 is P0.08 + _FL_DEFPIN(13, 41, 1); // D13 is P1.09 + _FL_DEFPIN(14, 4, 0); // D14 is P0.04 -- A0 + _FL_DEFPIN(15, 5, 0); // D15 is P0.05 -- A1 + + // Arduino pins 16..23 + _FL_DEFPIN(16, 30, 0); // D16 is P0.30 -- A2 + _FL_DEFPIN(17, 28, 0); // D17 is P0.28 -- A3 + _FL_DEFPIN(18, 2, 0); // D18 is P0.02 -- A4 + _FL_DEFPIN(19, 3, 0); // D19 is P0.03 -- A5 + //_FL_DEFPIN(20, 29, 0); // D20 is P0.29 -- A6 -- Connected to battery! + //_FL_DEFPIN(21, 31, 0); // D21 is P0.31 -- A7 -- AREF + _FL_DEFPIN(22, 12, 0); // D22 is P0.12 -- SDA + _FL_DEFPIN(23, 11, 0); // D23 is P0.11 -- SCL + + // Arduino pins 24..31 + _FL_DEFPIN(24, 15, 0); // D24 is P0.15 -- PIN_SPI_MISO + _FL_DEFPIN(25, 13, 0); // D25 is P0.13 -- PIN_SPI_MOSI + _FL_DEFPIN(26, 14, 0); // D26 is P0.14 -- PIN_SPI_SCK + //_FL_DEFPIN(27, 19, 0); // D27 is P0.19 -- PIN_QSPI_SCK + //_FL_DEFPIN(28, 20, 0); // D28 is P0.20 -- PIN_QSPI_CS + //_FL_DEFPIN(29, 17, 0); // D29 is P0.17 -- PIN_QSPI_DATA0 + //_FL_DEFPIN(30, 22, 0); // D30 is P0.22 -- PIN_QSPI_DATA1 + //_FL_DEFPIN(31, 23, 0); // D31 is P0.23 -- PIN_QSPI_DATA2 + + // Arduino pins 32..34 + //_FL_DEFPIN(32, 21, 0); // D32 is P0.21 -- PIN_QSPI_DATA3 + //_FL_DEFPIN(33, 9, 0); // 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" + + _FL_DEFPIN( 0, 25, 0); // D0 is P0.25 (UART TX) + _FL_DEFPIN( 1, 24, 0); // D1 is P0.24 (UART RX) + _FL_DEFPIN( 2, 10, 1); // D2 is P1.10 + _FL_DEFPIN( 3, 4, 1); // D3 is P1.04 + _FL_DEFPIN( 4, 11, 1); // D4 is P1.11 + _FL_DEFPIN( 5, 12, 1); // D5 is P1.12 + _FL_DEFPIN( 6, 14, 1); // D6 is P1.14 + _FL_DEFPIN( 7, 26, 0); // D7 is P0.26 + _FL_DEFPIN( 8, 27, 0); // D8 is P0.27 + _FL_DEFPIN( 9, 12, 0); // D9 is P0.12 + _FL_DEFPIN(10, 6, 0); // D10 is P0.06 + _FL_DEFPIN(11, 8, 0); // D11 is P0.08 + _FL_DEFPIN(12, 9, 1); // D12 is P1.09 + _FL_DEFPIN(13, 14, 0); // D13 is P0.14 + _FL_DEFPIN(14, 4, 0); // D14 is P0.04 (A0) + _FL_DEFPIN(15, 5, 0); // D15 is P0.05 (A1) + _FL_DEFPIN(16, 28, 0); // D16 is P0.28 (A2) + _FL_DEFPIN(17, 30, 0); // D17 is P0.30 (A3) + _FL_DEFPIN(18, 2, 0); // D18 is P0.02 (A4) + _FL_DEFPIN(19, 3, 0); // D19 is P0.03 (A5) + _FL_DEFPIN(20, 29, 0); // D20 is P0.29 (A6, battery) + _FL_DEFPIN(21, 31, 0); // D21 is P0.31 (A7, ARef) + _FL_DEFPIN(22, 15, 0); // D22 is P0.15 (SDA) + _FL_DEFPIN(23, 16, 0); // D23 is P0.16 (SCL) + _FL_DEFPIN(24, 11, 0); // D24 is P0.11 (SPI MISO) + _FL_DEFPIN(25, 8, 1); // D25 is P1.08 (SPI MOSI) + _FL_DEFPIN(26, 7, 0); // D26 is P0.07 (SPI SCK ) + //_FL_DEFPIN(27, 19, 0); // D27 is P0.19 (QSPI CLK ) + //_FL_DEFPIN(28, 20, 0); // D28 is P0.20 (QSPI CS ) + //_FL_DEFPIN(29, 17, 0); // D29 is P0.17 (QSPI Data 0) + //_FL_DEFPIN(30, 23, 0); // D30 is P0.23 (QSPI Data 1) + //_FL_DEFPIN(31, 22, 0); // D31 is P0.22 (QSPI Data 2) + //_FL_DEFPIN(32, 21, 0); // D32 is P0.21 (QSPI Data 3) + _FL_DEFPIN(33, 13, 1); // D33 is P1.13 LED1 + _FL_DEFPIN(34, 15, 1); // D34 is P1.15 LED2 + _FL_DEFPIN(35, 13, 0); // D35 is P0.13 NeoPixel + _FL_DEFPIN(36, 0, 1); // D36 is P1.02 Switch + _FL_DEFPIN(37, 0, 1); // D37 is P1.00 SWO/DFU + _FL_DEFPIN(38, 9, 0); // D38 is P0.09 NFC1 + _FL_DEFPIN(39, 10, 0); // 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 + */ + _FL_DEFPIN( 0, 1, 1); // D0 is P1.01 + _FL_DEFPIN( 1, 2, 1); // D1 is P1.02 + _FL_DEFPIN( 2, 3, 1); // D2 is P1.03 + _FL_DEFPIN( 3, 4, 1); // D3 is P1.04 + _FL_DEFPIN( 4, 5, 1); // D4 is P1.05 + _FL_DEFPIN( 5, 6, 1); // D5 is P1.06 + _FL_DEFPIN( 6, 7, 1); // D6 is P1.07 (BUTTON1 option) + _FL_DEFPIN( 7, 8, 1); // D7 is P1.08 (BUTTON2 option) + _FL_DEFPIN( 8, 10, 1); // D8 is P1.10 + _FL_DEFPIN( 9, 11, 1); // D9 is P1.11 + _FL_DEFPIN(10, 12, 1); // D10 is P1.12 + _FL_DEFPIN(11, 13, 1); // D11 is P1.13 + _FL_DEFPIN(12, 14, 1); // D12 is P1.14 + _FL_DEFPIN(13, 15, 1); // D13 is P1.15 + _FL_DEFPIN(14, 0, 0); // D14 is P0.00 (if SB4 bridged) + _FL_DEFPIN(15, 1, 0); // D15 is P0.01 (if SB3 bridged) + _FL_DEFPIN(16, 5, 0); // D16 is P0.05 (aka AIN3, aka UART RTS) + _FL_DEFPIN(17, 6, 0); // D17 is P0.06 (UART TxD) + _FL_DEFPIN(18, 7, 0); // D18 is P0.07 (UART CTS default) + _FL_DEFPIN(19, 8, 0); // D19 is P0.08 (UART RxD) + _FL_DEFPIN(20, 9, 0); // D20 is P0.09 (NFC1) + _FL_DEFPIN(21, 10, 0); // D21 is P0.10 (NFC2) + _FL_DEFPIN(22, 11, 0); // D22 is P0.11 (TRACEDATA2 / BUTTON1 default) + _FL_DEFPIN(23, 12, 0); // D23 is P0.12 (TRACEDATA1 / BUTTON2 default) + _FL_DEFPIN(24, 13, 0); // D24 is P0.13 (LED1) + _FL_DEFPIN(25, 14, 0); // D25 is P0.14 (LED2) + _FL_DEFPIN(26, 15, 0); // D26 is P0.15 (LED3) + _FL_DEFPIN(27, 16, 0); // D27 is P0.16 (LED4) + _FL_DEFPIN(28, 17, 0); // D28 is P0.17 (QSPI !CS , unless SB13 cut) + // _FL_DEFPIN(29, 18, 0); // D29 is P0.18 (RESET) + _FL_DEFPIN(30, 19, 0); // D30 is P0.19 (QSPI CLK , unless SB11 cut) + _FL_DEFPIN(31, 20, 0); // D31 is P0.20 (QSPI DIO0, unless SB12 cut) + _FL_DEFPIN(32, 21, 0); // D32 is P0.21 (QSPI DIO1, unless SB14 cut) + _FL_DEFPIN(33, 22, 0); // D33 is P0.22 (QSPI DIO2, unless SB15 cut) + _FL_DEFPIN(34, 23, 0); // D34 is P0.23 (QSPI DIO3, unless SB10 cut) + _FL_DEFPIN(35, 24, 0); // D35 is P0.24 (BUTTON3) + _FL_DEFPIN(36, 25, 0); // D36 is P0.25 (BUTTON4) + _FL_DEFPIN(37, 00, 1); // D37 is P1.00 (TRACEDATA0 / SWO) + _FL_DEFPIN(38, 09, 1); // D38 is P1.09 (TRACEDATA3) + //_FL_DEFPIN(??, 2, 0); // D?? is P0.02 (AREF, aka AIN0) + //_FL_DEFPIN(??, 3, 0); // D?? is P0.03 (A0, aka AIN1) + //_FL_DEFPIN(??, 4, 0); // D?? is P0.04 (A1, aka AIN2, aka UART CTS option) + //_FL_DEFPIN(??, 28, 0); // D?? is P0.28 (A2, aka AIN4) + //_FL_DEFPIN(??, 29, 0); // D?? is P0.29 (A3, aka AIN5) + //_FL_DEFPIN(??, 30, 0); // D?? is P0.30 (A4, aka AIN6) + //_FL_DEFPIN(??, 31, 0); // 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" + + _FL_DEFPIN( 0, 26, 0); // D0 is P0.26 + _FL_DEFPIN( 1, 27, 0); // D1 is P0.27 + _FL_DEFPIN( 2, 22, 0); // D2 is P0.22 (SPI SS ) + _FL_DEFPIN( 3, 23, 0); // D3 is P0.23 (SPI MOSI) + _FL_DEFPIN( 4, 24, 0); // D4 is P0.24 (SPI MISO, also A3) + _FL_DEFPIN( 5, 25, 0); // D5 is P0.25 (SPI SCK ) + _FL_DEFPIN( 6, 16, 0); // D6 is P0.16 (Button) + _FL_DEFPIN( 7, 19, 0); // D7 is P0.19 (R) + _FL_DEFPIN( 8, 18, 0); // D8 is P0.18 (G) + _FL_DEFPIN( 9, 17, 0); // D9 is P0.17 (B) + _FL_DEFPIN(10, 11, 0); // D10 is P0.11 (SCL) + _FL_DEFPIN(11, 12, 0); // D11 is P0.12 (DRDYn) + _FL_DEFPIN(12, 13, 0); // D12 is P0.13 (SDA) + _FL_DEFPIN(13, 14, 0); // D13 is P0.17 (INT) + _FL_DEFPIN(14, 15, 0); // D14 is P0.15 (INT1) + _FL_DEFPIN(15, 20, 0); // D15 is P0.20 (INT2) + _FL_DEFPIN(16, 2, 0); // D16 is P0.02 (A0) + _FL_DEFPIN(17, 3, 0); // D17 is P0.03 (A1) + _FL_DEFPIN(18, 4, 0); // D18 is P0.04 (A2) + _FL_DEFPIN(19, 24, 0); // D19 is P0.24 (A3, also D4/SPI MISO) -- is this right? + _FL_DEFPIN(20, 29, 0); // D20 is P0.29 (A4) + _FL_DEFPIN(21, 30, 0); // D21 is P0.30 (A5) + _FL_DEFPIN(22, 31, 0); // D22 is P0.31 (A6) + _FL_DEFPIN(23, 8, 0); // D23 is P0.08 (RX) + _FL_DEFPIN(24, 6, 0); // D24 is P0.06 (TX) + _FL_DEFPIN(25, 5, 0); // D25 is P0.05 (RTS) + _FL_DEFPIN(26, 7, 0); // 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" + _FL_DEFPIN( 0, 14, 0); // D0 is P0.14 (RX) + _FL_DEFPIN( 1, 13, 0); // D1 is P0.13 (TX) + _FL_DEFPIN( 2, 12, 0); // D2 is P0.12 + _FL_DEFPIN( 3, 11, 0); // D3 is P0.11 (SPI MOSI) + _FL_DEFPIN( 4, 8, 0); // D4 is P0.08 (SPI MISO) + _FL_DEFPIN( 5, 7, 0); // D5 is P0.07 (SPI SCK ) + _FL_DEFPIN( 6, 6, 0); // D6 is P0.06 + _FL_DEFPIN( 7, 27, 0); // D7 is P0.27 + _FL_DEFPIN( 8, 26, 0); // D8 is P0.26 + _FL_DEFPIN( 9, 25, 0); // D9 is P0.25 + _FL_DEFPIN(10, 5, 0); // D10 is P0.05 (A3) + _FL_DEFPIN(11, 4, 0); // D11 is P0.04 (A2) + _FL_DEFPIN(12, 3, 0); // D12 is P0.03 (A1) + _FL_DEFPIN(13, 2, 0); // D13 is P0.02 (A0 / AREF) + _FL_DEFPIN(14, 23, 0); // D14 is P0.23 + _FL_DEFPIN(15, 22, 0); // D15 is P0.22 + _FL_DEFPIN(16, 18, 0); // D16 is P0.18 + _FL_DEFPIN(17, 16, 0); // D17 is P0.16 + _FL_DEFPIN(18, 15, 0); // D18 is P0.15 + _FL_DEFPIN(19, 24, 0); // D19 is P0.24 + _FL_DEFPIN(20, 28, 0); // D20 is P0.28 (A4) + _FL_DEFPIN(21, 29, 0); // D21 is P0.29 (A5) + _FL_DEFPIN(22, 30, 0); // D22 is P0.30 (A6) + _FL_DEFPIN(23, 31, 0); // D23 is P0.31 (A7) + _FL_DEFPIN(24, 19, 0); // D24 is P0.19 (RED LED) + _FL_DEFPIN(25, 20, 0); // D25 is P0.20 (GREEN LED) + _FL_DEFPIN(26, 17, 0); // 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" + _FL_DEFPIN( 0, 11, 0); // D0 is P0.11 + _FL_DEFPIN( 1, 12, 0); // D1 is P0.12 + _FL_DEFPIN( 2, 13, 0); // D2 is P0.13 + _FL_DEFPIN( 3, 14, 0); // D3 is P0.14 + _FL_DEFPIN( 4, 15, 0); // D4 is P0.15 + _FL_DEFPIN( 5, 16, 0); // D5 is P0.16 + _FL_DEFPIN( 6, 17, 0); // D6 is P0.17 + _FL_DEFPIN( 7, 18, 0); // D7 is P0.18 + _FL_DEFPIN( 8, 19, 0); // D8 is P0.19 + _FL_DEFPIN( 9, 20, 0); // D9 is P0.20 + _FL_DEFPIN(10, 22, 0); // D10 is P0.22 (SPI SS ) + _FL_DEFPIN(11, 23, 0); // D11 is P0.23 (SPI MOSI) + _FL_DEFPIN(12, 24, 0); // D12 is P0.24 (SPI MISO) + _FL_DEFPIN(13, 25, 0); // D13 is P0.25 (SPI SCK / LED) + _FL_DEFPIN(14, 3, 0); // D14 is P0.03 (A0) + _FL_DEFPIN(15, 4, 0); // D15 is P0.04 (A1) + _FL_DEFPIN(16, 28, 0); // D16 is P0.28 (A2) + _FL_DEFPIN(17, 29, 0); // D17 is P0.29 (A3) + _FL_DEFPIN(18, 30, 0); // D18 is P0.30 (A4) + _FL_DEFPIN(19, 31, 0); // D19 is P0.31 (A5) + _FL_DEFPIN(20, 26, 0); // D20 is P0.26 (SDA) + _FL_DEFPIN(21, 27, 0); // D21 is P0.27 (SCL) + _FL_DEFPIN(22, 8, 0); // D22 is P0.08 (RX) + _FL_DEFPIN(23, 6, 0); // D23 is P0.06 (TX) + _FL_DEFPIN(24, 2, 0); // 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" + _FL_DEFPIN( 0, 30, 0); // D0 is P0.30 (A0 / RX) + _FL_DEFPIN( 1, 29, 0); // D1 is P0.29 (A1 / TX) + _FL_DEFPIN( 2, 28, 0); // D2 is P0.28 (A2 / SDA) + _FL_DEFPIN( 3, 2, 0); // D3 is P0.02 (A3 / SCL) + _FL_DEFPIN( 4, 5, 0); // D4 is P0.05 (A4) + _FL_DEFPIN( 5, 4, 0); // D5 is P0.04 (A5) + _FL_DEFPIN( 6, 3, 0); // D6 is P0.03 (SPI SS ) + _FL_DEFPIN( 7, 6, 0); // D7 is P0.06 (SPI MOSI) + _FL_DEFPIN( 8, 7, 0); // D8 is P0.07 (SPI MISO) + _FL_DEFPIN( 9, 8, 0); // D9 is P0.08 (SPI SCK ) + // _FL_DEFPIN(10, 21, 0); // D10 is P0.21 (RESET) + _FL_DEFPIN(13, 11, 0); // 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" + _FL_DEFPIN( 0, 11, 0); // D0 is P0.11 + _FL_DEFPIN( 1, 12, 0); // D1 is P0.12 + _FL_DEFPIN( 2, 13, 0); // D2 is P0.13 (BUTTON1) + _FL_DEFPIN( 3, 14, 0); // D3 is P0.14 (BUTTON2) + _FL_DEFPIN( 4, 15, 0); // D4 is P0.15 (BUTTON3) + _FL_DEFPIN( 5, 16, 0); // D5 is P0.16 (BUTTON4) + _FL_DEFPIN( 6, 17, 0); // D6 is P0.17 (LED1) + _FL_DEFPIN( 7, 18, 0); // D7 is P0.18 (LED2) + _FL_DEFPIN( 8, 19, 0); // D8 is P0.19 (LED3) + _FL_DEFPIN( 9, 20, 0); // D9 is P0.20 (LED4) + _FL_DEFPIN(10, 22, 0); // D10 is P0.22 (SPI SS ) + _FL_DEFPIN(11, 23, 0); // D11 is P0.23 (SPI MOSI) + _FL_DEFPIN(12, 24, 0); // D12 is P0.24 (SPI MISO) + _FL_DEFPIN(13, 25, 0); // D13 is P0.25 (SPI SCK / LED) + _FL_DEFPIN(14, 3, 0); // D14 is P0.03 (A0) + _FL_DEFPIN(15, 4, 0); // D15 is P0.04 (A1) + _FL_DEFPIN(16, 28, 0); // D16 is P0.28 (A2) + _FL_DEFPIN(17, 29, 0); // D17 is P0.29 (A3) + _FL_DEFPIN(18, 30, 0); // D18 is P0.30 (A4) + _FL_DEFPIN(19, 31, 0); // D19 is P0.31 (A5) + _FL_DEFPIN(20, 5, 0); // D20 is P0.05 (A6) + _FL_DEFPIN(21, 2, 0); // D21 is P0.02 (A7 / AREF) + _FL_DEFPIN(22, 26, 0); // D22 is P0.26 (SDA) + _FL_DEFPIN(23, 27, 0); // D23 is P0.27 (SCL) + _FL_DEFPIN(24, 8, 0); // D24 is P0.08 (RX) + _FL_DEFPIN(25, 6, 0); // 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" + //_FL_DEFPIN( 0, 25, 0); // D0 is P0.xx (near radio!) + //_FL_DEFPIN( 1, 26, 0); // D1 is P0.xx (near radio!) + //_FL_DEFPIN( 2, 27, 0); // D2 is P0.xx (near radio!) + //_FL_DEFPIN( 3, 28, 0); // D3 is P0.xx (near radio!) + //_FL_DEFPIN( 4, 29, 0); // D4 is P0.xx (Not connected, near radio!) + //_FL_DEFPIN( 5, 30, 0); // D5 is P0.xx (LED1, near radio!) + //_FL_DEFPIN( 6, 31, 0); // D6 is P0.xx (LED2, near radio!) + _FL_DEFPIN( 7, 2, 0); // D7 is P0.xx (SDA) + _FL_DEFPIN( 8, 3, 0); // D8 is P0.xx (SCL) + _FL_DEFPIN( 9, 4, 0); // D9 is P0.xx (BUTTON1 / NFC1) + _FL_DEFPIN(10, 5, 0); // D10 is P0.xx + //_FL_DEFPIN(11, 0, 0); // D11 is P0.xx (Not connected) + //_FL_DEFPIN(12, 1, 0); // D12 is P0.xx (Not connected) + _FL_DEFPIN(13, 6, 0); // D13 is P0.xx + _FL_DEFPIN(14, 7, 0); // D14 is P0.xx + _FL_DEFPIN(15, 8, 0); // D15 is P0.xx + //_FL_DEFPIN(16, 9, 0); // D16 is P0.xx (Not connected) + //_FL_DEFPIN(17, 10, 0); // D17 is P0.xx (NFC2, Not connected) + _FL_DEFPIN(18, 11, 0); // D18 is P0.xx (RXD) + _FL_DEFPIN(19, 12, 0); // D19 is P0.xx (TXD) + _FL_DEFPIN(20, 13, 0); // D20 is P0.xx (SPI SS ) + _FL_DEFPIN(21, 14, 0); // D21 is P0.xx (SPI MISO) + _FL_DEFPIN(22, 15, 0); // D22 is P0.xx (SPI MOSI) + _FL_DEFPIN(23, 16, 0); // D23 is P0.xx (SPI SCK ) + _FL_DEFPIN(24, 17, 0); // D24 is P0.xx (A0) + _FL_DEFPIN(25, 18, 0); // D25 is P0.xx (A1) + _FL_DEFPIN(26, 19, 0); // D26 is P0.xx (A2) + _FL_DEFPIN(27, 20, 0); // D27 is P0.xx (A3) + //_FL_DEFPIN(28, 22, 0); // D28 is P0.xx (A4, near radio!) + //_FL_DEFPIN(29, 23, 0); // D29 is P0.xx (A5, near radio!) + _FL_DEFPIN(30, 24, 0); // D30 is P0.xx + // _FL_DEFPIN(31, 21, 0); // 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 \ No newline at end of file diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastspi_arm_nrf52.h b/libraries/FastLED/platforms/arm/nrf52/fastspi_arm_nrf52.h similarity index 97% rename from libraries/FastLED-3.2.9/platforms/arm/nrf52/fastspi_arm_nrf52.h rename to libraries/FastLED/platforms/arm/nrf52/fastspi_arm_nrf52.h index 8492282..9c1a219 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/nrf52/fastspi_arm_nrf52.h +++ b/libraries/FastLED/platforms/arm/nrf52/fastspi_arm_nrf52.h @@ -21,7 +21,7 @@ */ /// SPI_CLOCK_DIVIDER is number of CPU clock cycles per SPI transmission bit? - template + template class NRF52SPIOutput { private: @@ -325,13 +325,13 @@ // Static member definition and initialization using templates. // see https://stackoverflow.com/questions/3229883/static-member-initialization-in-a-class-template#answer-3229919 - template + template bool NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER>::s_InUse = false; - template + template bool NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER>::s_NeedToWait = false; - template + template uint8_t NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER>::s_BufferIndex = 0; - template + template uint8_t NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER>::s_Buffer[2][2] = {{0,0},{0,0}}; #endif // #ifndef FASTLED_FORCE_SOFTWARE_SPI diff --git a/libraries/FastLED-3.2.9/platforms/arm/nrf52/led_sysdefs_arm_nrf52.h b/libraries/FastLED/platforms/arm/nrf52/led_sysdefs_arm_nrf52.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/nrf52/led_sysdefs_arm_nrf52.h rename to libraries/FastLED/platforms/arm/nrf52/led_sysdefs_arm_nrf52.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/sam/clockless_arm_sam.h b/libraries/FastLED/platforms/arm/sam/clockless_arm_sam.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/sam/clockless_arm_sam.h rename to libraries/FastLED/platforms/arm/sam/clockless_arm_sam.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/sam/clockless_block_arm_sam.h b/libraries/FastLED/platforms/arm/sam/clockless_block_arm_sam.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/sam/clockless_block_arm_sam.h rename to libraries/FastLED/platforms/arm/sam/clockless_block_arm_sam.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/sam/fastled_arm_sam.h b/libraries/FastLED/platforms/arm/sam/fastled_arm_sam.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/sam/fastled_arm_sam.h rename to libraries/FastLED/platforms/arm/sam/fastled_arm_sam.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/sam/fastpin_arm_sam.h b/libraries/FastLED/platforms/arm/sam/fastpin_arm_sam.h similarity index 65% rename from libraries/FastLED-3.2.9/platforms/arm/sam/fastpin_arm_sam.h rename to libraries/FastLED/platforms/arm/sam/fastpin_arm_sam.h index 2bb7804..339c5e7 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/sam/fastpin_arm_sam.h +++ b/libraries/FastLED/platforms/arm/sam/fastpin_arm_sam.h @@ -78,49 +78,50 @@ public: #define _R(T) struct __gen_struct_ ## T #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline reg32_t r() { return T; } \ template static __attribute__((always_inline)) inline ptr_reg32_t rx() { return GPIO_BITBAND_PTR(T, BIT); } }; -#define DUE_IO32(L) _RD32(REG_PIO ## L ## _ODSR); _RD32(REG_PIO ## L ## _SODR); _RD32(REG_PIO ## L ## _CODR); _RD32(REG_PIO ## L ## _OER); +#define _FL_IO(L,C) _RD32(REG_PIO ## L ## _ODSR); _RD32(REG_PIO ## L ## _SODR); _RD32(REG_PIO ## L ## _CODR); _RD32(REG_PIO ## L ## _OER); _FL_DEFINE_PORT3(L, C, _R(REG_PIO ## L ## _ODSR)); -#define _DEFPIN_DUE(PIN, BIT, L) template<> class FastPin : public _DUEPIN class FastPin : public _DUEPIN {}; \ template<> class FastPinBB : public _DUEPIN_BITBAND {}; +_FL_IO(A,0); +_FL_IO(B,1); +_FL_IO(C,2); +_FL_IO(D,3); + #if defined(__SAM3X8E__) -DUE_IO32(A); -DUE_IO32(B); -DUE_IO32(C); -DUE_IO32(D); #define MAX_PIN 78 -_DEFPIN_DUE(0, 8, A); _DEFPIN_DUE(1, 9, A); _DEFPIN_DUE(2, 25, B); _DEFPIN_DUE(3, 28, C); -_DEFPIN_DUE(4, 26, C); _DEFPIN_DUE(5, 25, C); _DEFPIN_DUE(6, 24, C); _DEFPIN_DUE(7, 23, C); -_DEFPIN_DUE(8, 22, C); _DEFPIN_DUE(9, 21, C); _DEFPIN_DUE(10, 29, C); _DEFPIN_DUE(11, 7, D); -_DEFPIN_DUE(12, 8, D); _DEFPIN_DUE(13, 27, B); _DEFPIN_DUE(14, 4, D); _DEFPIN_DUE(15, 5, D); -_DEFPIN_DUE(16, 13, A); _DEFPIN_DUE(17, 12, A); _DEFPIN_DUE(18, 11, A); _DEFPIN_DUE(19, 10, A); -_DEFPIN_DUE(20, 12, B); _DEFPIN_DUE(21, 13, B); _DEFPIN_DUE(22, 26, B); _DEFPIN_DUE(23, 14, A); -_DEFPIN_DUE(24, 15, A); _DEFPIN_DUE(25, 0, D); _DEFPIN_DUE(26, 1, D); _DEFPIN_DUE(27, 2, D); -_DEFPIN_DUE(28, 3, D); _DEFPIN_DUE(29, 6, D); _DEFPIN_DUE(30, 9, D); _DEFPIN_DUE(31, 7, A); -_DEFPIN_DUE(32, 10, D); _DEFPIN_DUE(33, 1, C); _DEFPIN_DUE(34, 2, C); _DEFPIN_DUE(35, 3, C); -_DEFPIN_DUE(36, 4, C); _DEFPIN_DUE(37, 5, C); _DEFPIN_DUE(38, 6, C); _DEFPIN_DUE(39, 7, C); -_DEFPIN_DUE(40, 8, C); _DEFPIN_DUE(41, 9, C); _DEFPIN_DUE(42, 19, A); _DEFPIN_DUE(43, 20, A); -_DEFPIN_DUE(44, 19, C); _DEFPIN_DUE(45, 18, C); _DEFPIN_DUE(46, 17, C); _DEFPIN_DUE(47, 16, C); -_DEFPIN_DUE(48, 15, C); _DEFPIN_DUE(49, 14, C); _DEFPIN_DUE(50, 13, C); _DEFPIN_DUE(51, 12, C); -_DEFPIN_DUE(52, 21, B); _DEFPIN_DUE(53, 14, B); _DEFPIN_DUE(54, 16, A); _DEFPIN_DUE(55, 24, A); -_DEFPIN_DUE(56, 23, A); _DEFPIN_DUE(57, 22, A); _DEFPIN_DUE(58, 6, A); _DEFPIN_DUE(59, 4, A); -_DEFPIN_DUE(60, 3, A); _DEFPIN_DUE(61, 2, A); _DEFPIN_DUE(62, 17, B); _DEFPIN_DUE(63, 18, B); -_DEFPIN_DUE(64, 19, B); _DEFPIN_DUE(65, 20, B); _DEFPIN_DUE(66, 15, B); _DEFPIN_DUE(67, 16, B); -_DEFPIN_DUE(68, 1, A); _DEFPIN_DUE(69, 0, A); _DEFPIN_DUE(70, 17, A); _DEFPIN_DUE(71, 18, A); -_DEFPIN_DUE(72, 30, C); _DEFPIN_DUE(73, 21, A); _DEFPIN_DUE(74, 25, A); _DEFPIN_DUE(75, 26, A); -_DEFPIN_DUE(76, 27, A); _DEFPIN_DUE(77, 28, A); _DEFPIN_DUE(78, 23, B); +_FL_DEFPIN(0, 8, A); _FL_DEFPIN(1, 9, A); _FL_DEFPIN(2, 25, B); _FL_DEFPIN(3, 28, C); +_FL_DEFPIN(4, 26, C); _FL_DEFPIN(5, 25, C); _FL_DEFPIN(6, 24, C); _FL_DEFPIN(7, 23, C); +_FL_DEFPIN(8, 22, C); _FL_DEFPIN(9, 21, C); _FL_DEFPIN(10, 29, C); _FL_DEFPIN(11, 7, D); +_FL_DEFPIN(12, 8, D); _FL_DEFPIN(13, 27, B); _FL_DEFPIN(14, 4, D); _FL_DEFPIN(15, 5, D); +_FL_DEFPIN(16, 13, A); _FL_DEFPIN(17, 12, A); _FL_DEFPIN(18, 11, A); _FL_DEFPIN(19, 10, A); +_FL_DEFPIN(20, 12, B); _FL_DEFPIN(21, 13, B); _FL_DEFPIN(22, 26, B); _FL_DEFPIN(23, 14, A); +_FL_DEFPIN(24, 15, A); _FL_DEFPIN(25, 0, D); _FL_DEFPIN(26, 1, D); _FL_DEFPIN(27, 2, D); +_FL_DEFPIN(28, 3, D); _FL_DEFPIN(29, 6, D); _FL_DEFPIN(30, 9, D); _FL_DEFPIN(31, 7, A); +_FL_DEFPIN(32, 10, D); _FL_DEFPIN(33, 1, C); _FL_DEFPIN(34, 2, C); _FL_DEFPIN(35, 3, C); +_FL_DEFPIN(36, 4, C); _FL_DEFPIN(37, 5, C); _FL_DEFPIN(38, 6, C); _FL_DEFPIN(39, 7, C); +_FL_DEFPIN(40, 8, C); _FL_DEFPIN(41, 9, C); _FL_DEFPIN(42, 19, A); _FL_DEFPIN(43, 20, A); +_FL_DEFPIN(44, 19, C); _FL_DEFPIN(45, 18, C); _FL_DEFPIN(46, 17, C); _FL_DEFPIN(47, 16, C); +_FL_DEFPIN(48, 15, C); _FL_DEFPIN(49, 14, C); _FL_DEFPIN(50, 13, C); _FL_DEFPIN(51, 12, C); +_FL_DEFPIN(52, 21, B); _FL_DEFPIN(53, 14, B); _FL_DEFPIN(54, 16, A); _FL_DEFPIN(55, 24, A); +_FL_DEFPIN(56, 23, A); _FL_DEFPIN(57, 22, A); _FL_DEFPIN(58, 6, A); _FL_DEFPIN(59, 4, A); +_FL_DEFPIN(60, 3, A); _FL_DEFPIN(61, 2, A); _FL_DEFPIN(62, 17, B); _FL_DEFPIN(63, 18, B); +_FL_DEFPIN(64, 19, B); _FL_DEFPIN(65, 20, B); _FL_DEFPIN(66, 15, B); _FL_DEFPIN(67, 16, B); +_FL_DEFPIN(68, 1, A); _FL_DEFPIN(69, 0, A); _FL_DEFPIN(70, 17, A); _FL_DEFPIN(71, 18, A); +_FL_DEFPIN(72, 30, C); _FL_DEFPIN(73, 21, A); _FL_DEFPIN(74, 25, A); _FL_DEFPIN(75, 26, A); +_FL_DEFPIN(76, 27, A); _FL_DEFPIN(77, 28, A); _FL_DEFPIN(78, 23, B); // digix pins -_DEFPIN_DUE(90, 0, B); _DEFPIN_DUE(91, 1, B); _DEFPIN_DUE(92, 2, B); _DEFPIN_DUE(93, 3, B); -_DEFPIN_DUE(94, 4, B); _DEFPIN_DUE(95, 5, B); _DEFPIN_DUE(96, 6, B); _DEFPIN_DUE(97, 7, B); -_DEFPIN_DUE(98, 8, B); _DEFPIN_DUE(99, 9, B); _DEFPIN_DUE(100, 5, A); _DEFPIN_DUE(101, 22, B); -_DEFPIN_DUE(102, 23, B); _DEFPIN_DUE(103, 24, B); _DEFPIN_DUE(104, 27, C); _DEFPIN_DUE(105, 20, C); -_DEFPIN_DUE(106, 11, C); _DEFPIN_DUE(107, 10, C); _DEFPIN_DUE(108, 21, A); _DEFPIN_DUE(109, 30, C); -_DEFPIN_DUE(110, 29, B); _DEFPIN_DUE(111, 30, B); _DEFPIN_DUE(112, 31, B); _DEFPIN_DUE(113, 28, B); +_FL_DEFPIN(90, 0, B); _FL_DEFPIN(91, 1, B); _FL_DEFPIN(92, 2, B); _FL_DEFPIN(93, 3, B); +_FL_DEFPIN(94, 4, B); _FL_DEFPIN(95, 5, B); _FL_DEFPIN(96, 6, B); _FL_DEFPIN(97, 7, B); +_FL_DEFPIN(98, 8, B); _FL_DEFPIN(99, 9, B); _FL_DEFPIN(100, 5, A); _FL_DEFPIN(101, 22, B); +_FL_DEFPIN(102, 23, B); _FL_DEFPIN(103, 24, B); _FL_DEFPIN(104, 27, C); _FL_DEFPIN(105, 20, C); +_FL_DEFPIN(106, 11, C); _FL_DEFPIN(107, 10, C); _FL_DEFPIN(108, 21, A); _FL_DEFPIN(109, 30, C); +_FL_DEFPIN(110, 29, B); _FL_DEFPIN(111, 30, B); _FL_DEFPIN(112, 31, B); _FL_DEFPIN(113, 28, B); #define SPI_DATA 75 #define SPI_CLOCK 76 diff --git a/libraries/FastLED-3.2.9/platforms/arm/sam/fastspi_arm_sam.h b/libraries/FastLED/platforms/arm/sam/fastspi_arm_sam.h similarity index 98% rename from libraries/FastLED-3.2.9/platforms/arm/sam/fastspi_arm_sam.h rename to libraries/FastLED/platforms/arm/sam/fastspi_arm_sam.h index eb9abe4..a944643 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/sam/fastspi_arm_sam.h +++ b/libraries/FastLED/platforms/arm/sam/fastspi_arm_sam.h @@ -6,7 +6,7 @@ FASTLED_NAMESPACE_BEGIN #if defined(__SAM3X8E__) #define m_SPI ((Spi*)SPI0) -template +template class SAMHardwareSPIOutput { Selectable *m_pSelect; diff --git a/libraries/FastLED-3.2.9/platforms/arm/sam/led_sysdefs_arm_sam.h b/libraries/FastLED/platforms/arm/sam/led_sysdefs_arm_sam.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/sam/led_sysdefs_arm_sam.h rename to libraries/FastLED/platforms/arm/sam/led_sysdefs_arm_sam.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/stm32/clockless_arm_stm32.h b/libraries/FastLED/platforms/arm/stm32/clockless_arm_stm32.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/stm32/clockless_arm_stm32.h rename to libraries/FastLED/platforms/arm/stm32/clockless_arm_stm32.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/stm32/cm3_regs.h b/libraries/FastLED/platforms/arm/stm32/cm3_regs.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/stm32/cm3_regs.h rename to libraries/FastLED/platforms/arm/stm32/cm3_regs.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/stm32/fastled_arm_stm32.h b/libraries/FastLED/platforms/arm/stm32/fastled_arm_stm32.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/stm32/fastled_arm_stm32.h rename to libraries/FastLED/platforms/arm/stm32/fastled_arm_stm32.h diff --git a/libraries/FastLED-3.2.9/platforms/arm/stm32/fastpin_arm_stm32.h b/libraries/FastLED/platforms/arm/stm32/fastpin_arm_stm32.h similarity index 63% rename from libraries/FastLED-3.2.9/platforms/arm/stm32/fastpin_arm_stm32.h rename to libraries/FastLED/platforms/arm/stm32/fastpin_arm_stm32.h index 57309cd..274d0f6 100644 --- a/libraries/FastLED-3.2.9/platforms/arm/stm32/fastpin_arm_stm32.h +++ b/libraries/FastLED/platforms/arm/stm32/fastpin_arm_stm32.h @@ -56,45 +56,67 @@ public: }; #if defined(STM32F10X_MD) - #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile GPIO_TypeDef * r() { return T; } }; - #define _IO32(L) _RD32(GPIO ## L) + #define _R(T) struct __gen_struct_ ## T + #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile GPIO_TypeDef * r() { return T; } }; + #define _FL_IO(L,C) _RD32(GPIO ## L); _FL_DEFINE_PORT3(L, C, _R(GPIO ## L)); #elif defined(__STM32F1__) - #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline gpio_reg_map* r() { return T->regs; } }; - #define _IO32(L) _RD32(GPIO ## L) + #define _R(T) struct __gen_struct_ ## T + #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline gpio_reg_map* r() { return T->regs; } }; + #define _FL_IO(L,C) _RD32(GPIO ## L); _FL_DEFINE_PORT3(L, C, _R(GPIO ## L)); #else #error "Platform not supported" #endif -#define _R(T) struct __gen_struct_ ## T -#define _DEFPIN_ARM(PIN, BIT, L) template<> class FastPin : public _ARMPIN {}; +#define _FL_DEFPIN(PIN, BIT, L) template<> class FastPin : public _ARMPIN {}; + +#ifdef GPIOA +_FL_IO(A,0); +#endif +#ifdef GPIOB +_FL_IO(B,1); +#endif +#ifdef GPIOC +_FL_IO(C,2); +#endif +#ifdef GPIOD +_FL_IO(D,3); +#endif +#ifdef GPIOE +_FL_IO(E,4); +#endif +#ifdef GPIOF +_FL_IO(F,5); +#endif +#ifdef GPIOG +_FL_IO(G,6); +#endif // Actual pin definitions #if defined(SPARK) // Sparkfun STM32F103 based board -_IO32(A); _IO32(B); _IO32(C); _IO32(D); _IO32(E); _IO32(F); _IO32(G); #define MAX_PIN 19 -_DEFPIN_ARM(0, 7, B); -_DEFPIN_ARM(1, 6, B); -_DEFPIN_ARM(2, 5, B); -_DEFPIN_ARM(3, 4, B); -_DEFPIN_ARM(4, 3, B); -_DEFPIN_ARM(5, 15, A); -_DEFPIN_ARM(6, 14, A); -_DEFPIN_ARM(7, 13, A); -_DEFPIN_ARM(8, 8, A); -_DEFPIN_ARM(9, 9, A); -_DEFPIN_ARM(10, 0, A); -_DEFPIN_ARM(11, 1, A); -_DEFPIN_ARM(12, 4, A); -_DEFPIN_ARM(13, 5, A); -_DEFPIN_ARM(14, 6, A); -_DEFPIN_ARM(15, 7, A); -_DEFPIN_ARM(16, 0, B); -_DEFPIN_ARM(17, 1, B); -_DEFPIN_ARM(18, 3, A); -_DEFPIN_ARM(19, 2, A); +_FL_DEFPIN(0, 7, B); +_FL_DEFPIN(1, 6, B); +_FL_DEFPIN(2, 5, B); +_FL_DEFPIN(3, 4, B); +_FL_DEFPIN(4, 3, B); +_FL_DEFPIN(5, 15, A); +_FL_DEFPIN(6, 14, A); +_FL_DEFPIN(7, 13, A); +_FL_DEFPIN(8, 8, A); +_FL_DEFPIN(9, 9, A); +_FL_DEFPIN(10, 0, A); +_FL_DEFPIN(11, 1, A); +_FL_DEFPIN(12, 4, A); +_FL_DEFPIN(13, 5, A); +_FL_DEFPIN(14, 6, A); +_FL_DEFPIN(15, 7, A); +_FL_DEFPIN(16, 0, B); +_FL_DEFPIN(17, 1, B); +_FL_DEFPIN(18, 3, A); +_FL_DEFPIN(19, 2, A); #define SPI_DATA 15 @@ -106,43 +128,41 @@ _DEFPIN_ARM(19, 2, A); #if defined(__STM32F1__) // Generic STM32F103 aka "Blue Pill" -_IO32(A); _IO32(B); _IO32(C); - #define MAX_PIN 46 -_DEFPIN_ARM(10, 0, A); // PA0 - PA7 -_DEFPIN_ARM(11, 1, A); -_DEFPIN_ARM(12, 2, A); -_DEFPIN_ARM(13, 3, A); -_DEFPIN_ARM(14, 4, A); -_DEFPIN_ARM(15, 5, A); -_DEFPIN_ARM(16, 6, A); -_DEFPIN_ARM(17, 7, A); -_DEFPIN_ARM(29, 8, A); // PA8 - PA15 -_DEFPIN_ARM(30, 9, A); -_DEFPIN_ARM(31, 10, A); -_DEFPIN_ARM(32, 11, A); -_DEFPIN_ARM(33, 12, A); -_DEFPIN_ARM(34, 13, A); -_DEFPIN_ARM(37, 14, A); -_DEFPIN_ARM(38, 15, A); +_FL_DEFPIN(10, 0, A); // PA0 - PA7 +_FL_DEFPIN(11, 1, A); +_FL_DEFPIN(12, 2, A); +_FL_DEFPIN(13, 3, A); +_FL_DEFPIN(14, 4, A); +_FL_DEFPIN(15, 5, A); +_FL_DEFPIN(16, 6, A); +_FL_DEFPIN(17, 7, A); +_FL_DEFPIN(29, 8, A); // PA8 - PA15 +_FL_DEFPIN(30, 9, A); +_FL_DEFPIN(31, 10, A); +_FL_DEFPIN(32, 11, A); +_FL_DEFPIN(33, 12, A); +_FL_DEFPIN(34, 13, A); +_FL_DEFPIN(37, 14, A); +_FL_DEFPIN(38, 15, A); -_DEFPIN_ARM(18, 0, B); // PB0 - PB11 -_DEFPIN_ARM(19, 1, B); -_DEFPIN_ARM(20, 2, B); -_DEFPIN_ARM(39, 3, B); -_DEFPIN_ARM(40, 4, B); -_DEFPIN_ARM(41, 5, B); -_DEFPIN_ARM(42, 6, B); -_DEFPIN_ARM(43, 7, B); -_DEFPIN_ARM(45, 8, B); -_DEFPIN_ARM(46, 9, B); -_DEFPIN_ARM(21, 10, B); -_DEFPIN_ARM(22, 11, B); +_FL_DEFPIN(18, 0, B); // PB0 - PB11 +_FL_DEFPIN(19, 1, B); +_FL_DEFPIN(20, 2, B); +_FL_DEFPIN(39, 3, B); +_FL_DEFPIN(40, 4, B); +_FL_DEFPIN(41, 5, B); +_FL_DEFPIN(42, 6, B); +_FL_DEFPIN(43, 7, B); +_FL_DEFPIN(45, 8, B); +_FL_DEFPIN(46, 9, B); +_FL_DEFPIN(21, 10, B); +_FL_DEFPIN(22, 11, B); -_DEFPIN_ARM(2, 13, C); // PC13 - PC15 -_DEFPIN_ARM(3, 14, C); -_DEFPIN_ARM(4, 15, C); +_FL_DEFPIN(2, 13, C); // PC13 - PC15 +_FL_DEFPIN(3, 14, C); +_FL_DEFPIN(4, 15, C); #define SPI_DATA BOARD_SPI1_MOSI_PIN #define SPI_CLOCK BOARD_SPI1_SCK_PIN diff --git a/libraries/FastLED-3.2.9/platforms/arm/stm32/led_sysdefs_arm_stm32.h b/libraries/FastLED/platforms/arm/stm32/led_sysdefs_arm_stm32.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/arm/stm32/led_sysdefs_arm_stm32.h rename to libraries/FastLED/platforms/arm/stm32/led_sysdefs_arm_stm32.h diff --git a/libraries/FastLED-3.2.9/platforms/avr/clockless_trinket.h b/libraries/FastLED/platforms/avr/clockless_trinket.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/avr/clockless_trinket.h rename to libraries/FastLED/platforms/avr/clockless_trinket.h diff --git a/libraries/FastLED-3.2.9/platforms/avr/fastled_avr.h b/libraries/FastLED/platforms/avr/fastled_avr.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/avr/fastled_avr.h rename to libraries/FastLED/platforms/avr/fastled_avr.h diff --git a/libraries/FastLED/platforms/avr/fastpin_avr.h b/libraries/FastLED/platforms/avr/fastpin_avr.h new file mode 100644 index 0000000..5b39aa0 --- /dev/null +++ b/libraries/FastLED/platforms/avr/fastpin_avr.h @@ -0,0 +1,361 @@ +#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 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 _FL_IO(L,C) _RD8(DDR ## L); _RD8(PORT ## L); _RD8(PIN ## L); _FL_DEFINE_PORT3(L, C, _R(PORT ## L)); +#define _FL_DEFPIN(_PIN, BIT, L) template<> class FastPin<_PIN> : public _AVRPIN<_PIN, 1< {}; + +// Pre-do all the port definitions +#ifdef PORTA + _FL_IO(A,0) +#endif +#ifdef PORTB + _FL_IO(B,1) +#endif +#ifdef PORTC + _FL_IO(C,2) +#endif +#ifdef PORTD + _FL_IO(D,3) +#endif +#ifdef PORTE + _FL_IO(E,4) +#endif +#ifdef PORTF + _FL_IO(F,5) +#endif +#ifdef PORTG + _FL_IO(G,6) +#endif +#ifdef PORTH + _FL_IO(H,7) +#endif +#ifdef PORTI + _FL_IO(I,8) +#endif +#ifdef PORTJ + _FL_IO(J,9) +#endif +#ifdef PORTK + _FL_IO(K,10) +#endif +#ifdef PORTL + _FL_IO(L,11) +#endif +#ifdef PORTM + _FL_IO(M,12) +#endif +#ifdef PORTN + _FL_IO(N,13) +#endif + +#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny25__) + +#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 + +_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); + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(__AVR_ATtiny841__) || defined(__AVR_ATtiny441__) +#define MAX_PIN 11 + +_FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); +_FL_DEFPIN(3, 7, A); _FL_DEFPIN(4, 6, A); _FL_DEFPIN(5, 5, A); +_FL_DEFPIN(6, 4, A); _FL_DEFPIN(7, 3, A); _FL_DEFPIN(8, 2, A); +_FL_DEFPIN(9, 1, A); _FL_DEFPIN(10, 0, A); _FL_DEFPIN(11, 3, 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 + +_FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); +_FL_DEFPIN(3, 7, A); _FL_DEFPIN(4, 6, A); _FL_DEFPIN(5, 5, A); + +#elif defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) + +#define MAX_PIN 10 + +_FL_DEFPIN(0, 0, A); _FL_DEFPIN(1, 1, A); _FL_DEFPIN(2, 2, A); _FL_DEFPIN(3, 3, A); +_FL_DEFPIN(4, 4, A); _FL_DEFPIN(5, 5, A); _FL_DEFPIN(6, 6, A); _FL_DEFPIN(7, 7, A); +_FL_DEFPIN(8, 2, B); _FL_DEFPIN(9, 1, B); _FL_DEFPIN(10, 0, B); + +#define HAS_HARDWARE_PIN_SUPPORT 1 + +#elif defined(ARDUINO_AVR_DIGISPARKPRO) + +#define MAX_PIN 12 + +_FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); _FL_DEFPIN(3, 5, B); +_FL_DEFPIN(4, 3, B); _FL_DEFPIN(5, 7, A); _FL_DEFPIN(6, 0, A); _FL_DEFPIN(7, 1, A); +_FL_DEFPIN(8, 2, A); _FL_DEFPIN(9, 3, A); _FL_DEFPIN(10, 4, A); _FL_DEFPIN(11, 5, A); +_FL_DEFPIN(12, 6, A); + +#elif defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__) + +#define MAX_PIN 15 + +_FL_DEFPIN(0, 0, A); _FL_DEFPIN(1, 1, A); _FL_DEFPIN(2, 2, A); _FL_DEFPIN(3, 3, A); +_FL_DEFPIN(4, 4, A); _FL_DEFPIN(5, 5, A); _FL_DEFPIN(6, 6, A); _FL_DEFPIN(7, 7, A); +_FL_DEFPIN(8, 0, B); _FL_DEFPIN(9, 1, B); _FL_DEFPIN(10, 2, B); _FL_DEFPIN(11, 3, B); +_FL_DEFPIN(12, 4, B); _FL_DEFPIN(13, 5, B); _FL_DEFPIN(14, 6, B); _FL_DEFPIN(15, 7, 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__) + +#define MAX_PIN 20 + +_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, 7, C); _FL_DEFPIN( 9, 6, C); _FL_DEFPIN( 10, 5,C); _FL_DEFPIN( 11, 4, C); +_FL_DEFPIN( 12, 2, C); _FL_DEFPIN( 13, 0, D); _FL_DEFPIN( 14, 1, D); _FL_DEFPIN(15, 2, D); +_FL_DEFPIN( 16, 3, D); _FL_DEFPIN( 17, 4, D); _FL_DEFPIN( 18, 5, D); _FL_DEFPIN( 19, 6, D); +_FL_DEFPIN( 20, 7, D); + +#define HAS_HARDWARE_PIN_SUPPORT 1 +// #define SPI_DATA 2 +// #define SPI_CLOCK 1 +// #define AVR_HARDWARE_SPI 1 + +#elif defined(IS_BEAN) + +#define MAX_PIN 19 +_FL_DEFPIN( 0, 6, D); _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, 0, D); _FL_DEFPIN( 7, 7, D); +_FL_DEFPIN( 8, 0, B); _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, 0, C); _FL_DEFPIN(15, 1, C); +_FL_DEFPIN(16, 2, C); _FL_DEFPIN(17, 3, C); _FL_DEFPIN(18, 4, C); _FL_DEFPIN(19, 5, 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__) + +#define MAX_PIN 19 +_FL_DEFPIN( 0, 0, D); _FL_DEFPIN( 1, 1, D); _FL_DEFPIN( 2, 2, D); _FL_DEFPIN( 3, 3, D); +_FL_DEFPIN( 4, 4, D); _FL_DEFPIN( 5, 5, D); _FL_DEFPIN( 6, 6, D); _FL_DEFPIN( 7, 7, D); +_FL_DEFPIN( 8, 0, B); _FL_DEFPIN( 9, 1, B); _FL_DEFPIN(10, 2, B); _FL_DEFPIN(11, 3, B); +_FL_DEFPIN(12, 4, B); _FL_DEFPIN(13, 5, B); _FL_DEFPIN(14, 0, C); _FL_DEFPIN(15, 1, C); +_FL_DEFPIN(16, 2, C); _FL_DEFPIN(17, 3, C); _FL_DEFPIN(18, 4, C); _FL_DEFPIN(19, 5, 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__) || defined(__AVR_ATmega32__) + +#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 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 +_FL_DEFPIN( 0, 0, E); _FL_DEFPIN( 1, 1, E); _FL_DEFPIN( 2, 7, B); _FL_DEFPIN( 3, 3, E); +_FL_DEFPIN( 4, 4, E); _FL_DEFPIN( 5, 5, E); _FL_DEFPIN( 6, 2, E); _FL_DEFPIN( 7, 6, E); +_FL_DEFPIN( 8, 5, D); _FL_DEFPIN( 9, 0, B); _FL_DEFPIN(10, 2, B); _FL_DEFPIN(11, 3, B); +_FL_DEFPIN(12, 1, B); _FL_DEFPIN(13, 2, D); _FL_DEFPIN(14, 3, D); _FL_DEFPIN(15, 0, D); +_FL_DEFPIN(16, 1, D); _FL_DEFPIN(17, 4, D); _FL_DEFPIN(18, 7, E); _FL_DEFPIN(19, 6, D); +_FL_DEFPIN(20, 7, D); _FL_DEFPIN(21, 4, B); _FL_DEFPIN(22, 5, B); _FL_DEFPIN(23, 6, B); +_FL_DEFPIN(24, 0, F); _FL_DEFPIN(25, 1, F); _FL_DEFPIN(26, 2, F); _FL_DEFPIN(27, 3, F); +_FL_DEFPIN(28, 4, F); _FL_DEFPIN(29, 5, F); _FL_DEFPIN(30, 6, F); _FL_DEFPIN(31, 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 +#define MAX_PIN 69 +_FL_DEFPIN(0, 0, E); _FL_DEFPIN(1, 1, E); _FL_DEFPIN(2, 4, E); _FL_DEFPIN(3, 5, E); +_FL_DEFPIN(4, 5, G); _FL_DEFPIN(5, 3, E); _FL_DEFPIN(6, 3, H); _FL_DEFPIN(7, 4, H); +_FL_DEFPIN(8, 5, H); _FL_DEFPIN(9, 6, H); _FL_DEFPIN(10, 4, B); _FL_DEFPIN(11, 5, B); +_FL_DEFPIN(12, 6, B); _FL_DEFPIN(13, 7, B); _FL_DEFPIN(14, 1, J); _FL_DEFPIN(15, 0, J); +_FL_DEFPIN(16, 1, H); _FL_DEFPIN(17, 0, H); _FL_DEFPIN(18, 3, D); _FL_DEFPIN(19, 2, D); +_FL_DEFPIN(20, 1, D); _FL_DEFPIN(21, 0, D); _FL_DEFPIN(22, 0, A); _FL_DEFPIN(23, 1, A); +_FL_DEFPIN(24, 2, A); _FL_DEFPIN(25, 3, A); _FL_DEFPIN(26, 4, A); _FL_DEFPIN(27, 5, A); +_FL_DEFPIN(28, 6, A); _FL_DEFPIN(29, 7, A); _FL_DEFPIN(30, 7, C); _FL_DEFPIN(31, 6, C); +_FL_DEFPIN(32, 5, C); _FL_DEFPIN(33, 4, C); _FL_DEFPIN(34, 3, C); _FL_DEFPIN(35, 2, C); +_FL_DEFPIN(36, 1, C); _FL_DEFPIN(37, 0, C); _FL_DEFPIN(38, 7, D); _FL_DEFPIN(39, 2, G); +_FL_DEFPIN(40, 1, G); _FL_DEFPIN(41, 0, G); _FL_DEFPIN(42, 7, L); _FL_DEFPIN(43, 6, L); +_FL_DEFPIN(44, 5, L); _FL_DEFPIN(45, 4, L); _FL_DEFPIN(46, 3, L); _FL_DEFPIN(47, 2, L); +_FL_DEFPIN(48, 1, L); _FL_DEFPIN(49, 0, L); _FL_DEFPIN(50, 3, B); _FL_DEFPIN(51, 2, B); +_FL_DEFPIN(52, 1, B); _FL_DEFPIN(53, 0, B); _FL_DEFPIN(54, 0, F); _FL_DEFPIN(55, 1, F); +_FL_DEFPIN(56, 2, F); _FL_DEFPIN(57, 3, F); _FL_DEFPIN(58, 4, F); _FL_DEFPIN(59, 5, F); +_FL_DEFPIN(60, 6, F); _FL_DEFPIN(61, 7, F); _FL_DEFPIN(62, 0, K); _FL_DEFPIN(63, 1, K); +_FL_DEFPIN(64, 2, K); _FL_DEFPIN(65, 3, K); _FL_DEFPIN(66, 4, K); _FL_DEFPIN(67, 5, K); +_FL_DEFPIN(68, 6, K); _FL_DEFPIN(69, 7, 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 +#define MAX_PIN 23 +_FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); _FL_DEFPIN(3, 3, B); +_FL_DEFPIN(4, 7, B); _FL_DEFPIN(5, 0, D); _FL_DEFPIN(6, 1, D); _FL_DEFPIN(7, 2, D); +_FL_DEFPIN(8, 3, D); _FL_DEFPIN(9, 6, C); _FL_DEFPIN(10, 7, C); _FL_DEFPIN(11, 6, D); +_FL_DEFPIN(12, 7, D); _FL_DEFPIN(13, 4, B); _FL_DEFPIN(14, 5, B); _FL_DEFPIN(15, 6, B); +_FL_DEFPIN(16, 7, F); _FL_DEFPIN(17, 6, F); _FL_DEFPIN(18, 5, F); _FL_DEFPIN(19, 4, F); +_FL_DEFPIN(20, 1, F); _FL_DEFPIN(21, 0, F); _FL_DEFPIN(22, 4, D); _FL_DEFPIN(23, 5, 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 +#define MAX_PIN 45 +_FL_DEFPIN(0, 0, D); _FL_DEFPIN(1, 1, D); _FL_DEFPIN(2, 2, D); _FL_DEFPIN(3, 3, D); +_FL_DEFPIN(4, 4, D); _FL_DEFPIN(5, 5, D); _FL_DEFPIN(6, 6, D); _FL_DEFPIN(7, 7, D); +_FL_DEFPIN(8, 0, E); _FL_DEFPIN(9, 1, E); _FL_DEFPIN(10, 0, C); _FL_DEFPIN(11, 1, C); +_FL_DEFPIN(12, 2, C); _FL_DEFPIN(13, 3, C); _FL_DEFPIN(14, 4, C); _FL_DEFPIN(15, 5, C); +_FL_DEFPIN(16, 6, C); _FL_DEFPIN(17, 7, C); _FL_DEFPIN(18, 6, E); _FL_DEFPIN(19, 7, E); +_FL_DEFPIN(20, 0, B); _FL_DEFPIN(21, 1, B); _FL_DEFPIN(22, 2, B); _FL_DEFPIN(23, 3, B); +_FL_DEFPIN(24, 4, B); _FL_DEFPIN(25, 5, B); _FL_DEFPIN(26, 6, B); _FL_DEFPIN(27, 7, B); +_FL_DEFPIN(28, 0, A); _FL_DEFPIN(29, 1, A); _FL_DEFPIN(30, 2, A); _FL_DEFPIN(31, 3, A); +_FL_DEFPIN(32, 4, A); _FL_DEFPIN(33, 5, A); _FL_DEFPIN(34, 6, A); _FL_DEFPIN(35, 7, A); +_FL_DEFPIN(36, 4, E); _FL_DEFPIN(37, 5, E); _FL_DEFPIN(38, 0, F); _FL_DEFPIN(39, 1, F); +_FL_DEFPIN(40, 2, F); _FL_DEFPIN(41, 3, F); _FL_DEFPIN(42, 4, F); _FL_DEFPIN(43, 5, F); +_FL_DEFPIN(44, 6, F); _FL_DEFPIN(45, 7, 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 +#define MAX_PIN 30 +_FL_DEFPIN(0, 2, D); _FL_DEFPIN(1, 3, D); _FL_DEFPIN(2, 1, D); _FL_DEFPIN(3, 0, D); +_FL_DEFPIN(4, 4, D); _FL_DEFPIN(5, 6, C); _FL_DEFPIN(6, 7, D); _FL_DEFPIN(7, 6, E); +_FL_DEFPIN(8, 4, B); _FL_DEFPIN(9, 5, B); _FL_DEFPIN(10, 6, B); _FL_DEFPIN(11, 7, B); +_FL_DEFPIN(12, 6, D); _FL_DEFPIN(13, 7, C); _FL_DEFPIN(14, 3, B); _FL_DEFPIN(15, 1, B); +_FL_DEFPIN(16, 2, B); _FL_DEFPIN(17, 0, B); _FL_DEFPIN(18, 7, F); _FL_DEFPIN(19, 6, F); +_FL_DEFPIN(20, 5, F); _FL_DEFPIN(21, 4, F); _FL_DEFPIN(22, 1, F); _FL_DEFPIN(23, 0, F); +_FL_DEFPIN(24, 4, D); _FL_DEFPIN(25, 7, D); _FL_DEFPIN(26, 4, B); _FL_DEFPIN(27, 5, B); +_FL_DEFPIN(28, 6, B); _FL_DEFPIN(29, 6, D); _FL_DEFPIN(30, 5, 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 diff --git a/libraries/FastLED-3.2.9/platforms/avr/fastspi_avr.h b/libraries/FastLED/platforms/avr/fastspi_avr.h similarity index 98% rename from libraries/FastLED-3.2.9/platforms/avr/fastspi_avr.h rename to libraries/FastLED/platforms/avr/fastspi_avr.h index fc14d59..d2edc96 100644 --- a/libraries/FastLED-3.2.9/platforms/avr/fastspi_avr.h +++ b/libraries/FastLED/platforms/avr/fastspi_avr.h @@ -20,7 +20,7 @@ FASTLED_NAMESPACE_BEGIN #define UCPHA1 1 #endif -template +template class AVRUSART1SPIOutput { Selectable *m_pSelect; @@ -167,7 +167,7 @@ public: #endif #if defined(UBRR0) -template +template class AVRUSART0SPIOutput { Selectable *m_pSelect; @@ -329,7 +329,7 @@ public: // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -template +template class AVRHardwareSPIOutput { Selectable *m_pSelect; bool mWait; @@ -506,7 +506,7 @@ public: // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -template +template class AVRHardwareSPIOutput { Selectable *m_pSelect; bool mWait; diff --git a/libraries/FastLED-3.2.9/platforms/avr/led_sysdefs_avr.h b/libraries/FastLED/platforms/avr/led_sysdefs_avr.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/avr/led_sysdefs_avr.h rename to libraries/FastLED/platforms/avr/led_sysdefs_avr.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/32/clockless_block_esp32.h b/libraries/FastLED/platforms/esp/32/clockless_block_esp32.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/32/clockless_block_esp32.h rename to libraries/FastLED/platforms/esp/32/clockless_block_esp32.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/32/clockless_esp32.h.orig b/libraries/FastLED/platforms/esp/32/clockless_esp32.h.orig similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/32/clockless_esp32.h.orig rename to libraries/FastLED/platforms/esp/32/clockless_esp32.h.orig diff --git a/libraries/FastLED-3.2.9/platforms/esp/32/clockless_i2s_esp32.h b/libraries/FastLED/platforms/esp/32/clockless_i2s_esp32.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/32/clockless_i2s_esp32.h rename to libraries/FastLED/platforms/esp/32/clockless_i2s_esp32.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/32/clockless_rmt_esp32.h b/libraries/FastLED/platforms/esp/32/clockless_rmt_esp32.h similarity index 93% rename from libraries/FastLED-3.2.9/platforms/esp/32/clockless_rmt_esp32.h rename to libraries/FastLED/platforms/esp/32/clockless_rmt_esp32.h index c9fee8a..6368bc9 100644 --- a/libraries/FastLED-3.2.9/platforms/esp/32/clockless_rmt_esp32.h +++ b/libraries/FastLED/platforms/esp/32/clockless_rmt_esp32.h @@ -118,21 +118,16 @@ __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() { #define DIVIDER 2 /* 4, 8 still seem to work, but timings become marginal */ #define MAX_PULSES 32 /* A channel has a 64 "pulse" buffer - we use half per pass */ -// -- Convert ESP32 cycles back into nanoseconds -#define ESPCLKS_TO_NS(_CLKS) (((long)(_CLKS) * 1000L) / F_CPU_MHZ) - -// -- Convert nanoseconds into RMT cycles -#define F_CPU_RMT ( 80000000L) -#define NS_PER_SEC (1000000000L) -#define CYCLES_PER_SEC (F_CPU_RMT/DIVIDER) -#define NS_PER_CYCLE ( NS_PER_SEC / CYCLES_PER_SEC ) -#define NS_TO_CYCLES(n) ( (n) / NS_PER_CYCLE ) - -// -- Convert ESP32 cycles to RMT cycles -#define TO_RMT_CYCLES(_CLKS) NS_TO_CYCLES(ESPCLKS_TO_NS(_CLKS)) +// -- Convert ESP32 CPU cycles to RMT device cycles, taking into account the divider +#define F_CPU_RMT ( 80000000L) +#define RMT_CYCLES_PER_SEC (F_CPU_RMT/DIVIDER) +#define RMT_CYCLES_PER_ESP_CYCLE (F_CPU / RMT_CYCLES_PER_SEC) +#define ESP_TO_RMT_CYCLES(n) ((n) / (RMT_CYCLES_PER_ESP_CYCLE)) // -- Number of cycles to signal the strip to latch -#define RMT_RESET_DURATION NS_TO_CYCLES(50000) +#define NS_PER_CYCLE ( 1000000000L / RMT_CYCLES_PER_SEC ) +#define NS_TO_CYCLES(n) ( (n) / NS_PER_CYCLE ) +#define RMT_RESET_DURATION NS_TO_CYCLES(50000) // -- Core or custom driver #ifndef FASTLED_RMT_BUILTIN_DRIVER @@ -190,6 +185,7 @@ class ClocklessController : public CPixelLEDController PixelController * mPixels; int mCurColor; uint16_t mCurPulse; + volatile uint32_t * mRMT_mem_ptr; // -- Buffer to hold all of the pulses. For the version that uses // the RMT driver built into the ESP core. @@ -208,17 +204,17 @@ public: // according to the timing values given in the template instantiation // T1H mOne.level0 = 1; - mOne.duration0 = TO_RMT_CYCLES(T1+T2); + mOne.duration0 = ESP_TO_RMT_CYCLES(T1+T2); // TO_RMT_CYCLES(T1+T2); // T1L mOne.level1 = 0; - mOne.duration1 = TO_RMT_CYCLES(T3); + mOne.duration1 = ESP_TO_RMT_CYCLES(T3); // TO_RMT_CYCLES(T3); // T0H mZero.level0 = 1; - mZero.duration0 = TO_RMT_CYCLES(T1); + mZero.duration0 = ESP_TO_RMT_CYCLES(T1); // TO_RMT_CYCLES(T1); // T0L mZero.level1 = 0; - mZero.duration1 = TO_RMT_CYCLES(T2 + T3); + mZero.duration1 = ESP_TO_RMT_CYCLES(T2+T3); // TO_RMT_CYCLES(T2 + T3); gControllers[gNumControllers] = this; gNumControllers++; @@ -414,6 +410,7 @@ protected: // -- Initialize the counters that keep track of where we are in // the pixel data. + mRMT_mem_ptr = & (RMTMEM.chan[mRMT_channel].data32[0].val); mCurPulse = 0; mCurColor = 0; @@ -494,7 +491,7 @@ protected: } } - uint8_t IRAM_ATTR getNextByte() + uint8_t IRAM_ATTR getNextByte() __attribute__ ((always_inline)) { uint8_t byte; @@ -526,7 +523,7 @@ protected: // buffer with pixel data. It also handles the case where the // pixel data is exhausted, so we need to fill the RMT buffer // with zeros to signal that it's done. - void IRAM_ATTR fillHalfRMTBuffer() + virtual void IRAM_ATTR fillHalfRMTBuffer() { uint32_t one_val = mOne.val; uint32_t zero_val = mZero.val; @@ -543,7 +540,8 @@ protected: // rmt_item32_t value corresponding to the buffered bit value for (register uint32_t j = 0; j < 8; j++) { uint32_t val = (byteval & 0x80000000L) ? one_val : zero_val; - RMTMEM.chan[mRMT_channel].data32[mCurPulse].val = val; + * mRMT_mem_ptr++ = val; + // Replaces: RMTMEM.chan[mRMT_channel].data32[mCurPulse].val = val; byteval <<= 1; mCurPulse++; } @@ -554,15 +552,18 @@ protected: // RMT buffer with 0's, which signals to the device that we're done. if ( ! mPixels->has(1) ) { while (pulses < 32) { - RMTMEM.chan[mRMT_channel].data32[mCurPulse].val = 0; + * mRMT_mem_ptr++ = 0; + // Replaces: RMTMEM.chan[mRMT_channel].data32[mCurPulse].val = 0; mCurPulse++; pulses++; } } // -- When we have filled the back half the buffer, reset the position to the first half - if (mCurPulse >= MAX_PULSES*2) + if (mCurPulse >= MAX_PULSES*2) { + mRMT_mem_ptr = & (RMTMEM.chan[mRMT_channel].data32[0].val); mCurPulse = 0; + } } }; diff --git a/libraries/FastLED-3.2.9/platforms/esp/32/fastled_esp32.h b/libraries/FastLED/platforms/esp/32/fastled_esp32.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/32/fastled_esp32.h rename to libraries/FastLED/platforms/esp/32/fastled_esp32.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/32/fastpin_esp32.h b/libraries/FastLED/platforms/esp/32/fastpin_esp32.h similarity index 61% rename from libraries/FastLED-3.2.9/platforms/esp/32/fastpin_esp32.h rename to libraries/FastLED/platforms/esp/32/fastpin_esp32.h index fd03d5c..d54d7fe 100644 --- a/libraries/FastLED-3.2.9/platforms/esp/32/fastpin_esp32.h +++ b/libraries/FastLED/platforms/esp/32/fastpin_esp32.h @@ -11,7 +11,7 @@ public: inline static void setOutput() { pinMode(PIN, OUTPUT); } inline static void setInput() { pinMode(PIN, INPUT); } - inline static void hi() __attribute__ ((always_inline)) { + inline static void hi() __attribute__ ((always_inline)) { if (PIN < 32) GPIO.out_w1ts = MASK; else GPIO.out1_w1ts.val = MASK; } @@ -28,9 +28,9 @@ public: inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } - inline static void toggle() __attribute__ ((always_inline)) { - if(PIN < 32) { GPIO.out ^= MASK; } - else { GPIO.out1.val ^=MASK; } + inline static void toggle() __attribute__ ((always_inline)) { + if(PIN < 32) { GPIO.out ^= MASK; } + else { GPIO.out1.val ^=MASK; } } inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } @@ -52,7 +52,7 @@ public: else return &GPIO.out1.val; } - inline static port_ptr_t sport() __attribute__ ((always_inline)) { + inline static port_ptr_t sport() __attribute__ ((always_inline)) { if (PIN < 32) return &GPIO.out_w1ts; else return &GPIO.out1_w1ts.val; } @@ -70,46 +70,45 @@ public: } }; -#define _DEFPIN_ESP32(PIN) template<> class FastPin : public _ESPPIN {}; -#define _DEFPIN_32_33_ESP32(PIN) template<> class FastPin : public _ESPPIN {}; +#define _FL_DEFPIN(PIN) template<> class FastPin : public _ESPPIN {}; -_DEFPIN_ESP32(0); -_DEFPIN_ESP32(1); // WARNING: Using TX causes flashiness when uploading -_DEFPIN_ESP32(2); -_DEFPIN_ESP32(3); // WARNING: Using RX causes flashiness when uploading -_DEFPIN_ESP32(4); -_DEFPIN_ESP32(5); +_FL_DEFPIN(0); +_FL_DEFPIN(1); // WARNING: Using TX causes flashiness when uploading +_FL_DEFPIN(2); +_FL_DEFPIN(3); // WARNING: Using RX causes flashiness when uploading +_FL_DEFPIN(4); +_FL_DEFPIN(5); // -- These pins are not safe to use: -// _DEFPIN_ESP32(6,6); _DEFPIN_ESP32(7,7); _DEFPIN_ESP32(8,8); -// _DEFPIN_ESP32(9,9); _DEFPIN_ESP32(10,10); _DEFPIN_ESP32(11,11); +// _FL_DEFPIN(6,6); _FL_DEFPIN(7,7); _FL_DEFPIN(8,8); +// _FL_DEFPIN(9,9); _FL_DEFPIN(10,10); _FL_DEFPIN(11,11); -_DEFPIN_ESP32(12); -_DEFPIN_ESP32(13); -_DEFPIN_ESP32(14); -_DEFPIN_ESP32(15); -_DEFPIN_ESP32(16); -_DEFPIN_ESP32(17); -_DEFPIN_ESP32(18); -_DEFPIN_ESP32(19); +_FL_DEFPIN(12); +_FL_DEFPIN(13); +_FL_DEFPIN(14); +_FL_DEFPIN(15); +_FL_DEFPIN(16); +_FL_DEFPIN(17); +_FL_DEFPIN(18); +_FL_DEFPIN(19); -// No pin 20 : _DEFPIN_ESP32(20,20); +// No pin 20 : _FL_DEFPIN(20,20); -_DEFPIN_ESP32(21); // Works, but note that GPIO21 is I2C SDA -_DEFPIN_ESP32(22); // Works, but note that GPIO22 is I2C SCL -_DEFPIN_ESP32(23); +_FL_DEFPIN(21); // Works, but note that GPIO21 is I2C SDA +_FL_DEFPIN(22); // Works, but note that GPIO22 is I2C SCL +_FL_DEFPIN(23); -// No pin 24 : _DEFPIN_ESP32(24,24); +// No pin 24 : _FL_DEFPIN(24,24); -_DEFPIN_ESP32(25); -_DEFPIN_ESP32(26); -_DEFPIN_ESP32(27); +_FL_DEFPIN(25); +_FL_DEFPIN(26); +_FL_DEFPIN(27); -// No pin 28-31: _DEFPIN_ESP32(28,28); _DEFPIN_ESP32(29,29); _DEFPIN_ESP32(30,30); _DEFPIN_ESP32(31,31); +// No pin 28-31: _FL_DEFPIN(28,28); _FL_DEFPIN(29,29); _FL_DEFPIN(30,30); _FL_DEFPIN(31,31); // Need special handling for pins > 31 -_DEFPIN_32_33_ESP32(32); -_DEFPIN_32_33_ESP32(33); +_FL_DEFPIN(32); +_FL_DEFPIN(33); #define HAS_HARDWARE_PIN_SUPPORT diff --git a/libraries/FastLED-3.2.9/platforms/esp/32/led_sysdefs_esp32.h b/libraries/FastLED/platforms/esp/32/led_sysdefs_esp32.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/32/led_sysdefs_esp32.h rename to libraries/FastLED/platforms/esp/32/led_sysdefs_esp32.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/8266/clockless_block_esp8266.h b/libraries/FastLED/platforms/esp/8266/clockless_block_esp8266.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/8266/clockless_block_esp8266.h rename to libraries/FastLED/platforms/esp/8266/clockless_block_esp8266.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/8266/clockless_esp8266.h b/libraries/FastLED/platforms/esp/8266/clockless_esp8266.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/8266/clockless_esp8266.h rename to libraries/FastLED/platforms/esp/8266/clockless_esp8266.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/8266/fastled_esp8266.h b/libraries/FastLED/platforms/esp/8266/fastled_esp8266.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/8266/fastled_esp8266.h rename to libraries/FastLED/platforms/esp/8266/fastled_esp8266.h diff --git a/libraries/FastLED-3.2.9/platforms/esp/8266/fastpin_esp8266.h b/libraries/FastLED/platforms/esp/8266/fastpin_esp8266.h similarity index 68% rename from libraries/FastLED-3.2.9/platforms/esp/8266/fastpin_esp8266.h rename to libraries/FastLED/platforms/esp/8266/fastpin_esp8266.h index b8095b8..69085bf 100644 --- a/libraries/FastLED-3.2.9/platforms/esp/8266/fastpin_esp8266.h +++ b/libraries/FastLED/platforms/esp/8266/fastpin_esp8266.h @@ -42,40 +42,40 @@ public: inline static bool isset() __attribute__ ((always_inline)) { return (PIN < 16) ? (GPO & MASK) : (GP16O & MASK); } }; -#define _DEFPIN_ESP8266(PIN, REAL_PIN) template<> class FastPin : public _ESPPIN {}; +#define _FL_DEFPIN(PIN, REAL_PIN) template<> class FastPin : public _ESPPIN {}; #ifdef FASTLED_ESP8266_RAW_PIN_ORDER #define MAX_PIN 16 -_DEFPIN_ESP8266(0,0); _DEFPIN_ESP8266(1,1); _DEFPIN_ESP8266(2,2); _DEFPIN_ESP8266(3,3); -_DEFPIN_ESP8266(4,4); _DEFPIN_ESP8266(5,5); +_FL_DEFPIN(0,0); _FL_DEFPIN(1,1); _FL_DEFPIN(2,2); _FL_DEFPIN(3,3); +_FL_DEFPIN(4,4); _FL_DEFPIN(5,5); // These pins should be disabled, as they always cause WDT resets -// _DEFPIN_ESP8266(6,6); _DEFPIN_ESP8266(7,7); -// _DEFPIN_ESP8266(8,8); _DEFPIN_ESP8266(9,9); _DEFPIN_ESP8266(10,10); _DEFPIN_ESP8266(11,11); +// _FL_DEFPIN(6,6); _FL_DEFPIN(7,7); +// _FL_DEFPIN(8,8); _FL_DEFPIN(9,9); _FL_DEFPIN(10,10); _FL_DEFPIN(11,11); -_DEFPIN_ESP8266(12,12); _DEFPIN_ESP8266(13,13); _DEFPIN_ESP8266(14,14); _DEFPIN_ESP8266(15,15); -_DEFPIN_ESP8266(16,16); +_FL_DEFPIN(12,12); _FL_DEFPIN(13,13); _FL_DEFPIN(14,14); _FL_DEFPIN(15,15); +_FL_DEFPIN(16,16); #define PORTA_FIRST_PIN 12 #elif defined(FASTLED_ESP8266_D1_PIN_ORDER) #define MAX_PIN 15 -_DEFPIN_ESP8266(0,3); -_DEFPIN_ESP8266(1,1); -_DEFPIN_ESP8266(2,16); -_DEFPIN_ESP8266(3,5); -_DEFPIN_ESP8266(4,4); -_DEFPIN_ESP8266(5,14); -_DEFPIN_ESP8266(6,12); -_DEFPIN_ESP8266(7,13); -_DEFPIN_ESP8266(8,0); -_DEFPIN_ESP8266(9,2); -_DEFPIN_ESP8266(10,15); -_DEFPIN_ESP8266(11,13); -_DEFPIN_ESP8266(12,12); -_DEFPIN_ESP8266(13,14); -_DEFPIN_ESP8266(14,4); -_DEFPIN_ESP8266(15,5); +_FL_DEFPIN(0,3); +_FL_DEFPIN(1,1); +_FL_DEFPIN(2,16); +_FL_DEFPIN(3,5); +_FL_DEFPIN(4,4); +_FL_DEFPIN(5,14); +_FL_DEFPIN(6,12); +_FL_DEFPIN(7,13); +_FL_DEFPIN(8,0); +_FL_DEFPIN(9,2); +_FL_DEFPIN(10,15); +_FL_DEFPIN(11,13); +_FL_DEFPIN(12,12); +_FL_DEFPIN(13,14); +_FL_DEFPIN(14,4); +_FL_DEFPIN(15,5); #define PORTA_FIRST_PIN 12 @@ -83,16 +83,16 @@ _DEFPIN_ESP8266(15,5); #define MAX_PIN 10 // This seems to be the standard Dxx pin mapping on most of the esp boards that i've found -_DEFPIN_ESP8266(0,16); _DEFPIN_ESP8266(1,5); _DEFPIN_ESP8266(2,4); _DEFPIN_ESP8266(3,0); -_DEFPIN_ESP8266(4,2); _DEFPIN_ESP8266(5,14); _DEFPIN_ESP8266(6,12); _DEFPIN_ESP8266(7,13); -_DEFPIN_ESP8266(8,15); _DEFPIN_ESP8266(9,3); _DEFPIN_ESP8266(10,1); +_FL_DEFPIN(0,16); _FL_DEFPIN(1,5); _FL_DEFPIN(2,4); _FL_DEFPIN(3,0); +_FL_DEFPIN(4,2); _FL_DEFPIN(5,14); _FL_DEFPIN(6,12); _FL_DEFPIN(7,13); +_FL_DEFPIN(8,15); _FL_DEFPIN(9,3); _FL_DEFPIN(10,1); #define PORTA_FIRST_PIN 6 // The rest of the pins - these are generally not available -// _DEFPIN_ESP8266(11,6); -// _DEFPIN_ESP8266(12,7); _DEFPIN_ESP8266(13,8); _DEFPIN_ESP8266(14,9); _DEFPIN_ESP8266(15,10); -// _DEFPIN_ESP8266(16,11); +// _FL_DEFPIN(11,6); +// _FL_DEFPIN(12,7); _FL_DEFPIN(13,8); _FL_DEFPIN(14,9); _FL_DEFPIN(15,10); +// _FL_DEFPIN(16,11); #endif diff --git a/libraries/FastLED-3.2.9/platforms/esp/8266/led_sysdefs_esp8266.h b/libraries/FastLED/platforms/esp/8266/led_sysdefs_esp8266.h similarity index 100% rename from libraries/FastLED-3.2.9/platforms/esp/8266/led_sysdefs_esp8266.h rename to libraries/FastLED/platforms/esp/8266/led_sysdefs_esp8266.h diff --git a/libraries/FastLED-3.2.9/power_mgt.cpp b/libraries/FastLED/power_mgt.cpp similarity index 100% rename from libraries/FastLED-3.2.9/power_mgt.cpp rename to libraries/FastLED/power_mgt.cpp diff --git a/libraries/FastLED-3.2.9/power_mgt.h b/libraries/FastLED/power_mgt.h similarity index 100% rename from libraries/FastLED-3.2.9/power_mgt.h rename to libraries/FastLED/power_mgt.h diff --git a/libraries/FastLED-3.2.9/preview_changes.txt b/libraries/FastLED/preview_changes.txt similarity index 100% rename from libraries/FastLED-3.2.9/preview_changes.txt rename to libraries/FastLED/preview_changes.txt diff --git a/libraries/FastLED-3.2.9/release_notes.md b/libraries/FastLED/release_notes.md similarity index 91% rename from libraries/FastLED-3.2.9/release_notes.md rename to libraries/FastLED/release_notes.md index ae9075c..cf9ce1a 100644 --- a/libraries/FastLED-3.2.9/release_notes.md +++ b/libraries/FastLED/release_notes.md @@ -1,3 +1,29 @@ +FastLED 3.3.2 +============= + +* Fix APA102 compile error #870 +* Normalize pin definition macros so that we can have an .ino file that can be used to output what pin/port mappings should be for a platform +* Add defnition for ATmega32 + +FastLED 3.3.1 +============= + +* Fix teensy build issue +* Bring in sam's RMT timing fix + +FastLED 3.3.0 +============== +* Preliminary Teensy 4 support +* Fix #861 - power computation for OctoWS2811 +* keywords and other minor changes for compilers (#854, #845) +* Fix some nrf52 issues (#856), #840 + +FastLED 3.2.10 +============== +* Adafruit Metro M4 Airlift support +* Arduino Nano 33 IOT preliminary definitions +* Bug fixes + FastLED 3.2.9 ============= * Update ItsyBitsy support diff --git a/libraries/FastLED-3.2.9/wiring.cpp b/libraries/FastLED/wiring.cpp similarity index 100% rename from libraries/FastLED-3.2.9/wiring.cpp rename to libraries/FastLED/wiring.cpp diff --git a/libraries/NTPClient-master/.travis.yml b/libraries/NTPClient/.travis.yml similarity index 100% rename from libraries/NTPClient-master/.travis.yml rename to libraries/NTPClient/.travis.yml diff --git a/libraries/NTPClient-master/CHANGELOG b/libraries/NTPClient/CHANGELOG similarity index 100% rename from libraries/NTPClient-master/CHANGELOG rename to libraries/NTPClient/CHANGELOG diff --git a/libraries/NTPClient-master/NTPClient.cpp b/libraries/NTPClient/NTPClient.cpp similarity index 84% rename from libraries/NTPClient-master/NTPClient.cpp rename to libraries/NTPClient/NTPClient.cpp index 87b7a53..fffe105 100644 --- a/libraries/NTPClient-master/NTPClient.cpp +++ b/libraries/NTPClient/NTPClient.cpp @@ -35,12 +35,25 @@ NTPClient::NTPClient(UDP& udp, const char* poolServerName) { this->_poolServerName = poolServerName; } +NTPClient::NTPClient(UDP& udp, IPAddress poolServerIP) { + this->_udp = &udp; + this->_poolServerIP = poolServerIP; + this->_poolServerName = NULL; +} + NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset) { this->_udp = &udp; this->_timeOffset = timeOffset; this->_poolServerName = poolServerName; } +NTPClient::NTPClient(UDP& udp, IPAddress poolServerIP, long timeOffset){ + this->_udp = &udp; + this->_timeOffset = timeOffset; + this->_poolServerIP = poolServerIP; + this->_poolServerName = NULL; +} + NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval) { this->_udp = &udp; this->_timeOffset = timeOffset; @@ -48,6 +61,14 @@ NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsi this->_updateInterval = updateInterval; } +NTPClient::NTPClient(UDP& udp, IPAddress poolServerIP, long timeOffset, unsigned long updateInterval) { + this->_udp = &udp; + this->_timeOffset = timeOffset; + this->_poolServerIP = poolServerIP; + this->_poolServerName = NULL; + this->_updateInterval = updateInterval; +} + void NTPClient::begin() { this->begin(NTP_DEFAULT_LOCAL_PORT); } @@ -65,6 +86,10 @@ bool NTPClient::forceUpdate() { Serial.println("Update from NTP Server"); #endif + // flush any existing packets + while(this->_udp->parsePacket() != 0) + this->_udp->flush(); + this->sendNTPPacket(); // Wait till data is there or timeout... @@ -89,7 +114,7 @@ bool NTPClient::forceUpdate() { this->_currentEpoc = secsSince1900 - SEVENZYYEARS; - return true; + return true; // return true after successful update } bool NTPClient::update() { @@ -98,7 +123,7 @@ bool NTPClient::update() { if (!this->_udpSetup) this->begin(); // setup the UDP client if needed return this->forceUpdate(); } - return true; + return false; // return false if update does not occur } unsigned long NTPClient::getEpochTime() const { @@ -169,7 +194,11 @@ void NTPClient::sendNTPPacket() { // all NTP fields have been given values, now // you can send a packet requesting a timestamp: - this->_udp->beginPacket(this->_poolServerName, 123); //NTP requests are to port 123 + if (this->_poolServerName) { + this->_udp->beginPacket(this->_poolServerName, 123); + } else { + this->_udp->beginPacket(this->_poolServerIP, 123); + } this->_udp->write(this->_packetBuffer, NTP_PACKET_SIZE); this->_udp->endPacket(); } diff --git a/libraries/NTPClient-master/NTPClient.h b/libraries/NTPClient/NTPClient.h similarity index 91% rename from libraries/NTPClient-master/NTPClient.h rename to libraries/NTPClient/NTPClient.h index 02d8752..20ec43b 100644 --- a/libraries/NTPClient-master/NTPClient.h +++ b/libraries/NTPClient/NTPClient.h @@ -14,6 +14,7 @@ class NTPClient { bool _udpSetup = false; const char* _poolServerName = "pool.ntp.org"; // Default time server + IPAddress _poolServerIP; int _port = NTP_DEFAULT_LOCAL_PORT; long _timeOffset = 0; @@ -32,6 +33,9 @@ class NTPClient { NTPClient(UDP& udp, const char* poolServerName); NTPClient(UDP& udp, const char* poolServerName, long timeOffset); NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval); + NTPClient(UDP& udp, IPAddress poolServerIP); + NTPClient(UDP& udp, IPAddress poolServerIP, long timeOffset); + NTPClient(UDP& udp, IPAddress poolServerIP, long timeOffset, unsigned long updateInterval); /** * Set time server name diff --git a/libraries/NTPClient-master/README.md b/libraries/NTPClient/README.md similarity index 78% rename from libraries/NTPClient-master/README.md rename to libraries/NTPClient/README.md index 6c8c07a..46f9eb5 100644 --- a/libraries/NTPClient-master/README.md +++ b/libraries/NTPClient/README.md @@ -45,3 +45,6 @@ void loop() { delay(1000); } ``` + +## Function documentation +`getEpochTime` returns the unix epoch, which are the seconds elapsed since 00:00:00 UTC on 1 January 1970 (leap seconds are ignored, every day is treated as having 86400 seconds). **Attention**: If you have set a time offset this time offset will be added to your epoch timestamp. diff --git a/libraries/NTPClient-master/examples/Advanced/Advanced.ino b/libraries/NTPClient/examples/Advanced/Advanced.ino similarity index 100% rename from libraries/NTPClient-master/examples/Advanced/Advanced.ino rename to libraries/NTPClient/examples/Advanced/Advanced.ino diff --git a/libraries/NTPClient-master/examples/Basic/Basic.ino b/libraries/NTPClient/examples/Basic/Basic.ino similarity index 100% rename from libraries/NTPClient-master/examples/Basic/Basic.ino rename to libraries/NTPClient/examples/Basic/Basic.ino diff --git a/libraries/NTPClient-master/keywords.txt b/libraries/NTPClient/keywords.txt similarity index 100% rename from libraries/NTPClient-master/keywords.txt rename to libraries/NTPClient/keywords.txt diff --git a/libraries/NTPClient-master/library.json b/libraries/NTPClient/library.json similarity index 100% rename from libraries/NTPClient-master/library.json rename to libraries/NTPClient/library.json diff --git a/libraries/NTPClient-master/library.properties b/libraries/NTPClient/library.properties similarity index 95% rename from libraries/NTPClient-master/library.properties rename to libraries/NTPClient/library.properties index d4908ca..309b75d 100644 --- a/libraries/NTPClient-master/library.properties +++ b/libraries/NTPClient/library.properties @@ -1,5 +1,5 @@ name=NTPClient -version=3.1.0 +version=3.2.0 author=Fabrice Weinberg maintainer=Fabrice Weinberg sentence=An NTPClient to connect to a time server diff --git a/libraries/Timezone/examples/Change_TZ_1/Change_TZ_1.ino b/libraries/Timezone/examples/Change_TZ_1/Change_TZ_1.ino index 7eb8913..7587455 100644 --- a/libraries/Timezone/examples/Change_TZ_1/Change_TZ_1.ino +++ b/libraries/Timezone/examples/Change_TZ_1/Change_TZ_1.ino @@ -99,7 +99,7 @@ time_t compileTime() { const time_t FUDGE(10); //fudge factor to allow for upload time, etc. (seconds, YMMV) const char *compDate = __DATE__, *compTime = __TIME__, *months = "JanFebMarAprMayJunJulAugSepOctNovDec"; - char compMon[3], *m; + char compMon[4], *m; strncpy(compMon, compDate, 3); compMon[3] = '\0'; diff --git a/libraries/Timezone/examples/Change_TZ_2/Change_TZ_2.ino b/libraries/Timezone/examples/Change_TZ_2/Change_TZ_2.ino index 9e3d175..0e471c0 100644 --- a/libraries/Timezone/examples/Change_TZ_2/Change_TZ_2.ino +++ b/libraries/Timezone/examples/Change_TZ_2/Change_TZ_2.ino @@ -85,7 +85,7 @@ time_t compileTime() { const time_t FUDGE(10); //fudge factor to allow for upload time, etc. (seconds, YMMV) const char *compDate = __DATE__, *compTime = __TIME__, *months = "JanFebMarAprMayJunJulAugSepOctNovDec"; - char compMon[3], *m; + char compMon[4], *m; strncpy(compMon, compDate, 3); compMon[3] = '\0'; diff --git a/libraries/Timezone/examples/Clock/Clock.ino b/libraries/Timezone/examples/Clock/Clock.ino index 5dc28a8..f943eeb 100644 --- a/libraries/Timezone/examples/Clock/Clock.ino +++ b/libraries/Timezone/examples/Clock/Clock.ino @@ -41,7 +41,7 @@ time_t compileTime() { const time_t FUDGE(10); // fudge factor to allow for compile time (seconds, YMMV) const char *compDate = __DATE__, *compTime = __TIME__, *months = "JanFebMarAprMayJunJulAugSepOctNovDec"; - char chMon[3], *m; + char chMon[4], *m; tmElements_t tm; strncpy(chMon, compDate, 3); diff --git a/libraries/Timezone/examples/WorldClock/WorldClock.ino b/libraries/Timezone/examples/WorldClock/WorldClock.ino index fa6d067..1416ffc 100644 --- a/libraries/Timezone/examples/WorldClock/WorldClock.ino +++ b/libraries/Timezone/examples/WorldClock/WorldClock.ino @@ -88,7 +88,7 @@ time_t compileTime() { const time_t FUDGE(10); // fudge factor to allow for compile time (seconds, YMMV) const char *compDate = __DATE__, *compTime = __TIME__, *months = "JanFebMarAprMayJunJulAugSepOctNovDec"; - char chMon[3], *m; + char chMon[4], *m; tmElements_t tm; strncpy(chMon, compDate, 3); diff --git a/libraries/Timezone/library.properties b/libraries/Timezone/library.properties index 795808a..6fda346 100644 --- a/libraries/Timezone/library.properties +++ b/libraries/Timezone/library.properties @@ -1,5 +1,5 @@ name=Timezone -version=1.2.2 +version=1.2.3 author=Jack Christensen maintainer=Jack Christensen sentence=Arduino library to facilitate time zone conversions and automatic daylight saving (summer) time adjustments. diff --git a/libraries/WiFiManager/WiFiManager.cpp b/libraries/WiFiManager/WiFiManager.cpp index 2e7884d..fcfcec7 100644 --- a/libraries/WiFiManager/WiFiManager.cpp +++ b/libraries/WiFiManager/WiFiManager.cpp @@ -143,18 +143,17 @@ void WiFiManager::setupConfigPortal() { dnsServer->start(DNS_PORT, "*", WiFi.softAPIP()); /* Setup web pages: root, wifi config pages, SO captive portal detectors and not found. */ - server->on(String(F("/")), std::bind(&WiFiManager::handleRoot, this)); - server->on(String(F("/wifi")), std::bind(&WiFiManager::handleWifi, this, true)); - server->on(String(F("/0wifi")), std::bind(&WiFiManager::handleWifi, this, false)); - server->on(String(F("/wifisave")), std::bind(&WiFiManager::handleWifiSave, this)); - server->on(String(F("/i")), std::bind(&WiFiManager::handleInfo, this)); - server->on(String(F("/r")), std::bind(&WiFiManager::handleReset, this)); + server->on(String(F("/")).c_str(), std::bind(&WiFiManager::handleRoot, this)); + server->on(String(F("/wifi")).c_str(), std::bind(&WiFiManager::handleWifi, this, true)); + server->on(String(F("/0wifi")).c_str(), std::bind(&WiFiManager::handleWifi, this, false)); + server->on(String(F("/wifisave")).c_str(), std::bind(&WiFiManager::handleWifiSave, this)); + server->on(String(F("/i")).c_str(), std::bind(&WiFiManager::handleInfo, this)); + server->on(String(F("/r")).c_str(), std::bind(&WiFiManager::handleReset, this)); //server->on("/generate_204", std::bind(&WiFiManager::handle204, this)); //Android/Chrome OS captive portal check. - server->on(String(F("/fwlink")), std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. + server->on(String(F("/fwlink")).c_str(), std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. server->onNotFound (std::bind(&WiFiManager::handleNotFound, this)); server->begin(); // Web server start DEBUG_WM(F("HTTP server started")); - } boolean WiFiManager::autoConnect() { @@ -283,7 +282,7 @@ int WiFiManager::connectWifi(String ssid, String pass) { DEBUG_WM(WiFi.localIP()); } //fix for auto connect racing issue - if (WiFi.status() == WL_CONNECTED) { + if (WiFi.status() == WL_CONNECTED && (WiFi.SSID() == ssid)) { DEBUG_WM(F("Already connected. Bailing out.")); return WL_CONNECTED; } @@ -291,7 +290,7 @@ int WiFiManager::connectWifi(String ssid, String pass) { if (ssid != "") { WiFi.begin(ssid.c_str(), pass.c_str()); } else { - if (WiFi.SSID()) { + if (WiFi.SSID() != "") { DEBUG_WM(F("Using last saved values, should be faster")); //trying to fix connection in progress hanging ETS_UART_INTR_DISABLE(); @@ -332,7 +331,7 @@ uint8_t WiFiManager::waitForConnectResult() { keepConnecting = false; DEBUG_WM (F("Connection timed out")); } - if (status == WL_CONNECTED || status == WL_CONNECT_FAILED) { + if (status == WL_CONNECTED) { keepConnecting = false; } delay(100); @@ -420,12 +419,12 @@ void WiFiManager::handleRoot() { return; } - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(HTTP_HEADER); page.replace("{v}", "Options"); page += FPSTR(HTTP_SCRIPT); page += FPSTR(HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(HTTP_HEADER_END); page += String(F("

")); page += _apName; page += String(F("

")); @@ -441,12 +440,12 @@ void WiFiManager::handleRoot() { /** Wifi config page handler */ void WiFiManager::handleWifi(boolean scan) { - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(HTTP_HEADER); page.replace("{v}", "Config ESP"); page += FPSTR(HTTP_SCRIPT); page += FPSTR(HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(HTTP_HEADER_END); if (scan) { int n = WiFi.scanNetworks(); @@ -636,12 +635,12 @@ void WiFiManager::handleWifiSave() { optionalIPFromString(&_sta_static_sn, sn.c_str()); } - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(HTTP_HEADER); page.replace("{v}", "Credentials Saved"); page += FPSTR(HTTP_SCRIPT); page += FPSTR(HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(HTTP_HEADER_END); page += FPSTR(HTTP_SAVED); page += FPSTR(HTTP_END); @@ -657,12 +656,12 @@ void WiFiManager::handleWifiSave() { void WiFiManager::handleInfo() { DEBUG_WM(F("Info")); - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(HTTP_HEADER); page.replace("{v}", "Info"); page += FPSTR(HTTP_SCRIPT); page += FPSTR(HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(HTTP_HEADER_END); page += F("
"); page += F("
Chip ID
"); page += ESP.getChipId(); @@ -698,12 +697,12 @@ void WiFiManager::handleInfo() { void WiFiManager::handleReset() { DEBUG_WM(F("Reset")); - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(HTTP_HEADER); page.replace("{v}", "Info"); page += FPSTR(HTTP_SCRIPT); page += FPSTR(HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(HTTP_HEADER_END); page += F("Module will reset in a few seconds."); page += FPSTR(HTTP_END); diff --git a/libraries/WiFiManager/WiFiManager.h b/libraries/WiFiManager/WiFiManager.h index 64bb96e..136dde0 100644 --- a/libraries/WiFiManager/WiFiManager.h +++ b/libraries/WiFiManager/WiFiManager.h @@ -22,10 +22,10 @@ extern "C" { #include "user_interface.h" } -const char HTTP_HEAD[] PROGMEM = "{v}"; +const char HTTP_HEADER[] PROGMEM = "{v}"; const char HTTP_STYLE[] PROGMEM = ""; const char HTTP_SCRIPT[] PROGMEM = ""; -const char HTTP_HEAD_END[] PROGMEM = "
"; +const char HTTP_HEADER_END[] PROGMEM = "
"; const char HTTP_PORTAL_OPTIONS[] PROGMEM = "



"; const char HTTP_ITEM[] PROGMEM = "
{v} {r}%
"; const char HTTP_FORM_START[] PROGMEM = "


"; @@ -125,7 +125,7 @@ class WiFiManager //const int WM_DONE = 0; //const int WM_WAIT = 10; - //const String HTTP_HEAD = "{v}"; + //const String HTTP_HEADER = "{v}"; void setupConfigPortal(); void startWPS(); diff --git a/libraries/WiFiManager/library.json b/libraries/WiFiManager/library.json index 8f0830a..d8b1d5e 100644 --- a/libraries/WiFiManager/library.json +++ b/libraries/WiFiManager/library.json @@ -9,5 +9,5 @@ }, "frameworks": "arduino", "platforms": "espressif8266", - "version": "0.14" + "version": "0.15.0-beta" } diff --git a/libraries/WiFiManager/library.properties b/libraries/WiFiManager/library.properties index e0420ad..743922e 100644 --- a/libraries/WiFiManager/library.properties +++ b/libraries/WiFiManager/library.properties @@ -1,5 +1,5 @@ name=WiFiManager -version=0.14 +version=0.15.0-beta author=tzapu maintainer=tzapu sentence=ESP8266 WiFi Connection manager with fallback web configuration portal