Compare commits

..
64 Commits
Author SHA1 Message Date
Earle F. Philhower, III 91c007eb8f Update version 2024-02-12 10:38:24 -08:00
ardnew b29f6b922f Update README.md (#1999)
The `Picoprobe` example showing how to upload to Ubuntu is invalid because Ubuntu does not create or assign users to a `users` group (for many major releases, now). 

The reason the example worked is because the permissions were applied globally, rendering the `GROUP=users` assignment in the rule irrelevant. Hence, this assignment has been dropped.  

The `pico-debug` example has been updated similarly, but it uses a proper group-level rule, and Ubuntu does still use group `plugdev`. 

The reader thus has two good examples of creating `udev` rules.
2024-02-12 10:27:52 -08:00
Earle F. Philhower, III 40e52f84b8 Fix WiFiMulti and ESPhost STA connection w/BSSID (#2001)
WiFiMulti specifies a specific BSSID, in addition to the AP name and
password.  In the WiFi core the BSSID is stored as the raw 6-byte MAC
address, but the ESPHostedFG firmware expects a formatted C-String
(i.e. "ab:cd:ef:01:02:03" instead of {0xab, 0xcd, 0xef, 1, 2, 3})

Convert the raw bytes to the string format expected in the ESP FW.
2024-02-12 10:17:36 -08:00
Earle F. Philhower, III 972b7f53be Fix warning in lwip_ESPHost, add to styler (#1998) 2024-02-11 11:51:16 -08:00
Kevin Witteveen fc894fba0e PWMAudio low bitrate whine fix (DMA pacing timer) (#1996) 2024-02-10 09:17:37 -08:00
Earle F. Philhower, III 929ee98a6c Make W5100 example run on Wiznet w/no changes (#1994)
Use the #define board name to identify when building for the
WIZnet W5100s-EVB-Pico and assign the proper pins and IRQs.
2024-02-09 14:06:28 -08:00
Earle F. Philhower, III 88ccf0c256 Undo FreeRTOS idleOtherCore changes (#1992)
Fixes #1991
2024-02-09 09:46:30 -08:00
Terry Phillips 874b41f549 Update wire.rst (#1990)
Correct buffer size to match Wire.h
2024-02-06 16:27:08 -08:00
LinusHeu fcd47fe170 Update ide.rst (#1989)
Remove outdated(?) info
2024-02-06 15:43:14 -08:00
Earle F. Philhower, III 842ec245ac Add W5100, W5500, and ECN28J60 interrupt-driven mode (#1986)
No polling needed and massively reduces latency by using the GPIO interrupt to
signal the Pico to read a received packet.  Also drops CPU load when no packets
are incoming.
2024-02-06 14:15:37 -08:00
Earle F. Philhower, III a41618fa87 Make Python3 re.split() use a r-string (#1985)
Fixes #1983
2024-02-06 09:49:45 -08:00
Earle F. Philhower, III c095fce5b2 More GH action updates (#1980) 2024-02-02 09:24:22 -08:00
Earle F. Philhower, III 6715e5e6b7 Update version 2024-02-02 09:10:28 -08:00
Earle F. Philhower, III 12702717e3 Undo #1864, fix LWIP offline error (#1979)
Fixes #1973

The periodic LWIP pump/Ethernet packet reader async_context stopped
firing occasionally under high packet loads, causing the LWIP stack
to become unresponsive to any incoming data.

Re-implement the 2-step process for polling (like the CYW43 driver
from the RPI folks does) and undoes #1864 change.
2024-02-01 19:09:09 -08:00
Earle F. Philhower, III 9c66d9737b Update all GitHub actions, remove deprecation warn (#1978) 2024-02-01 11:51:28 -08:00
Earle F. Philhower, III 7f5756c464 Make OpenOCD and Picotool M1 native, too (#1977)
All binaries should now be native on Apple silicon.
2024-02-01 11:43:41 -08:00
Earle F. Philhower, III 1a30113f0d Use ARM Python3 on M1 (#1976) 2024-01-31 09:38:47 -08:00
Earle F. Philhower, III f1170e9d54 Fix Apple M1 installation, add to CI (#1975) 2024-01-31 08:45:10 -08:00
Earle F. Philhower, III 1bf41bcc60 Add native Apple ARM silicon support (#1959)
* Add native Apple ARM silicon M1/M2/M3 support

* Identify Mac ARM in download get.py script

Thanks to the ESP32 `get.py` sources!

* Rebuild M1 w/o using strip
2024-01-30 15:06:52 -08:00
Juraj Andrássy 7180ca3b0c Add ESP32-based WiFi support via lwIP_ESPHost library (#1950) 2024-01-30 14:57:04 -08:00
Earle F. Philhower, III c64a4a58d7 Fix initial SPI startup (#1970)
Clocks were not being set at all after #1934.  Ensure they are by initting
to an impossible 0hz clock on creation and ::end

Fixes #1969
2024-01-28 16:21:48 -08:00
Nerradia 02c272b091 Skip SPI re-init if clock frequency doesn't change (#1934) 2024-01-28 10:27:12 -08:00
Juraj Andrássy 2a74250a51 lwIP_nodriver - end() compilation error fix (#1966) 2024-01-28 06:49:31 -08:00
Pontus Oldberg adb23c1cac Fixed incorrect pinout for SPI interface. (#1951) 2024-01-22 06:16:16 -08:00
Earle F. Philhower, III a99a572bda Add TZ.h database, borrowed from ESP8266 core (#1947) 2024-01-20 15:57:15 -08:00
Earle F. Philhower, III 7ce7dde06a Update README.md (#1946) 2024-01-20 12:51:53 -08:00
Juraj Andrássy fef8d2c384 WiFi - prepare for alternative drivers (#1935) 2024-01-20 12:35:13 -08:00
Pontus Oldberg 916c31d934 Adds iLabs RP2040 Connectivity (LTE/WIFI/BLE) board. (#1936) 2024-01-12 07:32:27 -08:00
Arnoz 403c147fa3 Adding Dude's Cab board (#1933)
Adding Dude's Cab board (rp2040 based board for virtual pinball use)
2024-01-10 14:02:07 -08:00
noqman 915e093564 Change Maker UNO RP2040 to Maker Uno RP2040 and board name in README.md (#1924) 2024-01-05 07:12:24 -08:00
Earle F. Philhower, III 32e74d024e Update version 2024-01-03 18:02:35 -08:00
Earle F. Philhower, III 326697bbe1 Update Mac Picotool/OpenOCD to use bundled dylibs (#1922)
Fixes #1919 by using binaries from https://github.com/earlephilhower/pico-quick-toolchain/pull/37
2024-01-02 18:51:20 -08:00
Earle F. Philhower, III afbba68549 Set AP IP address on ::beginAP
The Arduino WiFi normalization ended up calling the underlying LWIP
::config after the AP was begin, resulting in a failure to set the
IP configuration of the AP.  Move the _wifi.begin() call to after
the IP configuration is set.

Fixes #1989
2024-01-02 18:20:25 -08:00
Steve Bian 042555206b Adds definition for WIRE_INTERFACES_COUNT #1182 (#1921)
* Adds definition for WIRE_INTERFACES_COUNT so those libraries which rely on it can detect and use...

Wire1. e.g. u8g2 will not use Wire1 unless this is (a) defined and (b) >1. This constant is defined
on other cores, e.g. for SAMD based boards.
2024-01-01 18:55:03 -08:00
Richard Teel 24f6302612 Updated listfiles example and added CardInfo example (#1914) 2023-12-27 12:01:06 -08:00
Joseph Duchesne 15eb459df9 Add variants_dir support to pio build, allowing local variants in project repos (#1911) 2023-12-26 09:59:45 -08:00
Ha Thach 3160fde679 Support native USB as host (#1910)
* add a new usbstack menu to use native usb as host

* update tinyusb library to 2.3.0

* skip Host native example in ci
2023-12-25 11:36:07 -08:00
Earle F. Philhower, III 1160d7cd7c Replace ancient "boolean" with "bool" (#1908) 2023-12-20 13:46:07 -08:00
Earle F. Philhower, III 2aa85e3263 Minor LWIPEthernet cleanup (#1906) 2023-12-20 07:49:48 -08:00
erpebe c4f36170d4 Correct calculation of totalBlocks() in SD.h and SDFS.h (#1899) 2023-12-13 12:45:15 -08:00
Earle F. Philhower, III 3068cd0af0 Use SW random generator for all LWIP (#1892) 2023-12-10 16:18:17 -08:00
Earle F. Philhower, III fa390f48af Clean up FreeRTOS header, include add'l APIs (#1891) 2023-12-10 09:48:15 -08:00
Dominic Pearman 0c7454b6f7 Minor typo correction to platformio.rst. (#1889) 2023-12-08 07:42:35 -08:00
Earle F. Philhower, III 500f197c02 Update version 2023-12-06 09:52:23 -08:00
Earle F. Philhower, III 2bf249ffe1 Avoid freezeing the core from LWIP under FreeRTOS (#1884)
Avoid issues with interrupts and priority inversions and other deadlocks
and use a SW based random generator for LWIP when under FreeRTOS.

This means removing any overrides for sleep_until and the two
get_rand_xx calls from the SDK, making things much saner.

Related to #1883, #1872, and other random FreeRTOS lockups.
2023-12-06 09:41:14 -08:00
Dominic PearmanandDominic Pearman 81070a0b3f Minor documentation corrections in platformio.rst. (#1885)
* Corrected minor typo.

* Removed superfluous newline.

---------

Co-authored-by: Dominic Pearman <dominic@phymorous.de>
2023-12-06 06:20:59 -08:00
GUVWAF d45a11f9e7 Disable interrupts first when idling core (#1883) 2023-12-05 11:53:41 -08:00
Earle F. Philhower, III c3a3526aad Fix SPI 16-bit transfers (#1882)
Fixes #1879
Fixes #1874
2023-12-04 17:30:43 -08:00
Earle F. Philhower, III 280fc43731 Fix SPI debug print warning (#1881) 2023-12-04 12:48:49 -08:00
Earle F. Philhower, III 762535faf9 Add documentation about MDNS + FreeRTOS = crash (#1880)
See #1875
2023-12-04 08:57:49 -08:00
GUVWAF 0e4fd0587b Replace std::bind in MDNSResponder for UDP context (#1875) 2023-12-03 08:34:35 -08:00
GUVWAF d2461a14ad Enable interrupts last when resuming other core (#1872) 2023-12-02 10:20:05 -08:00
Juraj Andrássy a1902b5f41 WiFiServer modernization (#1871) 2023-12-02 09:31:39 -08:00
Taylor Alexander aka Sequoia c2d60774af Fix small typo in analog.rst (#1869)
Change "RP20400" to "RP2040"
2023-12-01 15:17:58 -08:00
Earle F. Philhower, III 269c579846 Remove IPv6 compile warning (#1867) 2023-12-01 12:10:16 -08:00
Juraj Andrássy 91183ca22f LwipIntfDev - disconnect()/end() should not clear static IP settings (#1866) 2023-12-01 11:53:01 -08:00
Earle F. Philhower, III 971c235e8d Remove unneeded intermediate async for Ethernet (#1864)
Remove the always pending worker whose job it was to fire another async
worker after a timeout.
2023-12-01 10:50:15 -08:00
Juraj Andrássy abd3547711 WiFi and Ethernet - config static IP auto gw,mask,dns as in Arduino libs (#1862) 2023-12-01 10:24:11 -08:00
Juraj Andrássy 9181ec055d LwipIntfDev - hostByName default value for the timeout parameter (#1858)
to have standard version with two parameters
2023-11-30 08:58:15 -08:00
Juraj Andrássy 58089b1f44 wl_defintions.h wl_enc_type update (#1859) 2023-11-30 08:33:33 -08:00
Juraj Andrássy 4f62e0a4ba LwipIntfDev - added macAddress getter and DNS IP getter and setter (#1856)
and dnsIP(n) getter in WiFiClass too
2023-11-29 13:24:16 -08:00
Richard Teel dbab62c214 Added clearAPList method to WiFiMulti (#1848)
Fixes #1846
2023-11-27 15:35:36 -08:00
Earle F. Philhower, III 6a878cdee8 Only create SPI/Wire instances if variant defined (#1842)
Fixes #1841
2023-11-24 09:56:13 -08:00
noqman cebdb6c917 Add new board variant: Cytron Maker UNO RP2040 (#1838) 2023-11-24 07:13:37 -08:00
96 changed files with 5652 additions and 735 deletions
+23 -19
View File
@@ -18,7 +18,7 @@ jobs:
name: Check spelling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Run codespell
@@ -32,7 +32,7 @@ jobs:
name: Style, Boards, Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: false
- name: Check package references
@@ -59,15 +59,15 @@ jobs:
matrix:
chunk: [0, 1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache Linux toolchain
id: cache-linux
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./tools/dist
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
@@ -87,15 +87,15 @@ jobs:
name: Build TinyUSB Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache Linux toolchain
id: cache-linux
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./tools/dist
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
@@ -113,15 +113,15 @@ jobs:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache Windows toolchain
id: cache-windows
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./tools/dist
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
@@ -144,17 +144,20 @@ jobs:
# Single build under macOS to ensure the Mac toolchain is good.
build-mac:
name: Mac
runs-on: macOS-12
strategy:
matrix:
os: [macOS-12, macOS-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache Mac toolchain
id: cache-mac
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./tools/dist
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
@@ -165,6 +168,7 @@ jobs:
mod: 500
rem: 1
run: |
uname -a
cd pico-sdk
git submodule update --init
cd ..
@@ -175,7 +179,7 @@ jobs:
name: Build PlatformIO Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Initialize needed submodules
@@ -186,19 +190,19 @@ jobs:
git submodule update --init
cd ../..
- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install PlatformIO
+4 -4
View File
@@ -9,21 +9,21 @@ jobs:
name: Update master JSON file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
# - name: Cache PlatformIO
# uses: actions/cache@v3
# uses: actions/cache@v4
# with:
# path: ~/.platformio
# key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
+2 -2
View File
@@ -15,11 +15,11 @@ jobs:
name: Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build package JSON
+42 -49
View File
@@ -30,6 +30,7 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* BridgeTek IDM2040-7A
* Cytron Maker Pi RP2040
* Cytron Maker Nano RP2040
* Cytron Maker Uno RP2040
* DatanoiseTV PicoADK+
* Degz Suibo RP2040
* DeRuiLab FlyBoard2040 Core
@@ -76,6 +77,34 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* WIZnet WizFi360-EVB-Pico
* Generic (configurable flash, I/O pins)
# Features
* Adafruit TinyUSB Arduino (USB mouse, keyboard, flash drive, generic HID, CDC Serial, MIDI, WebUSB, others)
* Bluetooth on the PicoW (Classic and BLE) with Keyboard, Mouse, Joystick, and Virtual Serial
* Generic Arduino USB Serial, Keyboard, Joystick, and Mouse emulation
* WiFi (Pico W)
* Ethernet (Wired W5500, W5100, ENC28J60)
* HTTP client and server (WebServer)
* SSL/TLS/HTTPS
* Over-the-Air (OTA) upgrades
* Filesystems (LittleFS and SD/SDFS)
* Multicore support (setup1() and loop1())
* FreeRTOS SMP support
* Overclocking and underclocking from the menus
* digitalWrite/Read, shiftIn/Out, tone, analogWrite(PWM)/Read, temperature
* Analog stereo audio in using DMA and the built-in ADC
* Analog stereo audio out using PWM hardware
* USB drive mode for data loggers (SingleFileDrive)
* Peripherals: SPI master/slave, Wire(I2C) master/slave, dual UART, emulated EEPROM, I2S audio input/output, Servo
* printf (i.e. debug) output over USB serial
The RP2040 PIO state machines (SMs) are used to generate jitter-free:
* Servos
* Tones
* I2S Input
* I2S Output
* Software UARTs (Serial ports)
# Installing via Arduino Boards Manager
## Windows-specific Notes
Please do not use the Windows Store version of the actual Arduino application
@@ -173,11 +202,14 @@ Under Windows a local admin user should be able to access the Picoprobe port aut
To set up user-level access to Picoprobes on Ubuntu (and other OSes which use `udev`):
````
echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0004", GROUP="users", MODE="0666"' | sudo tee -a /etc/udev/rules.d/98-PicoProbe.rules
echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0004", MODE="0666"' | sudo tee -a /etc/udev/rules.d/98-PicoProbe.rules
sudo udevadm control --reload
sudo udevadm trigger -w -s usb
````
The first line creates a file with the USB vendor and ID of the Picoprobe and tells UDEV to give users full access to it. The second causes `udev` to load this new rule. Note that you will need to unplug and re-plug in your device the first time you create this file, to allow udev to make the device node properly.
The first line creates a device file in `/dev` matching the USB vendor and product ID of the Picoprobe, and it enables global read+write permissions. The second line causes `udev` to load this new rule. The third line requests the kernel generate "device change" events that will cause our new `udev` rule to run.
If for some reason the device file does not appear, manually unplug and re-plug the USB connection and check again. The output from `dmesg` can reveal useful diagnostics if the device file remains absent.
Once Picoprobe permissions are set up properly, then select the board "Raspberry Pi Pico (Picoprobe)" in the Tools menu and upload as normal.
@@ -186,13 +218,16 @@ Once Picoprobe permissions are set up properly, then select the board "Raspberry
Under Windows and macOS, any user should be able to access pico-debug automatically, but under Linux `udev` must be told about the device and to allow normal users access.
To set up user-level access to all CMSIS-DAP adapters on Ubuntu (and other OSes which use `udev`):
To set up group-level access to all CMSIS-DAP adapters on Ubuntu (and other OSes which use `udev`):
````
echo 'ATTRS{product}=="*CMSIS-DAP*", MODE="664", GROUP="plugdev"' | sudo tee -a /etc/udev/rules.d/98-CMSIS-DAP.rules
sudo udevadm control --reload
sudo udevadm trigger -w -s usb
````
The first line creates a file that recognizes all CMSIS-DAP adapters and tells UDEV to give users full access to it. The second causes `udev` to load this new rule. Note that you will need to unplug and re-plug in your device the first time you create this file, to allow udev to make the device node properly.
The first line creates a device file in `/dev` that matches all CMSIS-DAP adapters, and it enables read+write permissions for members of the `plugdev` group. The second line causes `udev` to load this new rule. The third line requests the kernel generate "device change" events that will cause our new `udev` rule to run.
If for some reason the device file does not appear, manually unplug and re-plug the USB connection and check again. The output from `dmesg` can reveal useful diagnostics if the device file remains absent.
Once CMSIS-DAP permissions are set up properly, then select the board "Raspberry Pi Pico (pico-debug)" in the Tools menu.
@@ -201,48 +236,6 @@ When first connecting the USB port to your PC, you must copy [pico-debug-gimmeca
# Debugging with Picoprobe/pico-debug, OpenOCD, and GDB
The installed tools include a version of OpenOCD (in the pqt-openocd directory) and GDB (in the pqt-gcc directory). These may be used to run GDB in an interactive window as documented in the Pico Getting Started manuals from the Raspberry Pi Foundation. For [pico-debug](https://github.com/majbthrd/pico-debug/), replace the raspberrypi-swd and picoprobe example OpenOCD arguments of "-f interface/raspberrypi-swd.cfg -f target/rp2040.cfg" or "-f interface/picoprobe.cfg -f target/rp2040.cfg" respectively in the Pico Getting Started manual with "-f board/pico-debug.cfg".
# Features
* Adafruit TinyUSB Arduino (USB mouse, keyboard, flash drive, generic HID, CDC Serial, MIDI, WebUSB, others)
* Bluetooth on the PicoW (Classic and BLE) with Keyboard, Mouse, Joystick, and Virtual Serial
* Generic Arduino USB Serial, Keyboard, Joystick, and Mouse emulation
* WiFi (Pico W)
* Ethernet (Wired W5500, W5100, ENC28J60)
* HTTP client and server (WebServer)
* SSL/TLS/HTTPS
* Over-the-Air (OTA) upgrades
* Filesystems (LittleFS and SD/SDFS)
* Multicore support (setup1() and loop1())
* FreeRTOS SMP support
* Overclocking and underclocking from the menus
* digitalWrite/Read, shiftIn/Out, tone, analogWrite(PWM)/Read, temperature
* Analog stereo audio in using DMA and the built-in ADC
* Analog stereo audio out using PWM hardware
* USB drive mode for data loggers (SingleFileDrive)
* Peripherals: SPI master/slave, Wire(I2C) master/slave, dual UART, emulated EEPROM, I2S audio input/output, Servo
* printf (i.e. debug) output over USB serial
The RP2040 PIO state machines (SMs) are used to generate jitter-free:
* Servos
* Tones
* I2S Input
* I2S Output
* Software UARTs (Serial ports)
# Tutorials from Across the Web
Here are some links to coverage and additional tutorials for using `arduino-pico`
* The File:: class is taken from the ESP8266. See https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html
* Arduino Support for the Pi Pico available! And how fast is the Pico? - https://youtu.be/-XHh17cuH5E
* Pre-release Adafruit QT Py RP2040 - https://www.youtube.com/watch?v=sfC1msqXX0I
* Adafruit Feather RP2040 running LCD + TMP117 - https://www.youtube.com/watch?v=fKDeqZiIwHg
* Demonstration of Servos and I2C in Korean - https://cafe.naver.com/arduinoshield/1201
* Home Assistant Pico W integration starter project using Arduino - https://github.com/daniloc/PicoW_HomeAssistant_Starter
* Tutorials for the Raspberry Pi Pico / uPesy RP2040 DevKit board
- English version: https://www.upesy.com/blogs/tutorials/best-tutorials-for-rpi-pi-pico-with-arduino-code
- French version: https://www.upesy.fr/blogs/tutorials/best-tutorials-for-rpi-pi-pico-with-arduino-code
# Contributing
If you want to contribute or have bugfixes, drop me a note at <earlephilhower@yahoo.com> or open an issue/PR here.
# Licensing and Credits
* The [Arduino IDE and ArduinoCore-API](https://arduino.cc) are developed and maintained by the Arduino team. The IDE is licensed under GPL.
* The [RP2040 GCC-based toolchain](https://github.com/earlephilhower/pico-quick-toolchain) is licensed under under the GPL.
@@ -252,14 +245,14 @@ If you want to contribute or have bugfixes, drop me a note at <earlephilhower@ya
* [UF2CONV.PY](https://github.com/microsoft/uf2) is by Microsoft Corporation and licensed under the MIT license.
* Networking and filesystem code taken from the [ESP8266 Arduino Core](https://github.com/esp8266/Arduino) and licensed under the LGPL.
* DHCP server for AP host mode from the [Micropython Project](https://micropython.org), distributed under the MIT License.
* [FreeRTOS](https://freertos.org) is Copyright Amazon.com, Inc. or its affiliates, and distributed under the MIT license.
* [FreeRTOS](https://freertos.org) is copyright Amazon.com, Inc. or its affiliates, and distributed under the MIT license.
* [lwIP](https://savannah.nongnu.org/projects/lwip/) is (c) the Swedish Institute of Computer Science and licenced under the BSD license.
* [BearSSL](https://bearssl.org) library written by Thomas Pornin, is distributed under the [MIT License](https://bearssl.org/#legal-details).
* [UZLib](https://github.com/pfalcon/uzlib) is copyright (c) 2003 Joergen Ibsen and distributed under the zlib license.
* [LEAmDNS](https://github.com/LaborEtArs/ESP8266mDNS) is copyright multiple authors and distributed under the MIT license.
* [http-parser](https://github.com/nodejs/http-parser) is copyright Joyent, Inc. and other Node contributors.
* WebServer code modified from the [ESP32 WebServer](https://github.com/espressif/arduino-esp32/tree/master/libraries/WebServer) and is copyright (c) 2015 Ivan Grokhotkov and others
* WebServer code modified from the [ESP32 WebServer](https://github.com/espressif/arduino-esp32/tree/master/libraries/WebServer) and is copyright (c) 2015 Ivan Grokhotkov and others.
* [Xoshiro-cpp](https://github.com/Reputeless/Xoshiro-cpp) is copyright (c) 2020 Ryo Suzuki and distributed under the MIT license.
-Earle F. Philhower, III
earlephilhower@yahoo.com
+804
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,5 +1,5 @@
#pragma once
#define ARDUINO_PICO_MAJOR 3
#define ARDUINO_PICO_MINOR 6
#define ARDUINO_PICO_MINOR 7
#define ARDUINO_PICO_REVISION 1
#define ARDUINO_PICO_VERSION_STR "3.6.1"
#define ARDUINO_PICO_VERSION_STR "3.7.1"
+474
View File
@@ -0,0 +1,474 @@
// autogenerated from https://raw.githubusercontent.com/nayarsystems/posix_tz_db/master/zones.csv
// by script <rp2040 arduino core>/tools/tzupdate.sh
// Sat 20 Jan 2024 08:54:45 PM UTC
//
// This database is autogenerated from IANA timezone database
// https://raw.githubusercontent.com/nayarsystems/posix_tz_db/master/zones.csv
// (using https://www.iana.org/time-zones)
// and can be updated on demand in this repository
// or by yourself using the above script
#pragma once
#define TZ_Africa_Abidjan ("GMT0")
#define TZ_Africa_Accra ("GMT0")
#define TZ_Africa_Addis_Ababa ("EAT-3")
#define TZ_Africa_Algiers ("CET-1")
#define TZ_Africa_Asmara ("EAT-3")
#define TZ_Africa_Bamako ("GMT0")
#define TZ_Africa_Bangui ("WAT-1")
#define TZ_Africa_Banjul ("GMT0")
#define TZ_Africa_Bissau ("GMT0")
#define TZ_Africa_Blantyre ("CAT-2")
#define TZ_Africa_Brazzaville ("WAT-1")
#define TZ_Africa_Bujumbura ("CAT-2")
#define TZ_Africa_Cairo ("EET-2EEST,M4.5.5/0,M10.5.4/24")
#define TZ_Africa_Casablanca ("<+01>-1")
#define TZ_Africa_Ceuta ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Africa_Conakry ("GMT0")
#define TZ_Africa_Dakar ("GMT0")
#define TZ_Africa_Dar_es_Salaam ("EAT-3")
#define TZ_Africa_Djibouti ("EAT-3")
#define TZ_Africa_Douala ("WAT-1")
#define TZ_Africa_El_Aaiun ("<+01>-1")
#define TZ_Africa_Freetown ("GMT0")
#define TZ_Africa_Gaborone ("CAT-2")
#define TZ_Africa_Harare ("CAT-2")
#define TZ_Africa_Johannesburg ("SAST-2")
#define TZ_Africa_Juba ("CAT-2")
#define TZ_Africa_Kampala ("EAT-3")
#define TZ_Africa_Khartoum ("CAT-2")
#define TZ_Africa_Kigali ("CAT-2")
#define TZ_Africa_Kinshasa ("WAT-1")
#define TZ_Africa_Lagos ("WAT-1")
#define TZ_Africa_Libreville ("WAT-1")
#define TZ_Africa_Lome ("GMT0")
#define TZ_Africa_Luanda ("WAT-1")
#define TZ_Africa_Lubumbashi ("CAT-2")
#define TZ_Africa_Lusaka ("CAT-2")
#define TZ_Africa_Malabo ("WAT-1")
#define TZ_Africa_Maputo ("CAT-2")
#define TZ_Africa_Maseru ("SAST-2")
#define TZ_Africa_Mbabane ("SAST-2")
#define TZ_Africa_Mogadishu ("EAT-3")
#define TZ_Africa_Monrovia ("GMT0")
#define TZ_Africa_Nairobi ("EAT-3")
#define TZ_Africa_Ndjamena ("WAT-1")
#define TZ_Africa_Niamey ("WAT-1")
#define TZ_Africa_Nouakchott ("GMT0")
#define TZ_Africa_Ouagadougou ("GMT0")
#define TZ_Africa_PortomNovo ("WAT-1")
#define TZ_Africa_Sao_Tome ("GMT0")
#define TZ_Africa_Tripoli ("EET-2")
#define TZ_Africa_Tunis ("CET-1")
#define TZ_Africa_Windhoek ("CAT-2")
#define TZ_America_Adak ("HST10HDT,M3.2.0,M11.1.0")
#define TZ_America_Anchorage ("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Anguilla ("AST4")
#define TZ_America_Antigua ("AST4")
#define TZ_America_Araguaina ("<-03>3")
#define TZ_America_Argentina_Buenos_Aires ("<-03>3")
#define TZ_America_Argentina_Catamarca ("<-03>3")
#define TZ_America_Argentina_Cordoba ("<-03>3")
#define TZ_America_Argentina_Jujuy ("<-03>3")
#define TZ_America_Argentina_La_Rioja ("<-03>3")
#define TZ_America_Argentina_Mendoza ("<-03>3")
#define TZ_America_Argentina_Rio_Gallegos ("<-03>3")
#define TZ_America_Argentina_Salta ("<-03>3")
#define TZ_America_Argentina_San_Juan ("<-03>3")
#define TZ_America_Argentina_San_Luis ("<-03>3")
#define TZ_America_Argentina_Tucuman ("<-03>3")
#define TZ_America_Argentina_Ushuaia ("<-03>3")
#define TZ_America_Aruba ("AST4")
#define TZ_America_Asuncion ("<-04>4<-03>,M10.1.0/0,M3.4.0/0")
#define TZ_America_Atikokan ("EST5")
#define TZ_America_Bahia ("<-03>3")
#define TZ_America_Bahia_Banderas ("CST6")
#define TZ_America_Barbados ("AST4")
#define TZ_America_Belem ("<-03>3")
#define TZ_America_Belize ("CST6")
#define TZ_America_BlancmSablon ("AST4")
#define TZ_America_Boa_Vista ("<-04>4")
#define TZ_America_Bogota ("<-05>5")
#define TZ_America_Boise ("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Cambridge_Bay ("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Campo_Grande ("<-04>4")
#define TZ_America_Cancun ("EST5")
#define TZ_America_Caracas ("<-04>4")
#define TZ_America_Cayenne ("<-03>3")
#define TZ_America_Cayman ("EST5")
#define TZ_America_Chicago ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Chihuahua ("CST6")
#define TZ_America_Costa_Rica ("CST6")
#define TZ_America_Creston ("MST7")
#define TZ_America_Cuiaba ("<-04>4")
#define TZ_America_Curacao ("AST4")
#define TZ_America_Danmarkshavn ("GMT0")
#define TZ_America_Dawson ("MST7")
#define TZ_America_Dawson_Creek ("MST7")
#define TZ_America_Denver ("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Detroit ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Dominica ("AST4")
#define TZ_America_Edmonton ("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Eirunepe ("<-05>5")
#define TZ_America_El_Salvador ("CST6")
#define TZ_America_Fortaleza ("<-03>3")
#define TZ_America_Fort_Nelson ("MST7")
#define TZ_America_Glace_Bay ("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Godthab ("<-02>2<-01>,M3.5.0/-1,M10.5.0/0")
#define TZ_America_Goose_Bay ("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Grand_Turk ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Grenada ("AST4")
#define TZ_America_Guadeloupe ("AST4")
#define TZ_America_Guatemala ("CST6")
#define TZ_America_Guayaquil ("<-05>5")
#define TZ_America_Guyana ("<-04>4")
#define TZ_America_Halifax ("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Havana ("CST5CDT,M3.2.0/0,M11.1.0/1")
#define TZ_America_Hermosillo ("MST7")
#define TZ_America_Indiana_Indianapolis ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Knox ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Marengo ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Petersburg ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Tell_City ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Vevay ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Vincennes ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Winamac ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Inuvik ("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Iqaluit ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Jamaica ("EST5")
#define TZ_America_Juneau ("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Kentucky_Louisville ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Kentucky_Monticello ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Kralendijk ("AST4")
#define TZ_America_La_Paz ("<-04>4")
#define TZ_America_Lima ("<-05>5")
#define TZ_America_Los_Angeles ("PST8PDT,M3.2.0,M11.1.0")
#define TZ_America_Lower_Princes ("AST4")
#define TZ_America_Maceio ("<-03>3")
#define TZ_America_Managua ("CST6")
#define TZ_America_Manaus ("<-04>4")
#define TZ_America_Marigot ("AST4")
#define TZ_America_Martinique ("AST4")
#define TZ_America_Matamoros ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Mazatlan ("MST7")
#define TZ_America_Menominee ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Merida ("CST6")
#define TZ_America_Metlakatla ("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Mexico_City ("CST6")
#define TZ_America_Miquelon ("<-03>3<-02>,M3.2.0,M11.1.0")
#define TZ_America_Moncton ("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Monterrey ("CST6")
#define TZ_America_Montevideo ("<-03>3")
#define TZ_America_Montreal ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Montserrat ("AST4")
#define TZ_America_Nassau ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_New_York ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Nipigon ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Nome ("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Noronha ("<-02>2")
#define TZ_America_North_Dakota_Beulah ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_North_Dakota_Center ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_North_Dakota_New_Salem ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Nuuk ("<-02>2<-01>,M3.5.0/-1,M10.5.0/0")
#define TZ_America_Ojinaga ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Panama ("EST5")
#define TZ_America_Pangnirtung ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Paramaribo ("<-03>3")
#define TZ_America_Phoenix ("MST7")
#define TZ_America_PortmaumPrince ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Port_of_Spain ("AST4")
#define TZ_America_Porto_Velho ("<-04>4")
#define TZ_America_Puerto_Rico ("AST4")
#define TZ_America_Punta_Arenas ("<-03>3")
#define TZ_America_Rainy_River ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Rankin_Inlet ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Recife ("<-03>3")
#define TZ_America_Regina ("CST6")
#define TZ_America_Resolute ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Rio_Branco ("<-05>5")
#define TZ_America_Santarem ("<-03>3")
#define TZ_America_Santiago ("<-04>4<-03>,M9.1.6/24,M4.1.6/24")
#define TZ_America_Santo_Domingo ("AST4")
#define TZ_America_Sao_Paulo ("<-03>3")
#define TZ_America_Scoresbysund ("<-01>1<+00>,M3.5.0/0,M10.5.0/1")
#define TZ_America_Sitka ("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_St_Barthelemy ("AST4")
#define TZ_America_St_Johns ("NST3:30NDT,M3.2.0,M11.1.0")
#define TZ_America_St_Kitts ("AST4")
#define TZ_America_St_Lucia ("AST4")
#define TZ_America_St_Thomas ("AST4")
#define TZ_America_St_Vincent ("AST4")
#define TZ_America_Swift_Current ("CST6")
#define TZ_America_Tegucigalpa ("CST6")
#define TZ_America_Thule ("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Thunder_Bay ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Tijuana ("PST8PDT,M3.2.0,M11.1.0")
#define TZ_America_Toronto ("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Tortola ("AST4")
#define TZ_America_Vancouver ("PST8PDT,M3.2.0,M11.1.0")
#define TZ_America_Whitehorse ("MST7")
#define TZ_America_Winnipeg ("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Yakutat ("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Yellowknife ("MST7MDT,M3.2.0,M11.1.0")
#define TZ_Antarctica_Casey ("<+11>-11")
#define TZ_Antarctica_Davis ("<+07>-7")
#define TZ_Antarctica_DumontDUrville ("<+10>-10")
#define TZ_Antarctica_Macquarie ("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Antarctica_Mawson ("<+05>-5")
#define TZ_Antarctica_McMurdo ("NZST-12NZDT,M9.5.0,M4.1.0/3")
#define TZ_Antarctica_Palmer ("<-03>3")
#define TZ_Antarctica_Rothera ("<-03>3")
#define TZ_Antarctica_Syowa ("<+03>-3")
#define TZ_Antarctica_Troll ("<+00>0<+02>-2,M3.5.0/1,M10.5.0/3")
#define TZ_Antarctica_Vostok ("<+06>-6")
#define TZ_Arctic_Longyearbyen ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Asia_Aden ("<+03>-3")
#define TZ_Asia_Almaty ("<+06>-6")
#define TZ_Asia_Amman ("<+03>-3")
#define TZ_Asia_Anadyr ("<+12>-12")
#define TZ_Asia_Aqtau ("<+05>-5")
#define TZ_Asia_Aqtobe ("<+05>-5")
#define TZ_Asia_Ashgabat ("<+05>-5")
#define TZ_Asia_Atyrau ("<+05>-5")
#define TZ_Asia_Baghdad ("<+03>-3")
#define TZ_Asia_Bahrain ("<+03>-3")
#define TZ_Asia_Baku ("<+04>-4")
#define TZ_Asia_Bangkok ("<+07>-7")
#define TZ_Asia_Barnaul ("<+07>-7")
#define TZ_Asia_Beirut ("EET-2EEST,M3.5.0/0,M10.5.0/0")
#define TZ_Asia_Bishkek ("<+06>-6")
#define TZ_Asia_Brunei ("<+08>-8")
#define TZ_Asia_Chita ("<+09>-9")
#define TZ_Asia_Choibalsan ("<+08>-8")
#define TZ_Asia_Colombo ("<+0530>-5:30")
#define TZ_Asia_Damascus ("<+03>-3")
#define TZ_Asia_Dhaka ("<+06>-6")
#define TZ_Asia_Dili ("<+09>-9")
#define TZ_Asia_Dubai ("<+04>-4")
#define TZ_Asia_Dushanbe ("<+05>-5")
#define TZ_Asia_Famagusta ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Asia_Gaza ("EET-2EEST,M3.4.4/50,M10.4.4/50")
#define TZ_Asia_Hebron ("EET-2EEST,M3.4.4/50,M10.4.4/50")
#define TZ_Asia_Ho_Chi_Minh ("<+07>-7")
#define TZ_Asia_Hong_Kong ("HKT-8")
#define TZ_Asia_Hovd ("<+07>-7")
#define TZ_Asia_Irkutsk ("<+08>-8")
#define TZ_Asia_Jakarta ("WIB-7")
#define TZ_Asia_Jayapura ("WIT-9")
#define TZ_Asia_Jerusalem ("IST-2IDT,M3.4.4/26,M10.5.0")
#define TZ_Asia_Kabul ("<+0430>-4:30")
#define TZ_Asia_Kamchatka ("<+12>-12")
#define TZ_Asia_Karachi ("PKT-5")
#define TZ_Asia_Kathmandu ("<+0545>-5:45")
#define TZ_Asia_Khandyga ("<+09>-9")
#define TZ_Asia_Kolkata ("IST-5:30")
#define TZ_Asia_Krasnoyarsk ("<+07>-7")
#define TZ_Asia_Kuala_Lumpur ("<+08>-8")
#define TZ_Asia_Kuching ("<+08>-8")
#define TZ_Asia_Kuwait ("<+03>-3")
#define TZ_Asia_Macau ("CST-8")
#define TZ_Asia_Magadan ("<+11>-11")
#define TZ_Asia_Makassar ("WITA-8")
#define TZ_Asia_Manila ("PST-8")
#define TZ_Asia_Muscat ("<+04>-4")
#define TZ_Asia_Nicosia ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Asia_Novokuznetsk ("<+07>-7")
#define TZ_Asia_Novosibirsk ("<+07>-7")
#define TZ_Asia_Omsk ("<+06>-6")
#define TZ_Asia_Oral ("<+05>-5")
#define TZ_Asia_Phnom_Penh ("<+07>-7")
#define TZ_Asia_Pontianak ("WIB-7")
#define TZ_Asia_Pyongyang ("KST-9")
#define TZ_Asia_Qatar ("<+03>-3")
#define TZ_Asia_Qyzylorda ("<+05>-5")
#define TZ_Asia_Riyadh ("<+03>-3")
#define TZ_Asia_Sakhalin ("<+11>-11")
#define TZ_Asia_Samarkand ("<+05>-5")
#define TZ_Asia_Seoul ("KST-9")
#define TZ_Asia_Shanghai ("CST-8")
#define TZ_Asia_Singapore ("<+08>-8")
#define TZ_Asia_Srednekolymsk ("<+11>-11")
#define TZ_Asia_Taipei ("CST-8")
#define TZ_Asia_Tashkent ("<+05>-5")
#define TZ_Asia_Tbilisi ("<+04>-4")
#define TZ_Asia_Tehran ("<+0330>-3:30")
#define TZ_Asia_Thimphu ("<+06>-6")
#define TZ_Asia_Tokyo ("JST-9")
#define TZ_Asia_Tomsk ("<+07>-7")
#define TZ_Asia_Ulaanbaatar ("<+08>-8")
#define TZ_Asia_Urumqi ("<+06>-6")
#define TZ_Asia_UstmNera ("<+10>-10")
#define TZ_Asia_Vientiane ("<+07>-7")
#define TZ_Asia_Vladivostok ("<+10>-10")
#define TZ_Asia_Yakutsk ("<+09>-9")
#define TZ_Asia_Yangon ("<+0630>-6:30")
#define TZ_Asia_Yekaterinburg ("<+05>-5")
#define TZ_Asia_Yerevan ("<+04>-4")
#define TZ_Atlantic_Azores ("<-01>1<+00>,M3.5.0/0,M10.5.0/1")
#define TZ_Atlantic_Bermuda ("AST4ADT,M3.2.0,M11.1.0")
#define TZ_Atlantic_Canary ("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Atlantic_Cape_Verde ("<-01>1")
#define TZ_Atlantic_Faroe ("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Atlantic_Madeira ("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Atlantic_Reykjavik ("GMT0")
#define TZ_Atlantic_South_Georgia ("<-02>2")
#define TZ_Atlantic_Stanley ("<-03>3")
#define TZ_Atlantic_St_Helena ("GMT0")
#define TZ_Australia_Adelaide ("ACST-9:30ACDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Brisbane ("AEST-10")
#define TZ_Australia_Broken_Hill ("ACST-9:30ACDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Currie ("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Darwin ("ACST-9:30")
#define TZ_Australia_Eucla ("<+0845>-8:45")
#define TZ_Australia_Hobart ("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Lindeman ("AEST-10")
#define TZ_Australia_Lord_Howe ("<+1030>-10:30<+11>-11,M10.1.0,M4.1.0")
#define TZ_Australia_Melbourne ("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Perth ("AWST-8")
#define TZ_Australia_Sydney ("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Europe_Amsterdam ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Andorra ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Astrakhan ("<+04>-4")
#define TZ_Europe_Athens ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Belgrade ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Berlin ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Bratislava ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Brussels ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Bucharest ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Budapest ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Busingen ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Chisinau ("EET-2EEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Copenhagen ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Dublin ("IST-1GMT0,M10.5.0,M3.5.0/1")
#define TZ_Europe_Gibraltar ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Guernsey ("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Helsinki ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Isle_of_Man ("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Istanbul ("<+03>-3")
#define TZ_Europe_Jersey ("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Kaliningrad ("EET-2")
#define TZ_Europe_Kiev ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Kirov ("MSK-3")
#define TZ_Europe_Lisbon ("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Ljubljana ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_London ("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Luxembourg ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Madrid ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Malta ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Mariehamn ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Minsk ("<+03>-3")
#define TZ_Europe_Monaco ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Moscow ("MSK-3")
#define TZ_Europe_Oslo ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Paris ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Podgorica ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Prague ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Riga ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Rome ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Samara ("<+04>-4")
#define TZ_Europe_San_Marino ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Sarajevo ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Saratov ("<+04>-4")
#define TZ_Europe_Simferopol ("MSK-3")
#define TZ_Europe_Skopje ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Sofia ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Stockholm ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Tallinn ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Tirane ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Ulyanovsk ("<+04>-4")
#define TZ_Europe_Uzhgorod ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Vaduz ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Vatican ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Vienna ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Vilnius ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Volgograd ("MSK-3")
#define TZ_Europe_Warsaw ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Zagreb ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Zaporozhye ("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Zurich ("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Indian_Antananarivo ("EAT-3")
#define TZ_Indian_Chagos ("<+06>-6")
#define TZ_Indian_Christmas ("<+07>-7")
#define TZ_Indian_Cocos ("<+0630>-6:30")
#define TZ_Indian_Comoro ("EAT-3")
#define TZ_Indian_Kerguelen ("<+05>-5")
#define TZ_Indian_Mahe ("<+04>-4")
#define TZ_Indian_Maldives ("<+05>-5")
#define TZ_Indian_Mauritius ("<+04>-4")
#define TZ_Indian_Mayotte ("EAT-3")
#define TZ_Indian_Reunion ("<+04>-4")
#define TZ_Pacific_Apia ("<+13>-13")
#define TZ_Pacific_Auckland ("NZST-12NZDT,M9.5.0,M4.1.0/3")
#define TZ_Pacific_Bougainville ("<+11>-11")
#define TZ_Pacific_Chatham ("<+1245>-12:45<+1345>,M9.5.0/2:45,M4.1.0/3:45")
#define TZ_Pacific_Chuuk ("<+10>-10")
#define TZ_Pacific_Easter ("<-06>6<-05>,M9.1.6/22,M4.1.6/22")
#define TZ_Pacific_Efate ("<+11>-11")
#define TZ_Pacific_Enderbury ("<+13>-13")
#define TZ_Pacific_Fakaofo ("<+13>-13")
#define TZ_Pacific_Fiji ("<+12>-12")
#define TZ_Pacific_Funafuti ("<+12>-12")
#define TZ_Pacific_Galapagos ("<-06>6")
#define TZ_Pacific_Gambier ("<-09>9")
#define TZ_Pacific_Guadalcanal ("<+11>-11")
#define TZ_Pacific_Guam ("ChST-10")
#define TZ_Pacific_Honolulu ("HST10")
#define TZ_Pacific_Kiritimati ("<+14>-14")
#define TZ_Pacific_Kosrae ("<+11>-11")
#define TZ_Pacific_Kwajalein ("<+12>-12")
#define TZ_Pacific_Majuro ("<+12>-12")
#define TZ_Pacific_Marquesas ("<-0930>9:30")
#define TZ_Pacific_Midway ("SST11")
#define TZ_Pacific_Nauru ("<+12>-12")
#define TZ_Pacific_Niue ("<-11>11")
#define TZ_Pacific_Norfolk ("<+11>-11<+12>,M10.1.0,M4.1.0/3")
#define TZ_Pacific_Noumea ("<+11>-11")
#define TZ_Pacific_Pago_Pago ("SST11")
#define TZ_Pacific_Palau ("<+09>-9")
#define TZ_Pacific_Pitcairn ("<-08>8")
#define TZ_Pacific_Pohnpei ("<+11>-11")
#define TZ_Pacific_Port_Moresby ("<+10>-10")
#define TZ_Pacific_Rarotonga ("<-10>10")
#define TZ_Pacific_Saipan ("ChST-10")
#define TZ_Pacific_Tahiti ("<-10>10")
#define TZ_Pacific_Tarawa ("<+12>-12")
#define TZ_Pacific_Tongatapu ("<+13>-13")
#define TZ_Pacific_Wake ("<+12>-12")
#define TZ_Pacific_Wallis ("<+12>-12")
#define TZ_Etc_GMT ("GMT0")
#define TZ_Etc_GMTm0 ("GMT0")
#define TZ_Etc_GMTm1 ("<+01>-1")
#define TZ_Etc_GMTm2 ("<+02>-2")
#define TZ_Etc_GMTm3 ("<+03>-3")
#define TZ_Etc_GMTm4 ("<+04>-4")
#define TZ_Etc_GMTm5 ("<+05>-5")
#define TZ_Etc_GMTm6 ("<+06>-6")
#define TZ_Etc_GMTm7 ("<+07>-7")
#define TZ_Etc_GMTm8 ("<+08>-8")
#define TZ_Etc_GMTm9 ("<+09>-9")
#define TZ_Etc_GMTm10 ("<+10>-10")
#define TZ_Etc_GMTm11 ("<+11>-11")
#define TZ_Etc_GMTm12 ("<+12>-12")
#define TZ_Etc_GMTm13 ("<+13>-13")
#define TZ_Etc_GMTm14 ("<+14>-14")
#define TZ_Etc_GMT0 ("GMT0")
#define TZ_Etc_GMTp0 ("GMT0")
#define TZ_Etc_GMTp1 ("<-01>1")
#define TZ_Etc_GMTp2 ("<-02>2")
#define TZ_Etc_GMTp3 ("<-03>3")
#define TZ_Etc_GMTp4 ("<-04>4")
#define TZ_Etc_GMTp5 ("<-05>5")
#define TZ_Etc_GMTp6 ("<-06>6")
#define TZ_Etc_GMTp7 ("<-07>7")
#define TZ_Etc_GMTp8 ("<-08>8")
#define TZ_Etc_GMTp9 ("<-09>9")
#define TZ_Etc_GMTp10 ("<-10>10")
#define TZ_Etc_GMTp11 ("<-11>11")
#define TZ_Etc_GMTp12 ("<-12>12")
#define TZ_Etc_UCT ("UTC0")
#define TZ_Etc_UTC ("UTC0")
#define TZ_Etc_Greenwich ("GMT0")
#define TZ_Etc_Universal ("UTC0")
#define TZ_Etc_Zulu ("UTC0")
-42
View File
@@ -60,45 +60,3 @@ SemaphoreHandle_t __get_freertos_mutex_for_ptr(mutex_t *m, bool recursive) {
}
return nullptr; // Need to make space for more mutex maps!
}
// The HW Random code needs a precise sleep_until() in order to assure it
// grabs the ROSC bit when it wants. Unfortunately, under FreeRTOS the
// sleep_until() becomes imprecise and the "did I get the bit when I wanted"
// check in the pico_rand code always fails and you get an infinite loop.
// This block wraps the 2 get_rand calls to set a flag to convert
// sleep_until() (which can do a task swap and cause bad timing) into a
// busy wait.
extern "C" {
static bool __inRand = false;
extern uint64_t __real_get_rand_64();
uint64_t __wrap_get_rand_64() {
if (__isFreeRTOS) {
rp2040.idleOtherCore();
__inRand = true;
auto r = __real_get_rand_64();
__inRand = false;
rp2040.resumeOtherCore();
return r;
} else {
return __real_get_rand_64();
}
}
uint32_t __wrap_get_rand_32() {
return (uint32_t) __wrap_get_rand_64();
}
extern void __real_sleep_until(absolute_time_t t);
void __wrap_sleep_until(absolute_time_t t) {
if (__inRand) {
busy_wait_until(t);
} else {
__real_sleep_until(t);
}
}
}
File diff suppressed because it is too large Load Diff
+24 -8
View File
@@ -29,15 +29,21 @@
#include <pico/cyw43_arch.h>
#include <pico/mutex.h>
#include <sys/lock.h>
#include "_xoshiro.h"
extern void ethernet_arch_lwip_begin() __attribute__((weak));
extern void ethernet_arch_lwip_end() __attribute__((weak));
extern void ethernet_arch_lwip_gpio_mask() __attribute__((weak));
extern void ethernet_arch_lwip_gpio_unmask() __attribute__((weak));
auto_init_recursive_mutex(__lwipMutex); // Only for case with no Ethernet or PicoW, but still doing LWIP (PPP?)
class LWIPMutex {
public:
LWIPMutex() {
if (ethernet_arch_lwip_gpio_mask) {
ethernet_arch_lwip_gpio_mask();
}
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
if (rp2040.isPicoW()) {
cyw43_arch_lwip_begin();
@@ -55,26 +61,36 @@ public:
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
if (rp2040.isPicoW()) {
cyw43_arch_lwip_end();
return;
} else {
#endif
if (ethernet_arch_lwip_end) {
ethernet_arch_lwip_end();
} else {
recursive_mutex_exit(&__lwipMutex);
}
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
}
#endif
if (ethernet_arch_lwip_end) {
ethernet_arch_lwip_end();
} else {
recursive_mutex_exit(&__lwipMutex);
if (ethernet_arch_lwip_gpio_unmask) {
ethernet_arch_lwip_gpio_unmask();
}
}
};
extern "C" {
static XoshiroCpp::Xoshiro256PlusPlus *_lwip_rng = nullptr;
// Random number generator for LWIP
unsigned long __lwip_rand() {
return (unsigned long)(*_lwip_rng)();
}
// Avoid calling lwip_init multiple times
extern void __real_lwip_init();
void __wrap_lwip_init() {
static bool initted = false;
if (!initted) {
if (!_lwip_rng) {
_lwip_rng = new XoshiroCpp::Xoshiro256PlusPlus(get_rand_64());
__real_lwip_init();
initted = true;
}
}
+5 -1
View File
@@ -66,10 +66,14 @@ typedef enum {
} wl_status_t;
/* Encryption modes */
enum wl_enc_type { /* Values map to 802.11 encryption suites... */
enum wl_enc_type { /* Values map to 802.11 Cipher Algorithm Identifier */
ENC_TYPE_WEP = 5,
ENC_TYPE_TKIP = 2,
ENC_TYPE_WPA = ENC_TYPE_TKIP,
ENC_TYPE_CCMP = 4,
ENC_TYPE_WPA2 = ENC_TYPE_CCMP,
ENC_TYPE_GCMP = 6,
ENC_TYPE_WPA3 = ENC_TYPE_GCMP,
/* ... except these two, 7 and 8 are reserved in 802.11-2007 */
ENC_TYPE_NONE = 7,
ENC_TYPE_AUTO = 8,
+1 -1
View File
@@ -30,7 +30,7 @@ Analog Outputs
--------------
The RP2040 does not have any onboard DACs, so analog outputs are
simulated using the standard method of using pulse width modulation
(PWM) using the RP20400's hardware PWM units.
(PWM) using the RP2040's hardware PWM units.
While up to 16 PWM channels can be generated, they are not independent
and there are significant restrictions as to allowed pins in parallel.
+2 -2
View File
@@ -54,9 +54,9 @@ author = u'Earle F. Philhower, III'
# built documents.
#
# The short X.Y version.
version = u'3.6.1'
version = u'3.7.1'
# The full version, including alpha/beta/rc tags.
release = u'3.6.1'
release = u'3.7.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
+15 -2
View File
@@ -86,6 +86,19 @@ Pico may not have enough time to service the Ethernet port before the timer fire
leading to a lock up and hang.
Using Interrupt-Driven Handling
-------------------------------
The WizNet and ENC28J60 devices support generating an interrupt when a packet is received,
removing the need for polling and decreasing latency. Simply specify the SPI object to use and the
interrupt pin when instantiating the Ethernet object:
.. code:: cpp
#include <W5100lwIP.h>
Wiznet5100lwIP eth(SS /* Chip Select*/, SPI /* SPI interface */, 17 /* Interrupt GPIO */ );
Adjusting SPI Speed
-------------------
@@ -114,12 +127,12 @@ For example, to set the W5500 to use a 30MHZ clock:
Using the WIZnet W5100S-EVB-Pico
--------------------------------
You can use the onboard Ethernet chip with these drivers by utilizing the following options:
You can use the onboard Ethernet chip with these drivers, in interrupt mode, by utilizing the following options:
.. code:: cpp
#include <W5100lwIP.h>
Wiznet5100lwIP eth(17); // Note chip select is **17**
Wiznet5100lwIP eth(17, SPI, 21); // Note chip select is **17**
void setup() {
// Set SPI to the onboard Wiznet chip
+3 -7
View File
@@ -1,15 +1,11 @@
IDE Menus
=========
Model
Board
-----
Use the boards menu to select your model of RP2040 board. There will be two
options: `Boardname` and `Boardname (Picoprobe)`. If you want to use a
Picoprobe to upload your sketches and not the default automatic UF2 upload,
use the `(Picoprobe)` option, otherwise use the normal name. No functional
or code changes are done because of this.
Use the boards menu to select your model of RP2040 board.
There is also a `Generic` board which allows you to individually select
There is also a `Generic RP2040` board which allows you to individually select
things such as flash size or boot2 flash type. Use this if your board isn't
yet fully supported and isn't working with the normal `Raspberry Pi Pico`
option.
-6
View File
@@ -159,12 +159,6 @@ So for the first sketch you will need to rebuild (with the ``Upload Method->Pico
After the initial upload, as long as the running binary was built using the ``Picotool`` upload method, then the normal upload process should work.
Under MacOS, it may be necessary to install the USB support libraries from a command terminal before the ``Picotool`` upload method can be used:
.. code::
brew install libusb
For Ubuntu and other Linux operating systems you may need to add the following lines to a new `udev` config file(``99-picotool.rules``) to allow normal users to access the special USB device the Pico exports:
.. code::
+3 -4
View File
@@ -191,7 +191,7 @@ Debug Level
Done again by directly adding the needed `build
flags <https://github.com/earlephilhower/arduino-pico/blob/05356da2c5552413a442f742e209c6fa92823666/boards.txt#L104-L114>`__.
When wanting to define multiple build flags, they must be accumulated in
either a sing line or a newline-separated expression.
either a single line or a newline-separated expression.
.. code:: ini
@@ -363,7 +363,7 @@ For further information on customizing debug options, like the initial breakpoin
You can obtain precompiled binaries from `here <https://github.com/blackmagic-debug/blackmagic/issues/1364#issuecomment-1503372723>`__. A flashing guide is available `here <https://primalcortex.wordpress.com/2017/06/13/building-a-black-magic-debug-probe/>`__. You then have to configure the target serial port ("GDB port") in your project per `documentation <https://docs.platformio.org/en/latest/plus/debug-tools/blackmagic.html#debugging-tool-blackmagic>`__.
.. note::
For the pico-debug (`download <https://github.com/majbthrd/pico-debug/releases>`__) debugging way, *which needs to no additional debug probe*, add this snippet to your ``platformio.ini`` and follow the given procedure:
For the pico-debug (`download <https://github.com/majbthrd/pico-debug/releases>`__) debugging way, *which needs no additional debug probe*, add this snippet to your ``platformio.ini`` and follow the given procedure:
.. code:: ini
@@ -397,5 +397,4 @@ The task "Build Filesystem Image" will take all files in the data directory and
The task "Upload Filesystem Image" will upload the filesystem image to the Pico via the specified ``upload_protocol``.
.. note::
Set the space available for the filesystem in the ``platformio.ini`` using e.g., ``board_build.filesystem_size = 0.5m``, or filesystem
creation will fail!
Set the space available for the filesystem in the ``platformio.ini`` using e.g., ``board_build.filesystem_size = 0.5m``, or filesystem creation will fail!
+3 -1
View File
@@ -42,7 +42,9 @@ Please note that WiFi on the Pico W is a work-in-progress and there are some imp
* Multicore is supported, but only core 0 may run ``WiFi`` related code.
* FreeRTOS is supported only on core 0 and from within ``setup`` and ``loop`, not tasks, due to the requirement for a very different LWIP implementation. PRs always appreciated!
* FreeRTOS is supported only on core 0 and from within ``setup`` and ``loop``, not tasks, due to the requirement for a very different LWIP implementation. PRs always appreciated!
* LEAmDNS (``MDNS``) is not supported in FreeRTOS due to internal IRQ-time memory allocations.
The WiFi library borrows much work from the `ESP8266 Arduino Core <https://github.com/esp8266/Arduino>`__ , especially the ``WiFiClient`` and ``WiFiServer`` classes.
+1 -1
View File
@@ -20,7 +20,7 @@ diagram for your board, or it won't work.
Other than that, the API is compatible with the Arduino standard.
Both master and slave operation are supported.
Master transmissions are buffered (up to 128 bytes) and only performed
Master transmissions are buffered (up to 256 bytes) and only performed
on ``endTransmission``, as is standard with modern Arduino Wire implementations.
For more detailed information, check the `Arduino Wire documentation <https://www.arduino.cc/en/reference/wire>`_ .
+2 -2
View File
@@ -13,8 +13,8 @@ extern void interrupts();
#define SYS_ARCH_PROTECT(lev) noInterrupts
#define SYS_ARCH_UNPROTECT(lev) interrupts
extern unsigned long get_rand_32(void);
#define LWIP_RAND() get_rand_32()
extern unsigned long __lwip_rand(void);
#define LWIP_RAND() __lwip_rand()
// Common settings used in most of the pico_w examples
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details)
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-4
View File
@@ -209,7 +209,3 @@
-Wl,--wrap=cyw43_tcpip_link_status
-Wl,--wrap=cyw43_cb_tcpip_init
-Wl,--wrap=cyw43_cb_tcpip_deinit
-Wl,--wrap=get_rand_64
-Wl,--wrap=get_rand_32
-Wl,--wrap=sleep_until
@@ -46,7 +46,7 @@ IPAddress netMsk(255, 255, 255, 0);
/** Should I connect to WLAN asap? */
boolean connect;
bool connect;
/** Last time I tried to connect to WLAN */
unsigned long lastConnectTry = 0;
@@ -24,7 +24,7 @@ void handleRoot() {
}
/** Redirect to captive portal if we got a request for another domain. Return true in that case so the page handler do not try to handle the request again. */
boolean captivePortal() {
bool captivePortal() {
if (!isIp(server.hostHeader()) && server.hostHeader() != (String(myHostname) + ".local")) {
Serial.println("Request redirected to captive portal");
server.sendHeader("Location", String("http://") + toStringIp(server.client().localIP()), true);
@@ -1,5 +1,5 @@
/** Is this an IP? */
boolean isIp(String str) {
bool isIp(String str) {
for (size_t i = 0; i < str.length(); i++) {
int c = str.charAt(i);
if (c != '.' && (c < '0' || c > '9')) {
+62 -79
View File
@@ -1,127 +1,110 @@
/* Cores */
#define configNUM_CORES 2
#define configUSE_CORE_AFFINITY 1
#define configRUN_MULTIPLE_PRIORITIES 1
#define configNUM_CORES 2
#define configUSE_CORE_AFFINITY 1
#define configRUN_MULTIPLE_PRIORITIES 1
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_MINIMAL_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned long ) F_CPU )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 8 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 164 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_QUEUE_SETS 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSTACK_DEPTH_TYPE uint32_t
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_MINIMAL_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned long ) F_CPU )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 8 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 164 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_QUEUE_SETS 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSTACK_DEPTH_TYPE uint32_t
#define configUSE_TASK_PREEMPTION_DISABLE 1
#define configUSE_NEWLIB_REENTRANT 1
#define configUSE_NEWLIB_REENTRANT 1
#define configNEWLIB_REENTRANT_IS_DYNAMIC 1
/* Run time stats related definitions. */
void vMainConfigureTimerForRunTimeStats(void);
unsigned long ulMainGetRunTimeCounterValue(void);
extern void vMainConfigureTimerForRunTimeStats(void);
extern unsigned long ulMainGetRunTimeCounterValue(void);
#define configGENERATE_RUN_TIME_STATS 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //vMainConfigureTimerForRunTimeStats()
#define portGET_RUN_TIME_COUNTER_VALUE() ulMainGetRunTimeCounterValue()
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 1
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( 1024 )
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( 1024 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_xQueueGetMutexHolder 1
#define INCLUDE_xTaskAbortDelay 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_xTaskGetHandle 1
#define INCLUDE_xTaskGetIdleTaskHandle 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskResumeFromISR 1
#define INCLUDE_xTimerPendFunctionCall 1
/* This demo makes use of one or more example stats formatting functions. These
format the raw data provided by the uxTaskGetSystemState() function in to human
readable ASCII form. See the notes in the implementation of vTaskList() within
FreeRTOS/Source/tasks.c for limitations. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
#define configUSE_MUTEXES 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetIdleTaskHandle 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configCHECK_FOR_STACK_OVERFLOW 2
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
#define configUSE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configCHECK_FOR_STACK_OVERFLOW 2
/* Cortex-M specific definitions. */
#undef __NVIC_PRIO_BITS
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 3 /* 8 priority levels */
#define configPRIO_BITS 3 /* 8 priority levels */
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x7
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x7
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
extern void rtosFatalError(void);
#define configASSERT( x ) \
if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); rtosFatalError(); }
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names - or at least those used in the unmodified vector table. */
//#define xPortPendSVHandler PendSV_Handler
//#define xPortSysTickHandler SysTick_Handler
//#define vPortSVCHandler SVC_Handler
/* The size of the global output buffer that is available for use when there
are multiple command interpreters running at once (for example, one on a UART
and one on TCP/IP). This is done to prevent an output buffer being defined by
each implementation - which would waste RAM. In this case, there is only one
command interpreter running. */
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
#define configUSE_DYNAMIC_EXCEPTION_HANDLERS 0
#define configSUPPORT_PICO_SYNC_INTEROP 1
#define configSUPPORT_PICO_TIME_INTEROP 1
#define configSUPPORT_PICO_SYNC_INTEROP 1
#define configSUPPORT_PICO_TIME_INTEROP 1
#include "rp2040_config.h"
//#include "task.h"
+1 -1
View File
@@ -161,7 +161,7 @@ bool MDNSResponder::_allocUDPContext(void) {
if (m_pUDPContext->listen(IP4_ADDR_ANY, DNS_MQUERY_PORT)) {
m_pUDPContext->setMulticastTTL(MDNS_MULTICAST_TTL);
m_pUDPContext->onRx(std::bind(&MDNSResponder::_callProcess, this));
m_pUDPContext->onRx([this] { this->_callProcess(); });
} else {
return false;
}
+73 -3
View File
@@ -32,6 +32,8 @@ PWMAudio::PWMAudio(pin_size_t pin, bool stereo) {
_buffers = 8;
_bufferWords = 0;
_stereo = stereo;
_sampleRate = 48000;
_pacer = -1;
}
PWMAudio::~PWMAudio() {
@@ -63,7 +65,7 @@ bool PWMAudio::setStereo(bool stereo) {
return true;
}
bool PWMAudio::setFrequency(int newFreq) {
bool PWMAudio::setPWMFrequency(int newFreq) {
_freq = newFreq;
// Figure out the scale factor for PWM values
@@ -92,6 +94,17 @@ bool PWMAudio::setFrequency(int newFreq) {
return true;
}
bool PWMAudio::setFrequency(int frequency) {
if (_pacer < 0) {
return false;
}
uint16_t _pacer_D, _pacer_N;
/*Flip fraction(N for D, D for N) because we are using it as sys_clk * fraction(mechanic of dma_timer_set_fraction) for smaller than sys_clk values*/
find_pacer_fraction(frequency, &_pacer_D, &_pacer_N);
dma_timer_set_fraction(_pacer, _pacer_N, _pacer_D);
return true;
}
void PWMAudio::onTransmit(void(*fn)(void)) {
_cb = fn;
if (_running) {
@@ -117,12 +130,25 @@ bool PWMAudio::begin() {
_bufferWords = 16;
}
setFrequency(_freq);
setPWMFrequency(_freq);
/*Calculate and set the DMA pacer timer. This timer will pull data on a fixed sample rate. So the actual PWM frequency can be higher or lower.*/
_pacer = dma_claim_unused_timer(false);
/*When no unused timer is found, return*/
if (_pacer < 0) {
return false;
}
uint16_t _pacer_D = 0;
uint16_t _pacer_N = 0;
/*Flip fraction(N for D, D for N) because we are using it as sys_clk * fraction(mechanic of dma_timer_set_fraction) for smaller than sys_clk values*/
find_pacer_fraction(_sampleRate, &_pacer_D, &_pacer_N);
dma_timer_set_fraction(_pacer, _pacer_N, _pacer_D);
int _pacer_dreq = dma_get_timer_dreq(_pacer);
uint32_t ccAddr = PWM_BASE + PWM_CH0_CC_OFFSET + pwm_gpio_to_slice_num(_pin) * 20;
_arb = new AudioBufferManager(_buffers, _bufferWords, 0x80008000, OUTPUT, DMA_SIZE_32);
if (!_arb->begin(pwm_get_dreq(pwm_gpio_to_slice_num(_pin)), (volatile void*)ccAddr)) {
if (!_arb->begin(_pacer_dreq, (volatile void*)ccAddr)) {
_running = false;
delete _arb;
_arb = nullptr;
@@ -143,6 +169,9 @@ void PWMAudio::end() {
}
delete _arb;
_arb = nullptr;
dma_timer_unclaim(_pacer);
_pacer = -1;
}
}
@@ -219,3 +248,44 @@ size_t PWMAudio::write(const uint8_t *buffer, size_t size) {
}
return writtenSize;
}
void PWMAudio::find_pacer_fraction(int target, uint16_t *numerator, uint16_t *denominator) {
const uint16_t max = 0xFFFF;
/*Cache last results so we dont have to recalculate*/
static int last_target;
static uint16_t bestNum;
static uint16_t bestDenom;
/*Check if we can load the previous values*/
if (target == last_target) {
*numerator = bestNum;
*denominator = bestDenom;
return;
}
float targetRatio = (float)F_CPU / target;
float lowestError = HUGE_VALF;
for (uint16_t denom = 1; denom < max; denom++) {
uint16_t num = (int)((targetRatio * denom) + 0.5f); /*Calculate numerator, rounding to nearest integer*/
/*Check if numerator is within bounds*/
if (num > 0 && num < max) {
float actualRatio = (float)num / denom;
float error = fabsf(actualRatio - targetRatio);
if (error < lowestError) {
bestNum = num;
bestDenom = denom;
lowestError = error;
if (error == 0) {
break;
}
}
}
}
last_target = target;
*numerator = bestNum;
*denominator = bestDenom;
}
+17 -2
View File
@@ -29,12 +29,21 @@ public:
virtual ~PWMAudio();
bool setBuffers(size_t buffers, size_t bufferWords);
bool setFrequency(int newFreq);
/*Sets the frequency of the PWM in hz*/
bool setPWMFrequency(int newFreq);
/*Sets the sample rate frequency in hz*/
bool setFrequency(int frequency);
bool setPin(pin_size_t pin);
bool setStereo(bool stereo = true);
bool begin(long sampleRate) {
setFrequency(sampleRate);
_sampleRate = sampleRate;
return begin();
}
bool begin(long sampleRate, long PWMfrequency) {
setPWMFrequency(PWMfrequency);
_sampleRate = sampleRate;
return begin();
}
@@ -70,6 +79,9 @@ private:
bool _stereo;
int _freq;
int _sampleRate;
int _pacer;
size_t _buffers;
size_t _bufferWords;
@@ -84,4 +96,7 @@ private:
void (*_cb)();
AudioBufferManager *_arb;
/*An accurate but brute force method to find 16bit numerator and denominator.*/
void find_pacer_fraction(int target, uint16_t *numerator, uint16_t *denominator);
};
+180
View File
@@ -0,0 +1,180 @@
/*
SD card test
This example shows how use the utility libraries on which the'
SD library is based in order to get info about your SD card.
Very useful for testing a card when you're not sure whether its working or not.
The circuit:
SD card attached to SPI bus as follows on RP2040:
************ SPI0 ************
** MISO (AKA RX) - pin 0, 4, or 16
** MOSI (AKA TX) - pin 3, 7, or 19
** CS - pin 1, 5, or 17
** SCK - pin 2, 6, or 18
************ SPI1 ************
** MISO (AKA RX) - pin 8 or 12
** MOSI (AKA TX) - pin 11 or 15
** CS - pin 9 or 13
** SCK - pin 10 or 14
created 28 Mar 2011
by Limor Fried
modified 9 Apr 2012
by Tom Igoe
modified 26 Dec 2023
by Richard Teel from code provided by Renzo Mischianti
SOURCE: https://mischianti.org/raspberry-pi-pico-and-rp2040-boards-how-to-use-sd-card-5/
*/
// This are GP pins for SPI0 on the Raspberry Pi Pico board, and connect
// to different *board* level pinouts. Check the PCB while wiring.
// Only certain pins can be used by the SPI hardware, so if you change
// these be sure they are legal or the program will crash.
// See: https://datasheets.raspberrypi.com/picow/PicoW-A4-Pinout.pdf
const int _MISO = 4; // AKA SPI RX
const int _MOSI = 7; // AKA SPI TX
const int _CS = 5;
const int _SCK = 6;
// include the SD library:
#include <SPI.h>
#include <SD.h>
File root;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
delay(1); // wait for serial port to connect. Needed for native USB port only
}
Serial.println("\nInitializing SD card...");
bool sdInitialized = false;
// Ensure the SPI pinout the SD card is connected to is configured properly
// Select the correct SPI based on _MISO pin for the RP2040
if (_MISO == 0 || _MISO == 4 || _MISO == 16) {
SPI.setRX(_MISO);
SPI.setTX(_MOSI);
SPI.setSCK(_SCK);
sdInitialized = SD.begin(_CS);
} else if (_MISO == 8 || _MISO == 12) {
SPI1.setRX(_MISO);
SPI1.setTX(_MOSI);
SPI1.setSCK(_SCK);
sdInitialized = SD.begin(_CS, SPI1);
} else {
Serial.println(F("ERROR: Unknown SPI Configuration"));
return;
}
if (!sdInitialized) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card inserted?");
Serial.println("* is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
return;
} else {
Serial.println("Wiring is correct and a card is present.");
}
// 0 - SD V1, 1 - SD V2, or 3 - SDHC/SDXC
// print the type of card
Serial.println();
Serial.print("Card type: ");
switch (SD.type()) {
case 0:
Serial.println("SD1");
break;
case 1:
Serial.println("SD2");
break;
case 3:
Serial.println("SDHC/SDXC");
break;
default:
Serial.println("Unknown");
}
Serial.print("Cluster size: ");
Serial.println(SD.clusterSize());
Serial.print("Blocks x Cluster: ");
Serial.println(SD.blocksPerCluster());
Serial.print("Blocks size: ");
Serial.println(SD.blockSize());
Serial.print("Total Blocks: ");
Serial.println(SD.totalBlocks());
Serial.println();
Serial.print("Total Cluster: ");
Serial.println(SD.totalClusters());
Serial.println();
// print the type and size of the first FAT-type volume
uint32_t volumesize;
Serial.print("Volume type is: FAT");
Serial.println(SD.fatType(), DEC);
volumesize = SD.totalClusters();
volumesize *= SD.clusterSize();
volumesize /= 1000;
Serial.print("Volume size (Kb): ");
Serial.println(volumesize);
Serial.print("Volume size (Mb): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.print("Volume size (Gb): ");
Serial.println((float)volumesize / 1024.0);
Serial.print("Card size: ");
Serial.println((float)SD.size() / 1000);
FSInfo fs_info;
SDFS.info(fs_info);
Serial.print("Total bytes: ");
Serial.println(fs_info.totalBytes);
Serial.print("Used bytes: ");
Serial.println(fs_info.usedBytes);
root = SD.open("/");
printDirectory(root, 0);
}
void loop(void) {
// nothing happens after setup finishes.
}
void printDirectory(File dir, int numTabs) {
while (true) {
File entry = dir.openNextFile();
if (!entry) {
// no more files
break;
}
for (uint8_t i = 0; i < numTabs; i++) {
Serial.print('\t');
}
Serial.print(entry.name());
if (entry.isDirectory()) {
Serial.println("/");
printDirectory(entry, numTabs + 1);
} else {
// files have sizes, directories do not
Serial.print("\t\t");
Serial.print(entry.size(), DEC);
time_t cr = entry.getCreationTime();
time_t lw = entry.getLastWrite();
struct tm* tmstruct = localtime(&cr);
Serial.printf("\tCREATION: %d-%02d-%02d %02d:%02d:%02d", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour, tmstruct->tm_min, tmstruct->tm_sec);
tmstruct = localtime(&lw);
Serial.printf("\tLAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour, tmstruct->tm_min, tmstruct->tm_sec);
}
entry.close();
}
}
+42 -15
View File
@@ -5,11 +5,17 @@
directory on a SD card
The circuit:
SD card attached to SPI bus as follows:
** MISO - pin 4
** MOSI - pin 7
** CS - pin 5
** SCK - pin 6
SD card attached to SPI bus as follows on RP2040:
************ SPI0 ************
** MISO (AKA RX) - pin 0, 4, or 16
** MOSI (AKA TX) - pin 3, 7, or 19
** CS - pin 1, 5, or 17
** SCK - pin 2, 6, or 18
************ SPI1 ************
** MISO (AKA RX) - pin 8 or 12
** MOSI (AKA TX) - pin 11 or 15
** CS - pin 9 or 13
** SCK - pin 10 or 14
created Nov 2010
by David A. Mellis
@@ -17,6 +23,10 @@
by Tom Igoe
modified 2 Feb 2014
by Scott Fitzgerald
modified 12 Feb 2023
by Earle F. Philhower, III
modified 26 Dec 2023
by Richard Teel
This example code is in the public domain.
@@ -27,8 +37,8 @@
// Only certain pins can be used by the SPI hardware, so if you change
// these be sure they are legal or the program will crash.
// See: https://datasheets.raspberrypi.com/picow/PicoW-A4-Pinout.pdf
const int _MISO = 4;
const int _MOSI = 7;
const int _MISO = 4; // AKA SPI RX
const int _MOSI = 7; // AKA SPI TX
const int _CS = 5;
const int _SCK = 6;
@@ -41,14 +51,31 @@ void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
Serial.print("Initializing SD card...");
while (!Serial) {
delay(1); // wait for serial port to connect. Needed for native USB port only
}
Serial.println("\nInitializing SD card...");
bool sdInitialized = false;
// Ensure the SPI pinout the SD card is connected to is configured properly
SPI.setRX(_MISO);
SPI.setTX(_MOSI);
SPI.setSCK(_SCK);
// Select the correct SPI based on _MISO pin for the RP2040
if (_MISO == 0 || _MISO == 4 || _MISO == 16) {
SPI.setRX(_MISO);
SPI.setTX(_MOSI);
SPI.setSCK(_SCK);
sdInitialized = SD.begin(_CS);
} else if (_MISO == 8 || _MISO == 12) {
SPI1.setRX(_MISO);
SPI1.setTX(_MOSI);
SPI1.setSCK(_SCK);
sdInitialized = SD.begin(_CS, SPI1);
} else {
Serial.println(F("ERROR: Unknown SPI Configuration"));
return;
}
if (!SD.begin(_CS)) {
if (!sdInitialized) {
Serial.println("initialization failed!");
return;
}
@@ -68,8 +95,8 @@ void loop() {
void printDirectory(File dir, int numTabs) {
while (true) {
File entry = dir.openNextFile();
if (! entry) {
File entry = dir.openNextFile();
if (!entry) {
// no more files
break;
}
@@ -86,7 +113,7 @@ void printDirectory(File dir, int numTabs) {
Serial.print(entry.size(), DEC);
time_t cr = entry.getCreationTime();
time_t lw = entry.getLastWrite();
struct tm * tmstruct = localtime(&cr);
struct tm* tmstruct = localtime(&cr);
Serial.printf("\tCREATION: %d-%02d-%02d %02d:%02d:%02d", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour, tmstruct->tm_min, tmstruct->tm_sec);
tmstruct = localtime(&lw);
Serial.printf("\tLAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n", (tmstruct->tm_year) + 1900, (tmstruct->tm_mon) + 1, tmstruct->tm_mday, tmstruct->tm_hour, tmstruct->tm_min, tmstruct->tm_sec);
+23 -23
View File
@@ -31,13 +31,13 @@
class SDClass {
public:
boolean begin(uint8_t csPin, HardwareSPI &spi) {
bool begin(uint8_t csPin, HardwareSPI &spi) {
SDFS.setConfig(SDFSConfig(csPin, SPI_HALF_SPEED, spi));
return (boolean)SDFS.begin();
return SDFS.begin();
}
boolean begin(uint8_t csPin, uint32_t cfg = SPI_HALF_SPEED, HardwareSPI &spi = SPI) {
bool begin(uint8_t csPin, uint32_t cfg = SPI_HALF_SPEED, HardwareSPI &spi = SPI) {
SDFS.setConfig(SDFSConfig(csPin, cfg, spi));
return (boolean)SDFS.begin();
return SDFS.begin();
}
void end(bool endSPI = true) {
@@ -63,43 +63,43 @@ public:
return open(filename.c_str(), mode);
}
boolean exists(const char *filepath) {
return (boolean)SDFS.exists(filepath);
bool exists(const char *filepath) {
return SDFS.exists(filepath);
}
boolean exists(const String &filepath) {
return (boolean)SDFS.exists(filepath.c_str());
bool exists(const String &filepath) {
return SDFS.exists(filepath.c_str());
}
boolean rename(const char* filepathfrom, const char* filepathto) {
return (boolean)SDFS.rename(filepathfrom, filepathto);
bool rename(const char* filepathfrom, const char* filepathto) {
return SDFS.rename(filepathfrom, filepathto);
}
boolean rename(const String &filepathfrom, const String &filepathto) {
return (boolean)rename(filepathfrom.c_str(), filepathto.c_str());
bool rename(const String &filepathfrom, const String &filepathto) {
return rename(filepathfrom.c_str(), filepathto.c_str());
}
boolean mkdir(const char *filepath) {
return (boolean)SDFS.mkdir(filepath);
bool mkdir(const char *filepath) {
return SDFS.mkdir(filepath);
}
boolean mkdir(const String &filepath) {
return (boolean)SDFS.mkdir(filepath.c_str());
bool mkdir(const String &filepath) {
return SDFS.mkdir(filepath.c_str());
}
boolean remove(const char *filepath) {
return (boolean)SDFS.remove(filepath);
bool remove(const char *filepath) {
return SDFS.remove(filepath);
}
boolean remove(const String &filepath) {
bool remove(const String &filepath) {
return remove(filepath.c_str());
}
boolean rmdir(const char *filepath) {
return (boolean)SDFS.rmdir(filepath);
bool rmdir(const char *filepath) {
return SDFS.rmdir(filepath);
}
boolean rmdir(const String &filepath) {
bool rmdir(const String &filepath) {
return rmdir(filepath.c_str());
}
@@ -128,7 +128,7 @@ public:
}
size_t totalBlocks() {
return (totalClusters() / blocksPerCluster());
return (totalClusters() * blocksPerCluster());
}
size_t clusterSize() {
+1 -1
View File
@@ -183,7 +183,7 @@ public:
return _fs.vol()->clusterCount();
}
size_t totalBlocks() {
return (totalClusters() / blocksPerCluster());
return (totalClusters() * blocksPerCluster());
}
size_t clusterSize() {
return _fs.vol()->bytesPerCluster();
+1
View File
@@ -18,6 +18,7 @@ beginTransaction KEYWORD2
endTransaction KEYWORD2
SPISettings KEYWORD2
transfer KEYWORD2
transfer16 KEYWORD2
setBitOrder KEYWORD2
setDataMode KEYWORD2
setClockDivider KEYWORD2
+23 -14
View File
@@ -37,7 +37,7 @@ SPIClassRP2040::SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pi
_spi = spi;
_running = false;
_initted = false;
_spis = SPISettings();
_spis = SPISettings(0, LSBFIRST, SPI_MODE0); // Ensure spi_init called by setting current freq to 0
_RX = rx;
_TX = tx;
_SCK = sck;
@@ -111,6 +111,7 @@ byte SPIClassRP2040::transfer(uint8_t data) {
}
data = (_spis.getBitOrder() == MSBFIRST) ? data : reverseByte(data);
DEBUGSPI("SPI::transfer(%02x), cpol=%d, cpha=%d\n", data, cpol(), cpha());
hw_write_masked(&spi_get_hw(_spi)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); // Fast set to 8-bits
spi_write_read_blocking(_spi, &data, &ret, 1);
ret = (_spis.getBitOrder() == MSBFIRST) ? ret : reverseByte(ret);
DEBUGSPI("SPI: read back %02x\n", ret);
@@ -124,11 +125,8 @@ uint16_t SPIClassRP2040::transfer16(uint16_t data) {
}
data = (_spis.getBitOrder() == MSBFIRST) ? data : reverse16Bit(data);
DEBUGSPI("SPI::transfer16(%04x), cpol=%d, cpha=%d\n", data, cpol(), cpha());
uint8_t d[2];
d[0] = (data >> 8) & 0xff;
d[1] = data & 0xff;
spi_write_read_blocking(_spi, d, d, 2);
ret = ((d[0] << 8) | (d[1] & 0xff)) & 0xffff;
hw_write_masked(&spi_get_hw(_spi)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); // Fast set to 16-bits
spi_write16_read16_blocking(_spi, &data, &ret, 1);
ret = (_spis.getBitOrder() == MSBFIRST) ? ret : reverse16Bit(ret);
DEBUGSPI("SPI: read back %02x\n", ret);
return ret;
@@ -149,6 +147,8 @@ void SPIClassRP2040::transfer(const void *txbuf, void *rxbuf, size_t count) {
return;
}
hw_write_masked(&spi_get_hw(_spi)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); // Fast set to 8-bits
DEBUGSPI("SPI::transfer(%p, %p, %d)\n", txbuf, rxbuf, count);
const uint8_t *txbuff = reinterpret_cast<const uint8_t *>(txbuf);
uint8_t *rxbuff = reinterpret_cast<uint8_t *>(rxbuf);
@@ -184,15 +184,18 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
if (_initted && settings == _spis) {
DEBUGSPI("SPI: Reusing existing initted SPI\n");
} else {
_spis = settings;
if (_initted) {
DEBUGSPI("SPI: deinitting currently active SPI\n");
spi_deinit(_spi);
/* Only de-init if the clock changes frequency */
if (settings.getClockFreq() != _spis.getClockFreq()) {
if (_initted) {
DEBUGSPI("SPI: deinitting currently active SPI\n");
spi_deinit(_spi);
}
DEBUGSPI("SPI: initting SPI\n");
spi_init(_spi, settings.getClockFreq());
DEBUGSPI("SPI: actual baudrate=%u\n", spi_get_baudrate(_spi));
}
DEBUGSPI("SPI: initting SPI\n");
spi_init(_spi, _spis.getClockFreq());
_spis = settings;
spi_set_format(_spi, 8, cpol(), cpha(), SPI_MSB_FIRST);
DEBUGSPI("SPI: actual baudrate=%u\n", spi_get_baudrate(_spi));
_initted = true;
}
// Disable any IRQs that are being used for SPI
@@ -205,7 +208,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
io_rw_32 *en_reg = &irq_ctrl_base->inte[gpio / 8];
uint32_t val = ((*en_reg) >> (4 * (gpio % 8))) & 0xf;
_usingIRQs.insert_or_assign(gpio, val);
DEBUGSPI("SPI: GPIO %d = %d\n", gpio, val);
DEBUGSPI("SPI: GPIO %d = %lu\n", gpio, val);
(*en_reg) ^= val << (4 * (gpio % 8));
}
DEBUGSPI("SPI: IRQ masks after = %08x %08x %08x %08x\n", (unsigned)irq_ctrl_base->inte[0], (unsigned)irq_ctrl_base->inte[1], (unsigned)irq_ctrl_base->inte[2], (unsigned)irq_ctrl_base->inte[3]);
@@ -338,6 +341,7 @@ void SPIClassRP2040::end() {
}
gpio_set_function(_SCK, GPIO_FUNC_SIO);
gpio_set_function(_TX, GPIO_FUNC_SIO);
_spis = SPISettings(0, LSBFIRST, SPI_MODE0);
}
void SPIClassRP2040::setBitOrder(BitOrder order) {
@@ -363,5 +367,10 @@ void SPIClassRP2040::setClockDivider(uint8_t uc_div) {
#define __SPI1_DEVICE spi1
#endif
#ifdef PIN_SPI0_MISO
SPIClassRP2040 SPI(__SPI0_DEVICE, PIN_SPI0_MISO, PIN_SPI0_SS, PIN_SPI0_SCK, PIN_SPI0_MOSI);
#endif
#ifdef PIN_SPI1_MISO
SPIClassRP2040 SPI1(__SPI1_DEVICE, PIN_SPI1_MISO, PIN_SPI1_SS, PIN_SPI1_SCK, PIN_SPI1_MOSI);
#endif
+3 -3
View File
@@ -262,15 +262,15 @@ void HTTPServer::setContentLength(const size_t contentLength) {
_contentLength = contentLength;
}
void HTTPServer::enableDelay(boolean value) {
void HTTPServer::enableDelay(bool value) {
_nullDelay = value;
}
void HTTPServer::enableCORS(boolean value) {
void HTTPServer::enableCORS(bool value) {
_corsEnabled = value;
}
void HTTPServer::enableCrossOrigin(boolean value) {
void HTTPServer::enableCrossOrigin(bool value) {
enableCORS(value);
}
+5 -5
View File
@@ -146,9 +146,9 @@ public:
send(code, content_type, (const char *)content, contentLength);
}
void enableDelay(boolean value);
void enableCORS(boolean value = true);
void enableCrossOrigin(boolean value = true);
void enableDelay(bool value);
void enableCORS(bool value = true);
void enableCrossOrigin(bool value = true);
void setContentLength(const size_t contentLength);
void sendHeader(const String& name, const String& value, bool first = false);
@@ -235,7 +235,7 @@ protected:
String value;
};
boolean _corsEnabled;
bool _corsEnabled;
WiFiClient *_currentClient;
HTTPMethod _currentMethod;
@@ -243,7 +243,7 @@ protected:
uint8_t _currentVersion;
HTTPClientStatus _currentStatus;
unsigned long _statusChange;
boolean _nullDelay;
bool _nullDelay;
RequestHandler* _currentHandler;
RequestHandler* _firstHandler;
+1 -1
View File
@@ -339,7 +339,7 @@ int HTTPServer::_uploadReadByte(WiFiClient* client) {
// keep trying until you either read a valid byte or timeout
unsigned long startMillis = millis();
unsigned long timeoutIntervalMillis = client->getTimeout();
boolean timedOut = false;
bool timedOut = false;
for (;;) {
if (!client->connected()) {
return -1;
+1 -1
View File
@@ -90,7 +90,7 @@ void WebServerTemplate<ServerType, DefaultPort>::handleClient() {
_currentClient = nullptr;
}
_currentClient = new ClientType(_server.available());
_currentClient = new ClientType(_server.accept());
if (!_currentClient) {
if (_nullDelay) {
delay(1);
@@ -34,7 +34,7 @@ void loop() {
delay(1000);
Serial.printf("--loop %d\n", ++i);
delay(10);
WiFiClient client = server.available();
WiFiClient client = server.accept();
if (!client) {
return;
}
+49 -154
View File
@@ -21,8 +21,6 @@
*/
#include <inttypes.h>
#include <pico/cyw43_arch.h>
#include <cyw43.h>
#include "lwip/raw.h"
#include "lwip/icmp.h"
#include "lwip/inet_chksum.h"
@@ -31,7 +29,14 @@
// This is the real WiFi network object, we just tickle it to do our magic
#include <LwipEthernet.h>
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#include <pico/cyw43_arch.h>
static CYW43lwIP _wifi(1);
#elif defined(ESPHOSTSPI)
static ESPHostLwIP _wifi;
#else
static NoDriverLwIP _wifi;
#endif
WiFiClass::WiFiClass() {
}
@@ -75,7 +80,6 @@ int WiFiClass::beginBSSID(const char* ssid, const uint8_t *bssid) {
return begin(ssid, nullptr, bssid);
}
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
/* Start WiFi connection with passphrase
the most secure supported mode will be automatically selected
@@ -98,11 +102,11 @@ int WiFiClass::begin(const char* ssid, const char *passphrase, const uint8_t *bs
} else {
bzero(_bssid, sizeof(_bssid));
}
_wifi.setSTA();
_wifi.setSSID(_ssid.c_str());
_wifi.setBSSID(_bssid);
_wifi.setPassword(passphrase);
_wifi.setTimeout(_timeout);
_wifi.setSTA();
_apMode = false;
_wifiHWInitted = true;
uint32_t start = millis(); // The timeout starts from network init, not network link up
@@ -137,15 +141,11 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
_ssid = ssid;
_password = passphrase;
_wifi.setAP();
_wifi.setSSID(_ssid.c_str());
_wifi.setPassword(passphrase);
_wifi.setTimeout(_timeout);
_wifi.setAP();
_apMode = true;
if (!_wifi.begin()) {
return WL_IDLE_STATUS;
}
noLowPowerMode();
IPAddress gw = _wifi.gatewayIP();
if (!gw.isSet()) {
gw = IPAddress(192, 168, 42, 1);
@@ -155,6 +155,10 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
mask = IPAddress(255, 255, 255, 0);
}
config(gw);
if (!_wifi.begin()) {
return WL_IDLE_STATUS;
}
noLowPowerMode();
_dhcpServer = (dhcp_server_t *)malloc(sizeof(dhcp_server_t));
if (!_dhcpServer) {
// OOM
@@ -166,8 +170,8 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
return WL_CONNECTED;
}
#endif
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
uint8_t WiFiClass::softAPgetStationNum() {
if (!_apMode || !_wifiHWInitted) {
return 0;
@@ -182,10 +186,10 @@ uint8_t WiFiClass::softAPgetStationNum() {
free(macs);
return m;
}
#endif
bool WiFiClass::connected() {
return (_apMode && _wifiHWInitted) || (_wifi.connected() && localIP().isSet() && (cyw43_wifi_link_status(&cyw43_state, _apMode ? 1 : 0) == CYW43_LINK_JOIN));
return (_apMode && _wifiHWInitted) || (_wifi.connected() && localIP().isSet());
}
/* Change Ip configuration settings disabling the dhcp client
@@ -193,7 +197,7 @@ bool WiFiClass::connected() {
param local_ip: Static ip configuration
*/
void WiFiClass::config(IPAddress local_ip) {
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->ip_addr), local_ip.v4());
_wifi.config(local_ip);
}
/* Change Ip configuration settings disabling the dhcp client
@@ -202,8 +206,7 @@ void WiFiClass::config(IPAddress local_ip) {
param dns_server: IP configuration for DNS server 1
*/
void WiFiClass::config(IPAddress local_ip, IPAddress dns_server) {
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->ip_addr), local_ip.v4());
dns_setserver(0, dns_server);
_wifi.config(local_ip, dns_server);
}
/* Change Ip configuration settings disabling the dhcp client
@@ -213,9 +216,7 @@ void WiFiClass::config(IPAddress local_ip, IPAddress dns_server) {
param gateway : Static gateway configuration
*/
void WiFiClass::config(IPAddress local_ip, IPAddress dns_server, IPAddress gateway) {
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->ip_addr), local_ip.v4());
dns_setserver(0, dns_server);
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->gw), gateway.v4());
_wifi.config(local_ip, dns_server, gateway);
}
/* Change Ip configuration settings disabling the dhcp client
@@ -273,7 +274,6 @@ int WiFiClass::disconnect(bool wifi_off __unused) {
}
if (_wifiHWInitted) {
_wifiHWInitted = false;
cyw43_wifi_leave(&cyw43_state, _apMode ? 1 : 0);
_wifi.end();
}
return WL_DISCONNECTED;
@@ -291,12 +291,13 @@ void WiFiClass::end(void) {
return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
*/
uint8_t* WiFiClass::macAddress(uint8_t* mac) {
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
if (!_wifiHWInitted) {
_apMode = false;
cyw43_wifi_set_up(&cyw43_state, _apMode ? 1 : 0, true, CYW43_COUNTRY_WORLDWIDE);
}
cyw43_wifi_get_mac(&cyw43_state, _apMode ? 1 : 0, mac);
return mac;
#endif
return _wifi.macAddress(_apMode, mac);
}
/*
@@ -326,6 +327,15 @@ IPAddress WiFiClass::gatewayIP() {
return _wifi.gatewayIP();
}
/*
Get the DNS ip address.
return: IPAddress DNS Server IP
*/
IPAddress WiFiClass::dnsIP(uint8_t dns_no) {
return _wifi.dnsIP(dns_no);
}
/*
Return the current SSID associated with the network
@@ -342,30 +352,11 @@ const String &WiFiClass::SSID() {
return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
*/
uint8_t* WiFiClass::BSSID(uint8_t* bssid) {
#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;
return _wifi.BSSID(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 _wifi.channel();
}
@@ -376,17 +367,7 @@ int WiFiClass::channel() {
return: signed value
*/
int32_t WiFiClass::RSSI() {
#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;
return _wifi.RSSI();
}
/*
@@ -395,31 +376,10 @@ int32_t WiFiClass::RSSI() {
return: one value of wl_enc_type enum
*/
uint8_t WiFiClass::encryptionType() {
// TODO - Driver does not return this?!
if (_password == nullptr) {
return ENC_TYPE_NONE;
}
return ENC_TYPE_AUTO;
}
//TODO - this can be in the class
static uint64_t _to64(uint8_t b[8]) {
uint64_t x = 0;
for (int i = 0; i < 6; i++) {
x <<= 8LL;
x |= b[i] & 255;
}
return x;
}
int WiFiClass::_scanCB(void *env, const cyw43_ev_scan_result_t *result) {
WiFiClass *w = (WiFiClass *)env;
if (result) {
cyw43_ev_scan_result_t s;
memcpy(&s, result, sizeof(s));
w->_scan.insert_or_assign(_to64(s.bssid), s);
}
return 0;
return _wifi.encryptionType();
}
/*
@@ -428,39 +388,22 @@ int WiFiClass::_scanCB(void *env, const cyw43_ev_scan_result_t *result) {
return: Number of discovered networks
*/
int8_t WiFiClass::scanNetworks(bool async) {
cyw43_wifi_scan_options_t scan_options;
memset(&scan_options, 0, sizeof(scan_options));
_scan.clear();
if (!_wifiHWInitted) {
_apMode = false;
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
cyw43_arch_enable_sta_mode();
#endif
_wifiHWInitted = true;
}
int err = cyw43_wifi_scan(&cyw43_state, &scan_options, this, _scanCB);
if (err) {
return 0;
}
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 _wifi.scanNetworks(async);
}
int8_t WiFiClass::scanComplete() {
if (cyw43_wifi_scan_active(&cyw43_state)) {
return -1;
} else {
return _scan.size();
}
return _wifi.scanComplete();
}
void WiFiClass::scanDelete() {
_scan.clear();
_wifi.scanDelete();
}
/*
@@ -471,14 +414,7 @@ void WiFiClass::scanDelete() {
return: ssid string of the specified item on the networks scanned list
*/
const char*WiFiClass::SSID(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return nullptr;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
return (const char *)it->second.ssid;
return _wifi.SSID(networkItem);
}
/*
@@ -489,44 +425,15 @@ const char*WiFiClass::SSID(uint8_t networkItem) {
return: encryption type (enum wl_enc_type) of the specified item on the networks scanned list
*/
uint8_t WiFiClass::encryptionType(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return ENC_TYPE_UNKNOWN;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
// TODO - the driver returns a small integer but does not actually provide a way of mapping that to the proper enc type. My best guesses here...
switch (it->second.auth_mode) {
case 0: return ENC_TYPE_NONE;
case 3: return ENC_TYPE_TKIP;
case 5: return ENC_TYPE_CCMP;
case 7: return ENC_TYPE_AUTO;
}
return ENC_TYPE_UNKNOWN;
return _wifi.encryptionType(networkItem);
}
uint8_t* WiFiClass::BSSID(uint8_t networkItem, uint8_t* bssid) {
if (networkItem >= _scan.size()) {
return nullptr;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
memcpy(bssid, it->second.bssid, 6);
return bssid;
return _wifi.BSSID(networkItem, bssid);
}
uint8_t WiFiClass::channel(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return 255;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
return it->second.channel;
return _wifi.channel(networkItem);
}
/*
@@ -537,14 +444,7 @@ uint8_t WiFiClass::channel(uint8_t networkItem) {
return: signed value of RSSI of the specified item on the networks scanned list
*/
int32_t WiFiClass::RSSI(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return -9999;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
return it->second.rssi;
return _wifi.RSSI(networkItem);
}
/*
@@ -556,14 +456,7 @@ uint8_t WiFiClass::status() {
if (_apMode && _wifiHWInitted) {
return WL_CONNECTED;
}
switch (cyw43_wifi_link_status(&cyw43_state, _apMode ? 1 : 0)) {
case CYW43_LINK_DOWN: return WL_IDLE_STATUS;
case CYW43_LINK_JOIN: return localIP().isSet() ? WL_CONNECTED : WL_DISCONNECTED;
case CYW43_LINK_FAIL: return WL_CONNECT_FAILED;
case CYW43_LINK_NONET: return WL_CONNECT_FAILED;
case CYW43_LINK_BADAUTH: return WL_CONNECT_FAILED;
}
return WL_NO_MODULE;
return _wifi.status();
}
/*
@@ -593,6 +486,7 @@ unsigned long WiFiClass::getTime() {
return millis();
}
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
void WiFiClass::aggressiveLowPowerMode() {
cyw43_wifi_pm(&cyw43_state, CYW43_AGGRESSIVE_PM);
}
@@ -600,10 +494,11 @@ void WiFiClass::aggressiveLowPowerMode() {
void WiFiClass::defaultLowPowerMode() {
cyw43_wifi_pm(&cyw43_state, CYW43_DEFAULT_PM);
}
#endif
// The difference between the default CYW43_DEFAULT_PM (0xA11142) and not low power (0xA11140) is that it changed from "Powersave mode on specified interface with High throughput" to "No Powersave mode". All other parameters stayed the same.
void WiFiClass::noLowPowerMode() {
cyw43_wifi_pm(&cyw43_state, 0xA11140);
_wifi.noLowPowerMode();
}
int WiFiClass::ping(const char* hostname, uint8_t ttl) {
+17 -5
View File
@@ -23,13 +23,18 @@
#pragma once
#include <Arduino.h>
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#include <lwIP_CYW43.h>
#elif defined(ESPHOSTSPI)
#include <lwIP_ESPHost.h>
#else
#include "utility/lwIP_nodriver.h"
#endif
#include "WiFi.h"
#include <inttypes.h>
#include <map>
#include <cyw43.h>
#include "dhcpserver/dhcpserver.h"
#define WIFI_FIRMWARE_LATEST_VERSION PICO_SDK_VERSION_STRING
@@ -136,7 +141,9 @@ public:
return true;
}
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
uint8_t softAPgetStationNum();
#endif
IPAddress softAPIP() {
return localIP();
@@ -261,6 +268,13 @@ public:
*/
IPAddress gatewayIP();
/*
Get the DNS ip address.
return: IPAddress DNS Server IP
*/
IPAddress dnsIP(uint8_t dns_no = 0);
/*
Return the current SSID associated with the network
@@ -374,8 +388,10 @@ public:
unsigned long getTime();
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
void aggressiveLowPowerMode();
void defaultLowPowerMode();
#endif
void noLowPowerMode();
int ping(const char* hostname, uint8_t ttl = 128);
@@ -404,10 +420,6 @@ private:
bool _wifiHWInitted = false;
bool _apMode = false;
// WiFi Scan callback
std::map<uint64_t, cyw43_ev_scan_result_t> _scan;
static int _scanCB(void *env, const cyw43_ev_scan_result_t *result);
// DHCP for AP mode
dhcp_server_t *_dhcpServer = nullptr;
+9
View File
@@ -58,6 +58,15 @@ bool WiFiMulti::addAP(const char *ssid, const char *pass) {
return true;
}
void WiFiMulti::clearAPList() {
while (!_list.empty()) {
struct _AP ap = _list.front();
_list.pop_front();
free(ap.ssid);
free(ap.pass);
}
}
uint8_t WiFiMulti::run(uint32_t to) {
struct _scanAP {
char *ssid;
+2
View File
@@ -32,6 +32,8 @@ public:
bool addAP(const char *ssid, const char *pass = nullptr);
void clearAPList();
uint8_t run(uint32_t to = 10000);
private:
+8
View File
@@ -163,10 +163,18 @@ void WiFiServer::close() {
_listen_pcb = nullptr;
}
void WiFiServer::end() {
close();
}
void WiFiServer::stop() {
close();
}
WiFiServer::operator bool() {
return (status() != CLOSED);
}
template<typename T>
T* slist_append_tail(T* head, T* item) {
if (!head) {
+4 -2
View File
@@ -75,10 +75,10 @@ protected:
public:
WiFiServer(const IPAddress& addr, uint16_t port);
WiFiServer(uint16_t port);
WiFiServer(uint16_t port = 23);
virtual ~WiFiServer() {}
WiFiClient accept(); // https://www.arduino.cc/en/Reference/EthernetServerAccept
WiFiClient available(uint8_t* status = nullptr);
WiFiClient available(uint8_t* status = nullptr) __attribute__((deprecated("Use accept().")));
bool hasClient();
// hasClientData():
@@ -95,8 +95,10 @@ public:
bool getNoDelay();
uint8_t status();
uint16_t port() const;
void end();
void close();
void stop();
explicit operator bool();
using ClientType = WiFiClient;
+2 -2
View File
@@ -31,7 +31,7 @@ class WiFiClientSecure;
class WiFiServerSecure : public WiFiServer {
public:
WiFiServerSecure(IPAddress addr, uint16_t port);
WiFiServerSecure(uint16_t port);
WiFiServerSecure(uint16_t port = 22);
WiFiServerSecure(const WiFiServerSecure &rhs);
virtual ~WiFiServerSecure();
@@ -65,7 +65,7 @@ public:
// If awaiting connection available and authenticated (i.e. client cert), return it.
WiFiClientSecure accept(); // https://www.arduino.cc/en/Reference/EthernetServerAccept
WiFiClientSecure available(uint8_t* status = nullptr);
WiFiClientSecure available(uint8_t* status = nullptr) __attribute__((deprecated("Use accept().")));
WiFiServerSecure& operator=(const WiFiServerSecure&) = default;
+112
View File
@@ -0,0 +1,112 @@
#pragma once
#include <LwipIntfDev.h>
#include "nodriver.h"
class NoDriverLwIP : public LwipIntfDev<NoDriver> {
public:
NoDriverLwIP() :
LwipIntfDev<NoDriver>() {
}
bool initHW(bool apMode) {
(void) apMode;
return false;
}
void setSSID(const char *p) {
(void) p;
}
void setBSSID(const uint8_t *bssid) {
(void) bssid;
}
void setPassword(const char *p) {
(void) p;
}
void setSTA() {
}
void setAP() {
}
void setTimeout(int timeout) {
(void) timeout;
}
void end() {
}
bool connected() {
return false;
}
uint8_t* macAddress(bool apMode, uint8_t *mac) {
(void) apMode;
return mac;
}
uint8_t* BSSID(uint8_t *bssid) {
return bssid;
}
int32_t RSSI() {
return 0;
}
int channel() {
return -1;
}
uint8_t encryptionType() {
return ENC_TYPE_AUTO;
}
int8_t scanNetworks(bool async = false) {
(void) async;
return 0;
}
int8_t scanComplete() {
return 0;
}
void scanDelete() {
}
const char* SSID(uint8_t networkItem) {
(void) networkItem;
return nullptr;
}
uint8_t encryptionType(uint8_t networkItem) {
(void) networkItem;
return ENC_TYPE_AUTO;
}
uint8_t* BSSID(uint8_t networkItem, uint8_t *bssid) {
(void) networkItem;
return bssid;
}
uint8_t channel(uint8_t networkItem) {
(void) networkItem;
return 0;
}
int32_t RSSI(uint8_t networkItem) {
(void) networkItem;
return 0;
}
uint8_t status() {
return WL_NO_MODULE;
}
void noLowPowerMode() {
}
};
+55
View File
@@ -0,0 +1,55 @@
#pragma once
#include <Arduino.h>
#include <SPI.h>
class NoDriver {
public:
NoDriver(int8_t cs, arduino::SPIClass& spi, int8_t intrpin) {
(void) cs;
(void) spi;
(void) intrpin;
}
bool begin(const uint8_t* address, netif *netif) {
(void) address;
(void) netif;
return false;
}
uint16_t sendFrame(const uint8_t* data, uint16_t datalen) {
(void) data;
(void) datalen;
return 0;
}
uint16_t readFrame(uint8_t* buffer, uint16_t bufsize) {
(void) buffer;
(void) bufsize;
return 0;
}
uint16_t readFrameSize() {
return 0;
}
void discardFrame(uint16_t ign) {
(void) ign;
}
uint16_t readFrameData(uint8_t *ign1, uint16_t ign2) {
(void) ign1;
(void) ign2;
return 0;
}
bool interruptIsPossible() {
return true;
}
constexpr bool needsSPI() const {
return false;
}
};
+5
View File
@@ -470,5 +470,10 @@ void TwoWire::clearTimeoutFlag() {
#define __WIRE1_DEVICE i2c1
#endif
#ifdef PIN_WIRE0_SDA
TwoWire Wire(__WIRE0_DEVICE, PIN_WIRE0_SDA, PIN_WIRE0_SCL);
#endif
#ifdef PIN_WIRE1_SDA
TwoWire Wire1(__WIRE1_DEVICE, PIN_WIRE1_SDA, PIN_WIRE1_SCL);
#endif
+227
View File
@@ -0,0 +1,227 @@
/*
WiFiClass methods implementations for the CYG43 chip
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 "lwIP_CYW43.h"
#include <pico/cyw43_arch.h>
CYW43lwIP::CYW43lwIP(int8_t cs) : LwipIntfDev<CYW43>(cs) {
}
void CYW43lwIP::end() {
cyw43_wifi_leave(&cyw43_state, _ap ? 1 : 0);
LwipIntfDev<CYW43>::end();
}
bool CYW43lwIP::connected() {
return (LwipIntfDev<CYW43>::connected() && (cyw43_wifi_link_status(&cyw43_state, 0) == CYW43_LINK_JOIN));
}
uint8_t* CYW43lwIP::macAddress(bool apMode, uint8_t* mac) {
cyw43_wifi_get_mac(&cyw43_state, apMode ? 1 : 0, mac);
return mac;
}
uint8_t* CYW43lwIP::BSSID(uint8_t* bssid) {
#ifndef CYW43_IOCTL_GET_BSSID
#define CYW43_IOCTL_GET_BSSID ( (uint32_t)23 * 2 )
#endif
if (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 CYW43lwIP::channel() {
#ifndef CYW43_IOCTL_GET_CHANNEL
#define CYW43_IOCTL_GET_CHANNEL 0x3a
#endif
int32_t channel;
if (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
return: signed value
*/
int32_t CYW43lwIP::RSSI() {
#ifndef CYW43_IOCTL_GET_RSSI
#define CYW43_IOCTL_GET_RSSI 0xFE
#endif
int32_t rssi;
if (connected()) {
cyw43_ioctl(&cyw43_state, CYW43_IOCTL_GET_RSSI, sizeof rssi, (uint8_t *)&rssi, CYW43_ITF_STA);
} else {
rssi = -255;
}
return rssi;
}
/*
Return the Encryption Type associated with the network
return: one value of wl_enc_type enum
*/
uint8_t CYW43lwIP::encryptionType() {
// TODO - Driver does not return this?!
return ENC_TYPE_AUTO;
}
//TODO - this can be in the class
static uint64_t _to64(uint8_t b[8]) {
uint64_t x = 0;
for (int i = 0; i < 6; i++) {
x <<= 8LL;
x |= b[i] & 255;
}
return x;
}
int CYW43lwIP::_scanCB(void *env, const cyw43_ev_scan_result_t *result) {
CYW43lwIP *w = (CYW43lwIP *)env;
if (result) {
cyw43_ev_scan_result_t s;
memcpy(&s, result, sizeof(s));
w->_scan.insert_or_assign(_to64(s.bssid), s);
}
return 0;
}
int8_t CYW43lwIP::scanNetworks(bool async) {
cyw43_wifi_scan_options_t scan_options;
memset(&scan_options, 0, sizeof(scan_options));
_scan.clear();
int err = cyw43_wifi_scan(&cyw43_state, &scan_options, this, _scanCB);
if (err) {
return 0;
}
if (!async) {
uint32_t now = millis();
while (cyw43_wifi_scan_active(&cyw43_state) && (millis() - now < 10000)) {
delay(10);
}
return _scan.size();
} else {
return -1;
}
}
int8_t CYW43lwIP::scanComplete() {
if (cyw43_wifi_scan_active(&cyw43_state)) {
return -1;
} else {
return _scan.size();
}
}
void CYW43lwIP::scanDelete() {
_scan.clear();
}
const char*CYW43lwIP::SSID(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return nullptr;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
return (const char *)it->second.ssid;
}
uint8_t CYW43lwIP::encryptionType(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return ENC_TYPE_UNKNOWN;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
// TODO - the driver returns a small integer but does not actually provide a way of mapping that to the proper enc type. My best guesses here...
switch (it->second.auth_mode) {
case 0: return ENC_TYPE_NONE;
case 3: return ENC_TYPE_TKIP;
case 5: return ENC_TYPE_CCMP;
case 7: return ENC_TYPE_AUTO;
}
return ENC_TYPE_UNKNOWN;
}
uint8_t* CYW43lwIP::BSSID(uint8_t networkItem, uint8_t* bssid) {
if (networkItem >= _scan.size()) {
return nullptr;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
memcpy(bssid, it->second.bssid, 6);
return bssid;
}
uint8_t CYW43lwIP::channel(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return 255;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
return it->second.channel;
}
int32_t CYW43lwIP::RSSI(uint8_t networkItem) {
if (networkItem >= _scan.size()) {
return -9999;
}
auto it = _scan.begin();
for (int i = 0; i < networkItem; i++) {
++it;
}
return it->second.rssi;
}
uint8_t CYW43lwIP::status() {
switch (cyw43_wifi_link_status(&cyw43_state, 0)) {
case CYW43_LINK_DOWN: return WL_IDLE_STATUS;
case CYW43_LINK_JOIN: return localIP().isSet() ? WL_CONNECTED : WL_DISCONNECTED;
case CYW43_LINK_FAIL: return WL_CONNECT_FAILED;
case CYW43_LINK_NONET: return WL_CONNECT_FAILED;
case CYW43_LINK_BADAUTH: return WL_CONNECT_FAILED;
}
return WL_NO_MODULE;
}
void CYW43lwIP::noLowPowerMode() {
cyw43_wifi_pm(&cyw43_state, 0xA11140);
}
+35 -1
View File
@@ -3,4 +3,38 @@
#include <LwipIntfDev.h>
#include <utility/CYW43shim.h>
using CYW43lwIP = LwipIntfDev<CYW43>;
class CYW43lwIP: public LwipIntfDev<CYW43> {
public:
CYW43lwIP(int8_t cs = SS);
void end();
bool connected();
uint8_t* macAddress(bool apMode, uint8_t *mac);
uint8_t* BSSID(uint8_t *bssid);
int32_t RSSI();
int channel();
uint8_t encryptionType();
int8_t scanNetworks(bool async = false);
int8_t scanComplete();
void scanDelete();
const char* SSID(uint8_t networkItem);
uint8_t encryptionType(uint8_t networkItem);
uint8_t* BSSID(uint8_t networkItem, uint8_t *bssid);
uint8_t channel(uint8_t networkItem);
int32_t RSSI(uint8_t networkItem);
uint8_t status();
void noLowPowerMode();
private:
// WiFi Scan callback
std::map<uint64_t, cyw43_ev_scan_result_t> _scan;
static int _scanCB(void *env, const cyw43_ev_scan_result_t *result);
};
+6
View File
@@ -0,0 +1,6 @@
# lwIP_ESPHost library
RP2040 Arduino integration with the ESPHost library.
[ESPHost library](https://github.com/JAndrassy/ESPHost) is a driver for communication with Espressif's esp-hosted-fg firmware.
+10
View File
@@ -0,0 +1,10 @@
name=lwIP_ESPHost
version=1
author=Juraj Andrassy
maintainer=Earle F. Philhower, III <earlephilhower@yahoo.com>
sentence=RP2040 ESPHost wifi driver
paragraph=Driver for the esp-hosted-fg firmware with the ESPHosted library
category=Communication
url=https://github.com/earlephilhower/arduino-pico
architectures=rp2040
dot_a_linkage=true
+70
View File
@@ -0,0 +1,70 @@
/*
WiFi <-> LWIP for ESPHost library in RP2040 Core
Copyright (c) 2024 Juraj Andrassy
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 "ESPHost.h"
#include "CEspControl.h"
ESPHost::ESPHost(int8_t cs, arduino::SPIClass &spi, int8_t intrpin) {
(void) cs;
(void) spi;
(void) intrpin;
// CS and SPI are configured in ESPHost library
}
bool ESPHost::begin(const uint8_t *address, netif *netif) {
(void) address;
(void) netif;
// WiFi is initialized in ESPHostLwIP
return true;
}
void ESPHost::end() {
// WiFi is ended in ESPHostLwIP
}
uint16_t ESPHost::sendFrame(const uint8_t *data, uint16_t datalen) {
int res = CEspControl::getInstance().sendBuffer(apMode ? ESP_AP_IF : ESP_STA_IF, 0, (uint8_t*) data, datalen);
CEspControl::getInstance().communicateWithEsp();
return (res == ESP_CONTROL_OK) ? datalen : 0;
}
uint16_t ESPHost::readFrameData(uint8_t *buffer, uint16_t bufsize) {
uint8_t ifn = 0;
uint16_t res;
if (apMode) {
res = CEspControl::getInstance().getSoftApRx(ifn, buffer, bufsize);
} else {
res = CEspControl::getInstance().getStationRx(ifn, buffer, bufsize);
}
return res;
}
uint16_t ESPHost::readFrameSize() {
CEspControl::getInstance().communicateWithEsp();
uint16_t res;
if (apMode) {
res = CEspControl::getInstance().peekSoftApRxPayloadLen();
} else {
res = CEspControl::getInstance().peekStationRxPayloadLen();
}
return res;
}
+57
View File
@@ -0,0 +1,57 @@
/*
WiFi <-> LWIP for ESPHost library in RP2040 Core
Copyright (c) 2024 Juraj Andrassy
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
#include <Arduino.h>
#include <SPI.h>
class ESPHost {
public:
// constructor and methods as required by LwipIntfDev
ESPHost(int8_t cs, arduino::SPIClass &spi, int8_t intrpin);
bool begin(const uint8_t *address, netif *netif);
void end();
uint16_t sendFrame(const uint8_t *data, uint16_t datalen);
uint16_t readFrameData(uint8_t *buffer, uint16_t bufsize);
uint16_t readFrameSize();
void discardFrame(uint16_t ign) {
(void) ign;
}
bool interruptIsPossible() {
return false;
}
constexpr bool needsSPI() const {
return false;
}
protected:
bool apMode = false;
};
+331
View File
@@ -0,0 +1,331 @@
/*
WiFi <-> LWIP for ESPHost library in RP2040 Core
Copyright (c) 2024 Juraj Andrassy
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 "lwIP_ESPHost.h"
#include "CEspControl.h"
#define MAX_SOFTAP_CONNECTION_DEF 5
bool ESPHostLwIP::wifiHwInitialized = false;
ESPHostLwIP* ESPHostLwIP::instance = nullptr;
void ESPHostLwIP::setSTA() {
apMode = false;
}
void ESPHostLwIP::setAP() {
apMode = true;
}
void ESPHostLwIP::setSSID(const char *ssid) {
if (apMode) {
if (ssid == nullptr) {
softAP.ssid[0] = 0;
} else {
memcpy(softAP.ssid, ssid, sizeof(softAP.ssid));
}
} else {
if (ssid == nullptr) {
ap.ssid[0] = 0;
} else {
memcpy(ap.ssid, ssid, sizeof(ap.ssid));
}
}
}
void ESPHostLwIP::setBSSID(const uint8_t *bssid) {
if (bssid == nullptr) {
ap.bssid[0] = 0;
} else {
snprintf((char *)ap.bssid, sizeof(ap.bssid), "%02x:%02x:%02x:%02x:%02x:%02x", bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
}
}
void ESPHostLwIP::setPassword(const char *pass) {
if (apMode) {
if (pass == nullptr) {
softAP.pwd[0] = 0;
} else {
memcpy(softAP.pwd, pass, sizeof(softAP.pwd));
}
} else {
if (pass == nullptr) {
ap.pwd[0] = 0;
} else {
memcpy(ap.pwd, pass, sizeof(ap.pwd));
}
}
}
void ESPHostLwIP::setChannel(uint8_t channel) {
softAP.channel = (channel > MAX_CHNL_NO) ? MAX_CHNL_NO : channel;
}
void ESPHostLwIP::setTimeout(int _timeout) {
timeout = _timeout;
}
int ESPHostLwIP::initEventCb(CCtrlMsgWrapper *resp) {
(void) resp;
wifiHwInitialized = true;
return ESP_CONTROL_OK;
}
int ESPHostLwIP::disconnectEventCb(CCtrlMsgWrapper *resp) {
(void) resp;
instance->onDisconnectEvent();
return ESP_CONTROL_OK;
}
bool ESPHostLwIP::initHW() {
if (wifiHwInitialized) {
return true;
}
instance = this;
CEspControl::getInstance().listenForStationDisconnectEvent(disconnectEventCb);
CEspControl::getInstance().listenForInitEvent(initEventCb);
if (CEspControl::getInstance().initSpiDriver() != 0) {
return false;
}
uint32_t start = millis();
while (!wifiHwInitialized && (millis() - start < timeout)) {
CEspControl::getInstance().communicateWithEsp();
delay(100);
}
if (wifiHwInitialized) {
wifiStatus = WL_IDLE_STATUS;
}
__startEthernetContext();
return wifiHwInitialized;
}
bool ESPHostLwIP::begin() {
if (!initHW()) {
return false;
}
ethernet_arch_lwip_begin();
if (!apMode) {
CEspControl::getInstance().setWifiMode(WIFI_MODE_STA);
if (CEspControl::getInstance().connectAccessPoint(ap) != ESP_CONTROL_OK) {
wifiStatus = WL_CONNECT_FAILED;
ethernet_arch_lwip_end();
return false;
}
CEspControl::getInstance().getAccessPointConfig(ap);
} else {
CEspControl::getInstance().setWifiMode(WIFI_MODE_AP);
if (softAP.channel == 0 || softAP.channel > MAX_CHNL_NO) {
softAP.channel = 1;
}
softAP.max_connections = MAX_SOFTAP_CONNECTION_DEF;
softAP.encryption_mode = softAP.pwd[0] == 0 ? WIFI_AUTH_OPEN : WIFI_AUTH_WPA_WPA2_PSK;
softAP.bandwidth = WIFI_BW_HT40;
softAP.ssid_hidden = false;
int rv = CEspControl::getInstance().startSoftAccessPoint(softAP);
if (rv != ESP_CONTROL_OK) {
wifiStatus = WL_AP_FAILED;
ethernet_arch_lwip_end();
return false;
}
CEspControl::getInstance().getSoftAccessPointConfig(softAP);
}
ethernet_arch_lwip_end();
uint8_t mac[6];
if (!LwipIntfDev<ESPHost>::begin(macAddress(apMode, mac))) {
ethernet_arch_lwip_begin();
if (apMode) {
CEspControl::getInstance().stopSoftAccessPoint();
wifiStatus = WL_AP_FAILED;
} else {
CEspControl::getInstance().disconnectAccessPoint();
wifiStatus = WL_CONNECT_FAILED;
}
ethernet_arch_lwip_end();
return false;
}
if (apMode) {
wifiStatus = WL_AP_LISTENING;
} else {
joined = true;
wifiStatus = LwipIntfDev<ESPHost>::connected() ? WL_CONNECTED : WL_DISCONNECTED;
}
return true;
}
void ESPHostLwIP::end() {
LwipIntfDev<ESPHost>::end();
if (apMode) {
CEspControl::getInstance().stopSoftAccessPoint();
} else {
CEspControl::getInstance().disconnectAccessPoint();
joined = false;
}
wifiStatus = WL_IDLE_STATUS;
}
void ESPHostLwIP::onDisconnectEvent() {
LwipIntfDev<ESPHost>::end();
joined = false;
wifiStatus = WL_CONNECTION_LOST;
}
bool ESPHostLwIP::connected() {
return (status() == WL_CONNECTED);
}
uint8_t ESPHostLwIP::status() {
initHW();
if (joined && wifiStatus == WL_DISCONNECTED && LwipIntfDev<ESPHost>::connected()) {
wifiStatus = WL_CONNECTED; // DHCP finished
}
return wifiStatus;
}
uint8_t* ESPHostLwIP::macAddress(bool apMode, uint8_t *mac) {
if (!initHW()) {
return mac;
}
WifiMac_t MAC;
MAC.mode = apMode ? WIFI_MODE_AP : WIFI_MODE_STA;
ethernet_arch_lwip_begin();
if (CEspControl::getInstance().getWifiMacAddress(MAC) == ESP_CONTROL_OK) {
CNetUtilities::macStr2macArray(mac, MAC.mac);
}
ethernet_arch_lwip_end();
return mac;
}
uint8_t* ESPHostLwIP::BSSID(uint8_t *bssid) {
CNetUtilities::macStr2macArray(bssid, (char*) ap.bssid);
return bssid;
}
int ESPHostLwIP::channel() {
return ap.channel;
}
int32_t ESPHostLwIP::RSSI() {
if (!joined) {
return 0;
}
ethernet_arch_lwip_begin();
CEspControl::getInstance().getAccessPointConfig(ap);
ethernet_arch_lwip_end();
return ap.rssi;
}
static uint8_t encr2wl_enc(int enc) {
// the ESPHost returns authentication mode as encryption mode
if (enc == WIFI_AUTH_OPEN) {
return ENC_TYPE_NONE;
} else if (enc == WIFI_AUTH_WEP) {
return ENC_TYPE_WEP;
} else if (enc == WIFI_AUTH_WPA_PSK) {
return ENC_TYPE_WPA;
} else if (enc == WIFI_AUTH_WPA2_PSK) {
return ENC_TYPE_WPA2;
} else if (enc == WIFI_AUTH_WPA_WPA2_PSK) {
return ENC_TYPE_WPA2;
} else if (enc == WIFI_AUTH_WPA3_PSK) {
return ENC_TYPE_WPA3;
} else if (enc == WIFI_AUTH_WPA2_WPA3_PSK) {
return ENC_TYPE_WPA3;
} else {
return ENC_TYPE_UNKNOWN;
}
}
uint8_t ESPHostLwIP::encryptionType() {
return encr2wl_enc(ap.encryption_mode);
}
int8_t ESPHostLwIP::scanNetworks(bool async) {
(void) async;
accessPoints.clear();
if (!initHW()) {
return -1;
}
ethernet_arch_lwip_begin();
int res = CEspControl::getInstance().getAccessPointScanList(accessPoints);
ethernet_arch_lwip_end();
wifiStatus = WL_SCAN_COMPLETED;
if (res != ESP_CONTROL_OK) {
return -1;
}
return accessPoints.size();
}
int8_t ESPHostLwIP::scanComplete() {
return accessPoints.size();
}
void ESPHostLwIP::scanDelete() {
accessPoints.clear();
}
const char* ESPHostLwIP::SSID(uint8_t networkItem) {
if (networkItem < accessPoints.size()) {
return (const char*) accessPoints[networkItem].ssid;
}
return nullptr;
}
uint8_t ESPHostLwIP::encryptionType(uint8_t networkItem) {
if (networkItem < accessPoints.size()) {
return encr2wl_enc(accessPoints[networkItem].encryption_mode);
}
return ENC_TYPE_UNKNOWN;
}
uint8_t* ESPHostLwIP::BSSID(uint8_t networkItem, uint8_t *bssid) {
if (networkItem < accessPoints.size()) {
CNetUtilities::macStr2macArray(bssid, (char*) accessPoints[networkItem].bssid);
}
return bssid;
}
uint8_t ESPHostLwIP::channel(uint8_t networkItem) {
if (networkItem < accessPoints.size()) {
return accessPoints[networkItem].channel;
}
return 0;
}
int32_t ESPHostLwIP::RSSI(uint8_t networkItem) {
if (networkItem < accessPoints.size()) {
return accessPoints[networkItem].rssi;
}
return 0;
}
void ESPHostLwIP::lowPowerMode() {
if (!initHW()) {
return;
}
ethernet_arch_lwip_begin();
CEspControl::getInstance().setPowerSaveMode(1);
ethernet_arch_lwip_end();
}
void ESPHostLwIP::noLowPowerMode() {
// not supported by firmware
}
+83
View File
@@ -0,0 +1,83 @@
/*
WiFi <-> LWIP for ESPHost library in RP2040 Core
Copyright (c) 2024 Juraj Andrassy
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
#include <LwipIntfDev.h>
#include "CCtrlWrapper.h"
#include "ESPHost.h"
class ESPHostLwIP : public LwipIntfDev<ESPHost> {
public:
void setSTA();
void setAP();
void setSSID(const char *p);
void setBSSID(const uint8_t *bssid);
void setPassword(const char *p);
void setChannel(uint8_t channel);
bool begin();
void end();
bool connected();
uint8_t status();
uint8_t* macAddress(bool apMode, uint8_t *mac);
uint8_t* BSSID(uint8_t *bssid);
int32_t RSSI();
int channel();
uint8_t encryptionType();
int8_t scanNetworks(bool async = false);
int8_t scanComplete();
void scanDelete();
const char* SSID(uint8_t networkItem);
uint8_t encryptionType(uint8_t networkItem);
uint8_t* BSSID(uint8_t networkItem, uint8_t *bssid);
uint8_t channel(uint8_t networkItem);
int32_t RSSI(uint8_t networkItem);
void lowPowerMode();
void noLowPowerMode();
void setTimeout(int timeout);
private:
static int initEventCb(CCtrlMsgWrapper *resp);
static int disconnectEventCb(CCtrlMsgWrapper *resp);
static bool wifiHwInitialized;
static ESPHostLwIP* instance;
bool initHW();
void onDisconnectEvent();
uint32_t timeout = 10000;
uint8_t wifiStatus = WL_NO_MODULE;
WifiApCfg_t ap;
bool joined = false;
SoftApCfg_t softAP;
std::vector<AccessPoint_t> accessPoints;
}
;
+47 -5
View File
@@ -33,7 +33,6 @@ bool __ethernetContextInitted = false;
static async_context_threadsafe_background_t lwip_ethernet_async_context_threadsafe_background;
static async_when_pending_worker_t always_pending_update_timeout_worker;
static async_at_time_worker_t ethernet_timeout_worker;
static async_context_t *_context = nullptr;
// Theoretically support multiple interfaces
@@ -46,7 +45,7 @@ void ethernet_arch_lwip_begin() {
return;
}
#endif
async_context_acquire_lock_blocking(&lwip_ethernet_async_context_threadsafe_background.core);
async_context_acquire_lock_blocking(_context);
}
void ethernet_arch_lwip_end() {
@@ -56,7 +55,7 @@ void ethernet_arch_lwip_end() {
return;
}
#endif
async_context_release_lock(&lwip_ethernet_async_context_threadsafe_background.core);
async_context_release_lock(_context);
}
int __addEthernetPacketHandler(std::function<void(void)> _packetHandler) {
@@ -73,6 +72,45 @@ void __removeEthernetPacketHandler(int id) {
ethernet_arch_lwip_end();
}
#define GPIOSTACKSIZE 8
static uint32_t gpioMaskStack[GPIOSTACKSIZE][4];
static uint32_t gpioMask[4] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
void ethernet_arch_lwip_gpio_mask() {
noInterrupts();
memmove(gpioMaskStack[1], gpioMaskStack[0], 4 * sizeof(uint32_t) * (GPIOSTACKSIZE - 1)); // Push down the stack
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
for (int i = 0; i < 4; i++) {
gpioMaskStack[0][i] = irq_ctrl_base->inte[i];
irq_ctrl_base->inte[i] = irq_ctrl_base->inte[i] & gpioMask[i];
}
interrupts();
}
void ethernet_arch_lwip_gpio_unmask() {
noInterrupts();
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
for (int i = 0; i < 4; i++) {
irq_ctrl_base->inte[i] = gpioMaskStack[0][i];
}
memmove(gpioMaskStack[0], gpioMaskStack[1], 4 * sizeof(uint32_t) * (GPIOSTACKSIZE - 1)); // Pop up the stack
interrupts();
}
// To be called after IRQ is set, so we can just rad from the IOREG instead of duplicating the calculation
void __addEthernetGPIO(int pin) {
int idx = pin / 8;
int off = (pin % 8) * 4;
gpioMask[idx] &= ~(0xf << off);
}
void __removeEthernetGPIO(int pin) {
int idx = pin / 8;
int off = (pin % 8) * 4;
gpioMask[idx] |= 0xf << off;
}
static volatile bool _dns_lookup_pending = false;
static void _dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *callback_arg) {
@@ -129,9 +167,13 @@ static async_context_t *lwip_ethernet_init_default_async_context(void) {
return NULL;
}
uint32_t __ethernet_timeout_reached_calls = 0;
static uint32_t _pollingPeriod = 20;
// This will only be called under the protection of the async context mutex, so no re-entrancy checks needed
static void ethernet_timeout_reached(__unused async_context_t *context, __unused async_at_time_worker_t *worker) {
assert(worker == &ethernet_timeout_worker);
__ethernet_timeout_reached_calls++;
ethernet_arch_lwip_gpio_mask(); // Ensure non-polled devices won't interrupt us
for (auto handlePacket : _handlePacketList) {
handlePacket.second();
}
@@ -142,9 +184,9 @@ static void ethernet_timeout_reached(__unused async_context_t *context, __unused
#else
sys_check_timeouts();
#endif
ethernet_arch_lwip_gpio_unmask();
}
static uint32_t _pollingPeriod = 20;
static void update_next_timeout(async_context_t *context, async_when_pending_worker_t *worker) {
assert(worker == &always_pending_update_timeout_worker);
worker->work_pending = true;
@@ -164,9 +206,9 @@ void __startEthernetContext() {
#else
_context = lwip_ethernet_init_default_async_context();
#endif
ethernet_timeout_worker.do_work = ethernet_timeout_reached;
always_pending_update_timeout_worker.work_pending = true;
always_pending_update_timeout_worker.do_work = update_next_timeout;
ethernet_timeout_worker.do_work = ethernet_timeout_reached;
async_context_add_when_pending_worker(_context, &always_pending_update_timeout_worker);
__ethernetContextInitted = true;
}
@@ -27,6 +27,11 @@
void ethernet_arch_lwip_begin() __attribute__((weak));
void ethernet_arch_lwip_end() __attribute__((weak));
void ethernet_arch_lwip_gpio_mask() __attribute__((weak));
void ethernet_arch_lwip_gpio_unmask() __attribute__((weak));
void __addEthernetGPIO(int pin);
void __removeEthernetGPIO(int pin);
// Internal Ethernet helper functions
void __startEthernetContext();
+78 -6
View File
@@ -61,9 +61,14 @@ public:
memset(&_netif, 0, sizeof(_netif));
}
//The argument order for ESP is not the same as for Arduino. However, there is compatibility code under the hood
//to detect Arduino arg order, and handle it correctly.
bool config(const IPAddress& local_ip, const IPAddress& arg1, const IPAddress& arg2,
const IPAddress& arg3 = IPADDR_NONE, const IPAddress& dns2 = IPADDR_NONE);
// two and one parameter version. 2nd parameter is DNS like in Arduino. IPv4 only
bool config(IPAddress local_ip, IPAddress dns = IPADDR_NONE);
// default mac-address is inferred from esp8266's STA interface
bool begin(const uint8_t* macAddress = nullptr, const uint16_t mtu = DEFAULT_MTU);
@@ -73,6 +78,10 @@ public:
return &_netif;
}
uint8_t* macAddress(uint8_t* mac) {
memcpy(mac, &_netif.hwaddr, 6);
return mac;
}
IPAddress localIP() const {
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.ip_addr)));
}
@@ -82,6 +91,17 @@ public:
IPAddress gatewayIP() const {
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.gw)));
}
IPAddress dnsIP(int n = 0) const {
return IPAddress(dns_getserver(n));
}
void setDNS(IPAddress dns1, IPAddress dns2 = INADDR_ANY) {
if (dns1.isSet()) {
dns_setserver(0, dns1);
}
if (dns2.isSet()) {
dns_setserver(1, dns2);
}
}
// 1. Currently when no default is set, esp8266-Arduino uses the first
// DHCP client interface receiving a valid address and gateway to
@@ -107,7 +127,7 @@ public:
// ICMP echo, returns TTL
int ping(IPAddress host, uint8_t ttl, uint32_t timeout = 5000);
int hostByName(const char* aHostname, IPAddress& aResult, int timeout);
int hostByName(const char* aHostname, IPAddress& aResult, int timeout = 15000);
inline void setSPISpeed(int mhz) {
setSPISettings(SPISettings(mhz, MSBFIRST, SPI_MODE0));
@@ -117,6 +137,14 @@ public:
_spiSettings = s;
}
uint32_t packetsReceived() {
return _packetsReceived;
}
uint32_t packetsSent() {
return _packetsSent;
}
// ESP8266WiFi API compatibility
wl_status_t status();
@@ -129,6 +157,7 @@ protected:
static err_t netif_init_s(netif* netif);
static err_t linkoutput_s(netif* netif, struct pbuf* p);
static void netif_status_callback_s(netif* netif);
static void _irq(void *param);
public:
// called on a regular basis or on interrupt
err_t handlePackets();
@@ -152,6 +181,9 @@ protected:
// Packet handler number
int _phID = -1;
uint32_t _packetsReceived = 0;
uint32_t _packetsSent = 0;
};
@@ -249,6 +281,24 @@ bool LwipIntfDev<RawDev>::config(const IPAddress& localIP, const IPAddress& gate
}
return true;
}
template<class RawDev>
bool LwipIntfDev<RawDev>::config(IPAddress local_ip, IPAddress dns) {
if (!local_ip.isSet()) {
return config(INADDR_ANY, INADDR_ANY, INADDR_ANY);
}
if (!local_ip.isV4()) {
return false;
}
IPAddress gw(local_ip);
gw[3] = 1;
if (!dns.isSet()) {
dns = gw;
}
return config(local_ip, gw, IPAddress(255, 255, 255, 0), dns);
}
extern char wifi_station_hostname[];
template<class RawDev>
bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
@@ -310,7 +360,9 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
return false;
}
_phID = __addEthernetPacketHandler([this] { this->handlePackets(); });
if (_intrPin < 0) {
_phID = __addEthernetPacketHandler([this] { this->handlePackets(); });
}
if (localIP().v4() == 0) {
// IP not set, starting DHCP
@@ -337,6 +389,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
#endif
#if LWIP_IPV6_DHCP6_STATELESS
err_t __res = dhcp6_enable_stateless(&_netif);
(void) __res; // Not used except for debug
DEBUGV("LwipIntfDev: Enabled DHCP6 stateless: %d\n", __res);
#endif
@@ -344,7 +397,11 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
if (_intrPin >= 0) {
if (RawDev::interruptIsPossible()) {
// attachInterrupt(_intrPin, [&]() { this->handlePackets(); }, FALLING);
noInterrupts(); // Ensure this is atomically set up
pinMode(_intrPin, INPUT);
attachInterruptParam(_intrPin, _irq, LOW, (void*)this);
__addEthernetGPIO(_intrPin);
interrupts();
} else {
::printf((PGM_P)F(
"lwIP_Intf: Interrupt not implemented yet, enabling transparent polling\r\n"));
@@ -357,15 +414,28 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
template<class RawDev>
void LwipIntfDev<RawDev>::end() {
__removeEthernetPacketHandler(_phID);
if (_intrPin < 0) {
__removeEthernetPacketHandler(_phID);
} else {
detachInterrupt(_intrPin);
__removeEthernetGPIO(_intrPin);
}
RawDev::end();
netif_remove(&_netif);
memset(&_netif, 0, sizeof(_netif));
_started = false;
}
template<class RawDev>
void LwipIntfDev<RawDev>::_irq(void *param) {
LwipIntfDev *d = static_cast<LwipIntfDev*>(param);
ethernet_arch_lwip_begin();
d->handlePackets();
sys_check_timeouts();
ethernet_arch_lwip_end();
}
template<class RawDev>
wl_status_t LwipIntfDev<RawDev>::status() {
@@ -377,7 +447,7 @@ err_t LwipIntfDev<RawDev>::linkoutput_s(netif* netif, struct pbuf* pbuf) {
LwipIntfDev* lid = (LwipIntfDev*)netif->state;
ethernet_arch_lwip_begin();
uint16_t len = lid->sendFrame((const uint8_t*)pbuf->payload, pbuf->len);
lid->_packetsSent++;
#if PHY_HAS_CAPTURE
if (phy_capture) {
phy_capture(lid->_netif.num, (const char*)pbuf->payload, pbuf->len, /*out*/ 1,
@@ -491,6 +561,8 @@ err_t LwipIntfDev<RawDev>::handlePackets() {
return ERR_BUF;
}
_packetsReceived++;
err_t err = _netif.input(pbuf, &_netif);
#if PHY_HAS_CAPTURE
@@ -69,6 +69,9 @@
#define ECON2_AUTOINC 0x80
#define ECON2_PKTDEC 0x40
#define EIE_PKTIE 0x40
#define EIE_INTIE 0x80
#define EIR_TXIF 0x08
#define ERXTX_BANK 0x00
@@ -153,8 +156,7 @@
// The ENC28J60 SPI Interface supports clock speeds up to 20 MHz
static const SPISettings spiSettings(20000000, MSBFIRST, SPI_MODE0);
ENC28J60::ENC28J60(int8_t cs, SPIClass& spi, int8_t intr) : _bank(ERXTX_BANK), _cs(cs), _spi(spi) {
(void)intr;
ENC28J60::ENC28J60(int8_t cs, SPIClass& spi, int8_t intr) : _bank(ERXTX_BANK), _cs(cs), _intr(intr), _spi(spi) {
}
void ENC28J60::enc28j60_arch_spi_select(void) {
@@ -488,6 +490,12 @@ bool ENC28J60::reset(void) {
/* Turn on autoincrement for buffer access */
setregbitfield(ECON2, ECON2_AUTOINC);
/* Enable interrupt on packet receive if desired */
if (_intr >= 0) {
setregbitfield(EIE, EIE_PKTIE);
setregbitfield(EIE, EIE_INTIE);
}
/* Turn on reception */
writereg(ECON1, ECON1_RXEN);
@@ -511,6 +519,8 @@ bool ENC28J60::begin(const uint8_t* address, netif *net) {
uint16_t ENC28J60::sendFrame(const uint8_t* data, uint16_t datalen) {
uint16_t dataend;
ethernet_arch_lwip_gpio_mask(); // So we don't fire an IRQ and interrupt the send w/a receive!
/*
1. Appropriately program the ETXST pointer to point to an unused
location in memory. It will point to the per packet control
@@ -582,6 +592,8 @@ uint16_t ENC28J60::sendFrame(const uint8_t* data, uint16_t datalen) {
}
#endif
ethernet_arch_lwip_gpio_unmask();
// sent_packets++;
// PRINTF("enc28j60: sent_packets %d\n", sent_packets);
return datalen;
@@ -99,7 +99,7 @@ public:
netif *_netif;
protected:
static constexpr bool interruptIsPossible() {
return false;
return true;
}
/**
@@ -154,6 +154,7 @@ private:
uint8_t _bank;
int8_t _cs;
int8_t _intr;
SPIClass& _spi;
const uint8_t* _localMac;
@@ -8,14 +8,21 @@
const char* host = "djxmmx.net";
const uint16_t port = 17;
#ifdef ARDUINO_WIZNET_5100S_EVB_PICO
// To use Interrupt-driven mode, pass in an SPI object and an IRQ pin like so:
Wiznet5100lwIP eth(17, SPI, 21);
#else
Wiznet5100lwIP eth(1 /* chip select */);
#endif
void setup() {
#ifndef ARDUINO_WIZNET_5100S_EVB_PICO
// Set up SPI pinout to match your HW
SPI.setRX(0);
SPI.setCS(1);
SPI.setSCK(2);
SPI.setTX(3);
#endif
Serial.begin(115200);
delay(5000);
+14 -19
View File
@@ -34,6 +34,7 @@
#include <SPI.h>
#include "w5100.h"
#include <LwipEthernet.h>
uint8_t Wiznet5100::wizchip_read(uint16_t address) {
uint8_t ret;
@@ -178,8 +179,7 @@ void Wiznet5100::wizchip_sw_reset() {
setSHAR(_mac_address);
}
Wiznet5100::Wiznet5100(int8_t cs, SPIClass& spi, int8_t intr) : _spi(spi), _cs(cs) {
(void)intr;
Wiznet5100::Wiznet5100(int8_t cs, SPIClass& spi, int8_t intr) : _spi(spi), _cs(cs), _intr(intr) {
}
bool Wiznet5100::begin(const uint8_t* mac_address, netif *net) {
@@ -189,13 +189,6 @@ bool Wiznet5100::begin(const uint8_t* mac_address, netif *net) {
pinMode(_cs, OUTPUT);
wizchip_cs_deselect();
#if 0
_spi.begin();
_spi.setClockDivider(SPI_CLOCK_DIV4); // 4 MHz?
_spi.setBitOrder(MSBFIRST);
_spi.setDataMode(SPI_MODE0);
#endif
wizchip_sw_reset();
// Set the size of the Rx and Tx buffers
@@ -213,6 +206,11 @@ bool Wiznet5100::begin(const uint8_t* mac_address, netif *net) {
return false;
}
if (_intr >= 0) {
setSn_IR(0xff); // Clear everything
setIMR(IM_IR0);
}
// Success
return true;
}
@@ -245,6 +243,8 @@ uint16_t Wiznet5100::readFrame(uint8_t* buffer, uint16_t bufsize) {
}
uint16_t Wiznet5100::readFrameSize() {
setSn_IR(Sn_IR_RECV);
uint16_t len = getSn_RX_RSR();
if (len == 0) {
@@ -273,25 +273,18 @@ uint16_t Wiznet5100::readFrameData(uint8_t* buffer, uint16_t framesize) {
wizchip_recv_data(buffer, framesize);
setSn_CR(Sn_CR_RECV);
#if 1
// let lwIP deal with mac address filtering
return framesize;
#else
// W5100 doesn't have any built-in MAC address filtering
if ((buffer[0] & 0x01) || memcmp(&buffer[0], _mac_address, 6) == 0) {
// Addressed to an Ethernet multicast address or our unicast address
return framesize;
} else {
return 0;
}
#endif
}
uint16_t Wiznet5100::sendFrame(const uint8_t* buf, uint16_t len) {
ethernet_arch_lwip_gpio_mask(); // So we don't fire an IRQ and interrupt the send w/a receive!
// Wait for space in the transmit buffer
while (1) {
uint16_t freesize = getSn_TX_FSR();
if (getSn_SR() == SOCK_CLOSED) {
ethernet_arch_lwip_gpio_unmask();
return -1;
}
if (len <= freesize) {
@@ -311,9 +304,11 @@ uint16_t Wiznet5100::sendFrame(const uint8_t* buf, uint16_t len) {
} else if (tmp & Sn_IR_TIMEOUT) {
setSn_IR(Sn_IR_TIMEOUT);
// There was a timeout
ethernet_arch_lwip_gpio_unmask();
return -1;
}
}
ethernet_arch_lwip_gpio_unmask();
return len;
}
+31 -1
View File
@@ -101,7 +101,7 @@ public:
netif *_netif;
protected:
static constexpr bool interruptIsPossible() {
return false;
return true;
}
/**
@@ -144,6 +144,7 @@ private:
SPIClass& _spi;
int8_t _cs;
int8_t _intr;
uint8_t _mac_address[6];
/**
@@ -308,6 +309,17 @@ private:
MR_IND = 0x01, ///< Indirect Bus Interface mode
};
/** Interrupt Mask register values */
enum {
IM_IR0 = 0x01, ///< Occurrence of Socket 0 Socket Interrupt Enable
IM_IR1 = 0x02, ///< Occurrence of Socket 1 Socket Interrupt Enable
IM_IR2 = 0x04, ///< Occurrence of Socket 2 Socket Interrupt Enable
IM_IR3 = 0x08, ///< Occurrence of Socket 3 Socket Interrupt Enable
IM_IR5 = 0x20, ///< PPPoE Close Enable
IM_IR6 = 0x40, ///< Destination unreachable Enable
IM_IR7 = 0x80, ///< IP Conflict Enable
};
/** Socket Mode Register values @ref Sn_MR */
enum {
Sn_MR_CLOSE = 0x00, ///< Unused socket
@@ -375,6 +387,24 @@ private:
return wizchip_read(MR);
}
/**
Set Interrupt Mask Register
@param (uint8_t)mr The value to be set.
@sa geIMR()
*/
inline void setIMR(uint8_t mode) {
wizchip_write(IMR, mode);
}
/**
Get Mode Register
@return uint8_t. The value of Mode register.
@sa setIMR()
*/
inline uint8_t getIMR() {
return wizchip_read(IMR);
}
/**
Set local MAC address
@param (uint8_t*)shar Pointer variable to set local MAC address. It should be allocated 6
+14 -20
View File
@@ -34,6 +34,7 @@
#include <SPI.h>
#include "w5500.h"
#include <LwipEthernet.h>
uint8_t Wiznet5500::wizchip_read(uint8_t block, uint16_t address) {
uint8_t ret;
@@ -238,8 +239,7 @@ int8_t Wiznet5500::wizphy_setphypmode(uint8_t pmode) {
return -1;
}
Wiznet5500::Wiznet5500(int8_t cs, SPIClass& spi, int8_t intr) : _spi(spi), _cs(cs) {
(void)intr;
Wiznet5500::Wiznet5500(int8_t cs, SPIClass& spi, int8_t intr) : _spi(spi), _cs(cs), _intr(intr) {
}
bool Wiznet5500::begin(const uint8_t* mac_address, netif *net) {
@@ -249,13 +249,6 @@ bool Wiznet5500::begin(const uint8_t* mac_address, netif *net) {
pinMode(_cs, OUTPUT);
wizchip_cs_deselect();
#if 0
_spi.begin();
_spi.setClockDivider(SPI_CLOCK_DIV4); // 4 MHz?
_spi.setBitOrder(MSBFIRST);
_spi.setDataMode(SPI_MODE0);
#endif
wizchip_sw_reset();
// Use the full 16Kb of RAM for Socket 0
@@ -273,6 +266,11 @@ bool Wiznet5500::begin(const uint8_t* mac_address, netif *net) {
return false;
}
if (_intr >= 0) {
setSn_IR(0xff); // Clear everything
setSIMR(1);
}
// Success
return true;
}
@@ -305,6 +303,8 @@ uint16_t Wiznet5500::readFrame(uint8_t* buffer, uint16_t bufsize) {
}
uint16_t Wiznet5500::readFrameSize() {
setSn_IR(Sn_IR_RECV);
uint16_t len = getSn_RX_RSR();
if (len == 0) {
@@ -333,26 +333,18 @@ uint16_t Wiznet5500::readFrameData(uint8_t* buffer, uint16_t framesize) {
wizchip_recv_data(buffer, framesize);
setSn_CR(Sn_CR_RECV);
#if 1
// let lwIP deal with mac address filtering
return framesize;
#else
// Had problems with W5500 MAC address filtering (the Sn_MR_MFEN option)
// Do it in software instead:
if ((buffer[0] & 0x01) || memcmp(&buffer[0], _mac_address, 6) == 0) {
// Addressed to an Ethernet multicast address or our unicast address
return framesize;
} else {
return 0;
}
#endif
}
uint16_t Wiznet5500::sendFrame(const uint8_t* buf, uint16_t len) {
ethernet_arch_lwip_gpio_mask(); // So we don't fire an IRQ and interrupt the send w/a receive!
// Wait for space in the transmit buffer
while (1) {
uint16_t freesize = getSn_TX_FSR();
if (getSn_SR() == SOCK_CLOSED) {
ethernet_arch_lwip_gpio_unmask();
return -1;
}
if (len <= freesize) {
@@ -372,9 +364,11 @@ uint16_t Wiznet5500::sendFrame(const uint8_t* buf, uint16_t len) {
} else if (tmp & Sn_IR_TIMEOUT) {
setSn_IR(Sn_IR_TIMEOUT);
// There was a timeout
ethernet_arch_lwip_gpio_unmask();
return -1;
}
}
ethernet_arch_lwip_gpio_unmask();
return len;
}
+39 -2
View File
@@ -104,7 +104,7 @@ public:
protected:
static constexpr bool interruptIsPossible() {
return false;
return true;
}
/**
@@ -152,6 +152,7 @@ private:
SPIClass& _spi;
int8_t _cs;
int8_t _intr;
uint8_t _mac_address[6];
/**
@@ -319,7 +320,7 @@ private:
IR = 0x0015, ///< Interrupt Register (R/W)
_IMR_ = 0x0016, ///< Interrupt mask register (R/W)
SIR = 0x0017, ///< Socket Interrupt Register (R/W)
SIMR = 0x0018, ///< Socket Interrupt Mask Register (R/W)
_SIMR_ = 0x0018, ///< Socket Interrupt Mask Register (R/W)
_RTR_ = 0x0019, ///< Timeout register address (1 is 100us) (R/W)
_RCR_ = 0x001B, ///< Retry count register (R/W)
UIPR = 0x0028, ///< Unreachable IP register address in UDP mode (R)
@@ -520,6 +521,24 @@ private:
return wizchip_read(BlockSelectCReg, IR) & 0xF0;
}
/**
Set @ref SIR register
@param (uint8_t)ir Value to set @ref SIR register.
@sa getSIR()
*/
inline void setSIR(uint8_t ir) {
wizchip_write(BlockSelectCReg, SIR, ir);
}
/**
Get @ref SIR register
@return uint8_t. Value of @ref SIR register.
@sa setSIR()
*/
inline uint8_t getSIR() {
return wizchip_read(BlockSelectCReg, SIR);
}
/**
Set @ref _IMR_ register
@param (uint8_t)imr Value to set @ref _IMR_ register.
@@ -538,6 +557,24 @@ private:
return wizchip_read(BlockSelectCReg, _IMR_);
}
/**
Set @ref _SIMR_ register
@param (uint8_t)imr Value to set @ref _SIMR_ register.
@sa getIMR()
*/
inline void setSIMR(uint8_t imr) {
wizchip_write(BlockSelectCReg, _SIMR_, imr);
}
/**
Get @ref _SIMR_ register
@return uint8_t. Value of @ref _SIMR_ register.
@sa setSIMR()
*/
inline uint8_t getSIMR() {
return wizchip_read(BlockSelectCReg, _SIMR_);
}
/**
Set @ref PHYCFGR register
@param (uint8_t)phycfgr Value to set @ref PHYCFGR register.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "framework-arduinopico",
"version": "1.30601.0",
"version": "1.30701.0",
"description": "Arduino Wiring-based Framework (RPi Pico RP2040)",
"keywords": [
"framework",
+237 -179
View File
@@ -86,6 +86,9 @@
{
"name": "Cytron Maker Pi RP2040"
},
{
"name": "Cytron Maker Uno RP2040"
},
{
"name": "DatanoiseTV PicoADK"
},
@@ -98,6 +101,9 @@
{
"name": "DFRobot Beetle RP2040"
},
{
"name": "L'atelier d'Arnoz DudesCab"
},
{
"name": "ElectronicCats HunterCat NFC RP2040"
},
@@ -134,6 +140,9 @@
{
"name": "iLabs Challenger 2040 UWB"
},
{
"name": "iLabs Connectivity 2040 LTE/WiFi/BLE"
},
{
"name": "iLabs RPICO32"
},
@@ -231,22 +240,22 @@
"toolsDependencies": [
{
"packager": "rp2040",
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-gcc"
},
{
"packager": "rp2040",
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-mklittlefs"
},
{
"packager": "rp2040",
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-elf2uf2"
},
{
"packager": "rp2040",
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-pioasm"
},
{
@@ -256,12 +265,12 @@
},
{
"packager": "rp2040",
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-openocd"
},
{
"packager": "rp2040",
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-picotool"
}
],
@@ -272,112 +281,126 @@
],
"tools": [
{
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-picotool",
"systems": [
{
"host": "arm64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/picotool.macosarm.tar.gz",
"archiveFileName": "picotool.macosarm.tar.gz",
"checksum": "SHA-256:6b9d28dee6f3c67ab705ff1bc9bd96de3fcb7f1d73753a0e802999b408d39011",
"size": "174728"
},
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/aarch64-linux-gnu.picotool-f6fe6b7.230911.tar.gz",
"archiveFileName": "aarch64-linux-gnu.picotool-f6fe6b7.230911.tar.gz",
"checksum": "SHA-256:95192ab12bbe99eb64b7c50c883e971b306e1fc0fc43738ff2a6ffaf8e684325",
"size": "172728"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-linux-gnu.picotool-f6fe6b7.240125.tar.gz",
"archiveFileName": "aarch64-linux-gnu.picotool-f6fe6b7.240125.tar.gz",
"checksum": "SHA-256:3d3aec025f74e146d9d27b3a64604fa271ac6a25dc8bf61855035c75829f55c0",
"size": "179609"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/arm-linux-gnueabihf.picotool-f6fe6b7.230911.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.picotool-f6fe6b7.230911.tar.gz",
"checksum": "SHA-256:734b30df29b884de711bc9eb1859a44275c02c7d2c067259070a5abadb2e4dd1",
"size": "153317"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/arm-linux-gnueabihf.picotool-f6fe6b7.240125.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.picotool-f6fe6b7.240125.tar.gz",
"checksum": "SHA-256:d2ea134a0dfea2a5d0ab4bc206f1a823e9bff632218e5476b56acbb3f4c99837",
"size": "168619"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-linux-gnu.picotool-f6fe6b7.230911.tar.gz",
"archiveFileName": "i686-linux-gnu.picotool-f6fe6b7.230911.tar.gz",
"checksum": "SHA-256:f8cceebdf270beba3d5282ec30911bc8cd1c2afc4733772fd2b32ba8c62d87a8",
"size": "184349"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-linux-gnu.picotool-f6fe6b7.240125.tar.gz",
"archiveFileName": "i686-linux-gnu.picotool-f6fe6b7.240125.tar.gz",
"checksum": "SHA-256:56ebf53f6ce0748faca2fc06c05bad9cb8bfcb429f5c4336e56738f344b99e38",
"size": "202882"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"archiveFileName": "i686-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"checksum": "SHA-256:5c8fc5a9a9a6f4cc49a84bcf4cde6f4188d64008d11754bda4da48affca39f13",
"size": "291812"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-w64-mingw32.picotool-f6fe6b7.240125.zip",
"archiveFileName": "i686-w64-mingw32.picotool-f6fe6b7.240125.zip",
"checksum": "SHA-256:f8a1ea6f0ea863b74a26b155fca780f24403f1069921e965f904ceac3d328dd5",
"size": "292401"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.picotool1-f6fe6b7.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.picotool1-f6fe6b7.230911.tar.gz",
"checksum": "SHA-256:80415ab9b4b63a327b31a1b84df31883dae4080a286851a546a46badf1b7de41",
"size": "1130270"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-apple-darwin20.4.picotool-f6fe6b7.240125.tar.gz",
"archiveFileName": "x86_64-apple-darwin20.4.picotool-f6fe6b7.240125.tar.gz",
"checksum": "SHA-256:b04fccd0416cfa753d1e2dd431b7bfc24a971819eab255eaec2a3e7d76c5966f",
"size": "167079"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-linux-gnu.picotool-f6fe6b7.230911.tar.gz",
"archiveFileName": "x86_64-linux-gnu.picotool-f6fe6b7.230911.tar.gz",
"checksum": "SHA-256:1282e7ff7985537cac549eaa8b1e4107f5e27f8a1b99b56c5b239a6e1545e6b0",
"size": "131937"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-linux-gnu.picotool-f6fe6b7.240125.tar.gz",
"archiveFileName": "x86_64-linux-gnu.picotool-f6fe6b7.240125.tar.gz",
"checksum": "SHA-256:ba7c3a168fe7813de9645f64f22fbdbf81841412550338df02c0e20701caee66",
"size": "192471"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"archiveFileName": "x86_64-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"checksum": "SHA-256:1a0cbf35adcc1fa696af8a97ea37d9f413fb4de152713b8f97f1d0ca393a5593",
"size": "277139"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-w64-mingw32.picotool-f6fe6b7.240125.zip",
"archiveFileName": "x86_64-w64-mingw32.picotool-f6fe6b7.240125.zip",
"checksum": "SHA-256:0e75f683223b5237051d1a1e47917f2b37b2b3a8ac11e516a0020dffbd49d3bd",
"size": "277241"
}
]
},
{
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-openocd",
"systems": [
{
"host": "arm64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/openocd.macosarm.tar.gz",
"archiveFileName": "openocd.macosarm.tar.gz",
"checksum": "SHA-256:585128f38286c0026f0c3d3d14aab098282ef0958882226907fefb1824ddd350",
"size": "1877283"
},
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/aarch64-linux-gnu.openocd-4d87f6dca.230911.tar.gz",
"archiveFileName": "aarch64-linux-gnu.openocd-4d87f6dca.230911.tar.gz",
"checksum": "SHA-256:ca0e58739a5af5d4726668e6613fe9ec21c04d28eb857a640638ca94860b9229",
"size": "6440041"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-linux-gnu.openocd-4d87f6dca.240125.tar.gz",
"archiveFileName": "aarch64-linux-gnu.openocd-4d87f6dca.240125.tar.gz",
"checksum": "SHA-256:470bedcfc7e26006e3789439b7c3806e0ee4e715e28330c4e3a48a19c6efbefa",
"size": "7439489"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/arm-linux-gnueabihf.openocd-4d87f6dca.230911.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.openocd-4d87f6dca.230911.tar.gz",
"checksum": "SHA-256:0acb02f16080fdd0d1cb5e89708a9df954d2ba97a6fc7e963bbc8e27ff92c786",
"size": "6156659"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/arm-linux-gnueabihf.openocd-4d87f6dca.240125.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.openocd-4d87f6dca.240125.tar.gz",
"checksum": "SHA-256:d086bfc425829984d9257e5629277ae8eb4dff780ef3e92d292b132764246ed2",
"size": "7256877"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-linux-gnu.openocd-4d87f6dca.230911.tar.gz",
"archiveFileName": "i686-linux-gnu.openocd-4d87f6dca.230911.tar.gz",
"checksum": "SHA-256:a2db908d408949dea7785e062eeb1226465378590e54ae3561d31cb859ef2b7a",
"size": "5960505"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-linux-gnu.openocd-4d87f6dca.240125.tar.gz",
"archiveFileName": "i686-linux-gnu.openocd-4d87f6dca.240125.tar.gz",
"checksum": "SHA-256:06e97a31d77ed690767eaf579f7be8e295dec4eecbbe504650726631d94379e6",
"size": "6978839"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.openocd-4d87f6dca.230911.zip",
"archiveFileName": "i686-w64-mingw32.openocd-4d87f6dca.230911.zip",
"checksum": "SHA-256:2205a5746f869170448ee9fda68aa8388f3cb030a5e2a3847c502840f56ad33c",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-w64-mingw32.openocd-4d87f6dca.240125.zip",
"archiveFileName": "i686-w64-mingw32.openocd-4d87f6dca.240125.zip",
"checksum": "SHA-256:0151d237bb7d4418130346d9296daee2a903bad93ca0fd676db2e0ecc3742b4c",
"size": "2468166"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.openocd-4d87f6dca.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.openocd-4d87f6dca.230911.tar.gz",
"checksum": "SHA-256:cb44314cb64316e91cf45c5623319751706bd94ad734a322af243b77f8eb2328",
"size": "2801625"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-apple-darwin20.4.openocd-4d87f6dca.240125.tar.gz",
"archiveFileName": "x86_64-apple-darwin20.4.openocd-4d87f6dca.240125.tar.gz",
"checksum": "SHA-256:c37f3f1222b2b5614d09a08ed820a27f79be78daa699884abfa26da9f96b2126",
"size": "3083387"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-linux-gnu.openocd-4d87f6dca.230911.tar.gz",
"archiveFileName": "x86_64-linux-gnu.openocd-4d87f6dca.230911.tar.gz",
"checksum": "SHA-256:327f80305ab5d02162bc5b88b1bdf05a41bfe6717b8a27153d62cad60f88a19c",
"size": "6355683"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-linux-gnu.openocd-4d87f6dca.240125.tar.gz",
"archiveFileName": "x86_64-linux-gnu.openocd-4d87f6dca.240125.tar.gz",
"checksum": "SHA-256:cf7163e0c3981cd1025a3eba64dda1ea02cc8042f340ae2740c89c1048b55f20",
"size": "7454235"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.openocd-4d87f6dca.230911.zip",
"archiveFileName": "x86_64-w64-mingw32.openocd-4d87f6dca.230911.zip",
"checksum": "SHA-256:99e6b543fd648f033299b6a49e1895e75c720386b1d31d1574fab973689937f5",
"size": "2412179"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-w64-mingw32.openocd-4d87f6dca.240125.zip",
"archiveFileName": "x86_64-w64-mingw32.openocd-4d87f6dca.240125.zip",
"checksum": "SHA-256:a15ba6f4a8054ca787c5ec47ce9a866b033667bbbf3dcbd0941a55539b2fbe37",
"size": "2412178"
}
]
},
@@ -434,6 +457,13 @@
"checksum": "SHA-256:01a5bf1fa264c6f04cfaadf4c6e9f6caaacb6833ef40104dfbe953fcdb9bca1c",
"size": "25494144"
},
{
"host": "arm64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/python3.18-portable-darwin_arm64.tar.gz",
"archiveFileName": "python3.18-portable-darwin_arm64.tar.gz",
"checksum": "SHA-256:ac6ee694191ac4db770e147429a7606b50063110db9ccbaf46e0e5ff8f7dcd20",
"size": "90294119"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/python3-via-env.tar.gz",
@@ -444,222 +474,250 @@
]
},
{
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-gcc",
"systems": [
{
"host": "arm64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-apple-darwin20.4.arm-none-eabi-d04e724.240127.tar.gz",
"archiveFileName": "aarch64-apple-darwin20.4.arm-none-eabi-d04e724.240127.tar.gz",
"checksum": "SHA-256:f70431e62a1d64b43d8730911be6b6f18ece3b91a216ce6c40d5318ad263756f",
"size": "86285430"
},
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/aarch64-linux-gnu.arm-none-eabi-d3d2e6b.230911.tar.gz",
"archiveFileName": "aarch64-linux-gnu.arm-none-eabi-d3d2e6b.230911.tar.gz",
"checksum": "SHA-256:248690d021b9da120ecf459972b35aba03b051b6cae6c7215fa7450c5e5c1ea4",
"size": "92005838"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-linux-gnu.arm-none-eabi-d04e724.240125.tar.gz",
"archiveFileName": "aarch64-linux-gnu.arm-none-eabi-d04e724.240125.tar.gz",
"checksum": "SHA-256:752be9aebf0f040794232a331bd6fd17a8843f7ebe819c73e728d1a9fe8de3c3",
"size": "93501390"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/arm-linux-gnueabihf.arm-none-eabi-d3d2e6b.230911.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.arm-none-eabi-d3d2e6b.230911.tar.gz",
"checksum": "SHA-256:fea1f309249344a6ff09e965e2e4e35aa6c51dbf46fb2cbd18c8efe37f7b6974",
"size": "85920067"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/arm-linux-gnueabihf.arm-none-eabi-d04e724.240125.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.arm-none-eabi-d04e724.240125.tar.gz",
"checksum": "SHA-256:494dc88980d0f1e2cc0ac10f0bd3adb5d6964cc31b43f44a14b8a167781a0316",
"size": "87330830"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-linux-gnu.arm-none-eabi-d3d2e6b.230911.tar.gz",
"archiveFileName": "i686-linux-gnu.arm-none-eabi-d3d2e6b.230911.tar.gz",
"checksum": "SHA-256:01f0cde4760ddfe1614f30c42b50153d392971edaec9a356bdb525c472441b44",
"size": "94592210"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-linux-gnu.arm-none-eabi-d04e724.240125.tar.gz",
"archiveFileName": "i686-linux-gnu.arm-none-eabi-d04e724.240125.tar.gz",
"checksum": "SHA-256:b00b8e138886c7957b28615762285c70b8ac84172c32b189a673bc33c2f29e2d",
"size": "96150883"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.arm-none-eabi-d3d2e6b.230911-v2.zip",
"archiveFileName": "i686-w64-mingw32.arm-none-eabi-d3d2e6b.230911-v2.zip",
"checksum": "SHA-256:cbda04d0327c963504c1c71bfbfd2f6fb27ca964e2004704108939a7716cb7a4",
"size": "99150816"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-w64-mingw32.arm-none-eabi-d04e724.240125.zip",
"archiveFileName": "i686-w64-mingw32.arm-none-eabi-d04e724.240125.zip",
"checksum": "SHA-256:f9b35511c2385b9351f70d5503b1e7f86ab4e47035402749ea7220175c9bf7fa",
"size": "102603587"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.arm-none-eabi-d3d2e6b.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.arm-none-eabi-d3d2e6b.230911.tar.gz",
"checksum": "SHA-256:7e8a6fb52b947850fcb10f5c6bf7e26d08edab060ac42237d3d7739f6b226400",
"size": "97134440"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-apple-darwin20.4.arm-none-eabi-d04e724.240125.tar.gz",
"archiveFileName": "x86_64-apple-darwin20.4.arm-none-eabi-d04e724.240125.tar.gz",
"checksum": "SHA-256:a2d9ea24986973c31082b35ada0fe9d1577167e6a68a908b69aa6d99490b2499",
"size": "97543047"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-linux-gnu.arm-none-eabi-d3d2e6b.230911.tar.gz",
"archiveFileName": "x86_64-linux-gnu.arm-none-eabi-d3d2e6b.230911.tar.gz",
"checksum": "SHA-256:4bbf08c2c529e76763cf29be7580f55f4932d691cb0090e41e9d7f22ede8612d",
"size": "94544555"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-linux-gnu.arm-none-eabi-028e019.240125.tar.gz",
"archiveFileName": "x86_64-linux-gnu.arm-none-eabi-028e019.240125.tar.gz",
"checksum": "SHA-256:447951503effc0238cdc83b23b5253909b4b9d9f1175f4cc6c29169927fa0964",
"size": "96301885"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.arm-none-eabi-d3d2e6b.230911-v2.zip",
"archiveFileName": "x86_64-w64-mingw32.arm-none-eabi-d3d2e6b.230911-v2.zip",
"checksum": "SHA-256:97dda385e4c20a228bfe59b8d61ebb23f2f419e9ebd4d04fb57980a6a1e6edd2",
"size": "102620481"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-w64-mingw32.arm-none-eabi-d04e724.240125.zip",
"archiveFileName": "x86_64-w64-mingw32.arm-none-eabi-d04e724.240125.zip",
"checksum": "SHA-256:f8f79b3da6b4997dc30c91689e6aeb126a37eb034b51c9f9356b382f1982c075",
"size": "106485317"
}
]
},
{
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-elf2uf2",
"systems": [
{
"host": "arm64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-apple-darwin20.4.elf2uf2-6a7db34.240127.tar.gz",
"archiveFileName": "aarch64-apple-darwin20.4.elf2uf2-6a7db34.240127.tar.gz",
"checksum": "SHA-256:3fb12aa0d39bb03520a46ff5e3d0dbd0eb0df31843056f5dcd8b6fffa1d7ff86",
"size": "30084"
},
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/aarch64-linux-gnu.elf2uf2-6a7db34.230911.tar.gz",
"archiveFileName": "aarch64-linux-gnu.elf2uf2-6a7db34.230911.tar.gz",
"checksum": "SHA-256:5eed824fdd1c529295c1fd3945017f0e9baed8250055749651aeee72c3e11ae5",
"size": "83825"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-linux-gnu.elf2uf2-6a7db34.240125.tar.gz",
"archiveFileName": "aarch64-linux-gnu.elf2uf2-6a7db34.240125.tar.gz",
"checksum": "SHA-256:b8ab83714f963dd42164ff1093a02822d63a2825fc04ac395f5ce9c98224fc6a",
"size": "85433"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/arm-linux-gnueabihf.elf2uf2-6a7db34.230911.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.elf2uf2-6a7db34.230911.tar.gz",
"checksum": "SHA-256:137792ded226d15fc7ce9041b1322cdc895d8423328cf08fbe0f3eb8f63a98fe",
"size": "56866"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/arm-linux-gnueabihf.elf2uf2-6a7db34.240125.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.elf2uf2-6a7db34.240125.tar.gz",
"checksum": "SHA-256:027de6742745bd27bb79e98563da95fc72f7aad28af19d2893e40b14602b3e99",
"size": "59530"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-linux-gnu.elf2uf2-6a7db34.230911.tar.gz",
"archiveFileName": "i686-linux-gnu.elf2uf2-6a7db34.230911.tar.gz",
"checksum": "SHA-256:7956e5365d647f1c810c1ac3c6786f8b81e7b1b89d90c2edc495448dbd7b82b9",
"size": "92453"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-linux-gnu.elf2uf2-6a7db34.240125.tar.gz",
"archiveFileName": "i686-linux-gnu.elf2uf2-6a7db34.240125.tar.gz",
"checksum": "SHA-256:b8ab8cf6fe09a6ce0c30861ded3e88c785cec06f1b3ccb888522ba6da8fc3220",
"size": "96835"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.elf2uf2-6a7db34.230911.zip",
"archiveFileName": "i686-w64-mingw32.elf2uf2-6a7db34.230911.zip",
"checksum": "SHA-256:74e9be8f520b2752010978f4f140671da95d7faa385d4cca5aae06d719674ae0",
"size": "72746"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-w64-mingw32.elf2uf2-6a7db34.240125.zip",
"archiveFileName": "i686-w64-mingw32.elf2uf2-6a7db34.240125.zip",
"checksum": "SHA-256:80c2b269d50475f0bcc518b3cc08d3ee639470603912bc17fbcd695efb5ac825",
"size": "73951"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.elf2uf2-6a7db34.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.elf2uf2-6a7db34.230911.tar.gz",
"checksum": "SHA-256:29b23e904fab7f373a082a09fe197555f79372aeef1e4d4cdef8ac8860476655",
"size": "105035"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-apple-darwin20.4.elf2uf2-6a7db34.240125.tar.gz",
"archiveFileName": "x86_64-apple-darwin20.4.elf2uf2-6a7db34.240125.tar.gz",
"checksum": "SHA-256:3d3e47d70981b852e553e1250b90c5442320232952f18d4a74ca87ff14a55ea7",
"size": "106528"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-linux-gnu.elf2uf2-6a7db34.230911.tar.gz",
"archiveFileName": "x86_64-linux-gnu.elf2uf2-6a7db34.230911.tar.gz",
"checksum": "SHA-256:ff48939331d44d51418e55e7ca2cf3e63a746e2617d307ac8000422c05914ee4",
"size": "83343"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-linux-gnu.elf2uf2-6a7db34.240125.tar.gz",
"archiveFileName": "x86_64-linux-gnu.elf2uf2-6a7db34.240125.tar.gz",
"checksum": "SHA-256:ba9cbfa2b6a46ced939b7c02f2c21f923cfb98228468634618e4a1ea2e4f10a1",
"size": "86035"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.elf2uf2-6a7db34.230911.zip",
"archiveFileName": "x86_64-w64-mingw32.elf2uf2-6a7db34.230911.zip",
"checksum": "SHA-256:bd932b64376557790ab130cfef941c4cf0c4f636ea373fb1bb30ccb7d9a667d0",
"size": "81346"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-w64-mingw32.elf2uf2-6a7db34.240125.zip",
"archiveFileName": "x86_64-w64-mingw32.elf2uf2-6a7db34.240125.zip",
"checksum": "SHA-256:8bd4440c8a0a5102235377ab3437d75324e7cfa58aa69bbce24c5dff29f5947d",
"size": "81681"
}
]
},
{
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-pioasm",
"systems": [
{
"host": "arm64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-apple-darwin20.4.pioasm-6a7db34.240127.tar.gz",
"archiveFileName": "aarch64-apple-darwin20.4.pioasm-6a7db34.240127.tar.gz",
"checksum": "SHA-256:b325fdf8c2e7712e821049c68fc29dfac80bc492fb03c0fb3597de272ff42deb",
"size": "246217"
},
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/aarch64-linux-gnu.pioasm-6a7db34.230911.tar.gz",
"archiveFileName": "aarch64-linux-gnu.pioasm-6a7db34.230911.tar.gz",
"checksum": "SHA-256:db0e42e85463d3ff61fa07e40fad274f414161ea9d54098ee41a048c38cf9bed",
"size": "453497"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-linux-gnu.pioasm-6a7db34.240125.tar.gz",
"archiveFileName": "aarch64-linux-gnu.pioasm-6a7db34.240125.tar.gz",
"checksum": "SHA-256:fb9faf961945bd2f0773feeb760750f38028740c34b279ea85904377f16d5a55",
"size": "456608"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/arm-linux-gnueabihf.pioasm-6a7db34.230911.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.pioasm-6a7db34.230911.tar.gz",
"checksum": "SHA-256:afaabb3367f8fe1c5d95d8324eccc288c20a7fd29d0499ec52488a6a317cdeb5",
"size": "360810"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/arm-linux-gnueabihf.pioasm-6a7db34.240125.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.pioasm-6a7db34.240125.tar.gz",
"checksum": "SHA-256:14bcd7305a2542b807eb9d3e31c043a7465dea170a928c8dc5a651476d8b9a14",
"size": "379178"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-linux-gnu.pioasm-6a7db34.230911.tar.gz",
"archiveFileName": "i686-linux-gnu.pioasm-6a7db34.230911.tar.gz",
"checksum": "SHA-256:62d58a88c22d94081a20d2005fddcdce08ebeb6cf3eb3ad824f28e5f3bb05424",
"size": "511516"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-linux-gnu.pioasm-6a7db34.240125.tar.gz",
"archiveFileName": "i686-linux-gnu.pioasm-6a7db34.240125.tar.gz",
"checksum": "SHA-256:2822abdfb3226c9cfa6bd7e58cbd9f0699cc9fe8ec319bb7adceb31c209095d2",
"size": "530142"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.pioasm-6a7db34.230911.zip",
"archiveFileName": "i686-w64-mingw32.pioasm-6a7db34.230911.zip",
"checksum": "SHA-256:c5bb884e3e8452495152662946be6ff5c9dc03981a6694df33d17572037888d2",
"size": "386187"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-w64-mingw32.pioasm-6a7db34.240125.zip",
"archiveFileName": "i686-w64-mingw32.pioasm-6a7db34.240125.zip",
"checksum": "SHA-256:a1f8f36ef039c3081d80d874949d243282889f81868ca626389b7d0c2ffef40a",
"size": "404747"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.pioasm-6a7db34.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.pioasm-6a7db34.230911.tar.gz",
"checksum": "SHA-256:74c3d7f5502674763cb205ed87df469abd5d763a84d37c28ca9fb7b66b583062",
"size": "585394"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-apple-darwin20.4.pioasm-6a7db34.240125.tar.gz",
"archiveFileName": "x86_64-apple-darwin20.4.pioasm-6a7db34.240125.tar.gz",
"checksum": "SHA-256:4c54204a7d5312825d6609cc326d4b4072728f8446ead346bae1c319256d7abe",
"size": "650257"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-linux-gnu.pioasm-6a7db34.230911.tar.gz",
"archiveFileName": "x86_64-linux-gnu.pioasm-6a7db34.230911.tar.gz",
"checksum": "SHA-256:029bbc6f1ab44481583730aedc58a091341267c4089aa151a1e50ba17aca4ba5",
"size": "458908"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-linux-gnu.pioasm-6a7db34.240125.tar.gz",
"archiveFileName": "x86_64-linux-gnu.pioasm-6a7db34.240125.tar.gz",
"checksum": "SHA-256:13db79fd0992a0aa8c6a78684fcf6538d77eb645758ccc5dc16b148d452ad796",
"size": "477990"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.pioasm-6a7db34.230911.zip",
"archiveFileName": "x86_64-w64-mingw32.pioasm-6a7db34.230911.zip",
"checksum": "SHA-256:3c506a8163ed5d3c6408343f5768f87bbcc6209a049313b51b1dda8bcfe634f4",
"size": "408968"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-w64-mingw32.pioasm-6a7db34.240125.zip",
"archiveFileName": "x86_64-w64-mingw32.pioasm-6a7db34.240125.zip",
"checksum": "SHA-256:71eee9c820774328cbd5d082a032fb960587af6a7568b2502ee75ebc6fe6c9a2",
"size": "429999"
}
]
},
{
"version": "2.1.0-a-d3d2e6b",
"version": "2.2.0-d04e724",
"name": "pqt-mklittlefs",
"systems": [
{
"host": "arm64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-apple-darwin20.4.mklittlefs-6e2fa17.240127.tar.gz",
"archiveFileName": "aarch64-apple-darwin20.4.mklittlefs-6e2fa17.240127.tar.gz",
"checksum": "SHA-256:ad46da0560569a97edd11490829479e70aa3c53b4525c5a8f6ae154f2d41c0bb",
"size": "70714"
},
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/aarch64-linux-gnu.mklittlefs-4aca452.230911.tar.gz",
"archiveFileName": "aarch64-linux-gnu.mklittlefs-4aca452.230911.tar.gz",
"checksum": "SHA-256:ebaa3a47e4004afc40e68c948d4811eec546b9e971691faa6cdb8798b450ceca",
"size": "63224"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/aarch64-linux-gnu.mklittlefs-6e2fa17.240125.tar.gz",
"archiveFileName": "aarch64-linux-gnu.mklittlefs-6e2fa17.240125.tar.gz",
"checksum": "SHA-256:63e549d45addddc0e029efed36fdf4684cb4b9f3f965426c56282fef890f7a3f",
"size": "68800"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/arm-linux-gnueabihf.mklittlefs-4aca452.230911.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.mklittlefs-4aca452.230911.tar.gz",
"checksum": "SHA-256:2865730ce61934f9b24b91ee675a9bcca3db7e2676520363062cd49f501f6f29",
"size": "53459"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/arm-linux-gnueabihf.mklittlefs-6e2fa17.240125.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.mklittlefs-6e2fa17.240125.tar.gz",
"checksum": "SHA-256:79746a9b44590ab132c03f686529c3894caf557a15720b2d9e4d64c91742093d",
"size": "59810"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-linux-gnu.mklittlefs-4aca452.230911.tar.gz",
"archiveFileName": "i686-linux-gnu.mklittlefs-4aca452.230911.tar.gz",
"checksum": "SHA-256:d8042d1d0d8d052af6c3979cfa61d63790cf940e74ad670df7591530081be923",
"size": "69995"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-linux-gnu.mklittlefs-6e2fa17.240125.tar.gz",
"archiveFileName": "i686-linux-gnu.mklittlefs-6e2fa17.240125.tar.gz",
"checksum": "SHA-256:084c016bf074b028cb40471b2087a6d54ef31a3d34709f5879b86e9577bff44d",
"size": "76575"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.mklittlefs-4aca452.230911.zip",
"archiveFileName": "i686-w64-mingw32.mklittlefs-4aca452.230911.zip",
"checksum": "SHA-256:0ddc40ccd20f36101543ea4a7a3ff56c63450d417746db2de8a499cb7cdd59b5",
"size": "347611"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/i686-w64-mingw32.mklittlefs-6e2fa17.240125.zip",
"archiveFileName": "i686-w64-mingw32.mklittlefs-6e2fa17.240125.zip",
"checksum": "SHA-256:35c1bcdd05be6389992e78fdb890e81cdd9c298408d811293a2bc7605ac59e7a",
"size": "369155"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.mklittlefs-4aca452.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.mklittlefs-4aca452.230911.tar.gz",
"checksum": "SHA-256:bdb0d7ec9e2ae9f7ab672a7dd5cc103db3bae287ab3e1b000bbbb6d8141c34f7",
"size": "435002"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-apple-darwin20.4.mklittlefs-6e2fa17.240125.tar.gz",
"archiveFileName": "x86_64-apple-darwin20.4.mklittlefs-6e2fa17.240125.tar.gz",
"checksum": "SHA-256:5d0eb016a0712b17f3178acf835590557a6a4990c0400e325f27db4fc9d9813c",
"size": "508017"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-linux-gnu.mklittlefs-4aca452.230911.tar.gz",
"archiveFileName": "x86_64-linux-gnu.mklittlefs-4aca452.230911.tar.gz",
"checksum": "SHA-256:a2b5b89c2535a426d59edd51495ba162c347632aeed2af9af27e8378ebeaad4b",
"size": "64930"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-linux-gnu.mklittlefs-6e2fa17.240125.tar.gz",
"archiveFileName": "x86_64-linux-gnu.mklittlefs-6e2fa17.240125.tar.gz",
"checksum": "SHA-256:91efeabcd4765d4f6a8e07b1561a226aaaf176abacee3d5f879e94c68dcc5617",
"size": "71165"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.mklittlefs-4aca452.230911.zip",
"archiveFileName": "x86_64-w64-mingw32.mklittlefs-4aca452.230911.zip",
"checksum": "SHA-256:49c18c392c86106ca317bc6fa1db0f3bd7430f937cab372987ebae9cb5194f6a",
"size": "359296"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.2.0/x86_64-w64-mingw32.mklittlefs-6e2fa17.240125.zip",
"archiveFileName": "x86_64-w64-mingw32.mklittlefs-6e2fa17.240125.zip",
"checksum": "SHA-256:cf7291de4633f3a041f38973771a4298128b7641c4c65a94f080fd13cbd50275",
"size": "381186"
}
]
}
+1 -1
View File
@@ -20,7 +20,7 @@
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Raspberry Pi RP2040 Boards
version=3.6.1
version=3.7.1
# Required discoveries and monitors
# ---------------------------------
+1
View File
@@ -25,6 +25,7 @@ function skip_ino()
/midi_pizza_box_dj/
/msc_esp32_file_browser/
/DualRole/
/Host/
EOL
echo $ino | grep -q -F "$skiplist"
echo $(( 1 - $? ))
-5
View File
@@ -178,11 +178,6 @@ function install_ide()
unzip -q ${core_path}/tools/dist/arduino-windows.zip
mv arduino-${idever} arduino-distrib
elif [ "$MACOSX" = "1" ]; then
# MACOS only has next-to-obsolete Python2 installed. Install Python 3 from python.org
wget -q https://www.python.org/ftp/python/3.7.4/python-3.7.4-macosx10.9.pkg
sudo installer -pkg python-3.7.4-macosx10.9.pkg -target /
# Install the Python3 certificates, because SSL connections fail w/o them and of course they aren't installed by default.
( cd "/Applications/Python 3.7/" && sudo "./Install Certificates.command" )
# Hack to place arduino-builder in the same spot as sane OSes
test -r ${core_path}/tools/dist/arduino-macos.zip || wget -q -O ${core_path}/tools/dist/arduino-macos.zip "${ideurl}-macosx.zip"
unzip -q ${core_path}/tools/dist/arduino-macos.zip
+1 -1
View File
@@ -14,7 +14,7 @@ for dir in ./cores/rp2040 ./libraries/EEPROM ./libraries/I2S ./libraries/SingleF
./libraries/MouseBT ./libraries/SerialBT ./libraries/HID_Bluetooth \
./libraries/JoystickBLE ./libraries/KeyboardBLE ./libraries/MouseBLE \
./libraries/lwIP_w5500 ./libraries/lwIP_w5100 ./libraries/lwIP_enc28j60 \
./libraries/SPISlave ; do
./libraries/SPISlave ./libraries/lwIP_ESPHost; do
find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" \) -a \! -path '*api*' -exec astyle --suffix=none --options=./tests/astyle_core.conf \{\} \;
find $dir -type f -name "*.ino" -exec astyle --suffix=none --options=./tests/astyle_examples.conf \{\} \;
done
+11 -10
View File
@@ -99,22 +99,23 @@ def load_tools_list(filename, platform):
return tools_to_download
def identify_platform():
arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'},
'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'},
'LinuxARM': {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'},
'Windows' : {32 : 'i686-mingw32', 64 : 'x86_64-mingw32'}}
arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'},
'DarwinARM': {32 : 'arm64-apple-darwin', 64 : 'arm64-apple-darwin'},
'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'},
'LinuxARM' : {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'},
'Windows' : {32 : 'i686-mingw32', 64 : 'x86_64-mingw32'}}
bits = 32
if sys.maxsize > 2**32:
bits = 64
sys_name = platform.system()
if 'Linux' in sys_name and (platform.platform().find('arm') > 0 or platform.platform().find('aarch64') > 0):
sys_platform = platform.platform()
if 'Darwin' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('arm64') > 0):
sys_name = 'DarwinARM'
if 'Linux' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('aarch64') > 0):
sys_name = 'LinuxARM'
if 'CYGWIN_NT' in sys_name:
sys_name = 'Windows'
if 'MSYS_NT' in sys_name:
sys_name = 'Windows'
if 'MINGW' in sys_name:
if ('CYGWIN_NT' in sys_name) or ('MSYS_NT' in sys_name) or ('MINGW' in sys_name):
sys_name = 'Windows'
print('System: %s, Bits: %d, Info: %s' % (sys_name, bits, sys_platform))
return arduino_platform_names[sys_name][bits]
def main():
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0x106F"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_RASPBERRY_PI_PICO -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0x106F"
]
],
"mcu": "rp2040",
"variant": "DudesCab"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "DudesCab",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 4194304,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "L'atelier d'Arnoz"
}
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0x107B"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_CONNECTIVITY_2040_LTE_WIFI_BLE_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 -DWIFIESPAT2",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0x107B"
]
],
"mcu": "rp2040",
"variant": "connectivity_2040_lte_wifi_ble"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Connectivity 2040 LTE/WiFi/BLE",
"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": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "iLabs"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0x1071"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_CYTRON_MAKER_UNO_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0x1071"
]
],
"mcu": "rp2040",
"variant": "cytron_maker_uno_rp2040"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Maker Uno 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": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "Cytron"
}
+1 -1
View File
@@ -9,7 +9,7 @@
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_ILABS_2040_RPICO32_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"extra_flags": "-D ARDUINO_ILABS_2040_RPICO32_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DWIFIESPAT2",
"f_cpu": "133000000L",
"hwids": [
[
+2 -2
View File
@@ -13,8 +13,8 @@ extern void interrupts();
#define SYS_ARCH_PROTECT(lev) noInterrupts
#define SYS_ARCH_UNPROTECT(lev) interrupts
extern unsigned long get_rand_32(void);
#define LWIP_RAND() get_rand_32()
extern unsigned long __lwip_rand(void);
#define LWIP_RAND() __lwip_rand()
// Common settings used in most of the pico_w examples
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details)
+9 -1
View File
@@ -88,6 +88,8 @@ def BuildUSBStack(name):
print('%s.menu.usbstack.picosdk.build.usbstack_flags=' % (name))
print("%s.menu.usbstack.tinyusb=Adafruit TinyUSB" % (name))
print('%s.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"' % (name))
print("%s.menu.usbstack.tinyusb_host=Adafruit TinyUSB Host" % (name))
print('%s.menu.usbstack.tinyusb_host.build.usbstack_flags=-DUSE_TINYUSB -DUSE_TINYUSB_HOST "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"' % (name))
print("%s.menu.usbstack.nousb=No USB" % (name))
print('%s.menu.usbstack.nousb.build.usbstack_flags="-DNO_USB -DDISABLE_USB_SERIAL -I{runtime.platform.path}/tools/libpico"' % (name))
@@ -370,6 +372,7 @@ MakeBoard("bridgetek_idm2040-7a", "BridgeTek", "IDM2040-7A", "0x2e8a", "0x1041",
# 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")
MakeBoard("cytron_maker_uno_rp2040", "Cytron", "Maker Uno RP2040", "0x2e8a", "0x1071", 250, "CYTRON_MAKER_UNO_RP2040", 2, "boot2_w25q080_2_padded_checksum")
# DatanoiseTV
MakeBoard("datanoisetv_picoadk", "DatanoiseTV", "PicoADK", "0x2e8a", "0x000a", 250, "DATANOISETV_PICOADK", 2, "boot2_w25q080_2_padded_checksum")
@@ -383,6 +386,10 @@ MakeBoard("flyboard2040_core", "DeRuiLab", "FlyBoard2040Core", "0x2e8a", "0x008a
# DFRobot
MakeBoard("dfrobot_beetle_rp2040", "DFRobot", "Beetle RP2040", "0x3343", "0x4253", 250, "DFROBOT_BEETLE_RP2040", 2, "boot2_w25q080_2_padded_checksum")
# DudesCab
MakeBoard("DudesCab", "L'atelier d'Arnoz", "DudesCab", "0x2e8a", "0x106F", 250, "RASPBERRY_PI_PICO", 4, "boot2_w25q080_2_padded_checksum")
# ElectronicCat
MakeBoard("electroniccats_huntercat_nfc", "ElectronicCats", "HunterCat NFC RP2040", "0x2E8A", "0x1037", 500, "ELECTRONICCATS_HUNTERCAT_NFC", 2, "boot2_w25q080_2_padded_checksum")
@@ -400,7 +407,8 @@ MakeBoard("challenger_nb_2040_wifi", "iLabs", "Challenger NB 2040 WiFi", "0x2e8a
MakeBoard("challenger_2040_sdrtc", "iLabs", "Challenger 2040 SD/RTC", "0x2e8a", "0x102d", 250, "CHALLENGER_2040_SDRTC_RP2040", 8, "boot2_w25q080_2_padded_checksum")
MakeBoard("challenger_2040_nfc", "iLabs", "Challenger 2040 NFC", "0x2e8a", "0x1036", 250, "CHALLENGER_2040_NFC_RP2040", 8, "boot2_w25q080_2_padded_checksum")
MakeBoard("challenger_2040_uwb", "iLabs", "Challenger 2040 UWB", "0x2e8a", "0x1052", 500, "CHALLENGER_2040_UWB_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")
MakeBoard("connectivity_2040_lte_wifi_ble", "iLabs", "Connectivity 2040 LTE/WiFi/BLE", "0x2e8a", "0x107b", 500, "CONNECTIVITY_2040_LTE_WIFI_BLE_RP2040", 8, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
MakeBoard("ilabs_rpico32", "iLabs", "RPICO32", "0x2e8a", "0x1010", 250, "ILABS_2040_RPICO32_RP2040", 8, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
# Melopero
MakeBoard("melopero_cookie_rp2040", "Melopero", "Cookie RP2040", "0x2e8a", "0x1011", 250, "MELOPERO_COOKIE_RP2040", 8, "boot2_w25q080_2_padded_checksum")
+8 -2
View File
@@ -321,9 +321,15 @@ libs = []
variant = board.get("build.arduino.earlephilhower.variant", board.get("build.variant", ""))
# The following 3 lines are adapted from espressif/arduino-esp32, also licensed under apache2
variants_dir = os.path.join(FRAMEWORK_DIR, "variants")
if "build.variants_dir" in board:
variants_dir = os.path.join("$PROJECT_DIR", board.get("build.variants_dir"))
if variant != "":
env.Append(CPPPATH=[
os.path.join(FRAMEWORK_DIR, "variants", variant)
os.path.join(variants_dir, variant)
])
env.Append(CPPDEFINES=[
@@ -335,7 +341,7 @@ if variant != "":
# otherwise weak function overriding won't work in the linking stage.
env.BuildSources(
os.path.join("$BUILD_DIR", "FrameworkArduinoVariant"),
os.path.join(FRAMEWORK_DIR, "variants", variant))
os.path.join(variants_dir, variant))
libs.append(
env.BuildLibrary(
+66
View File
@@ -0,0 +1,66 @@
#!/bin/sh
# this shell script refreshes world timezone definitions in
# cores/rp2040/TZ.h
#
# to run it, use:
# /path/to/TZupdate.sh
# tools/TZupdate.sh
# ./TZupdate.sh
dir=$(cd ${0%/*} 2>/dev/null; pwd)
base=${0##*/}
csv=https://raw.githubusercontent.com/nayarsystems/posix_tz_db/master/zones.csv
set -e
tz_tmpdir=$(mktemp -d)
trap 'rm -r $tz_tmpdir' EXIT
input=$tz_tmpdir/zones.csv
names=$tz_tmpdir/names.txt
values=$tz_tmpdir/values.txt
wget -O $input $csv || curl $csv > $input
sed -e 's/^[^,]*,//g' -e 's,^,(,g' -e 's,$,),g' < $input > $values
sed -e 's/^\([^,]*\),.*/#define TZ_\1/g' -e 's,["],,g' < $input | tr '/\-+' '_mp' > $names
(
cat << EOF
// autogenerated from $csv
// by script <rp2040 arduino core>/tools/${base}
// $(date -u)
//
// This database is autogenerated from IANA timezone database
// ${csv}
// (using https://www.iana.org/time-zones)
// and can be updated on demand in this repository
// or by yourself using the above script
#pragma once
EOF
paste $names $values
) > $tz_tmpdir/TZ.h
backup=$(date +%s)
mv ${dir}/../cores/rp2040/TZ.h ${dir}/../cores/rp2040/TZ.h.$backup
mv $tz_tmpdir/TZ.h ${dir}/../cores/rp2040/TZ.h
cat << EOF
Done:
'${dir}/../cores/rp2040/TZ.h' is updated
Diff:
----8<-------8<------8<---
$(diff -u ${dir}/../cores/rp2040/TZ.h.$backup ${dir}/../cores/rp2040/TZ.h)
--->8----->8------>8------
EOF
+1 -1
View File
@@ -261,7 +261,7 @@ def get_drives():
print("Unable to build drive list");
sys.exit(1)
for line in to_str(r).split('\n'):
words = re.split('\s+', line)
words = re.split(r'\s+', line)
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
drives.append(words[0])
else:
+39
View File
@@ -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 (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 (18u)
#define PIN_WIRE0_SCL (19u)
#define PIN_WIRE1_SDA (10u)
#define PIN_WIRE1_SCL (11u)
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)
#include "../generic/common.h"
+1 -1
View File
@@ -24,7 +24,7 @@
#define SARA_SERIAL_PORT Serial2
// SPI
#define PIN_SPI0_MISO (24u)
#define PIN_SPI0_MISO (20u)
#define PIN_SPI0_MOSI (23u)
#define PIN_SPI0_SCK (22u)
#define PIN_SPI0_SS (21u)
@@ -0,0 +1,280 @@
/*
UBlox SARA/ESP helper class for the Connectivity RP2040 LTE/WIFI/BLE board
Copyright (c) 2024 P. Oldberg <pontus@ilabs.se>
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>
#include <Connectivity.h>
iLabsConnectivityClass::iLabsConnectivityClass(HardwareSerial* espSerial, HardwareSerial* modemSerial) {
_espSerial = espSerial;
_modemSerial = modemSerial;
/* SARA pins */
pinMode(PIN_SARA_ON, OUTPUT);
digitalWrite(PIN_SARA_ON, LOW); // Output register must always be low
pinMode(PIN_SARA_ON, INPUT_PULLUP);
pinMode(PIN_SARA_RST, INPUT_PULLUP); // Keep as input for now
pinMode(PIN_SARA_PWR, OUTPUT);
digitalWrite(PIN_SARA_PWR, LOW); // No power to SARA yet
pinMode(PIN_SARA_DTR, OUTPUT);
digitalWrite(PIN_SARA_PWR, HIGH); // Make sure DTR is low on the R412M
modemSerialPortConfigured = false;
/* ESP Pins */
pinMode(PIN_ESP_RST, OUTPUT);
digitalWrite(PIN_ESP_RST, LOW); // Hold ESP in reset
pinMode(PIN_ESP_MODE, OUTPUT);
digitalWrite(PIN_ESP_MODE, HIGH); // Prepare for normal start
espSerialPortConfigured = false;
}
// Do a HW reset by applying a low pulse to the reset line for 1mSec
bool iLabsConnectivityClass::doModemPowerOn() {
bool ret;
digitalWrite(PIN_SARA_PWR, HIGH); // Make sure LDO is on
delay(100); // let the power stabilize
pinMode(PIN_SARA_ON, OUTPUT); // Pull power on control low
delay(150); // For 150mS
pinMode(PIN_SARA_ON, INPUT_PULLUP); // before releasing it again.
delay(1000); // Now wait for 1 second
SARA_SERIAL_PORT.setRTS(PIN_SERIAL2_RTS); // Enable hardware handshaking
SARA_SERIAL_PORT.setCTS(PIN_SERIAL2_CTS);
SARA_SERIAL_PORT.begin(DEFAULT_SARA_BAUDRATE);
modemSerialPortConfigured = true;
ret = isModemAlive(); // Make sure the modem is up and running
delay(250); // Allow for any extra characters
// before flushing the input buffer
while (SARA_SERIAL_PORT.available()) {
SARA_SERIAL_PORT.read();
}
return ret;
}
// Checks to see if the modem responds to the "AT" poll command.
bool iLabsConnectivityClass::isModemAlive(uint32_t timeout) {
SARA_SERIAL_PORT.setTimeout(100);
SARA_SERIAL_PORT.println(F("AT"));
String rdy = SARA_SERIAL_PORT.readStringUntil('\n');
while (!rdy.startsWith(F("OK")) && --timeout) {
SARA_SERIAL_PORT.println(F("AT"));
rdy = SARA_SERIAL_PORT.readStringUntil('\n');
//Serial.println(rdy);
}
SARA_SERIAL_PORT.setTimeout(1000); // Restore serial timeout
if (timeout) {
return true;
}
return false;
}
// Return the current MNO profile
// Returns -1 if the serial port is not yet setup or the number of the current
// MNO profile setting from the modem.
int iLabsConnectivityClass::getModemMNOProfile() {
if (!modemSerialPortConfigured) {
return -1;
}
SARA_SERIAL_PORT.println(F("AT+UMNOPROF?"));
String resp = getModemResponse();
return resp.substring(resp.indexOf("+UMNOPROF: ") + 11).toInt();
}
// Set a new MNO profile
// Returns false if the serial port is not yet setup or if an error
// is detected during the communication with the modem.
// This call is synchronous and will wait for the modem to start after
// the soft restart which takes about 10 seconds.
bool iLabsConnectivityClass::setModemMNOProfile(int profile) {
if (!modemSerialPortConfigured) {
return false;
}
// Disconnect from the network
SARA_SERIAL_PORT.println("AT+COPS=2");
if (!getModemResponse().endsWith("OK")) {
return false;
}
String cmd = "AT+UMNOPROF=" + String(profile) + ",1";
SARA_SERIAL_PORT.println(cmd);
if (!getModemResponse().endsWith("OK")) {
return false;
}
// Restart the modem to apply the new MNO profile
SARA_SERIAL_PORT.println("AT+CFUN=15");
if (!getModemResponse().endsWith("OK")) {
return false;
}
return isModemAlive(15000);
}
// Disable power save features
bool iLabsConnectivityClass::enableModemPS(bool enable) {
if (!modemSerialPortConfigured) {
return false;
}
if (enable) {
SARA_SERIAL_PORT.println(F("AT+CPSMS=1"));
} else {
SARA_SERIAL_PORT.println(F("AT+CPSMS=0"));
}
if (!getModemResponse().endsWith("OK")) {
return false;
}
return true;
}
// Get a response from SARA
// A default serial timeout of 2 seconds allow for reading really slow
// responses which should accommodate most replies. Replies are then trimmed
// from control characters and appended with a tab character as a separator.
//
String iLabsConnectivityClass::getModemResponse(int timeout) {
SARA_SERIAL_PORT.setTimeout(2000); // allow for really slow responses
String resp = SARA_SERIAL_PORT.readStringUntil('\n');
resp.trim();
String acc = resp;
while (resp.indexOf("OK") == -1 && resp.indexOf("ERROR") == -1 && --timeout) {
resp = SARA_SERIAL_PORT.readStringUntil('\n');
resp.trim();
if (resp.length()) {
acc += "\t" + resp;
}
}
return acc;
}
// Do a HW reset by applying a low pulse to the reset line for 1mSec
void iLabsConnectivityClass::doEspHWReset() {
digitalWrite(PIN_ESP_RST, LOW); // Hold ESP in reset
delay(1);
digitalWrite(PIN_ESP_RST, HIGH); // Release ESP reset
}
// Set the mode flag high to indicate normal run operation and do a HW
// reset.
void iLabsConnectivityClass::runEspReset() { // Prepare ESP for normal op
digitalWrite(PIN_ESP_MODE, HIGH); // Prepare for normal start
doEspHWReset();
}
// Set the mode flag low to indicate flash operation and do a HW
// reset.
void iLabsConnectivityClass::flashEspReset() { // Prepare ESP for flashing
digitalWrite(PIN_ESP_MODE, LOW); // Prepare for normal start
doEspHWReset();
}
// Wait for the modem to reply with a "ready" prompt. This can be done
// after a sw or hw reset have been performed to ensure that the AT
// interpreter is up and running.
bool iLabsConnectivityClass::waitForEspReady() {
int timeout = 20; // Aprox max 2 sec
_espSerial->setTimeout(100);
String rdy = _espSerial->readStringUntil('\n');
while (!rdy.startsWith("ready") && timeout--) {
rdy = _espSerial->readStringUntil('\n');
}
_espSerial->setTimeout(1000); // Reset default timeout to 1000
if (timeout) {
return true;
}
return false;
}
// Reset the ESP and wait for the "ready" prompt to be returned.
bool iLabsConnectivityClass::resetEsp() {
runEspReset();
_espSerial->begin(DEFAULT_ESP_BAUDRATE);
return waitForEspReady();
}
// Checks to see if the modem responds to the "AT" poll command.
bool iLabsConnectivityClass::isEspAlive() {
int timeout = 100;
_espSerial->setTimeout(250);
_espSerial->println(F("AT"));
String rdy = _espSerial->readStringUntil('\n');
while (!rdy.startsWith(F("OK")) && timeout--) {
_espSerial->println(F("AT"));
rdy = _espSerial->readStringUntil('\n');
}
_espSerial->setTimeout(1000);
if (timeout) {
return true;
}
return false;
}
// Change the baud rate of the ESP device as well as the local UART.
// No checking is done on the input baud rate so the user must know what
// baud rates are valid. The function ends by checking if the ESP is
// reachable by doing an "AT" poll.
bool iLabsConnectivityClass::changeEspBaudRate(int baud) {
_espSerial->print(F("AT+UART_CUR="));
_espSerial->print(baud);
_espSerial->println(F(",8,1,0,0"));
delay(100);
_espSerial->end();
_espSerial->begin(baud);
return isEspAlive();
}
// This method should be called if the builtin object isn't needed any more
// It basically just releases the UART pins for other use.
void iLabsConnectivityClass::releaseEsp() {
_espSerial->end();
}
// We can assign a new hardware serial port to accommodate the ESP device here.
// The function will release the previously used serial port and assign the
// new port. The ESP will be left in a reset state ready to start normal
// operation when exiting the function.
// This function is useful for when using the PIO serial ports to communicate
// with the ESP instead of the built in hardware serial port.
void iLabsConnectivityClass::setEspSerial(HardwareSerial* serial) {
releaseEsp();
_espSerial = serial;
pinMode(PIN_ESP_RST, OUTPUT);
digitalWrite(PIN_ESP_RST, LOW); // Hold ESP in reset
pinMode(PIN_ESP_MODE, OUTPUT);
digitalWrite(PIN_ESP_MODE, HIGH); // Prepare for normal start
}
// Return the current serial object
HardwareSerial* iLabsConnectivityClass::getEspSerial() {
return _espSerial;
}
iLabsConnectivityClass iLabsConnectivity;
@@ -0,0 +1,57 @@
/*
UBlox SARA/ESP helper class for the Connectivity RP2040 LTE/WIFI/BLE board
Copyright (c) 2024 P. Oldberg <pontus@ilabs.se>
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
#define DEFAULT_SARA_BAUDRATE 115200
#define DEFAULT_ESP_BAUDRATE 115200
class iLabsConnectivityClass {
public:
iLabsConnectivityClass(HardwareSerial* = &ESP_SERIAL_PORT, HardwareSerial* = &SARA_SERIAL_PORT);
// Modem stuff
bool doModemPowerOn();
bool isModemAlive(uint32_t timeout = 50);
int getModemMNOProfile();
bool setModemMNOProfile(int profile);
bool enableModemPS(bool enable = true);
String getModemResponse(int timeout = 5);
// ESP stuff
void doEspHWReset();
void runEspReset();
void flashEspReset();
bool waitForEspReady();
bool resetEsp();
bool isEspAlive();
bool changeEspBaudRate(int);
void releaseEsp();
void setEspSerial(HardwareSerial*);
HardwareSerial* getEspSerial();
private:
bool modemSerialPortConfigured;
bool espSerialPortConfigured;
HardwareSerial* _espSerial;
HardwareSerial* _modemSerial;
};
extern iLabsConnectivityClass iLabsConnectivity;
@@ -0,0 +1,55 @@
#pragma once
// LEDs
#define PIN_LED (19u)
// Serial1, (UART0) Connected to ESP32 chip)
#define PIN_SERIAL1_TX (16u)
#define PIN_SERIAL1_RX (17u)
#define PIN_ESP32_RST (24u)
#define PIN_ESP32_MODE (25u)
#define ESP32_SERIAL Serial1
// Uart define esp serial abstraction pins
#define PIN_ESP_TX PIN_SERIAL1_TX
#define PIN_ESP_RX PIN_SERIAL1_RX
#define PIN_ESP_RST PIN_ESP32_RST
#define PIN_ESP_MODE PIN_ESP32_MODE
#define ESP_SERIAL_PORT ESP32_SERIAL
// Serial2, (UART1) connected to SARA-R4XX modem
#define PIN_SERIAL2_TX (4u)
#define PIN_SERIAL2_RX (5u)
#define PIN_SERIAL2_CTS (6u)
#define PIN_SERIAL2_RTS (7u)
#define PIN_SARA_DTR (12u)
#define PIN_SARA_ON (13u)
#define PIN_SARA_RST (14u)
#define PIN_SARA_PWR (15u)
#define SARA_SERIAL_PORT Serial2
// SPI
#define PIN_SPI0_MISO (20u)
#define PIN_SPI0_MOSI (23u)
#define PIN_SPI0_SCK (22u)
#define PIN_SPI0_SS (21u)
// 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 (0u)
#define PIN_WIRE0_SCL (1u)
// Not pinned out
#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,53 @@
#pragma once
// LEDs
#define PIN_LED (3u)
// Neopixel
#define PIN_NEOPIXEL (25u)
#define NUM_NEOPIXEL (2u)
#define PIN_RGB PIN_NEOPIXEL
// Buzzer
#define PIN_BUZZER (8u)
// Button
#define PIN_BUTTON (2u)
// Serial 1
#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 0
#define PIN_SPI0_MISO (12u)
#define PIN_SPI0_MOSI (11u)
#define PIN_SPI0_SCK (10u)
#define PIN_SPI0_SS (13u)
// SPI 1 (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 (20u)
#define PIN_WIRE0_SCL (21u)
#define PIN_WIRE1_SDA (26u)
#define PIN_WIRE1_SCL (27u)
#define SERIAL_HOWMANY (1u)
#define SPI_HOWMANY (1u)
#define WIRE_HOWMANY (1u)
#include "../generic/common.h"
+1
View File
@@ -7,6 +7,7 @@
#define NUM_ANALOG_INPUTS (4u)
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
#define WIRE_INTERFACES_COUNT (WIRE_HOWMANY)
#ifdef PIN_LED
#define LED_BUILTIN PIN_LED