Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9321b034f | ||
|
|
65dd19a158 | ||
|
|
be60060941 | ||
|
|
39ac1d6bfb | ||
|
|
d94ca66e3e | ||
|
|
e47e3c73c2 | ||
|
|
f11c22d984 | ||
|
|
bd4a2d232f | ||
|
|
158cf3c7b3 | ||
|
|
a7cf5cd1ca | ||
|
|
4e6e1d6024 | ||
|
|
0133ecc887 | ||
|
|
913dfad1ad | ||
|
|
2062f94adc | ||
|
|
f9db547cf3 | ||
|
|
2782dd1716 | ||
|
|
852219caf5 | ||
|
|
07fbed06c6 | ||
|
|
ea5f8241e3 | ||
|
|
895ffced8e | ||
|
|
40855c90fb | ||
|
|
6570c4856b | ||
|
|
008c4d62ef | ||
|
|
63dfd9ab6b | ||
|
|
9b28fc3e17 | ||
|
|
6bbaf64daf | ||
|
|
44eeebbc6f | ||
|
|
ec7631096b | ||
|
|
07a1484d72 | ||
|
|
9503620525 | ||
|
|
e05a3b8ad0 | ||
|
|
9d0b9bef67 | ||
|
|
0446b732fa | ||
|
|
c3da4ada61 | ||
|
|
4fdcc6e5ac | ||
|
|
b82336c8d9 | ||
|
|
075958883f | ||
|
|
fe632cde4b | ||
|
|
10090b60a9 | ||
|
|
a6bdb27178 | ||
|
|
62ed93f12a | ||
|
|
e89ce78c79 | ||
|
|
98c4b921b8 | ||
|
|
86765cebb2 | ||
|
|
25ceb08f93 | ||
|
|
205983e206 | ||
|
|
1e7098c1cb | ||
|
|
68ecdfc023 | ||
|
|
a9356ceca5 |
@@ -6,6 +6,10 @@ name: Arduino-Pico CI
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
TRAVIS_TAG: ${{ github.ref }}
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -20,7 +24,7 @@ jobs:
|
||||
- name: Run codespell
|
||||
uses: codespell-project/actions-codespell@master
|
||||
with:
|
||||
skip: ./ArduinoCore-API,./libraries/ESP8266SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst,./cores/rp2040/api,./libraries/FreeRTOS,./tools/libbearssl/bearssl,./include,./libraries/WiFi/examples/BearSSL_Server,./ota/uzlib,./libraries/http-parser/lib,./libraries/WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino,./libraries/HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino
|
||||
skip: ./ArduinoCore-API,./libraries/ESP8266SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst,./cores/rp2040/api,./libraries/FreeRTOS,./tools/libbearssl/bearssl,./include,./libraries/WiFi/examples/BearSSL_Server,./ota/uzlib,./libraries/http-parser/lib,./libraries/WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino,./libraries/HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino,./.git
|
||||
ignore_words_list: ser,dout
|
||||
|
||||
# Consistent style
|
||||
@@ -46,10 +50,6 @@ jobs:
|
||||
./tests/restyle.sh
|
||||
# If anything changed, GIT should return an error and fail the test
|
||||
git diff --exit-code
|
||||
# - name: Check Arduino API copy is clean
|
||||
# run: |
|
||||
# git submodule update --init ./ArduinoCore-API
|
||||
# diff -r ./cores/rp2040/api ./ArduinoCore-API/api
|
||||
|
||||
# Build all examples on linux (core and Arduino IDE)
|
||||
build-linux:
|
||||
@@ -62,19 +62,17 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Cache Linux toolchain
|
||||
id: cache-linux
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./tools/dist
|
||||
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
|
||||
- name: Build Sketches
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
TRAVIS_TAG: ${{ github.ref }}
|
||||
BUILD_PARITY: custom
|
||||
mod: 6
|
||||
rem: ${{ matrix.chunk }}
|
||||
@@ -92,19 +90,17 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Cache Linux toolchain
|
||||
id: cache-linux
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./tools/dist
|
||||
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
|
||||
- name: Build Sketches
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
TRAVIS_TAG: ${{ github.ref }}
|
||||
BUILD_PARITY: custom
|
||||
run: |
|
||||
cd pico-sdk
|
||||
@@ -120,19 +116,17 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Cache Windows toolchain
|
||||
id: cache-windows
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./tools/dist
|
||||
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
|
||||
- name: Build Sketch
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
TRAVIS_TAG: ${{ github.ref }}
|
||||
WINDOWS: 1
|
||||
BUILD_PARITY: custom
|
||||
mod: 500
|
||||
@@ -150,24 +144,22 @@ jobs:
|
||||
# Single build under macOS to ensure the Mac toolchain is good.
|
||||
build-mac:
|
||||
name: Mac
|
||||
runs-on: macOS-latest
|
||||
runs-on: macOS-12
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Cache Mac toolchain
|
||||
id: cache-mac
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./tools/dist
|
||||
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
|
||||
- name: Build Sketch
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
TRAVIS_TAG: ${{ github.ref }}
|
||||
MACOSX: 1
|
||||
BUILD_PARITY: custom
|
||||
mod: 500
|
||||
@@ -194,19 +186,21 @@ jobs:
|
||||
git submodule update --init
|
||||
cd ../..
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Cache PlatformIO
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
@@ -9,22 +9,22 @@ jobs:
|
||||
name: Update master JSON file
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Cache PlatformIO
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install PlatformIO
|
||||
|
||||
@@ -15,11 +15,11 @@ jobs:
|
||||
name: Package
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Build package JSON
|
||||
|
||||
@@ -13,6 +13,7 @@ See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for m
|
||||
* Raspberry Pi Pico
|
||||
* Raspberry Pi Pico W
|
||||
* Adafruit Feather RP2040
|
||||
* Adafruit Feather RP2040 SCORPIO
|
||||
* Adafruit ItsyBitsy RP2040
|
||||
* Adafruit KB2040
|
||||
* Adafruit Macropad RP2040
|
||||
@@ -20,8 +21,11 @@ See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for m
|
||||
* Adafruit STEMMA Friend RP2040
|
||||
* Adafruit Trinkey RP2040 QT
|
||||
* Arduino Nano RP2040 Connect
|
||||
* BridgeTek IDM2040-7A
|
||||
* Cytron Maker Pi RP2040
|
||||
* Cytron Maker Nano RP2040
|
||||
* DatanoiseTV PicoADK+
|
||||
* Degz Mizu
|
||||
* DeRuiLab FlyBoard2040 Core
|
||||
* DFRobot Beetle RP2040
|
||||
* ElectronicCats Hunter Cat NFC
|
||||
@@ -34,12 +38,19 @@ See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for m
|
||||
* Invector Labs Challenger RP2040 SubGHz
|
||||
* Invector Labs Challenger RP2040 SD/RTC
|
||||
* Invector Labs RPICO32
|
||||
* Melopero Cookie RP2040
|
||||
* Melopero Shake RP2040
|
||||
* Pimoroni PGA2040
|
||||
* Seeed XIAO RP2040
|
||||
* Solder Party RP2040 Stamp
|
||||
* SparkFun ProMicro RP2040
|
||||
* SparkFun Thing Plus RP2040
|
||||
* uPesy RP2040 DevKit
|
||||
* Waveshare RP2040 Zero
|
||||
* Waveshare RP2040 One
|
||||
* Waveshare RP2040 Plus
|
||||
* Waveshare RP2040 LCD 0.96
|
||||
* Waveshare RP2040 LCD 1.28
|
||||
* WIZnet W5100S-EVB-Pico
|
||||
* WIZnet W5500-EVB-Pico
|
||||
* WIZnet WizFi360-EVB-Pico
|
||||
|
||||
+7650
-490
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
// Padded and checksummed version of: generated\Winbond\W25Q16JVxQ\boot2.bin
|
||||
|
||||
.cpu cortex-m0plus
|
||||
.thumb
|
||||
|
||||
.section .boot2, "ax"
|
||||
|
||||
.byte 0xf7, 0xb5, 0x73, 0x46, 0x21, 0x22, 0x02, 0x26, 0x01, 0x93, 0x29, 0x4b, 0xc0, 0x24, 0x5a, 0x60
|
||||
.byte 0x9a, 0x68, 0x00, 0x27, 0xb2, 0x43, 0xda, 0x60, 0x9a, 0x60, 0x1a, 0x61, 0x5a, 0x61, 0x04, 0x23
|
||||
.byte 0x01, 0x25, 0x64, 0x05, 0xa7, 0x60, 0x63, 0x61, 0x22, 0x4b, 0x30, 0x00, 0x1d, 0x60, 0xe0, 0x23
|
||||
.byte 0xdb, 0x02, 0x23, 0x60, 0x35, 0x23, 0xa5, 0x60, 0x23, 0x66, 0x23, 0x66, 0x00, 0xf0, 0x4a, 0xf8
|
||||
.byte 0xc0, 0xb2, 0xb0, 0x42, 0x12, 0xd0, 0x06, 0x23, 0x28, 0x00, 0x23, 0x66, 0x00, 0xf0, 0x42, 0xf8
|
||||
.byte 0x25, 0x66, 0x03, 0x20, 0x27, 0x66, 0x26, 0x66, 0x00, 0xf0, 0x3c, 0xf8, 0x03, 0x36, 0x26, 0x66
|
||||
.byte 0x02, 0x20, 0x26, 0x66, 0x00, 0xf0, 0x36, 0xf8, 0x28, 0x42, 0xf8, 0xd1, 0x00, 0x25, 0x12, 0x4b
|
||||
.byte 0xa5, 0x60, 0x12, 0x4f, 0x23, 0x60, 0x12, 0x4b, 0x65, 0x60, 0x01, 0x26, 0x3b, 0x60, 0xeb, 0x23
|
||||
.byte 0xa6, 0x60, 0x23, 0x66, 0x4b, 0x3b, 0x23, 0x66, 0x02, 0x20, 0x00, 0xf0, 0x23, 0xf8, 0x0d, 0x4b
|
||||
.byte 0xa5, 0x60, 0x3b, 0x60, 0xa6, 0x60, 0x01, 0x9b, 0xab, 0x42, 0x08, 0xd1, 0x0a, 0x4b, 0x0b, 0x4a
|
||||
.byte 0x13, 0x60, 0x1b, 0x68, 0x83, 0xf3, 0x08, 0x88, 0x09, 0x4b, 0x1b, 0x68, 0x18, 0x47, 0xf7, 0xbd
|
||||
.byte 0x00, 0x00, 0x02, 0x40, 0xf0, 0x00, 0x00, 0x18, 0x00, 0x03, 0x5f, 0x00, 0xf4, 0x00, 0x00, 0x18
|
||||
.byte 0x21, 0x22, 0x00, 0x00, 0x22, 0x20, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x10, 0x08, 0xed, 0x00, 0xe0
|
||||
.byte 0x04, 0x01, 0x00, 0x10, 0xc0, 0x22, 0x03, 0x00, 0x04, 0x21, 0x52, 0x05, 0x90, 0x6a, 0x08, 0x42
|
||||
.byte 0xfc, 0xd0, 0x01, 0x21, 0x90, 0x6a, 0x08, 0x42, 0xfc, 0xd1, 0x01, 0x3b, 0xdb, 0xb2, 0x10, 0x6e
|
||||
.byte 0x00, 0x2b, 0xfa, 0xd1, 0x70, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xa0, 0xf0, 0x2f
|
||||
@@ -0,0 +1,23 @@
|
||||
// Padded and checksummed version of: boot2_w25q64jv.4.bin
|
||||
|
||||
.cpu cortex-m0plus
|
||||
.thumb
|
||||
|
||||
.section .boot2, "ax"
|
||||
|
||||
.byte 0xf7, 0xb5, 0x73, 0x46, 0x21, 0x22, 0x02, 0x25, 0x01, 0x93, 0x29, 0x4b, 0xc0, 0x24, 0x5a, 0x60
|
||||
.byte 0x9a, 0x68, 0x01, 0x26, 0xaa, 0x43, 0xda, 0x60, 0x9a, 0x60, 0x1a, 0x61, 0x5a, 0x61, 0x00, 0x23
|
||||
.byte 0x64, 0x05, 0xa3, 0x60, 0x04, 0x33, 0x63, 0x61, 0x22, 0x4b, 0x28, 0x00, 0x1e, 0x60, 0xe0, 0x23
|
||||
.byte 0xdb, 0x02, 0x23, 0x60, 0x35, 0x23, 0xa6, 0x60, 0x23, 0x66, 0x23, 0x66, 0x00, 0xf0, 0x4a, 0xf8
|
||||
.byte 0xc0, 0xb2, 0xa8, 0x42, 0x12, 0xd0, 0x06, 0x23, 0x30, 0x00, 0x23, 0x66, 0x00, 0xf0, 0x42, 0xf8
|
||||
.byte 0x31, 0x23, 0x28, 0x00, 0x23, 0x66, 0x25, 0x66, 0x00, 0xf0, 0x3c, 0xf8, 0x03, 0x35, 0x25, 0x66
|
||||
.byte 0x02, 0x20, 0x25, 0x66, 0x00, 0xf0, 0x36, 0xf8, 0x30, 0x42, 0xf8, 0xd1, 0x00, 0x25, 0x12, 0x4b
|
||||
.byte 0xa5, 0x60, 0x12, 0x4f, 0x23, 0x60, 0x12, 0x4b, 0x65, 0x60, 0x01, 0x26, 0x3b, 0x60, 0xeb, 0x23
|
||||
.byte 0xa6, 0x60, 0x23, 0x66, 0x4b, 0x3b, 0x23, 0x66, 0x02, 0x20, 0x00, 0xf0, 0x23, 0xf8, 0x0d, 0x4b
|
||||
.byte 0xa5, 0x60, 0x3b, 0x60, 0xa6, 0x60, 0x01, 0x9b, 0xab, 0x42, 0x08, 0xd1, 0x0a, 0x4b, 0x0b, 0x4a
|
||||
.byte 0x13, 0x60, 0x1b, 0x68, 0x83, 0xf3, 0x08, 0x88, 0x09, 0x4b, 0x1b, 0x68, 0x18, 0x47, 0xf7, 0xbd
|
||||
.byte 0x00, 0x00, 0x02, 0x40, 0xf0, 0x00, 0x00, 0x18, 0x00, 0x03, 0x5f, 0x00, 0xf4, 0x00, 0x00, 0x18
|
||||
.byte 0x21, 0x22, 0x00, 0x00, 0x22, 0x20, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x10, 0x08, 0xed, 0x00, 0xe0
|
||||
.byte 0x04, 0x01, 0x00, 0x10, 0xc0, 0x23, 0x02, 0x00, 0x04, 0x21, 0x5b, 0x05, 0x98, 0x6a, 0x08, 0x42
|
||||
.byte 0xfc, 0xd0, 0x01, 0x21, 0x98, 0x6a, 0x08, 0x42, 0xfc, 0xd1, 0x18, 0x6e, 0x01, 0x2a, 0x00, 0xd0
|
||||
.byte 0x18, 0x6e, 0x70, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x2d, 0x68, 0xca
|
||||
@@ -24,17 +24,22 @@
|
||||
#include "Arduino.h"
|
||||
#include "CoreMutex.h"
|
||||
|
||||
CoreMutex::CoreMutex(mutex_t *mutex, bool debugEnable) {
|
||||
CoreMutex::CoreMutex(mutex_t *mutex, uint8_t option) {
|
||||
_mutex = mutex;
|
||||
_acquired = false;
|
||||
_option = option;
|
||||
if (__isFreeRTOS) {
|
||||
auto m = __get_freertos_mutex_for_ptr(mutex);
|
||||
__freertos_mutex_take(m);
|
||||
if (_option & FromISR) {
|
||||
__freertos_mutex_take_from_isr(m);
|
||||
} else {
|
||||
__freertos_mutex_take(m);
|
||||
}
|
||||
} else {
|
||||
uint32_t owner;
|
||||
if (!mutex_try_enter(_mutex, &owner)) {
|
||||
if (owner == get_core_num()) { // Deadlock!
|
||||
if (debugEnable) {
|
||||
if (_option & DebugEnable) {
|
||||
DEBUGCORE("CoreMutex - Deadlock detected!\n");
|
||||
}
|
||||
return;
|
||||
@@ -49,7 +54,11 @@ CoreMutex::~CoreMutex() {
|
||||
if (_acquired) {
|
||||
if (__isFreeRTOS) {
|
||||
auto m = __get_freertos_mutex_for_ptr(_mutex);
|
||||
__freertos_mutex_give(m);
|
||||
if (_option & FromISR) {
|
||||
__freertos_mutex_give_from_isr(m);
|
||||
} else {
|
||||
__freertos_mutex_give(m);
|
||||
}
|
||||
} else {
|
||||
mutex_exit(_mutex);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,14 @@
|
||||
#include "pico/mutex.h"
|
||||
#include "_freertos.h"
|
||||
|
||||
enum {
|
||||
DebugEnable = 1,
|
||||
FromISR = 1 << 1,
|
||||
};
|
||||
|
||||
class CoreMutex {
|
||||
public:
|
||||
CoreMutex(mutex_t *mutex, bool debugEnable = true);
|
||||
CoreMutex(mutex_t *mutex, uint8_t option = DebugEnable);
|
||||
~CoreMutex();
|
||||
|
||||
operator bool() {
|
||||
@@ -38,4 +43,5 @@ public:
|
||||
private:
|
||||
mutex_t *_mutex;
|
||||
bool _acquired;
|
||||
u_int8_t _option;
|
||||
};
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
WiFiMutex.h - Ensure the timer-driven sys_check_timeouts doesn't
|
||||
get executed while we're in the user-level TCP stack.
|
||||
Copyright (c) 2022 Earle F. Philhower, III. All rights reserved.
|
||||
|
||||
Implements the API defined by the Arduino WiFiNINA library,
|
||||
copyright (c) 2018 Arduino SA. All rights reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern "C" volatile bool __inLWIP;
|
||||
|
||||
class LWIPMutex {
|
||||
public:
|
||||
LWIPMutex() {
|
||||
__inLWIP = true;
|
||||
_ref++;
|
||||
}
|
||||
~LWIPMutex() {
|
||||
if (0 == --_ref) {
|
||||
__inLWIP = false;
|
||||
}
|
||||
}
|
||||
private:
|
||||
static int _ref;
|
||||
};
|
||||
@@ -325,7 +325,7 @@ public:
|
||||
}
|
||||
|
||||
const char *getChipID() {
|
||||
static char id[PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1] = { 0 };
|
||||
static char id[2 * PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1] = { 0 };
|
||||
if (!id[0]) {
|
||||
pico_get_unique_board_id_string(id, sizeof(id));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#define ARDUINO_PICO_MAJOR 2
|
||||
#define ARDUINO_PICO_MINOR 6
|
||||
#define ARDUINO_PICO_REVISION 0
|
||||
#define ARDUINO_PICO_VERSION_STR "2.6.0"
|
||||
#define ARDUINO_PICO_REVISION 4
|
||||
#define ARDUINO_PICO_VERSION_STR "2.6.4"
|
||||
|
||||
@@ -230,7 +230,7 @@ void SerialPIO::begin(unsigned long baud, uint16_t config) {
|
||||
pio_sm_clear_fifos(_rxPIO, _rxSM); // Remove any existing data
|
||||
|
||||
// Put phase divider into OSR w/o using add'l program memory
|
||||
pio_sm_put_blocking(_rxPIO, _rxSM, clock_get_hz(clk_sys) / (_baud * 2) - 5 /* insns in PIO halfbit loop */);
|
||||
pio_sm_put_blocking(_rxPIO, _rxSM, clock_get_hz(clk_sys) / (_baud * 2) - 7 /* insns in PIO halfbit loop */);
|
||||
pio_sm_exec(_rxPIO, _rxSM, pio_encode_pull(false, false));
|
||||
|
||||
// Join the TX FIFO to the RX one now that we don't need it
|
||||
@@ -259,9 +259,11 @@ void SerialPIO::end() {
|
||||
}
|
||||
if (_tx != NOPIN) {
|
||||
pio_sm_set_enabled(_txPIO, _txSM, false);
|
||||
pio_sm_unclaim(_txPIO, _txSM);
|
||||
}
|
||||
if (_rx != NOPIN) {
|
||||
pio_sm_set_enabled(_rxPIO, _rxSM, false);
|
||||
pio_sm_unclaim(_rxPIO, _rxSM);
|
||||
_pioSP[pio_get_index(_rxPIO)][_rxSM] = nullptr;
|
||||
// If no more active, disable the IRQ
|
||||
auto pioNum = pio_get_index(_rxPIO);
|
||||
|
||||
@@ -38,10 +38,15 @@ extern "C" SemaphoreHandle_t __get_freertos_mutex_for_ptr(mutex_t *m) {
|
||||
return _map[i].dst;
|
||||
}
|
||||
}
|
||||
// Make a new mutex
|
||||
auto fm = __freertos_mutex_create();
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (_map[i].src == nullptr) {
|
||||
// Make a new mutex
|
||||
SemaphoreHandle_t fm = __freertos_mutex_create();
|
||||
if (fm == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_map[i].src = m;
|
||||
_map[i].dst = fm;
|
||||
return fm;
|
||||
|
||||
@@ -41,8 +41,10 @@ extern "C" {
|
||||
extern SemaphoreHandle_t _freertos_recursive_mutex_create() __attribute__((weak));
|
||||
|
||||
extern void __freertos_mutex_take(SemaphoreHandle_t mtx) __attribute__((weak));
|
||||
extern void __freertos_mutex_take_from_isr(SemaphoreHandle_t mtx) __attribute__((weak));
|
||||
extern int __freertos_mutex_try_take(SemaphoreHandle_t mtx) __attribute__((weak));
|
||||
extern void __freertos_mutex_give(SemaphoreHandle_t mtx) __attribute__((weak));
|
||||
extern void __freertos_mutex_give_from_isr(SemaphoreHandle_t mtx) __attribute__((weak));
|
||||
|
||||
extern void __freertos_recursive_mutex_take(SemaphoreHandle_t mtx) __attribute__((weak));
|
||||
extern int __freertos_recursive_mutex_try_take(SemaphoreHandle_t mtx) __attribute__((weak));
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
LWIP wrappers to protect against timer-based re-entrancy
|
||||
|
||||
Copyright (c) 202s Earle F. Philhower, III <earlephilhower@yahoo.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "pico/mutex.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/raw.h"
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
// Global indicator that we're inside an LWIP block
|
||||
extern "C" {
|
||||
volatile bool __inLWIP = false;
|
||||
}
|
||||
|
||||
auto_init_recursive_mutex(__mtxLWIP);
|
||||
|
||||
class LWIPMutex {
|
||||
public:
|
||||
LWIPMutex() {
|
||||
noInterrupts();
|
||||
recursive_mutex_enter_blocking(&__mtxLWIP);
|
||||
__inLWIP = true;
|
||||
_ref++;
|
||||
interrupts();
|
||||
}
|
||||
|
||||
~LWIPMutex() {
|
||||
noInterrupts();
|
||||
if (0 == --_ref) {
|
||||
__inLWIP = false;
|
||||
}
|
||||
recursive_mutex_exit(&__mtxLWIP);
|
||||
interrupts();
|
||||
}
|
||||
|
||||
private:
|
||||
static int _ref;
|
||||
};
|
||||
int LWIPMutex::_ref = 0;
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern u8_t __real_pbuf_header(struct pbuf *p, s16_t header_size);
|
||||
u8_t __wrap_pbuf_header(struct pbuf *p, s16_t header_size) {
|
||||
LWIPMutex m;
|
||||
return __real_pbuf_header(p, header_size);
|
||||
}
|
||||
|
||||
extern u8_t __real_pbuf_free(struct pbuf *p);
|
||||
u8_t __wrap_pbuf_free(struct pbuf *p) {
|
||||
LWIPMutex m;
|
||||
return __real_pbuf_free(p);
|
||||
}
|
||||
|
||||
extern struct pbuf *__real_pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type);
|
||||
struct pbuf *__wrap_pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type) {
|
||||
LWIPMutex m;
|
||||
return __real_pbuf_alloc(l, length, type);
|
||||
}
|
||||
|
||||
extern err_t __real_pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len);
|
||||
err_t __wrap_pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len) {
|
||||
LWIPMutex m;
|
||||
return __real_pbuf_take(buf, dataptr, len);
|
||||
}
|
||||
|
||||
extern u16_t __real_pbuf_copy_partial(const struct pbuf *p, void *dataptr, u16_t len, u16_t offset);
|
||||
u16_t __wrap_pbuf_copy_partial(const struct pbuf *p, void *dataptr, u16_t len, u16_t offset) {
|
||||
LWIPMutex m;
|
||||
return __real_pbuf_copy_partial(p, dataptr, len, offset);
|
||||
}
|
||||
|
||||
extern void __real_pbuf_ref(struct pbuf *p);
|
||||
void __wrap_pbuf_ref(struct pbuf *p) {
|
||||
LWIPMutex m;
|
||||
__real_pbuf_ref(p);
|
||||
}
|
||||
|
||||
extern u8_t __real_pbuf_get_at(const struct pbuf* p, u16_t offset);
|
||||
u8_t __wrap_pbuf_get_at(const struct pbuf* p, u16_t offset) {
|
||||
LWIPMutex m;
|
||||
return __real_pbuf_get_at(p, offset);
|
||||
}
|
||||
|
||||
extern void *__real_pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset);
|
||||
void *__wrap_pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset) {
|
||||
LWIPMutex m;
|
||||
return __real_pbuf_get_contiguous(p, buffer, bufsize, len, offset);
|
||||
}
|
||||
|
||||
extern void __real_pbuf_cat(struct pbuf *head, struct pbuf *tail);
|
||||
void __wrap_pbuf_cat(struct pbuf *head, struct pbuf *tail) {
|
||||
LWIPMutex m;
|
||||
__real_pbuf_cat(head, tail);
|
||||
}
|
||||
|
||||
extern void __real_tcp_arg(struct tcp_pcb *pcb, void *arg);
|
||||
void __wrap_tcp_arg(struct tcp_pcb *pcb, void *arg) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_arg(pcb, arg);
|
||||
}
|
||||
|
||||
extern struct tcp_pcb *__real_tcp_new(void);
|
||||
struct tcp_pcb *__wrap_tcp_new(void) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_new();
|
||||
}
|
||||
|
||||
extern err_t __real_tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port);
|
||||
err_t __wrap_tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_bind(pcb, ipaddr, port);
|
||||
}
|
||||
|
||||
extern struct tcp_pcb *__real_tcp_listen(struct tcp_pcb *pcb);
|
||||
struct tcp_pcb *__wrap_tcp_listen(struct tcp_pcb *pcb) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_listen(pcb);
|
||||
}
|
||||
|
||||
extern struct tcp_pcb *__real_tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog);
|
||||
struct tcp_pcb *__wrap_tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_listen_with_backlog(pcb, backlog);
|
||||
}
|
||||
|
||||
extern void __real_tcp_accept(struct tcp_pcb *pcb, err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err));
|
||||
void __wrap_tcp_accept(struct tcp_pcb *pcb, err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err)) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_accept(pcb, accept);
|
||||
}
|
||||
|
||||
extern err_t __real_tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port, err_t (* connected)(void *arg, struct tcp_pcb *tpcb, err_t err));
|
||||
err_t __wrap_tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port, err_t (* connected)(void *arg, struct tcp_pcb *tpcb, err_t err)) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_connect(pcb, ipaddr, port, connected);
|
||||
}
|
||||
|
||||
extern err_t __real_tcp_write(struct tcp_pcb *pcb, const void *dataptr, u16_t len, u8_t apiflags);
|
||||
err_t __wrap_tcp_write(struct tcp_pcb *pcb, const void *dataptr, u16_t len, u8_t apiflags) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_write(pcb, dataptr, len, apiflags);
|
||||
}
|
||||
|
||||
extern void __real_tcp_sent(struct tcp_pcb *pcb, err_t (* sent)(void *arg, struct tcp_pcb *tpcb, u16_t len));
|
||||
void __wrap_tcp_sent(struct tcp_pcb *pcb, err_t (* sent)(void *arg, struct tcp_pcb *tpcb, u16_t len)) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_sent(pcb, sent);
|
||||
}
|
||||
|
||||
extern void __real_tcp_recv(struct tcp_pcb *pcb, err_t (* recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err));
|
||||
void __wrap_tcp_recv(struct tcp_pcb *pcb, err_t (* recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_recv(pcb, recv);
|
||||
}
|
||||
|
||||
extern void __real_tcp_recved(struct tcp_pcb *pcb, u16_t len);
|
||||
void __wrap_tcp_recved(struct tcp_pcb *pcb, u16_t len) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_recved(pcb, len);
|
||||
}
|
||||
|
||||
extern void __real_tcp_poll(struct tcp_pcb *pcb, err_t (* poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval);
|
||||
void __wrap_tcp_poll(struct tcp_pcb *pcb, err_t (* poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_poll(pcb, poll, interval);
|
||||
}
|
||||
|
||||
extern err_t __real_tcp_close(struct tcp_pcb *pcb);
|
||||
err_t __wrap_tcp_close(struct tcp_pcb *pcb) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_close(pcb);
|
||||
}
|
||||
|
||||
extern void __real_tcp_abort(struct tcp_pcb *pcb);
|
||||
void __wrap_tcp_abort(struct tcp_pcb *pcb) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_abort(pcb);
|
||||
}
|
||||
|
||||
extern void __real_tcp_err(struct tcp_pcb *pcb, void (* err)(void *arg, err_t err));
|
||||
void __wrap_tcp_err(struct tcp_pcb *pcb, void (* err)(void *arg, err_t err)) {
|
||||
LWIPMutex m;
|
||||
__real_tcp_err(pcb, err);
|
||||
}
|
||||
|
||||
extern err_t __real_tcp_output(struct tcp_pcb *pcb);
|
||||
err_t __wrap_tcp_output(struct tcp_pcb *pcb) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_output(pcb);
|
||||
}
|
||||
|
||||
extern void __real_tcp_setprio(struct tcp_pcb *pcb, u8_t prio);
|
||||
void __wrap_tcp_setprio(struct tcp_pcb *pcb, u8_t prio) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_setprio(pcb, prio);
|
||||
}
|
||||
|
||||
extern void __real_tcp_backlog_delayed(struct tcp_pcb* pcb);
|
||||
void __wrap_tcp_backlog_delayed(struct tcp_pcb* pcb) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_backlog_delayed(pcb);
|
||||
}
|
||||
|
||||
extern void __real_tcp_backlog_accepted(struct tcp_pcb* pcb);
|
||||
void __wrap_tcp_backlog_accepted(struct tcp_pcb* pcb) {
|
||||
LWIPMutex m;
|
||||
return __real_tcp_backlog_accepted(pcb);
|
||||
}
|
||||
extern struct udp_pcb *__real_udp_new(void);
|
||||
struct udp_pcb *__wrap_udp_new(void) {
|
||||
LWIPMutex m;
|
||||
return __real_udp_new();
|
||||
}
|
||||
|
||||
extern void __real_udp_remove(struct udp_pcb *pcb);
|
||||
void __wrap_udp_remove(struct udp_pcb *pcb) {
|
||||
LWIPMutex m;
|
||||
__real_udp_remove(pcb);
|
||||
}
|
||||
|
||||
extern err_t __real_udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port);
|
||||
err_t __wrap_udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) {
|
||||
LWIPMutex m;
|
||||
return __real_udp_bind(pcb, ipaddr, port);
|
||||
}
|
||||
|
||||
extern err_t __real_udp_connect(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port);
|
||||
err_t __wrap_udp_connect(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) {
|
||||
LWIPMutex m;
|
||||
return __real_udp_connect(pcb, ipaddr, port);
|
||||
}
|
||||
|
||||
extern err_t __real_udp_disconnect(struct udp_pcb *pcb);
|
||||
err_t __wrap_udp_disconnect(struct udp_pcb *pcb) {
|
||||
LWIPMutex m;
|
||||
return __real_udp_disconnect(pcb);
|
||||
}
|
||||
|
||||
extern err_t __real_udp_send(struct udp_pcb *pcb, struct pbuf *p);
|
||||
err_t __wrap_udp_send(struct udp_pcb *pcb, struct pbuf *p) {
|
||||
LWIPMutex m;
|
||||
return __real_udp_send(pcb, p);
|
||||
}
|
||||
|
||||
extern void __real_udp_recv(struct udp_pcb *pcb, void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u16_t port), void *recv_arg);
|
||||
void __wrap_udp_recv(struct udp_pcb *pcb, void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u16_t port), void *recv_arg) {
|
||||
LWIPMutex m;
|
||||
__real_udp_recv(pcb, recv, recv_arg);
|
||||
}
|
||||
|
||||
extern err_t __real_udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif);
|
||||
err_t __wrap_udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif) {
|
||||
LWIPMutex m;
|
||||
return __real_udp_sendto_if(pcb, p, dst_ip, dst_port, netif);
|
||||
}
|
||||
|
||||
extern void __real_sys_check_timeouts(void);
|
||||
void __wrap_sys_check_timeouts(void) {
|
||||
LWIPMutex m;
|
||||
__real_sys_check_timeouts();
|
||||
}
|
||||
|
||||
extern err_t __real_dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg);
|
||||
err_t __wrap_dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg) {
|
||||
LWIPMutex m;
|
||||
return __real_dns_gethostbyname(hostname, addr, found, callback_arg);
|
||||
}
|
||||
|
||||
extern err_t __real_dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg, u8_t dns_addrtype);
|
||||
err_t __wrap_dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg, u8_t dns_addrtype) {
|
||||
LWIPMutex m;
|
||||
return __real_dns_gethostbyname_addrtype(hostname, addr, found, callback_arg, dns_addrtype);
|
||||
}
|
||||
|
||||
extern struct raw_pcb *__real_raw_new(u8_t proto);
|
||||
struct raw_pcb *__wrap_raw_new(u8_t proto) {
|
||||
LWIPMutex m;
|
||||
return __real_raw_new(proto);
|
||||
}
|
||||
|
||||
extern void __real_raw_recv(struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
|
||||
void __wrap_raw_recv(struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg) {
|
||||
LWIPMutex m;
|
||||
__real_raw_recv(pcb, recv, recv_arg);
|
||||
}
|
||||
|
||||
extern err_t __real_raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr);
|
||||
err_t __wrap_raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr) {
|
||||
LWIPMutex m;
|
||||
return __real_raw_bind(pcb, ipaddr);
|
||||
}
|
||||
|
||||
extern err_t __real_raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr);
|
||||
err_t __wrap_raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr) {
|
||||
LWIPMutex m;
|
||||
return __real_raw_sendto(pcb, p, ipaddr);
|
||||
}
|
||||
|
||||
extern void __real_raw_remove(struct raw_pcb *pcb);
|
||||
void __wrap_raw_remove(struct raw_pcb *pcb) {
|
||||
LWIPMutex m;
|
||||
__real_raw_remove(pcb);
|
||||
}
|
||||
|
||||
}; // extern "C"
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "RP2040USB.h"
|
||||
#include <pico/stdlib.h>
|
||||
#include <pico/multicore.h>
|
||||
#include "LWIPMutex.h"
|
||||
#include <reent.h>
|
||||
|
||||
RP2040 rp2040;
|
||||
@@ -33,8 +32,6 @@ extern "C" {
|
||||
|
||||
mutex_t _pioMutex;
|
||||
|
||||
int LWIPMutex::_ref = 0;
|
||||
|
||||
extern void setup();
|
||||
extern void loop();
|
||||
|
||||
@@ -128,7 +125,6 @@ extern "C" int main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_USB
|
||||
if (!__isFreeRTOS) {
|
||||
if (setup1 || loop1) {
|
||||
rp2040.fifo.begin(2);
|
||||
@@ -137,7 +133,6 @@ extern "C" int main() {
|
||||
}
|
||||
rp2040.fifo.registerCore();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!__isFreeRTOS) {
|
||||
if (setup1 || loop1) {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Malloc/etc. interrupt locking wrappers
|
||||
|
||||
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
extern "C" void *__real_malloc(size_t size);
|
||||
extern "C" void *__real_calloc(size_t count, size_t size);
|
||||
extern "C" void *__real_realloc(void *mem, size_t size);
|
||||
extern "C" void __real_free(void *mem);
|
||||
|
||||
extern "C" void *__wrap_malloc(size_t size) {
|
||||
noInterrupts();
|
||||
void *rc = __real_malloc(size);
|
||||
interrupts();
|
||||
return rc;
|
||||
}
|
||||
|
||||
extern "C" void *__wrap_calloc(size_t count, size_t size) {
|
||||
noInterrupts();
|
||||
void *rc = __real_calloc(count, size);
|
||||
interrupts();
|
||||
return rc;
|
||||
}
|
||||
|
||||
extern "C" void *__wrap_realloc(void *mem, size_t size) {
|
||||
noInterrupts();
|
||||
void *rc = __real_realloc(mem, size);
|
||||
interrupts();
|
||||
return rc;
|
||||
}
|
||||
|
||||
extern "C" void __wrap_free(void *mem) {
|
||||
noInterrupts();
|
||||
__real_free(mem);
|
||||
interrupts();
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
// Taken from the Pico-SDK v1.4.0 and hacked by EFP3 to allow overriding the LWIP setup
|
||||
|
||||
#include <stdio.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
#include "pico/cyw43_arch.h"
|
||||
#include "pico/mutex.h"
|
||||
@@ -36,7 +36,7 @@
|
||||
#define CYW43_WL_GPIO_LED_PIN 0
|
||||
#endif
|
||||
|
||||
volatile bool __inLWIP = false;
|
||||
extern volatile bool __inLWIP;
|
||||
|
||||
// note same code
|
||||
#if PICO_CYW43_ARCH_THREADSAFE_BACKGROUND
|
||||
@@ -145,7 +145,7 @@ static void gpio_irq_handler(void) {
|
||||
static void low_priority_irq_handler(void) {
|
||||
assert(cyw43_core_num == get_core_num());
|
||||
if (recursive_mutex_try_enter(&cyw43_mutex, NULL)) {
|
||||
if (recursive_mutex_enter_count(&cyw43_mutex) != 1) {
|
||||
if (__inLWIP || (recursive_mutex_enter_count(&cyw43_mutex) != 1)) {
|
||||
low_priority_irq_missed = true;
|
||||
CYW43_STAT_INC(PENDSV_DISABLED_COUNT);
|
||||
} else {
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
static uint32_t analogScale = 255;
|
||||
static uint32_t analogFreq = 1000;
|
||||
static bool pwmInitted = false;
|
||||
static uint32_t pwmInitted = 0;
|
||||
static bool scaleInitted = false;
|
||||
static bool adcInitted = false;
|
||||
static uint16_t analogWritePseudoScale = 1;
|
||||
static uint16_t analogWriteSlowScale = 1;
|
||||
@@ -42,29 +43,31 @@ extern "C" void analogWriteFreq(uint32_t freq) {
|
||||
if (freq < 100) {
|
||||
DEBUGCORE("ERROR: analogWriteFreq too low (%d)\n", freq);
|
||||
analogFreq = 100;
|
||||
} else if (freq > 1'000'000) {
|
||||
} else if (freq > 10'000'000) {
|
||||
DEBUGCORE("ERROR: analogWriteFreq too high (%d)\n", freq);
|
||||
analogFreq = 1'000'000;
|
||||
analogFreq = 10'000'000;
|
||||
} else {
|
||||
analogFreq = freq;
|
||||
}
|
||||
pwmInitted = false;
|
||||
pwmInitted = 0;
|
||||
scaleInitted = false;
|
||||
}
|
||||
|
||||
extern "C" void analogWriteRange(uint32_t range) {
|
||||
if (range == analogScale) {
|
||||
return;
|
||||
}
|
||||
if ((range >= 15) && (range <= 65535)) {
|
||||
if ((range >= 3) && (range <= 65535)) {
|
||||
analogScale = range;
|
||||
pwmInitted = false;
|
||||
pwmInitted = 0;
|
||||
scaleInitted = false;
|
||||
} else {
|
||||
DEBUGCORE("ERROR: analogWriteRange out of range (%d)\n", range);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void analogWriteResolution(int res) {
|
||||
if ((res >= 4) && (res <= 16)) {
|
||||
if ((res >= 2) && (res <= 16)) {
|
||||
analogWriteRange((1 << res) - 1);
|
||||
} else {
|
||||
DEBUGCORE("ERROR: analogWriteResolution out of range (%d)\n", res);
|
||||
@@ -78,29 +81,29 @@ extern "C" void analogWrite(pin_size_t pin, int val) {
|
||||
DEBUGCORE("ERROR: Illegal analogWrite pin (%d)\n", pin);
|
||||
return;
|
||||
}
|
||||
if (!pwmInitted) {
|
||||
if (!scaleInitted) {
|
||||
// For low frequencies, we need to scale the output max value up to achieve lower periods
|
||||
analogWritePseudoScale = 1;
|
||||
while (((clock_get_hz(clk_sys) / (float)(analogScale * analogFreq)) > 255.0) && (analogScale < 32678)) {
|
||||
while (((clock_get_hz(clk_sys) / ((float)analogScale * analogFreq)) > 255.0) && (analogScale < 32678)) {
|
||||
analogWritePseudoScale++;
|
||||
analogScale *= 2;
|
||||
DEBUGCORE("Adjusting analogWrite values PS=%d, scale=%d\n", analogWritePseudoScale, analogScale);
|
||||
}
|
||||
// For high frequencies, we need to scale the output max value down to actually hit the frequency target
|
||||
analogWriteSlowScale = 1;
|
||||
while (((clock_get_hz(clk_sys) / (float)(analogScale * analogFreq)) < 2.0) && (analogScale > 32)) {
|
||||
while (((clock_get_hz(clk_sys) / ((float)analogScale * analogFreq)) < 1.0) && (analogScale >= 6)) {
|
||||
analogWriteSlowScale++;
|
||||
analogScale /= 2;
|
||||
DEBUGCORE("Adjusting analogWrite values SS=%d, scale=%d\n", analogWriteSlowScale, analogScale);
|
||||
}
|
||||
|
||||
scaleInitted = true;
|
||||
}
|
||||
if (!(pwmInitted & (1 << pwm_gpio_to_slice_num(pin)))) {
|
||||
pwm_config c = pwm_get_default_config();
|
||||
pwm_config_set_clkdiv(&c, clock_get_hz(clk_sys) / (float)(analogScale * analogFreq));
|
||||
pwm_config_set_wrap(&c, analogScale);
|
||||
for (int i = 0; i < 30; i++) {
|
||||
pwm_init(pwm_gpio_to_slice_num(i), &c, true);
|
||||
}
|
||||
pwmInitted = true;
|
||||
pwm_config_set_clkdiv(&c, clock_get_hz(clk_sys) / ((float)analogScale * analogFreq));
|
||||
pwm_config_set_wrap(&c, analogScale - 1);
|
||||
pwm_init(pwm_gpio_to_slice_num(pin), &c, true);
|
||||
pwmInitted |= 1 << pwm_gpio_to_slice_num(pin);
|
||||
}
|
||||
|
||||
val <<= analogWritePseudoScale;
|
||||
|
||||
@@ -22,24 +22,30 @@
|
||||
#include <CoreMutex.h>
|
||||
#include <hardware/gpio.h>
|
||||
#include <hardware/sync.h>
|
||||
#include <stack>
|
||||
#include <map>
|
||||
|
||||
// Support nested IRQ disable/re-enable
|
||||
static std::stack<uint32_t> _irqStack[2];
|
||||
#define maxIRQs 15
|
||||
static uint32_t _irqStackTop[2] = { 0, 0 };
|
||||
static uint32_t _irqStack[2][maxIRQs];
|
||||
|
||||
extern "C" void interrupts() {
|
||||
if (_irqStack[get_core_num()].empty()) {
|
||||
auto core = get_core_num();
|
||||
if (!_irqStackTop[core]) {
|
||||
// ERROR
|
||||
return;
|
||||
}
|
||||
auto oldIrqs = _irqStack[get_core_num()].top();
|
||||
_irqStack[get_core_num()].pop();
|
||||
restore_interrupts(oldIrqs);
|
||||
restore_interrupts(_irqStack[core][--_irqStackTop[core]]);
|
||||
}
|
||||
|
||||
extern "C" void noInterrupts() {
|
||||
_irqStack[get_core_num()].push(save_and_disable_interrupts());
|
||||
auto core = get_core_num();
|
||||
if (_irqStackTop[core] == maxIRQs) {
|
||||
// ERROR
|
||||
panic("IRQ stack overflow");
|
||||
}
|
||||
|
||||
_irqStack[core][_irqStackTop[core]++] = save_and_disable_interrupts();
|
||||
}
|
||||
|
||||
// Only 1 GPIO IRQ callback for all pins, so we need to look at the pin it's for and
|
||||
@@ -71,7 +77,7 @@ static std::map<pin_size_t, CBInfo> _map;
|
||||
void _gpioInterruptDispatcher(uint gpio, uint32_t events) {
|
||||
(void) events;
|
||||
// Only need to lock around the std::map check, not the whole IRQ callback
|
||||
CoreMutex m(&_irqMutex);
|
||||
CoreMutex m(&_irqMutex, (FromISR | DebugEnable));
|
||||
if (m) {
|
||||
auto irq = _map.find(gpio);
|
||||
if (irq != _map.end()) {
|
||||
@@ -129,7 +135,7 @@ void attachInterruptParam(pin_size_t pin, voidFuncPtrParam callback, PinStatus m
|
||||
default: return; // ERROR
|
||||
}
|
||||
noInterrupts();
|
||||
detachInterrupt(pin);
|
||||
_detachInterruptInternal(pin);
|
||||
CBInfo cb(callback, param);
|
||||
_map.insert({pin, cb});
|
||||
gpio_set_irq_enabled_with_callback(pin, events, true, _gpioInterruptDispatcher);
|
||||
|
||||
+2
-2
@@ -54,9 +54,9 @@ author = u'Earle F. Philhower, III'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = u'2.6.0'
|
||||
version = u'2.6.4'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'2.6.0'
|
||||
release = u'2.6.4'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
+2
-2
@@ -38,12 +38,12 @@ void rp2040.reboot()
|
||||
Forces a hardware reboot of the Pico.
|
||||
|
||||
Hardware Watchdog
|
||||
_________________
|
||||
-----------------
|
||||
|
||||
void rp2040.wdt_begin(uint32_t delay_ms)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Enables the hardware watchdog timer with a delay value of delay_ms
|
||||
microseconds. Note that on the RP2040, once this function has called, the
|
||||
milliseconds. Note that on the RP2040, once this function has called, the
|
||||
hardware watchdog can _not_ be disabled.
|
||||
|
||||
void rp2040.wdt_reset()
|
||||
|
||||
@@ -40,8 +40,6 @@ Please note that WiFi on the Pico W is a work-in-progress and there are some imp
|
||||
|
||||
* Combined STA/AP mode is not supported
|
||||
|
||||
* Certain WiFi status values (RSSI, BSSID, etc.) are not available.
|
||||
|
||||
* Multicore is supported, but only one core may run ``WiFi`` code.
|
||||
|
||||
* FreeRTOS is not yet supported due to the requirement for a very different LWIP implementation. PRs always appreciated!
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
source [find board/pico-debug.cfg]
|
||||
@@ -0,0 +1,2 @@
|
||||
source [find interface/picoprobe.cfg]
|
||||
source [find target/rp2040.cfg]
|
||||
@@ -144,4 +144,59 @@
|
||||
-Wl,--wrap=tanhf
|
||||
-Wl,--wrap=trunc
|
||||
-Wl,--wrap=truncf
|
||||
|
||||
-Wl,--wrap=__getreent
|
||||
|
||||
-Wl,--wrap=malloc
|
||||
-Wl,--wrap=calloc
|
||||
-Wl,--wrap=realloc
|
||||
-Wl,--wrap=free
|
||||
|
||||
-Wl,--wrap=pbuf_header
|
||||
-Wl,--wrap=pbuf_free
|
||||
-Wl,--wrap=pbuf_alloc
|
||||
-Wl,--wrap=pbuf_take
|
||||
-Wl,--wrap=pbuf_copy_partial
|
||||
-Wl,--wrap=pbuf_ref
|
||||
-Wl,--wrap=pbuf_get_at
|
||||
-Wl,--wrap=pbuf_get_contiguous
|
||||
-Wl,--wrap=pbuf_cat
|
||||
|
||||
-Wl,--wrap=tcp_arg
|
||||
-Wl,--wrap=tcp_new
|
||||
-Wl,--wrap=tcp_listen
|
||||
-Wl,--wrap=tcp_listen_with_backlog
|
||||
-Wl,--wrap=tcp_accept
|
||||
-Wl,--wrap=tcp_connect
|
||||
-Wl,--wrap=tcp_write
|
||||
-Wl,--wrap=tcp_sent
|
||||
-Wl,--wrap=tcp_recv
|
||||
-Wl,--wrap=tcp_recved
|
||||
-Wl,--wrap=tcp_poll
|
||||
-Wl,--wrap=tcp_close
|
||||
-Wl,--wrap=tcp_abort
|
||||
-Wl,--wrap=tcp_err
|
||||
-Wl,--wrap=tcp_output
|
||||
-Wl,--wrap=tcp_setprio
|
||||
-Wl,--wrap=tcp_backlog_delayed
|
||||
-Wl,--wrap=tcp_backlog_accepted
|
||||
|
||||
-Wl,--wrap=udp_new
|
||||
-Wl,--wrap=udp_remove
|
||||
-Wl,--wrap=udp_bind
|
||||
-Wl,--wrap=udp_connect
|
||||
-Wl,--wrap=udp_disconnect
|
||||
-Wl,--wrap=udp_send
|
||||
-Wl,--wrap=udp_recv
|
||||
-Wl,--wrap=udp_sendto_if
|
||||
|
||||
-Wl,--wrap=sys_check_timeouts
|
||||
|
||||
-Wl,--wrap=dns_gethostbyname
|
||||
-Wl,--wrap=dns_gethostbyname_addrtype
|
||||
|
||||
-Wl,--wrap=raw_new
|
||||
-Wl,--wrap=raw_recv
|
||||
-Wl,--wrap=raw_bind
|
||||
-Wl,--wrap=raw_sendto
|
||||
-Wl,--wrap=raw_remove
|
||||
|
||||
@@ -110,7 +110,7 @@ void ArduinoOTAClass::begin(bool useMDNS) {
|
||||
_useMDNS = useMDNS;
|
||||
|
||||
if (!_hostname.length()) {
|
||||
char tmp[15];
|
||||
char tmp[2 * PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 6];
|
||||
sprintf(tmp, "pico-%s", rp2040.getChipID());
|
||||
_hostname = tmp;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ void EEPROMClass::begin(size_t size) {
|
||||
size = 4096;
|
||||
}
|
||||
|
||||
_size = (size + 255) & (~255); // Flash writes limited to 256 byte boundaries
|
||||
size = (size + 255) & (~255); // Flash writes limited to 256 byte boundaries
|
||||
|
||||
// In case begin() is called a 2nd+ time, don't reallocate if size is the same
|
||||
if (_data && size != _size) {
|
||||
@@ -55,6 +55,8 @@ void EEPROMClass::begin(size_t size) {
|
||||
_data = new uint8_t[size];
|
||||
}
|
||||
|
||||
_size = size;
|
||||
|
||||
memcpy(_data, _sector, _size);
|
||||
|
||||
_dirty = false; //make sure dirty is cleared in case begin() is called 2nd+ time
|
||||
|
||||
@@ -59,7 +59,7 @@ volatile bool __usbInitted = false;
|
||||
|
||||
static void __core0(void *params) {
|
||||
(void) params;
|
||||
#ifndef NO_USB
|
||||
#if !defined(NO_USB) && !defined(USE_TINYUSB)
|
||||
while (!__usbInitted) {
|
||||
delay(1);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ static void __core0(void *params) {
|
||||
|
||||
static void __core1(void *params) {
|
||||
(void) params;
|
||||
#ifndef NO_USB
|
||||
#if !defined(NO_USB) && !defined(USE_TINYUSB)
|
||||
while (!__usbInitted) {
|
||||
delay(1);
|
||||
}
|
||||
@@ -414,6 +414,10 @@ extern "C" {
|
||||
xSemaphoreTake(mtx, portMAX_DELAY);
|
||||
}
|
||||
|
||||
void __freertos_mutex_take_from_isr(SemaphoreHandle_t mtx) {
|
||||
xSemaphoreTakeFromISR(mtx, NULL);
|
||||
}
|
||||
|
||||
int __freertos_mutex_try_take(SemaphoreHandle_t mtx) {
|
||||
return xSemaphoreTake(mtx, 0);
|
||||
}
|
||||
@@ -422,6 +426,10 @@ extern "C" {
|
||||
xSemaphoreGive(mtx);
|
||||
}
|
||||
|
||||
void __freertos_mutex_give_from_isr(SemaphoreHandle_t mtx) {
|
||||
xSemaphoreGiveFromISR(mtx, NULL);
|
||||
}
|
||||
|
||||
void __freertos_recursive_mutex_take(SemaphoreHandle_t mtx) {
|
||||
xSemaphoreTakeRecursive(mtx, portMAX_DELAY);
|
||||
}
|
||||
|
||||
@@ -27,11 +27,26 @@ I2S::I2S(PinMode direction) {
|
||||
_running = false;
|
||||
_bps = 16;
|
||||
_writtenHalf = false;
|
||||
_isOutput = direction == OUTPUT;
|
||||
_pinBCLK = 26;
|
||||
_pinDOUT = 28;
|
||||
#ifdef PIN_I2S_BCLK
|
||||
_pinBCLK = PIN_I2S_BCLK;
|
||||
#endif
|
||||
|
||||
#ifdef PIN_I2S_DOUT
|
||||
if (_isOutput) {
|
||||
_pinDOUT = PIN_I2S_DOUT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PIN_I2S_DIN
|
||||
if (!_isOutput) {
|
||||
_pinDOUT = PIN_I2S_DIN;
|
||||
}
|
||||
#endif
|
||||
_freq = 48000;
|
||||
_arb = nullptr;
|
||||
_isOutput = direction == OUTPUT;
|
||||
_cb = nullptr;
|
||||
_buffers = 8;
|
||||
_bufferWords = 16;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "ESP8266mDNS.h"
|
||||
#include "LEAmDNS_Priv.h"
|
||||
#include <LwipIntf.h> // LwipIntf::stateUpCB()
|
||||
#include <LWIPMutex.h> // LwipIntf::stateUpCB()
|
||||
#include <lwip/igmp.h>
|
||||
#include <lwip/prot/dns.h>
|
||||
|
||||
|
||||
@@ -43,9 +43,10 @@ const char *password = STAPSK;
|
||||
|
||||
WebServer server(80);
|
||||
|
||||
const int led = 13;
|
||||
const int led = LED_BUILTIN;
|
||||
|
||||
void handleRoot() {
|
||||
static int cnt = 0;
|
||||
digitalWrite(led, 1);
|
||||
char temp[400];
|
||||
int sec = millis() / 1000;
|
||||
@@ -65,11 +66,13 @@ void handleRoot() {
|
||||
<body>\
|
||||
<h1>Hello from the Pico W!</h1>\
|
||||
<p>Uptime: %02d:%02d:%02d</p>\
|
||||
<p>Free Memory: %d</p>\
|
||||
<p>Page Count: %d</p>\
|
||||
<img src=\"/test.svg\" />\
|
||||
</body>\
|
||||
</html>",
|
||||
|
||||
hr, min % 60, sec % 60);
|
||||
hr, min % 60, sec % 60, rp2040.getFreeHeap(), ++cnt);
|
||||
server.send(200, "text/html", temp);
|
||||
digitalWrite(led, 0);
|
||||
}
|
||||
|
||||
@@ -280,7 +280,10 @@ void HTTPServer::httpHandleClient() {
|
||||
}
|
||||
|
||||
if (!keepCurrentClient) {
|
||||
_currentClient = nullptr;
|
||||
if (_currentClient) {
|
||||
delete _currentClient;
|
||||
_currentClient = nullptr;
|
||||
}
|
||||
_currentStatus = HC_NONE;
|
||||
_currentUpload.reset();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ gatewayIP KEYWORD2
|
||||
SSID KEYWORD2
|
||||
BSSID KEYWORD2
|
||||
RSSI KEYWORD2
|
||||
channel KEYWORD2
|
||||
encryptionType KEYWORD2
|
||||
beginPacket KEYWORD2
|
||||
endPacket KEYWORD2
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include "wl_definitions.h"
|
||||
#include "wl_types.h"
|
||||
|
||||
#include "LWIPMutex.h"
|
||||
|
||||
#include "WiFiClass.h"
|
||||
#include "WiFiClient.h"
|
||||
#include "WiFiServer.h"
|
||||
|
||||
@@ -44,17 +44,20 @@ const char* WiFiClass::firmwareVersion() {
|
||||
return PICO_SDK_VERSION_STRING;
|
||||
}
|
||||
|
||||
void WiFiClass::mode(_wifiModeESP m) {
|
||||
void WiFiClass::mode(WiFiMode_t m) {
|
||||
_calledESP = true;
|
||||
switch (m) {
|
||||
case WIFI_OFF:
|
||||
case WiFiMode_t::WIFI_OFF:
|
||||
end();
|
||||
break;
|
||||
case WIFI_AP:
|
||||
_modeESP = WIFI_AP;
|
||||
case WiFiMode_t::WIFI_AP:
|
||||
_modeESP = WiFiMode_t::WIFI_AP;
|
||||
break;
|
||||
case WIFI_STA:
|
||||
_modeESP = WIFI_STA;
|
||||
case WiFiMode_t::WIFI_STA:
|
||||
_modeESP = WiFiMode_t::WIFI_STA;
|
||||
break;
|
||||
case WiFiMode_t::WIFI_AP_STA:
|
||||
_modeESP = WiFiMode_t::WIFI_STA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +89,7 @@ int WiFiClass::begin(const char* ssid, const char *passphrase) {
|
||||
|
||||
_ssid = ssid;
|
||||
_password = passphrase;
|
||||
_wifi.setSSID(ssid);
|
||||
_wifi.setSSID(_ssid.c_str());
|
||||
_wifi.setPassword(passphrase);
|
||||
_wifi.setTimeout(_timeout);
|
||||
_wifi.setSTA();
|
||||
@@ -123,7 +126,7 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
|
||||
|
||||
_ssid = ssid;
|
||||
_password = passphrase;
|
||||
_wifi.setSSID(ssid);
|
||||
_wifi.setSSID(_ssid.c_str());
|
||||
_wifi.setPassword(passphrase);
|
||||
_wifi.setTimeout(_timeout);
|
||||
_wifi.setAP();
|
||||
@@ -234,7 +237,7 @@ const char *WiFiClass::getHostname() {
|
||||
|
||||
return: one value of wl_status_t enum
|
||||
*/
|
||||
int WiFiClass::disconnect(void) {
|
||||
int WiFiClass::disconnect(bool wifi_off __unused) {
|
||||
if (_dhcpServer) {
|
||||
dhcp_server_deinit(_dhcpServer);
|
||||
free(_dhcpServer);
|
||||
@@ -300,7 +303,7 @@ IPAddress WiFiClass::gatewayIP() {
|
||||
|
||||
return: ssid string
|
||||
*/
|
||||
const char* WiFiClass::SSID() {
|
||||
const String &WiFiClass::SSID() {
|
||||
return _ssid;
|
||||
}
|
||||
|
||||
@@ -311,11 +314,33 @@ const char* WiFiClass::SSID() {
|
||||
return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
|
||||
*/
|
||||
uint8_t* WiFiClass::BSSID(uint8_t* bssid) {
|
||||
// TODO - driver does not return this?!
|
||||
memset(bssid, 0xee, WL_MAC_ADDR_LENGTH);
|
||||
#ifndef CYW43_IOCTL_GET_BSSID
|
||||
#define CYW43_IOCTL_GET_BSSID ( (uint32_t)23 * 2 )
|
||||
#endif
|
||||
|
||||
if (_wifi.connected()) {
|
||||
cyw43_ioctl(&cyw43_state, CYW43_IOCTL_GET_BSSID, WL_MAC_ADDR_LENGTH, bssid, CYW43_ITF_STA);
|
||||
} else {
|
||||
memset(bssid, 0, WL_MAC_ADDR_LENGTH);
|
||||
}
|
||||
return bssid;
|
||||
}
|
||||
|
||||
int WiFiClass::channel() {
|
||||
#ifndef CYW43_IOCTL_GET_CHANNEL
|
||||
#define CYW43_IOCTL_GET_CHANNEL 0x3a
|
||||
#endif
|
||||
|
||||
int32_t channel;
|
||||
if (_wifi.connected()) {
|
||||
cyw43_ioctl(&cyw43_state, CYW43_IOCTL_GET_CHANNEL, sizeof channel, (uint8_t *)&channel, CYW43_ITF_STA);
|
||||
} else {
|
||||
channel = -1;
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return the current RSSI /Received Signal Strength in dBm)
|
||||
associated with the network
|
||||
@@ -323,8 +348,17 @@ uint8_t* WiFiClass::BSSID(uint8_t* bssid) {
|
||||
return: signed value
|
||||
*/
|
||||
int32_t WiFiClass::RSSI() {
|
||||
// TODO - driver does not return this?!
|
||||
return 0;
|
||||
#ifndef CYW43_IOCTL_GET_RSSI
|
||||
#define CYW43_IOCTL_GET_RSSI 0xFE
|
||||
#endif
|
||||
|
||||
int32_t rssi;
|
||||
if (_wifi.connected()) {
|
||||
cyw43_ioctl(&cyw43_state, CYW43_IOCTL_GET_RSSI, sizeof rssi, (uint8_t *)&rssi, CYW43_ITF_STA);
|
||||
} else {
|
||||
rssi = -255;
|
||||
}
|
||||
return rssi;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -365,7 +399,7 @@ int WiFiClass::_scanCB(void *env, const cyw43_ev_scan_result_t *result) {
|
||||
|
||||
return: Number of discovered networks
|
||||
*/
|
||||
int8_t WiFiClass::scanNetworks() {
|
||||
int8_t WiFiClass::scanNetworks(bool async) {
|
||||
cyw43_wifi_scan_options_t scan_options;
|
||||
memset(&scan_options, 0, sizeof(scan_options));
|
||||
_scan.clear();
|
||||
@@ -378,11 +412,27 @@ int8_t WiFiClass::scanNetworks() {
|
||||
if (err) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t now = millis();
|
||||
while (cyw43_wifi_scan_active(&cyw43_state) && (millis() - now < 10000)) {
|
||||
delay(10);
|
||||
if (!async) {
|
||||
uint32_t now = millis();
|
||||
while (cyw43_wifi_scan_active(&cyw43_state) && (millis() - now < 10000)) {
|
||||
delay(10);
|
||||
}
|
||||
return _scan.size();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return _scan.size();
|
||||
}
|
||||
|
||||
int8_t WiFiClass::scanComplete() {
|
||||
if (cyw43_wifi_scan_active(&cyw43_state)) {
|
||||
return -1;
|
||||
} else {
|
||||
return _scan.size();
|
||||
}
|
||||
}
|
||||
|
||||
void WiFiClass::scanDelete() {
|
||||
_scan.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
typedef void(*FeedHostProcessorWatchdogFuncPointer)();
|
||||
|
||||
typedef enum { WIFI_STA, WIFI_AP, WIFI_OFF } _wifiModeESP; // For ESP8266 compatibility
|
||||
typedef enum { WIFI_OFF = 0, WIFI_STA = 1, WIFI_AP = 2, WIFI_AP_STA = 3 } WiFiMode_t; // For ESP8266 compatibility
|
||||
|
||||
class WiFiClass {
|
||||
public:
|
||||
@@ -46,7 +46,18 @@ public:
|
||||
*/
|
||||
static const char* firmwareVersion();
|
||||
|
||||
void mode(_wifiModeESP m); // For ESP8266 compatibility
|
||||
void mode(WiFiMode_t m); // For ESP8266 compatibility
|
||||
|
||||
WiFiMode_t getMode() {
|
||||
if (_wifiHWInitted) {
|
||||
if (_apMode) {
|
||||
return WiFiMode_t::WIFI_AP;
|
||||
} else {
|
||||
return WiFiMode_t::WIFI_STA;
|
||||
}
|
||||
}
|
||||
return WiFiMode_t::WIFI_OFF;
|
||||
};
|
||||
|
||||
/* Start WiFi connection for OPEN networks
|
||||
|
||||
@@ -138,7 +149,7 @@ public:
|
||||
}
|
||||
|
||||
String softAPSSID() {
|
||||
return String(SSID());
|
||||
return SSID();
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +216,7 @@ public:
|
||||
|
||||
return: one value of wl_status_t enum
|
||||
*/
|
||||
int disconnect(void);
|
||||
int disconnect(bool wifi_off = false);
|
||||
|
||||
void end(void);
|
||||
|
||||
@@ -249,7 +260,7 @@ public:
|
||||
|
||||
return: ssid string
|
||||
*/
|
||||
const char* SSID();
|
||||
const String &SSID();
|
||||
|
||||
/*
|
||||
Return the current BSSID associated with the network.
|
||||
@@ -267,6 +278,10 @@ public:
|
||||
*/
|
||||
int32_t RSSI();
|
||||
|
||||
|
||||
/* Return the current network channel */
|
||||
int channel();
|
||||
|
||||
/*
|
||||
Return the Encryption Type associated with the network
|
||||
|
||||
@@ -277,9 +292,23 @@ public:
|
||||
/*
|
||||
Start scan WiFi networks available
|
||||
|
||||
param async: whether to perform asynchronous scan
|
||||
|
||||
return: Number of discovered networks
|
||||
*/
|
||||
int8_t scanNetworks();
|
||||
int8_t scanNetworks(bool async = false);
|
||||
|
||||
/*
|
||||
Return number of scanned WiFi networks
|
||||
|
||||
return: Number of discovered networks
|
||||
*/
|
||||
int8_t scanComplete();
|
||||
|
||||
/*
|
||||
Delete scan results
|
||||
*/
|
||||
void scanDelete();
|
||||
|
||||
/*
|
||||
Return the SSID discovered during the network scan.
|
||||
@@ -353,8 +382,8 @@ public:
|
||||
|
||||
private:
|
||||
int _timeout = 10000;
|
||||
const char * _ssid = nullptr;
|
||||
const char * _password = nullptr;
|
||||
String _ssid;
|
||||
String _password;
|
||||
bool _wifiHWInitted = false;
|
||||
bool _apMode = false;
|
||||
|
||||
@@ -367,7 +396,7 @@ private:
|
||||
|
||||
// ESP compat
|
||||
bool _calledESP = false; // Should we behave like the ESP8266 for connect?
|
||||
_wifiModeESP _modeESP = WIFI_STA;
|
||||
WiFiMode_t _modeESP = WIFI_STA;
|
||||
};
|
||||
|
||||
extern WiFiClass WiFi;
|
||||
|
||||
@@ -130,8 +130,6 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) {
|
||||
_client = nullptr;
|
||||
}
|
||||
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
|
||||
tcp_pcb* pcb = tcp_new();
|
||||
if (!pcb) {
|
||||
return 0;
|
||||
|
||||
@@ -56,8 +56,6 @@ void WiFiServer::begin(uint16_t port, uint8_t backlog) {
|
||||
}
|
||||
_port = port;
|
||||
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
|
||||
tcp_pcb* pcb = tcp_new();
|
||||
if (!pcb) {
|
||||
return;
|
||||
@@ -134,7 +132,6 @@ WiFiClient WiFiServer::accept() {
|
||||
|
||||
// pcb can be null when peer has already closed the connection
|
||||
if (_unclaimed->getPCB()) {
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
// give permission to lwIP to accept one more peer
|
||||
tcp_backlog_accepted(_unclaimed->getPCB());
|
||||
}
|
||||
@@ -162,7 +159,6 @@ void WiFiServer::close() {
|
||||
if (!_listen_pcb) {
|
||||
return;
|
||||
}
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
tcp_close(_listen_pcb);
|
||||
_listen_pcb = nullptr;
|
||||
}
|
||||
@@ -197,7 +193,6 @@ err_t WiFiServer::_accept(tcp_pcb* apcb, err_t err) {
|
||||
// https://www.nongnu.org/lwip/2_1_x/group__tcp__raw.html#gaeff14f321d1eecd0431611f382fcd338
|
||||
|
||||
// increase lwIP's backlog
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
tcp_backlog_delayed(apcb);
|
||||
|
||||
_unclaimed = slist_append_tail(_unclaimed, client);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <wl_definitions.h>
|
||||
struct tcp_pcb;
|
||||
|
||||
#include <LWIPMutex.h>
|
||||
#include <Server.h>
|
||||
#include <IPAddress.h>
|
||||
#include <lwip/err.h>
|
||||
|
||||
@@ -27,6 +27,8 @@ class WiFiClient;
|
||||
typedef void (*discard_cb_t)(void*, ClientContext*);
|
||||
|
||||
#include <assert.h>
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
//#include <esp_priv.h>
|
||||
//#include <coredecls.h>
|
||||
|
||||
@@ -36,6 +38,7 @@ template <typename T>
|
||||
inline void esp_delay(const uint32_t timeout_ms, T&& blocked, const uint32_t intvl_ms) {
|
||||
const auto start_ms = millis();
|
||||
while ((((uint32_t)millis() - start_ms) < timeout_ms) && blocked()) {
|
||||
sys_check_timeouts();
|
||||
delay(intvl_ms);
|
||||
}
|
||||
}
|
||||
@@ -68,7 +71,6 @@ public:
|
||||
tcp_recv(_pcb, nullptr);
|
||||
tcp_err(_pcb, nullptr);
|
||||
tcp_poll(_pcb, nullptr, 0);
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
tcp_abort(_pcb);
|
||||
_pcb = nullptr;
|
||||
}
|
||||
@@ -84,7 +86,6 @@ public:
|
||||
tcp_recv(_pcb, nullptr);
|
||||
tcp_err(_pcb, nullptr);
|
||||
tcp_poll(_pcb, nullptr, 0);
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
err = tcp_close(_pcb);
|
||||
if (err != ERR_OK) {
|
||||
DEBUGV(":tc err %d\r\n", (int) err);
|
||||
@@ -136,7 +137,6 @@ public:
|
||||
ip6_addr_assign_zone(ip_2_ip6(addr), IP6_UNKNOWN, netif_default);
|
||||
}
|
||||
#endif
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
err_t err = tcp_connect(_pcb, addr, port, &ClientContext::_s_connected);
|
||||
if (err != ERR_OK) {
|
||||
return 0;
|
||||
@@ -162,7 +162,6 @@ public:
|
||||
}
|
||||
|
||||
size_t availableForWrite() const {
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
return _pcb ? tcp_sndbuf(_pcb) : 0;
|
||||
}
|
||||
|
||||
@@ -170,7 +169,6 @@ public:
|
||||
if (!_pcb) {
|
||||
return;
|
||||
}
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
if (nodelay) {
|
||||
tcp_nagle_disable(_pcb);
|
||||
} else {
|
||||
@@ -182,7 +180,6 @@ public:
|
||||
if (!_pcb) {
|
||||
return false;
|
||||
}
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
return tcp_nagle_disabled(_pcb);
|
||||
}
|
||||
|
||||
@@ -300,7 +297,6 @@ public:
|
||||
if (!_rx_buf) {
|
||||
return;
|
||||
}
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
if (_pcb) {
|
||||
tcp_recved(_pcb, (size_t) _rx_buf->tot_len);
|
||||
}
|
||||
@@ -332,7 +328,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
|
||||
// force lwIP to send what can be sent
|
||||
tcp_output(_pcb);
|
||||
@@ -517,7 +512,6 @@ protected:
|
||||
const auto remaining = _datalen - _written;
|
||||
size_t next_chunk_size;
|
||||
{
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call, just for this call
|
||||
next_chunk_size = std::min((size_t)tcp_sndbuf(_pcb), remaining);
|
||||
// Potentially reduce transmit size if we are tight on memory, but only if it doesn't return a 0 chunk size
|
||||
if (next_chunk_size > (size_t)(1 << scale)) {
|
||||
@@ -571,7 +565,6 @@ protected:
|
||||
// lwIP's tcp_output doc: "Find out what we can send and send it"
|
||||
// *with respect to Nagle*
|
||||
// more info: https://lists.gnu.org/archive/html/lwip-users/2017-11/msg00134.html
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
tcp_output(_pcb);
|
||||
}
|
||||
|
||||
@@ -596,7 +589,6 @@ protected:
|
||||
|
||||
void _consume(size_t size) {
|
||||
ptrdiff_t left = _rx_buf->len - _rx_buf_offset - size;
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
if (left > 0) {
|
||||
_rx_buf_offset += size;
|
||||
} else if (!_rx_buf->next) {
|
||||
@@ -638,7 +630,6 @@ protected:
|
||||
|
||||
if (_rx_buf) {
|
||||
DEBUGV(":rch %d, %d\r\n", _rx_buf->tot_len, pb->tot_len);
|
||||
LWIPMutex m; // Block the timer sys_check_timeouts call
|
||||
pbuf_cat(_rx_buf, pb);
|
||||
} else {
|
||||
DEBUGV(":rn %d\r\n", pb->tot_len);
|
||||
@@ -676,24 +667,44 @@ protected:
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
// We may receive a nullptr as arg in the case when an IRQ happens during a shutdown sequence
|
||||
// In that case, just ignore the CB
|
||||
static err_t _s_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_recv(tpcb, pb, err);
|
||||
if (arg) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_recv(tpcb, pb, err);
|
||||
} else {
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
static void _s_error(void *arg, err_t err) {
|
||||
reinterpret_cast<ClientContext*>(arg)->_error(err);
|
||||
if (arg) {
|
||||
reinterpret_cast<ClientContext*>(arg)->_error(err);
|
||||
}
|
||||
}
|
||||
|
||||
static err_t _s_poll(void *arg, struct tcp_pcb *tpcb) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_poll(tpcb);
|
||||
if (arg) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_poll(tpcb);
|
||||
} else {
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
static err_t _s_acked(void *arg, struct tcp_pcb *tpcb, uint16_t len) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_acked(tpcb, len);
|
||||
if (arg) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_acked(tpcb, len);
|
||||
} else {
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
static err_t _s_connected(void* arg, struct tcp_pcb *pcb, err_t err) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_connected(pcb, err);
|
||||
if (arg) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_connected(pcb, err);
|
||||
} else {
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -29,6 +29,8 @@ extern "C" {
|
||||
|
||||
#include <AddrList.h>
|
||||
#include <Arduino.h>
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
//#include <PolledTimeout.h>
|
||||
|
||||
#define PBUF_ALIGNER_ADJUST 4
|
||||
@@ -383,6 +385,7 @@ public:
|
||||
uint32_t start = millis();
|
||||
while (((err = trySend(addr, port, /* keep buffer on error */true)) != ERR_OK) && (millis() - start < timeoutMs)) {
|
||||
delay(1);
|
||||
sys_check_timeouts();
|
||||
}
|
||||
if (err != ERR_OK) {
|
||||
cancelBuffer(); // get rid of buffer kept on error after timeout
|
||||
|
||||
+42
-31
@@ -140,23 +140,52 @@ void TwoWire::begin(uint8_t addr) {
|
||||
_running = true;
|
||||
}
|
||||
|
||||
// See: https://github.com/earlephilhower/arduino-pico/issues/979#issuecomment-1328237128
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
void TwoWire::onIRQ() {
|
||||
if (_i2c->hw->intr_stat & (1 << 12)) {
|
||||
if (_onReceiveCallback && _buffLen) {
|
||||
_onReceiveCallback(_buffLen);
|
||||
}
|
||||
_buffLen = 0;
|
||||
_buffOff = 0;
|
||||
_slaveStartDet = false;
|
||||
_i2c->hw->clr_restart_det;
|
||||
// Make a local copy of the IRQ status up front. If it changes while we're
|
||||
// running the IRQ callback will fire again after returning. Avoids potential
|
||||
// race conditions
|
||||
uint32_t irqstat = _i2c->hw->intr_stat;
|
||||
if (irqstat == 0) {
|
||||
return;
|
||||
}
|
||||
if (_i2c->hw->intr_stat & (1 << 10)) {
|
||||
_buffLen = 0;
|
||||
_buffOff = 0;
|
||||
|
||||
// First, pull off any data available
|
||||
if (irqstat & (1 << 2)) {
|
||||
// RX_FULL
|
||||
if (_buffLen < (int)sizeof(_buff)) {
|
||||
_buff[_buffLen++] = _i2c->hw->data_cmd & 0xff;
|
||||
} else {
|
||||
_i2c->hw->data_cmd;
|
||||
}
|
||||
}
|
||||
// RD_REQ
|
||||
if (irqstat & (1 << 5)) {
|
||||
if (_onRequestCallback) {
|
||||
_onRequestCallback();
|
||||
}
|
||||
_i2c->hw->clr_rd_req;
|
||||
}
|
||||
// TX_ABRT
|
||||
if (irqstat & (1 << 6)) {
|
||||
_i2c->hw->clr_tx_abrt;
|
||||
}
|
||||
// START_DET
|
||||
if (irqstat & (1 << 10)) {
|
||||
_slaveStartDet = true;
|
||||
_i2c->hw->clr_start_det;
|
||||
}
|
||||
if (_i2c->hw->intr_stat & (1 << 9)) {
|
||||
// RESTART_DET
|
||||
if (irqstat & (1 << 12)) {
|
||||
if (_onReceiveCallback && _buffLen) {
|
||||
_onReceiveCallback(_buffLen);
|
||||
}
|
||||
_i2c->hw->clr_restart_det;
|
||||
}
|
||||
// STOP_DET
|
||||
if (irqstat & (1 << 9)) {
|
||||
if (_onReceiveCallback && _buffLen) {
|
||||
_onReceiveCallback(_buffLen);
|
||||
}
|
||||
@@ -165,26 +194,8 @@ void TwoWire::onIRQ() {
|
||||
_slaveStartDet = false;
|
||||
_i2c->hw->clr_stop_det;
|
||||
}
|
||||
if (_i2c->hw->intr_stat & (1 << 6)) {
|
||||
// TX_ABRT
|
||||
_i2c->hw->clr_tx_abrt;
|
||||
}
|
||||
if (_i2c->hw->intr_stat & (1 << 5)) {
|
||||
// RD_REQ
|
||||
if (_onRequestCallback) {
|
||||
_onRequestCallback();
|
||||
}
|
||||
_i2c->hw->clr_rd_req;
|
||||
}
|
||||
if (_i2c->hw->intr_stat & (1 << 2)) {
|
||||
// RX_FULL
|
||||
if (_slaveStartDet && (_buffLen < (int)sizeof(_buff))) {
|
||||
_buff[_buffLen++] = _i2c->hw->data_cmd & 0xff;
|
||||
} else {
|
||||
_i2c->hw->data_cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma GCC pop_options
|
||||
|
||||
void TwoWire::end() {
|
||||
if (!_running) {
|
||||
|
||||
@@ -39,6 +39,7 @@ extern "C" {
|
||||
|
||||
|
||||
netif *CYW43::_netif = nullptr;
|
||||
extern "C" volatile bool __inLWIP;
|
||||
|
||||
CYW43::CYW43(int8_t cs, arduino::SPIClass& spi, int8_t intrpin) {
|
||||
(void) cs;
|
||||
@@ -99,7 +100,20 @@ uint16_t CYW43::readFrame(uint8_t* buffer, uint16_t bufsize) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CB from the cyg32_driver
|
||||
//#define MAXWAIT 16
|
||||
//static struct pbuf *_pbufWaiting[MAXWAIT];
|
||||
//static bool _pbufHold(struct pbuf *p) {
|
||||
// for (int i = 0; i < MAXWAIT; i++) {
|
||||
// if (!_pbufWaiting[i]) {
|
||||
// _pbufWaiting[i] = p;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
// CB from the cyw43 driver
|
||||
extern "C" void cyw43_cb_process_ethernet(void *cb_data, int itf, size_t len, const uint8_t *buf) {
|
||||
//cyw43_t *self = (cyw43_t *)cb_data
|
||||
(void) cb_data;
|
||||
@@ -114,7 +128,7 @@ extern "C" void cyw43_cb_process_ethernet(void *cb_data, int itf, size_t len, co
|
||||
struct pbuf *p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
|
||||
if (p != nullptr) {
|
||||
pbuf_take(p, buf, len);
|
||||
if (netif->input(p, netif) != ERR_OK) {
|
||||
if (__inLWIP || (netif->input(p, netif) != ERR_OK)) {
|
||||
pbuf_free(p);
|
||||
}
|
||||
CYW43_STAT_INC(PACKET_IN_COUNT);
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
// TODO:
|
||||
// unchain pbufs
|
||||
|
||||
#include <LWIPMutex.h>
|
||||
|
||||
#include <netif/ethernet.h>
|
||||
#include <lwip/init.h>
|
||||
#include <lwip/netif.h>
|
||||
@@ -176,7 +174,6 @@ int LwipIntfDev<RawDev>::hostByName(const char* aHostname, IPAddress& aResult, i
|
||||
return 1;
|
||||
}
|
||||
|
||||
LWIPMutex m;
|
||||
_dns_cb_t cb = { &aResult, this };
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
err_t err = dns_gethostbyname_addrtype(aHostname, &addr, &_dns_found_callback, &cb, LWIP_DNS_ADDRTYPE_DEFAULT);
|
||||
@@ -230,8 +227,6 @@ int LwipIntfDev<RawDev>::ping(IPAddress host, uint8_t ttl, uint32_t _timeout) {
|
||||
auto ping_pcb = raw_new(IP_PROTO_ICMP);
|
||||
ping_pcb->ttl = ttl;
|
||||
|
||||
LWIPMutex m;
|
||||
|
||||
raw_recv(ping_pcb, _pingCB, this);
|
||||
raw_bind(ping_pcb, IP_ADDR_ANY);
|
||||
|
||||
@@ -256,7 +251,7 @@ int LwipIntfDev<RawDev>::ping(IPAddress host, uint8_t ttl, uint32_t _timeout) {
|
||||
uint32_t now = millis();
|
||||
while ((millis() - now < _timeout) && (_ping_ttl < 0)) {
|
||||
sys_check_timeouts();
|
||||
delay(10);
|
||||
delay(1);
|
||||
}
|
||||
pbuf_free(p);
|
||||
raw_remove(ping_pcb);
|
||||
@@ -408,6 +403,7 @@ void LwipIntfDev<RawDev>::end() {
|
||||
RawDev::end();
|
||||
netif_remove(&_netif);
|
||||
memset(&_netif, 0, sizeof(_netif));
|
||||
_started = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "framework-arduinopico",
|
||||
"version": "1.20600.0",
|
||||
"version": "1.20604.0",
|
||||
"description": "Arduino Wiring-based Framework (RPi Pico RP2040)",
|
||||
"keywords": [
|
||||
"framework",
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
{
|
||||
"name": "Adafruit Feather RP2040"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit Feather RP2040 SCORPIO"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit ItsyBitsy RP2040"
|
||||
},
|
||||
@@ -47,12 +50,21 @@
|
||||
{
|
||||
"name": "Arduino Nano RP2040 Connect"
|
||||
},
|
||||
{
|
||||
"name": "BridgeTek IDM2040-7A"
|
||||
},
|
||||
{
|
||||
"name": "Cytron Maker Nano RP2040"
|
||||
},
|
||||
{
|
||||
"name": "Cytron Maker Pi RP2040"
|
||||
},
|
||||
{
|
||||
"name": "DatanoiseTV PicoADK"
|
||||
},
|
||||
{
|
||||
"name": "Degz Mizu"
|
||||
},
|
||||
{
|
||||
"name": "DeRuiLab FlyBoard2040Core"
|
||||
},
|
||||
@@ -92,9 +104,15 @@
|
||||
{
|
||||
"name": "iLabs RPICO32"
|
||||
},
|
||||
{
|
||||
"name": "Melopero Cookie RP2040"
|
||||
},
|
||||
{
|
||||
"name": "Melopero Shake RP2040"
|
||||
},
|
||||
{
|
||||
"name": "Pimoroni PGA2040"
|
||||
},
|
||||
{
|
||||
"name": "Solder Party RP2040 Stamp"
|
||||
},
|
||||
@@ -110,6 +128,24 @@
|
||||
{
|
||||
"name": "Seeed XIAO RP2040"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 Zero"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 One"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 Plus 4MB"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 Plus 16MB"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 LCD 0.96"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 LCD 1.28"
|
||||
},
|
||||
{
|
||||
"name": "WIZnet W5100S-EVB-Pico"
|
||||
},
|
||||
|
||||
+15
-7
@@ -20,14 +20,14 @@
|
||||
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
|
||||
|
||||
name=Raspberry Pi RP2040 Boards
|
||||
version=2.6.0
|
||||
version=2.6.4
|
||||
|
||||
runtime.tools.pqt-gcc.path={runtime.platform.path}/system/arm-none-eabi
|
||||
runtime.tools.pqt-python3.path={runtime.platform.path}/system/python3
|
||||
runtime.tools.pqt-mklittlefs.path={runtime.platform.path}/system/mklittlefs
|
||||
runtime.tools.pqt-pioasm.path={runtime.platform.path}/system/pioasm
|
||||
runtime.tools.pqt-elf2uf2.path={runtime.platform.path}/system/elf2uf2
|
||||
|
||||
runtime.tools.pqt-openocd.path={runtime.platform.path}/system/openocd
|
||||
compiler.path={runtime.tools.pqt-gcc.path}/bin/
|
||||
|
||||
compiler.libraries.ldflags=
|
||||
@@ -96,6 +96,7 @@ build.libpico=libpico.a
|
||||
build.boot2=boot2_generic_03h_4_padded_checksum
|
||||
build.lwipdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1
|
||||
build.wificc=-DWIFICC=CYW43_COUNTRY_WORLDWIDE
|
||||
build.debugscript=picoprobe.tcl
|
||||
|
||||
# Allow Pico boards do be auto-discovered by the IDE
|
||||
#discovery.rp2040.pattern={runtime.tools.pqt-python3.path}/python3 -I "{runtime.platform.path}/tools/pluggable_discovery.py"
|
||||
@@ -152,11 +153,18 @@ recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build
|
||||
recipe.size.regex=^(?:\.boot2|\.text|\.rodata|\.ARM\.extab|\.ARM\.exidx)\s+([0-9]+).*
|
||||
recipe.size.regex.data=^(?:\.data|\.bss|\.ram_vector_table|\.uninitialized_data)\s+([0-9]+).*
|
||||
|
||||
upload.tool.uf2conv=uf2conv
|
||||
upload.tool.serial=uf2conv
|
||||
upload.tool.network=uf2conv-network
|
||||
upload.tool.picoprobe=picoprobe
|
||||
upload.tool.picodebug=picodebug
|
||||
|
||||
# Debugging
|
||||
debug.executable={build.path}/{build.project_name}.elf
|
||||
debug.toolchain=gcc
|
||||
debug.toolchain.path={runtime.tools.pqt-gcc.path}/bin/
|
||||
debug.toolchain.prefix=arm-none-eabi-
|
||||
debug.server=openocd
|
||||
debug.server.openocd.path={runtime.tools.pqt-openocd.path}/bin/openocd
|
||||
debug.server.openocd.scripts_dir={runtime.tools.pqt-openocd.path}/share/openocd/scripts/
|
||||
debug.server.openocd.script={runtime.platform.path}/lib/{build.debugscript}
|
||||
|
||||
|
||||
|
||||
tools.uf2conv.path=
|
||||
# Because the variable expansion doesn't allow one tool to find another, the following lines
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x239A",
|
||||
"usb_pid": "0x8121"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_ADAFRUIT_FEATHER_RP2040_SCORPIO -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x8121"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "adafruit_feather_scorpio"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Feather RP2040 SCORPIO",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 8388608,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Adafruit"
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2341",
|
||||
"usb_pid": "0x0058"
|
||||
"usb_pid": "0x005E"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
@@ -18,7 +18,7 @@
|
||||
],
|
||||
[
|
||||
"0x2341",
|
||||
"0x0058"
|
||||
"0x005E"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x1041"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_BRIDGETEK_IDM2040-7A -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DFT8XX_TYPE=BT817 -DDISPLAY_RES=WVGA -DPLATFORM_RP2040",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x1041"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "bridgetek_idm2040-7a"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "IDM2040-7A",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 8388608,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "BridgeTek"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x000A"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_DATANOISETV_PICOADK -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x000A"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "datanoisetv_picoadk"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "PicoADK",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 2097152,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "DatanoiseTV"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_generic_03h_4_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x000A"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_DEGZ_MIZU -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x000A"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "degz_mizu"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Mizu",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 8388608,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Degz"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x1037"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_ELECTRONICCATS_HUNTERCAT_NFC -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x1037"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "electroniccats_huntercat_nfc"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "HunterCat NFC RP2040",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 2097152,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "ElectronicCats"
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_generic_03h_4_padded_checksum.S",
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x008A"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x1011"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_MELOPERO_COOKIE_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x1011"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "melopero_cookie_rp2040"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Cookie RP2040",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 8388608,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Melopero"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q64jv_4_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x1008"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_PIMORONI_PGA2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x1008"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "pimoroni_pga2040"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "PGA2040",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 8388608,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Pimoroni"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q16jvxq_4_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x0003"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-D ARDUINO_WAVESHARE_RP2040_ZERO -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x0003"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "waveshare_rp2040_zero"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "RP2040 Zero",
|
||||
"upload": {
|
||||
"maximum_ram_size": 270336,
|
||||
"maximum_size": 2097152,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Waveshare"
|
||||
}
|
||||
@@ -97,6 +97,6 @@ target_link_libraries(pico
|
||||
)
|
||||
|
||||
add_custom_command(TARGET pico POST_BUILD
|
||||
COMMAND ar d libpico.a stdio.c.obj stdio_usb.c.obj stdio_usb_descriptors.c.obj cyw43_arch_threadsafe_background.c.obj
|
||||
COMMAND ar d libpico.a stdio.c.obj stdio_usb.c.obj stdio_usb_descriptors.c.obj cyw43_arch_threadsafe_background.c.obj pico_malloc.c.obj
|
||||
COMMAND ar q libpico.a pico-sdk/src/rp2_common/cyw43_driver/cyw43_resource.o
|
||||
)
|
||||
|
||||
+62
-21
@@ -69,7 +69,8 @@ def BuildBoot(name):
|
||||
for l in [ ("Generic SPI /2", "boot2_generic_03h_2_padded_checksum"), ("Generic SPI /4", "boot2_generic_03h_4_padded_checksum"),
|
||||
("IS25LP080 QSPI /2", "boot2_is25lp080_2_padded_checksum"), ("IS25LP080 QSPI /4", "boot2_is25lp080_4_padded_checksum"),
|
||||
("W25Q080 QSPI /2", "boot2_w25q080_2_padded_checksum"), ("W25Q080 QSPI /4", "boot2_w25q080_4_padded_checksum"),
|
||||
("W25X10CL QSPI /2", "boot2_w25x10cl_2_padded_checksum"), ("W25X10CL QSPI /4", "boot2_w25x10cl_4_padded_checksum") ]:
|
||||
("W25X10CL QSPI /2", "boot2_w25x10cl_2_padded_checksum"), ("W25X10CL QSPI /4", "boot2_w25x10cl_4_padded_checksum"),
|
||||
("W25Q64JV QSPI /4", "boot2_w25q64jv_4_padded_checksum"), ("W25Q16JVxQ QSPI /4", "boot2_w25q16jvxq_4_padded_checksum") ]:
|
||||
print("%s.menu.boot2.%s=%s" % (name, l[1], l[0]))
|
||||
print("%s.menu.boot2.%s.build.boot2=%s" % (name, l[1], l[1]))
|
||||
|
||||
@@ -102,27 +103,39 @@ def BuildIPStack(name):
|
||||
print('%s.menu.ipstack.ipv4ipv6.build.libpico=libpico-ipv6.a' % (name))
|
||||
print('%s.menu.ipstack.ipv4ipv6.build.lwipdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1' % (name))
|
||||
|
||||
def BuildHeader(name, vendor_name, product_name, vidtouse, pidtouse, vid, pid, pwr, boarddefine, variant, uploadtool, flashsize, ramsize, boot2, extra):
|
||||
def BuildHeader(name, vendor_name, product_name, vidtouse, pidtouse, vid, pid, pwr, boarddefine, variant, uploadtool, networkuploadtool, flashsize, ramsize, boot2, dbg, extra):
|
||||
prettyname = vendor_name + " " + product_name
|
||||
print()
|
||||
print("# -----------------------------------")
|
||||
print("# %s" % (prettyname))
|
||||
print("# -----------------------------------")
|
||||
print("%s.name=%s" % (name, prettyname))
|
||||
usb = 0;
|
||||
for kb in [ "0", "0x8000" ]:
|
||||
for ms in [ "0", "0x4000" ]:
|
||||
for jy in [ "0", "0x0100" ]:
|
||||
thispid = int(pidtouse, 16) | int(kb, 16) | int(ms, 16) | int(jy, 16)
|
||||
print("%s.vid.%d=%s" % (name, usb, vidtouse))
|
||||
print("%s.pid.%d=0x%04x" % (name, usb, thispid))
|
||||
usb = usb + 1
|
||||
print("%s.build.usbpid=-DSERIALUSB_PID=%s" % (name, pid))
|
||||
usb = 0
|
||||
if type(pidtouse) == list:
|
||||
for tp in pid:
|
||||
print("%s.vid.%d=%s" % (name, usb, vidtouse))
|
||||
print("%s.pid.%d=0x%04x" % (name, usb, int(tp, 16)))
|
||||
usb = usb + 1
|
||||
else:
|
||||
for kb in [ "0", "0x8000" ]:
|
||||
for ms in [ "0", "0x4000" ]:
|
||||
for jy in [ "0", "0x0100" ]:
|
||||
thispid = int(pidtouse, 16) | int(kb, 16) | int(ms, 16) | int(jy, 16)
|
||||
print("%s.vid.%d=%s" % (name, usb, vidtouse))
|
||||
print("%s.pid.%d=0x%04x" % (name, usb, thispid))
|
||||
usb = usb + 1
|
||||
if type(pid) == list:
|
||||
print("%s.build.usbpid=-DSERIALUSB_PID=%s" % (name, pid[0]))
|
||||
else:
|
||||
print("%s.build.usbpid=-DSERIALUSB_PID=%s" % (name, pid))
|
||||
print("%s.build.usbpwr=-DUSBD_MAX_POWER_MA=%s" % (name, pwr))
|
||||
print("%s.build.board=%s" % (name, boarddefine))
|
||||
print("%s.build.mcu=cortex-m0plus" % (name))
|
||||
print("%s.build.variant=%s" % (name, variant))
|
||||
print("%s.upload.tool=%s" % (name, uploadtool))
|
||||
print("%s.upload.tool.default=%s" % (name, uploadtool))
|
||||
if networkuploadtool != None:
|
||||
print("%s.upload.tool.network=%s" % (name, networkuploadtool))
|
||||
print("%s.upload.maximum_size=%d" % (name, flashsize))
|
||||
print("%s.upload.maximum_data_size=%d" % (name, ramsize))
|
||||
print("%s.upload.wait_for_upload_port=true" % (name))
|
||||
@@ -134,9 +147,13 @@ def BuildHeader(name, vendor_name, product_name, vidtouse, pidtouse, vid, pid, p
|
||||
print("%s.build.core=rp2040" % (name))
|
||||
print("%s.build.ldscript=memmap_default.ld" % (name))
|
||||
print("%s.build.ram_length=%dk" % (name, ramsize / 1024))
|
||||
print("%s.build.debugscript=%s" % (name, dbg))
|
||||
print("%s.build.boot2=%s" % (name, boot2))
|
||||
print("%s.build.vid=%s" % (name, vid))
|
||||
print("%s.build.pid=%s" % (name, pid))
|
||||
if type(pid) == list:
|
||||
print("%s.build.pid=%s" % (name, pid[0]))
|
||||
else:
|
||||
print("%s.build.pid=%s" % (name, pid))
|
||||
print('%s.build.usb_manufacturer="%s"' % (name, vendor_name))
|
||||
print('%s.build.usb_product="%s"' % (name, product_name))
|
||||
if extra != None:
|
||||
@@ -167,7 +184,7 @@ def BuildGlobalMenuList():
|
||||
print("menu.ipstack=IP Stack")
|
||||
|
||||
def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra = None):
|
||||
for a, b, c in [ ["", "", "uf2conv"], ["picoprobe", " (Picoprobe)", "picoprobe"], ["picodebug", " (pico-debug)", "picodebug"]]:
|
||||
for a, b, c, d in [ ["", "", "uf2conv", "uf2conv-network"], ["picoprobe", " (Picoprobe)", "picoprobe", None], ["picodebug", " (pico-debug)", "picodebug", None]]:
|
||||
n = name + a
|
||||
p = product_name + b
|
||||
fssizelist = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ]
|
||||
@@ -175,15 +192,17 @@ def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flash
|
||||
fssizelist.append(i * 1024 * 1024)
|
||||
vidtouse = vid;
|
||||
ramsizekb = 256;
|
||||
dbg = "picoprobe.tcl"
|
||||
if a == "picoprobe":
|
||||
pidtouse = '0x0004'
|
||||
elif a == "picodebug":
|
||||
vidtouse = '0x1209'
|
||||
pidtouse = '0x2488'
|
||||
ramsizekb = 240;
|
||||
dbg = "picodebug.tcl"
|
||||
else:
|
||||
pidtouse = pid
|
||||
BuildHeader(n, vendor_name, p, vidtouse, pidtouse, vid, pid, pwr, boarddefine, name, c, flashsizemb * 1024 * 1024, ramsizekb * 1024, boot2, extra)
|
||||
BuildHeader(n, vendor_name, p, vidtouse, pidtouse, vid, pid, pwr, boarddefine, name, c, d, flashsizemb * 1024 * 1024, ramsizekb * 1024, boot2, dbg, extra)
|
||||
if name == "generic":
|
||||
BuildFlashMenu(n, 2*1024*1024, [0, 1*1024*1024])
|
||||
BuildFlashMenu(n, 4*1024*1024, [0, 2*1024*1024])
|
||||
@@ -198,10 +217,9 @@ def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flash
|
||||
BuildExceptions(n)
|
||||
BuildDebugPort(n)
|
||||
BuildDebugLevel(n)
|
||||
if a == "picodebug":
|
||||
BuildWithoutUSBStack(n)
|
||||
else:
|
||||
if a != "picodebug":
|
||||
BuildUSBStack(n)
|
||||
BuildWithoutUSBStack(n)
|
||||
if name == "rpipicow":
|
||||
BuildCountry(n)
|
||||
BuildIPStack(n)
|
||||
@@ -214,6 +232,8 @@ def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flash
|
||||
pkgjson['packages'][0]['platforms'][0]['boards'].append(thisbrd)
|
||||
|
||||
def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra):
|
||||
if type(pid) == list:
|
||||
pid = pid[0]
|
||||
if extra != None:
|
||||
m_extra = ' '
|
||||
for m_item in extra:
|
||||
@@ -306,6 +326,7 @@ MakeBoard("rpipicow", "Raspberry Pi", "Pico W", "0x2e8a", "0xf00a", 250, "RASPBE
|
||||
|
||||
# Adafruit
|
||||
MakeBoard("adafruit_feather", "Adafruit", "Feather RP2040", "0x239a", "0x80f1", 250, "ADAFRUIT_FEATHER_RP2040", 8, "boot2_w25x10cl_4_padded_checksum")
|
||||
MakeBoard("adafruit_feather_scorpio", "Adafruit", "Feather RP2040 SCORPIO", "0x239a", "0x8121", 250, "ADAFRUIT_FEATHER_RP2040_SCORPIO", 8, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("adafruit_itsybitsy", "Adafruit", "ItsyBitsy RP2040", "0x239a", "0x80fd", 250, "ADAFRUIT_ITSYBITSY_RP2040", 8, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("adafruit_qtpy", "Adafruit", "QT Py RP2040", "0x239a", "0x80f7", 250, "ADAFRUIT_QTPY_RP2040", 8, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("adafruit_stemmafriend", "Adafruit", "STEMMA Friend RP2040", "0x239a", "0x80e3", 250, "ADAFRUIT_STEMMAFRIEND_RP2040", 8, "boot2_w25q080_2_padded_checksum")
|
||||
@@ -314,20 +335,29 @@ MakeBoard("adafruit_macropad2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8
|
||||
MakeBoard("adafruit_kb2040", "Adafruit", "KB2040", "0x239a", "0x8105", 250, "ADAFRUIT_KB2040_RP2040", 8, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Arduino
|
||||
MakeBoard("arduino_nano_connect", "Arduino", "Nano RP2040 Connect", "0x2341", "0x0058", 250, "NANO_RP2040_CONNECT", 16, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("arduino_nano_connect", "Arduino", "Nano RP2040 Connect", "0x2341", ["0x005e", "0x805e", "0x015e", "0x025e"] , 250, "NANO_RP2040_CONNECT", 16, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# BridgeTek
|
||||
MakeBoard("bridgetek_idm2040-7a", "BridgeTek", "IDM2040-7A", "0x2e8a", "0x1041", 250, "BRIDGETEK_IDM2040-7A", 8, "boot2_w25q080_2_padded_checksum", ["FT8XX_TYPE=BT817", "DISPLAY_RES=WVGA", "PLATFORM_RP2040"])
|
||||
|
||||
# Cytron
|
||||
MakeBoard("cytron_maker_nano_rp2040", "Cytron", "Maker Nano RP2040", "0x2e8a", "0x100f", 250, "CYTRON_MAKER_NANO_RP2040", 2, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("cytron_maker_pi_rp2040", "Cytron", "Maker Pi RP2040", "0x2e8a", "0x1000", 250, "CYTRON_MAKER_PI_RP2040", 2, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# DatanoiseTV
|
||||
MakeBoard("datanoisetv_picoadk", "DatanoiseTV", "PicoADK", "0x2e8a", "0x000a", 250, "DATANOISETV_PICOADK", 2, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Degz
|
||||
MakeBoard("degz_mizu", "Degz", "Mizu", "0x2e8a", "0x000a", 250, "DEGZ_MIZU", 8, "boot2_generic_03h_4_padded_checksum")
|
||||
|
||||
# DeRuiLab
|
||||
MakeBoard("flyboard2040_core", "DeRuiLab", "FlyBoard2040Core", "0x2e8a", "0x008a", 500, "FLYBOARD2040_CORE", 4, "boot2_generic_03h_4_padded_checksum")
|
||||
MakeBoard("flyboard2040_core", "DeRuiLab", "FlyBoard2040Core", "0x2e8a", "0x008a", 500, "FLYBOARD2040_CORE", 4, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# DFRobot
|
||||
MakeBoard("dfrobot_beetle_rp2040", "DFRobot", "Beetle RP2040", "0x3343", "0x4253", 250, "DFROBOT_BEETLE_RP2040", 2, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# ElectronicCat
|
||||
MakeBoard("electroniccats_bombercat", "ElectronicCats", "HunterCat NFC RP2040", "0x1209", "0x1209", 500, "ELECTRONICCATS_BOMBERCAT", 2, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("electroniccats_huntercat_nfc", "ElectronicCats", "HunterCat NFC RP2040", "0x2E8A", "0x1037", 500, "ELECTRONICCATS_HUNTERCAT_NFC", 2, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# ExtremeElectronics
|
||||
MakeBoard("extelec_rc2040", "ExtremeElectronics", "RC2040", "0x2e8a", "0xee20", 250, "EXTREMEELEXTRONICS_RC2040", 2, "boot2_w25q080_2_padded_checksum")
|
||||
@@ -343,9 +373,13 @@ MakeBoard("challenger_2040_sdrtc", "iLabs", "Challenger 2040 SD/RTC", "0x2e8a",
|
||||
MakeBoard("challenger_2040_nfc", "iLabs", "Challenger 2040 NFC", "0x2e8a", "0x1036", 250, "CHALLENGER_NB_2040_NFC_RP2040", 8, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("ilabs_rpico32", "iLabs", "RPICO32", "0x2e8a", "0x1010", 250, "ILABS_2040_RPICO32_RP2040", 8, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Melopera
|
||||
# Melopero
|
||||
MakeBoard("melopero_cookie_rp2040", "Melopero", "Cookie RP2040", "0x2e8a", "0x1011", 250, "MELOPERO_COOKIE_RP2040", 8, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("melopero_shake_rp2040", "Melopero", "Shake RP2040", "0x2e8a", "0x1005", 250, "MELOPERO_SHAKE_RP2040", 16, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Pimoroni
|
||||
MakeBoard("pimoroni_pga2040", "Pimoroni", "PGA2040", "0x2e8a", "0x1008", 250, "PIMORONI_PGA2040", 8, "boot2_w25q64jv_4_padded_checksum")
|
||||
|
||||
# Solder Party
|
||||
MakeBoard("solderparty_rp2040_stamp", "Solder Party", "RP2040 Stamp", "0x1209", "0xa182", 500, "SOLDERPARTY_RP2040_STAMP", 8, "boot2_generic_03h_4_padded_checksum")
|
||||
|
||||
@@ -359,6 +393,13 @@ MakeBoard("upesy_rp2040_devkit", "uPesy", "RP2040 DevKit", "0x2e8a", "0x1007", 2
|
||||
# Seeed
|
||||
MakeBoard("seeed_xiao_rp2040", "Seeed", "XIAO RP2040", "0x2e8a", "0x000a", 250, "SEEED_XIAO_RP2040", 2, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Waveshare
|
||||
MakeBoard("waveshare_rp2040_zero", "Waveshare", "RP2040 Zero", "0x2e8a", "0x0003", 500, "WAVESHARE_RP2040_ZERO", 2, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_one", "Waveshare", "RP2040 One", "0x2e8a", "0x103a", 500, "WAVESHARE_RP2040_ONE", 4, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_plus_4mb", "Waveshare", "RP2040 Plus 4MB", "0x2e8a", "0x1020", 500, "WAVESHARE_RP2040_PLUS", 4, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_plus_16mb", "Waveshare", "RP2040 Plus 16MB", "0x2e8a", "0x1020", 500, "WAVESHARE_RP2040_PLUS", 16, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_lcd_0_96", "Waveshare", "RP2040 LCD 0.96", "0x2e8a", "0x1021", 500, "WAVESHARE_RP2040_LCD_0_96", 2, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_lcd_1_28", "Waveshare", "RP2040 LCD 1.28", "0x2e8a", "0x1039", 500, "WAVESHARE_RP2040_LCD_1_28", 2, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
# WIZnet
|
||||
MakeBoard("wiznet_5100s_evb_pico", "WIZnet", "W5100S-EVB-Pico", "0x2e8a", "0x1027", 250, "WIZNET_5100S_EVB_PICO", 2, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("wiznet_wizfi360_evb_pico", "WIZnet", "WizFi360-EVB-Pico", "0x2e8a", "0x1028", 250, "WIZNET_WIZFI360_EVB_PICO", 2, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
// Pin definitions taken from:
|
||||
// https://learn.adafruit.com/assets/100337
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (13u)
|
||||
|
||||
// NeoPixel
|
||||
#define PIN_NEOPIXEL (4u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
// Not pinned out
|
||||
#define PIN_SERIAL2_TX (31u)
|
||||
#define PIN_SERIAL2_RX (31u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (8u)
|
||||
#define PIN_SPI0_MOSI (15u)
|
||||
#define PIN_SPI0_SCK (14u)
|
||||
#define PIN_SPI0_SS (13u)
|
||||
|
||||
// Not pinned out
|
||||
#define PIN_SPI1_MISO (31u)
|
||||
#define PIN_SPI1_MOSI (31u)
|
||||
#define PIN_SPI1_SCK (31u)
|
||||
#define PIN_SPI1_SS (31u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (2u)
|
||||
#define PIN_WIRE0_SCL (3u)
|
||||
#define PIN_WIRE1_SDA (31u)
|
||||
#define PIN_WIRE1_SCL (31u)
|
||||
|
||||
#define SERIAL_HOWMANY (2u)
|
||||
#define SPI_HOWMANY (1u)
|
||||
#define WIRE_HOWMANY (1u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
// Pin definitions taken from:
|
||||
// https://brtchip.com/ic-module/wp-content/uploads/sites/3/2022/07/DS_IDM2040-7A-Revised.pdf
|
||||
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (25u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (4u)
|
||||
#define PIN_SPI0_MOSI (3u)
|
||||
#define PIN_SPI0_SCK (2u)
|
||||
#define PIN_SPI0_SS (5u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (11u)
|
||||
#define PIN_SPI1_SCK (10u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// default spi
|
||||
#define PIN_SD_MOSI PIN_SPI1_MOSI
|
||||
#define PIN_SD_MISO PIN_SPI1_MISO
|
||||
#define PIN_SD_SCK PIN_SPI1_SCK
|
||||
#define PIN_SD_SS PIN_SPI1_SS
|
||||
#define SDCARD_DETECT 33
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (4u)
|
||||
#define PIN_WIRE0_SCL (5u)
|
||||
|
||||
#define PIN_WIRE1_SDA (26u)
|
||||
#define PIN_WIRE1_SCL (27u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
// DatanoiseTV PicoADK+ - Audio Development Kit
|
||||
// Pin definitions taken from:
|
||||
// https://github.com/DatanoiseTV/PicoDSP-Hardware
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (15u)
|
||||
|
||||
// Debug LEDs near the USB connector
|
||||
#define PIN_LED0 (2u)
|
||||
#define PIN_LED1 (3u)
|
||||
#define PIN_LED2 (4u)
|
||||
#define PIN_LED3 (5u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI0
|
||||
#define PIN_SPI0_MISO (16u)
|
||||
#define PIN_SPI0_MOSI (19u)
|
||||
#define PIN_SPI0_SCK (18u)
|
||||
#define PIN_SPI0_SS (17u)
|
||||
|
||||
// SPI1
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (11u)
|
||||
#define PIN_SPI1_SCK (10u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (8u)
|
||||
#define PIN_WIRE0_SCL (9u)
|
||||
|
||||
#define PIN_WIRE1_SDA (6u)
|
||||
#define PIN_WIRE1_SCL (7u)
|
||||
|
||||
// I2S
|
||||
#define PIN_I2S_BCLK (17u)
|
||||
#define PIN_I2S_LRCLK (18u)
|
||||
#define PIN_I2S_DOUT (16u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
// Pin definitions taken from:
|
||||
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
|
||||
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (25u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (16u)
|
||||
#define PIN_SPI0_MOSI (7u)
|
||||
#define PIN_SPI0_SCK (6u)
|
||||
#define PIN_SPI0_SS (17u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (11u)
|
||||
#define PIN_SPI1_SCK (10u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (4u)
|
||||
#define PIN_WIRE0_SCL (5u)
|
||||
|
||||
#define PIN_WIRE1_SDA (2u)
|
||||
#define PIN_WIRE1_SCL (3u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -27,8 +27,8 @@
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (6u)
|
||||
#define PIN_WIRE0_SCL (7u)
|
||||
#define PIN_WIRE0_SDA (16u)
|
||||
#define PIN_WIRE0_SCL (17u)
|
||||
|
||||
#define PIN_WIRE1_SDA (14u)
|
||||
#define PIN_WIRE1_SCL (15u)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
// Pin definitions taken from:
|
||||
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
|
||||
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (21u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
//Serial 2 not pinned out
|
||||
#define PIN_SERIAL2_TX (31u)
|
||||
#define PIN_SERIAL2_RX (31u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (20u)
|
||||
#define PIN_SPI0_MOSI (19u)
|
||||
#define PIN_SPI0_SCK (18u)
|
||||
#define PIN_SPI0_SS (1u)
|
||||
|
||||
#define PIN_SPI1_MISO (28u)
|
||||
#define PIN_SPI1_MOSI (27u)
|
||||
#define PIN_SPI1_SCK (26u)
|
||||
#define PIN_SPI1_SS (29u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (12u)
|
||||
#define PIN_WIRE0_SCL (13u)
|
||||
|
||||
#define PIN_WIRE1_SDA (2u)
|
||||
#define PIN_WIRE1_SCL (3u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// This is a bare board with no real predefined pins, so use generic
|
||||
|
||||
#include "../generic/pins_arduino.h"
|
||||
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2040 lcd 0.96
|
||||
// https://www.waveshare.com/wiki/RP2040-LCD-0.96
|
||||
// https://www.waveshare.com/w/upload/0/01/RP2040-LCD-0.96.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2040-LCD-0.96/RP2040-LCD-0.96-details-7.jpg
|
||||
//
|
||||
|
||||
/*
|
||||
Pin# Pin#
|
||||
___(_____)___
|
||||
GPIO0 1 | *USB C* | 40 VBUS
|
||||
GPIO1 2 | | 39 VSYS
|
||||
GND 3 | | 38 GND
|
||||
GPIO2 4 | | 37 3V3_EN
|
||||
GPIO3 5 | | 36 3V3(OUT)
|
||||
GPIO4 6 | | 35 ADC_VREF
|
||||
GPIO5 7 | | 34 GPIO28
|
||||
GND 8 | | 33 GND
|
||||
GPIO6 9 | | 32 GPIO27
|
||||
GPIO7 10 | | 31 GPIO26
|
||||
GPIO8 11 | | 30 RUN
|
||||
GPIO9 12 | | 29 GPIO22
|
||||
GND 13 | | 28 GND
|
||||
GPIO10 14 | | 27 GPIO21
|
||||
GPIO11 15 | | 25 GPIO20
|
||||
GPIO12 16 | | 25 GPIO19
|
||||
GPIO13 17 | | 24 GPIO18
|
||||
GND 18 | | 23 GND
|
||||
GPIO14 19 | | 22 GPIO17
|
||||
GPIO15 20 |____|_|_|____| 21 GPIO16
|
||||
S G S
|
||||
W N W
|
||||
C D D
|
||||
L I
|
||||
K N
|
||||
*/
|
||||
|
||||
// LCD
|
||||
#define LDC_SPI (1u)
|
||||
#define PIN_LCD_DC (8u)
|
||||
#define PIN_LCD_CS (9u)
|
||||
#define PIN_LCD_SCLK (10u)
|
||||
#define PIN_LCD_MOSI (11u)
|
||||
#define PIN_LCD_RST (12u)
|
||||
#define PIN_LCD_BL (25u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (16u)
|
||||
#define PIN_SPI0_MOSI (19u)
|
||||
#define PIN_SPI0_SCK (18u)
|
||||
#define PIN_SPI0_SS (17u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (15u)
|
||||
#define PIN_SPI1_SCK (14u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (8u)
|
||||
#define PIN_WIRE0_SCL (9u)
|
||||
|
||||
#define PIN_WIRE1_SDA (6u)
|
||||
#define PIN_WIRE1_SCL (7u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2040 LCD 1.28
|
||||
// https://www.waveshare.com/wiki/RP2040-LCD-1.28
|
||||
// https://www.waveshare.com/w/upload/6/60/RP2040-LCD-1.28-sch.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2040-LCD-1.28/RP2040-LCD-1.28-details-3.jpg
|
||||
//
|
||||
|
||||
/*
|
||||
H1 H2
|
||||
Pin# Pin# Pin# Pin#
|
||||
GPIO8 1 2 GPIO0 GND 1 2 GND
|
||||
GPIO9 3 4 GPIO1 VSYS 3 4 ADC_AVDD
|
||||
GPIO10 5 6 GPIO2 GPIO23 5 6 BOOT
|
||||
GPIO11 7 8 GPIO3 GPIO22 7 8 RUM
|
||||
GPIO12 9 10 GPIO4 GPIO21 9 10 GPIO29
|
||||
GPIO13 11 12 GPIO5 GPIO20 11 12 GPIO28
|
||||
GPIO14 13 14 GPIO6 GPIO19 13 14 GPIO27
|
||||
GPIO15 15 16 GPIO7 GPIO18 15 16 GPIO26
|
||||
SWCLK 17 18 VSYS GPIO17 17 18 GPIO25
|
||||
SWDIP 19 20 GND GPIO16 19 20 GPIO24
|
||||
*/
|
||||
|
||||
// LCD
|
||||
#define LDC_SPI (1u)
|
||||
#define PIN_LCD_DC (8u)
|
||||
#define PIN_LCD_CS (9u)
|
||||
#define PIN_LCD_SCLK (10u)
|
||||
#define PIN_LCD_MOSI (11u)
|
||||
#define PIN_LCD_RST (12u)
|
||||
#define PIN_LCD_BL (25u)
|
||||
// BAT_ADC
|
||||
#define PIN_BAT_ADC (25u)
|
||||
// IMU
|
||||
#define PIN_IMU_SDA (6u)
|
||||
#define PIN_IMU_SCL (7u)
|
||||
#define PIN_IMU_INT1 (23u)
|
||||
#define PIN_IMU_INT2 (24u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (16u)
|
||||
#define PIN_SPI0_MOSI (19u)
|
||||
#define PIN_SPI0_SCK (18u)
|
||||
#define PIN_SPI0_SS (17u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (15u)
|
||||
#define PIN_SPI1_SCK (14u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (8u)
|
||||
#define PIN_WIRE0_SCL (9u)
|
||||
|
||||
#define PIN_WIRE1_SDA (6u)
|
||||
#define PIN_WIRE1_SCL (7u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2040 One
|
||||
// https://www.waveshare.com/wiki/RP2040-One
|
||||
// https://www.waveshare.com/w/upload/9/90/RP2040-One.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2040-One/RP2040-One-details-9.jpg
|
||||
|
||||
/*
|
||||
Pin# Pin#
|
||||
_____
|
||||
|USB A|
|
||||
___| |___
|
||||
5v 1 | | 23 GPIO0
|
||||
GND 2 | | 22 GPIO1
|
||||
3.3v 3 | | 21 GPIO2
|
||||
GPIO29 4 | | 20 GPIO3
|
||||
GPIO28 5 | | 19 GPIO4
|
||||
GPIO27 6 | | 18 GPIO5
|
||||
GPIO26 7 | | 17 GPIO6
|
||||
GPIO15 8 | | 16 GPIO7
|
||||
GPIO14 9 |__|_|_|_|_|__| 15 GPIO8
|
||||
1 1 1 1 1
|
||||
0 1 2 3 4
|
||||
|
||||
Pin10 = GPIO13
|
||||
Pin11 = GPIO12
|
||||
Pin12 = GPIO11
|
||||
Pin13 = GPIO10
|
||||
Pin14 = GPIO9
|
||||
*/
|
||||
|
||||
// NeoPixel
|
||||
#define PIN_NEOPIXEL (16u)
|
||||
//#define LED_BUILTIN PIN_NEOPIXEL
|
||||
|
||||
// Serial1
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (4u)
|
||||
#define PIN_SPI0_MOSI (3u)
|
||||
#define PIN_SPI0_SCK (2u)
|
||||
#define PIN_SPI0_SS (5u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (15u)
|
||||
#define PIN_SPI1_SCK (14u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (4u)
|
||||
#define PIN_WIRE0_SCL (5u)
|
||||
|
||||
#define PIN_WIRE1_SDA (26u)
|
||||
#define PIN_WIRE1_SCL (27u)
|
||||
|
||||
#define SERIAL_HOWMANY (2u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2040 Plus
|
||||
// https://www.waveshare.com/wiki/RP2040-Plus
|
||||
// https://www.waveshare.com/w/upload/d/d1/RP2040_Plus.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2040-Plus/RP2040-Plus-details-7.jpg
|
||||
//
|
||||
|
||||
/*
|
||||
Pin# Pin#
|
||||
___(_____)___
|
||||
GPIO0 1 | *USB C* | 40 VBUS
|
||||
GPIO1 2 | | 39 VSYS
|
||||
GND 3 | | 38 GND
|
||||
GPIO2 4 | | 37 3V3_EN
|
||||
GPIO3 5 | | 36 3V3(OUT)
|
||||
GPIO4 6 | | 35 ADC_VREF
|
||||
GPIO5 7 | | 34 GPIO28
|
||||
GND 8 | | 33 GND
|
||||
GPIO6 9 | | 32 GPIO27
|
||||
GPIO7 10 | | 31 GPIO26
|
||||
GPIO8 11 | | 30 RUN
|
||||
GPIO9 12 | | 29 GPIO22
|
||||
GND 13 | | 28 GND
|
||||
GPIO10 14 | | 27 GPIO21
|
||||
GPIO11 15 | | 25 GPIO20
|
||||
GPIO12 16 | | 25 GPIO19
|
||||
GPIO13 17 | | 24 GPIO18
|
||||
GND 18 | | 23 GND
|
||||
GPIO14 19 | | 22 GPIO17
|
||||
GPIO15 20 |____|_|_|____| 21 GPIO16
|
||||
S G S
|
||||
W N W
|
||||
C D D
|
||||
L I
|
||||
K N
|
||||
*/
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (25u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (16u)
|
||||
#define PIN_SPI0_MOSI (19u)
|
||||
#define PIN_SPI0_SCK (18u)
|
||||
#define PIN_SPI0_SS (17u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (15u)
|
||||
#define PIN_SPI1_SCK (14u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (8u)
|
||||
#define PIN_WIRE0_SCL (9u)
|
||||
|
||||
#define PIN_WIRE1_SDA (6u)
|
||||
#define PIN_WIRE1_SCL (7u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2040 Plus
|
||||
// https://www.waveshare.com/wiki/RP2040-Plus
|
||||
// https://www.waveshare.com/w/upload/d/d1/RP2040_Plus.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2040-Plus/RP2040-Plus-details-7.jpg
|
||||
//
|
||||
|
||||
/*
|
||||
Pin# Pin#
|
||||
___(_____)___
|
||||
GPIO0 1 | *USB C* | 40 VBUS
|
||||
GPIO1 2 | | 39 VSYS
|
||||
GND 3 | | 38 GND
|
||||
GPIO2 4 | | 37 3V3_EN
|
||||
GPIO3 5 | | 36 3V3(OUT)
|
||||
GPIO4 6 | | 35 ADC_VREF
|
||||
GPIO5 7 | | 34 GPIO28
|
||||
GND 8 | | 33 GND
|
||||
GPIO6 9 | | 32 GPIO27
|
||||
GPIO7 10 | | 31 GPIO26
|
||||
GPIO8 11 | | 30 RUN
|
||||
GPIO9 12 | | 29 GPIO22
|
||||
GND 13 | | 28 GND
|
||||
GPIO10 14 | | 27 GPIO21
|
||||
GPIO11 15 | | 25 GPIO20
|
||||
GPIO12 16 | | 25 GPIO19
|
||||
GPIO13 17 | | 24 GPIO18
|
||||
GND 18 | | 23 GND
|
||||
GPIO14 19 | | 22 GPIO17
|
||||
GPIO15 20 |____|_|_|____| 21 GPIO16
|
||||
S G S
|
||||
W N W
|
||||
C D D
|
||||
L I
|
||||
K N
|
||||
*/
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (25u)
|
||||
|
||||
// Serial
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (16u)
|
||||
#define PIN_SPI0_MOSI (19u)
|
||||
#define PIN_SPI0_SCK (18u)
|
||||
#define PIN_SPI0_SS (17u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (15u)
|
||||
#define PIN_SPI1_SCK (14u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (8u)
|
||||
#define PIN_WIRE0_SCL (9u)
|
||||
|
||||
#define PIN_WIRE1_SDA (6u)
|
||||
#define PIN_WIRE1_SCL (7u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2040 Zero
|
||||
// https://www.waveshare.com/wiki/RP2040-Zero
|
||||
// https://www.waveshare.com/w/upload/4/4c/RP2040_Zero.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2040-Zero/RP2040-Zero-details-7.jpg
|
||||
//
|
||||
// https://www.mischianti.org/2022/09/19/waveshare-rp2040-zero-high-resolution-pinout-and-specs/
|
||||
// https://www.mischianti.org/wp-content/uploads/2022/09/Waveshare-rp2040-zero-Raspberry-Pi-Pico-alternative-pinout.jpg
|
||||
|
||||
/*
|
||||
Pin# Pin#
|
||||
___(_____)___
|
||||
5v 1 | *USB C* | 23 GPIO0
|
||||
GND 2 | | 22 GPIO1
|
||||
3.3v 3 | | 21 GPIO2
|
||||
GPIO29 4 | | 20 GPIO3
|
||||
GPIO28 5 | | 19 GPIO4
|
||||
GPIO27 6 | | 18 GPIO5
|
||||
GPIO26 7 | | 17 GPIO6
|
||||
GPIO15 8 | | 16 GPIO7
|
||||
GPIO14 9 |__|_|_|_|_|__| 15 GPIO8
|
||||
1 1 1 1 1
|
||||
0 1 2 3 4
|
||||
|
||||
Pin10 = GPIO13
|
||||
Pin11 = GPIO12
|
||||
Pin12 = GPIO11
|
||||
Pin13 = GPIO10
|
||||
Pin14 = GPIO9
|
||||
*/
|
||||
|
||||
// NeoPixel
|
||||
#define PIN_NEOPIXEL (16u)
|
||||
//#define LED_BUILTIN PIN_NEOPIXEL
|
||||
|
||||
// Serial1
|
||||
#define PIN_SERIAL1_TX (0u)
|
||||
#define PIN_SERIAL1_RX (1u)
|
||||
|
||||
#define PIN_SERIAL2_TX (8u)
|
||||
#define PIN_SERIAL2_RX (9u)
|
||||
|
||||
// SPI
|
||||
#define PIN_SPI0_MISO (4u)
|
||||
#define PIN_SPI0_MOSI (3u)
|
||||
#define PIN_SPI0_SCK (2u)
|
||||
#define PIN_SPI0_SS (5u)
|
||||
|
||||
#define PIN_SPI1_MISO (12u)
|
||||
#define PIN_SPI1_MOSI (15u)
|
||||
#define PIN_SPI1_SCK (14u)
|
||||
#define PIN_SPI1_SS (13u)
|
||||
|
||||
// Wire
|
||||
#define PIN_WIRE0_SDA (4u)
|
||||
#define PIN_WIRE0_SCL (5u)
|
||||
|
||||
#define PIN_WIRE1_SDA (26u)
|
||||
#define PIN_WIRE1_SCL (27u)
|
||||
|
||||
#define SERIAL_HOWMANY (2u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
Reference in New Issue
Block a user