Commit graph

466 commits

Author SHA1 Message Date
Earle F. Philhower, III
a8e6634776
Avoid swapping L/R channels on I2S input (#2124)
Fixes #2123
2024-04-25 11:22:07 -07:00
Earle F. Philhower, III
bd8eb9bca2
Shift I2S input data by 1 bit (#2121)
Fixes #2037
2024-04-24 11:20:22 -07:00
Earle F. Philhower, III
d554df7670
Protect W5500/ENC28J60 isLinked() call from IRQ (#2115)
Fixes #2105

W5100 doesn't support isLinked, so no change needed there.
2024-04-19 13:59:11 -07:00
Earle F. Philhower, III
074b952314
Add FatFS and FatFSUSB - Wear-Leveled FTL based FAT filesystem for onboard flash (#2028)
* Add FatFS for onboard flash use/sharing of FAT

* Move all to "fatfs" namespace

The FatFS library defines commonly used names like WORD which could conflict
with user code otherwise.

* Restyle

* FTL-based, wear-leveling FatFS with USB export

Allow using FAT filesystem with onboard flash in a safer, wear-leveled
way and to export the onboard flash to the host as a USB drive for easy
data transfer.

* Update documentation

* Fix submodule reference

* Don't spellehcek ChaN FatFS files

* Disable FTL debugging

* More codespell skips

* Move to latest SPIFTL library

* Allow using raw flash instead of FTL

* Remove unneeded static FIL 4k allocation

* Expose FAT FS format configuration options

* Update documentation

* Remove USB partial flash rewrites

* Remove unneeded dups of FatFS sources

Leave the LICENSE.md and README.md to point to upstream.

* Clean up comments
2024-04-19 10:52:02 -07:00
Kevin Witteveen (MartiniMarter)
11dfb2c913
Add WiFi::beginNoBlock() (#2063) 2024-04-19 10:16:03 -07:00
Earle F. Philhower, III
6c22ea3be1
Set creation time on LittleFS directory creation (#2108) 2024-04-18 15:58:06 -07:00
Earle F. Philhower, III
1be28b55e4
Update to Adafruit TinyUSB 3.1.3 (#2043) 2024-04-18 15:49:20 -07:00
Earle F. Philhower, III
48a52e61ce
Update to SDFat 2.2.2 release (#2079) 2024-04-18 15:05:36 -07:00
Juraj Andrássy
2a256f9c25
LwipIntfDev - linkStatus added (#2081) 2024-03-29 09:14:05 -07:00
Juraj Andrássy
71edeb8d1a
lwIP_enc28j60 - add missing end() method (#2055) 2024-03-16 14:10:12 -07:00
Juraj Andrássy
22139df33c
Enable interrupt-mode for lwIP_ESPHost (#2036) 2024-03-06 12:38:29 -08:00
Juraj Andrássy
9c94bab290
Add RawDev::interruptMode (#2042) 2024-03-06 11:58:37 -08:00
Earle F. Philhower, III
ea8874037c
Use passed-in SPI on SD.end(true) (#2040)
Fixes #2034
2024-03-05 12:22:01 -08:00
Earle F. Philhower, III
77209a12cc
Update SPISlave.cpp (#2021)
Fixes #2019
2024-02-23 09:46:42 -08:00
Earle F. Philhower, III
795968a8e0
Clean up WIFI local variable MAC size (#2006)
MACs are 6-bytes long, not 8.
2024-02-14 12:17:09 -08:00
Earle F. Philhower, III
01ab02d02a
Fix ESPHost WiFi connect without a specified BSSID (#2007)
See https://github.com/earlephilhower/arduino-pico/pull/2001#issuecomment-1944461469
2024-02-14 12:00:06 -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💿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
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
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
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
Juraj Andrássy
fef8d2c384
WiFi - prepare for alternative drivers (#1935) 2024-01-20 12:35:13 -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
Richard Teel
24f6302612
Updated listfiles example and added CardInfo example (#1914) 2023-12-27 12:01:06 -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
fa390f48af
Clean up FreeRTOS header, include add'l APIs (#1891) 2023-12-10 09:48:15 -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
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
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
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
Earle F. Philhower, III
1020023eab
Avoid infinite loop in BLE HID send (#1834)
If the BLE connection is severed, don't wait for the needToSend
flag to clear in the HID::send routine since it may never actually
clear unless the BLE connection is restored.

Partial #1817
2023-11-21 11:53:41 -08:00
Earle F. Philhower, III
4625d2c8ab
Avoid memory allocation in Ethernet callbacks (#1815)
std::bind can cause a memory allocation to occur during the periodic
polling interrupt which is a very bad thing.  Use a lambda instead.

Fixes #1812
2023-11-14 10:01:06 -08:00
David Ross Smith
db7ba160ae
Allow MCLK multiplier to be set on all I2S devices (#1813)
As discussed in #1765.
2023-11-13 06:57:37 -08:00
Earle F. Philhower, III
ea936f00e1
Protect W5500/ENC28J60 isLinked from interrupt (#1805)
Fixes #1786
2023-11-12 11:09:09 -08:00
ZinnerC
8ac616e8db
Adding capability to enable timeout for I2C (#1793) 2023-11-09 17:37:28 -08:00
Cole Deck
2e93f1c9c8
Clear dirty flag after commiting EEPROM to flash (#1776)
* Clear dirty flag after commiting EEPROM to flash

* Styling: remove whitespace
2023-10-18 17:21:27 -07:00
Earle F. Philhower, III
5678bb9904
Don't break transfer16 into 2 8-bit CS periods (#1764)
With HW chip select enabled, transfer16's 2 individual byte transfers will
actualy deassert CS for a brief instant between bytes.  Avoid this by doing
a single multi-byte (2) tranfer of 16b.
2023-10-11 08:40:17 -07:00
Earle F. Philhower, III
52d50da56f
Avoid calling spi_set_format during SPI transfers (#1762)
Avoid potential interaction with Pico SDK 1.5.1 update that causes hiccups in
SPI transmissions.  SPI.transfer16 to use 8-bit transfers.

Fixes #1760
2023-10-11 08:22:01 -07:00
Earle F. Philhower, III
47111a6eba
Undo BSTstackLib warning (#1758)
Undo #1751
2023-10-08 16:42:08 -07:00
Earle F. Philhower, III
7868ddee42
Allow full 8K stack for both cores, optionally (#1750)
Fixes #1749

Defining a global true `bool core1_separate_stack = true` will separate
the two cores' stacks, with core 0 using the scratch RAM while core 1
will use 8K from the heap.
2023-10-07 07:38:32 -07:00
Earle F. Philhower, III
bd6b20dedd
Mark the BTStackLib as unsupported (#1751)
Per https://github.com/bluekitchen/btstack/issues/529#issuecomment-1746293987
Don't run BTstackLib examples in CI
2023-10-04 09:39:01 -07:00
Earle F. Philhower, III
4f945780e7
Remove redundant variable set in LittleFS lib (#1737) 2023-09-28 17:56:18 -07:00
Benjamin Aigner
60e93f3e20
BLE HID composite device support (#1587)
* Adapted all libraries to support multiprotocol HID over BT & BLE

* Added ATT DB depending on setup; still no success with working connection

* Added hids_device from BTStack develop branch as override

* Fixing the GATT handle patching, added working ATT DB

* ran astyle on example

* Updates in BLE implementation; WORKING! (but only if all are activated). Removed sdkoverride again, doesn't work.

* Moved ATT DB handles to correct places

* Finally functioning for Mouse+KBD+Joy, and each individual

* Cleaned up code & ran astyle

* Added sdkoverrides to pull develop functions from BTSTack

* Changed a few typos by BTStack to run codespell successfully

* Ran astyle on sdkoverride files

* Added some #if guards for including BTSTack file only if BT is enabled

* Fixed Feature Report value characteristics handle assignment; fixed too long HID report

* Ran astyle
2023-09-22 17:27:20 -07:00
Dom
7e8fcc5afa
Allow Ethernet devices on SPI1 (#1725)
_spiUnit is a reference, and when initialized with SPI, it cannot be changed in the constructor afterwards.
So initialize it in the constructor's declaration.
2023-09-22 11:54:53 -07:00
Earle F. Philhower, III
f60b7831c8
Add SPISlave class (#1717)
Allows the Pico to behave as an SPI slave and allows apps to respond
with appropriate data through callbacks.

Fixes #1680
2023-09-17 15:23:03 -07:00
Earle F. Philhower, III
c48cdeeea0
Protect SPI transaction start/end from race conditions (#1715)
It would be possible for an IRQ-driven SPI user to fire
while the main app's SPI.beginTransaction was in process.
This would result in incorrect state for the main app since
the IRQ may overwrite some settings that the app already
set.

Disable all IRQs around the begin and end processes to avoid
the possibility.
2023-09-16 13:59:37 -07:00
Earle F. Philhower, III
0be7c98dff
Support IRQ disabled SPI transactions (#1714)
Fixes #1147

When SPI.beginTransaction() is called, disable all GPIO IRQs that were
registered using SPI.usingInterrupt().  On SPI.endTransaction(), restore
all the IRQs to their prior state.
2023-09-16 13:31:14 -07:00
Earle F. Philhower, III
1f3d5011b2
Support wired network interfaces (W5500, W5100, ENC28J60) (#1703)
Enable use of wired Ethernet modules as first-class LWIP citizens.  All
networking classes like MDNS, WebServer, HTTPClient, WiFiClient, and OTA
can use a wired Ethernet adapter just like built-in WiFi.

Two examples updated to show proper use.

Uses the Async Context support built into the Pico SDK.  When running on the
Pico  it will use the CYW43 async instance.

Uses modified wired Ethernet drivers, thanks Nicholas Humfrey!

Note, the classic, non-LWIP integrated `Ethernet` and related libraries
should still work fine (but not be able to use WebServer/HTTPS/etc.)

Fixes #775
2023-09-14 19:04:39 -07:00
Earle F. Philhower, III
b9c66ca0fd
Ensure HID reports aren't dropped (#1685)
Fixes #1682

Make the HID report wait up to 500ms for an existing one to go out
before giving up sending a report.
2023-08-31 08:40:38 -07:00
Earle F. Philhower, III
e9daaa3589
Add TDM support to I2S (#1673)
Fixes #1066

Implements a simple TDM mode for the I2S output object.
2023-08-30 08:28:34 -07:00
Earle F. Philhower, III
ade74986ee
GCC 12.3, GDB 12, OpenOCD 0.12, Picotool 1.1.2 (#1670)
Major toolchain update including:
* GCC 12.3
* GDB 12
* OpenOCD 0.12
* Picotool 1.1.2

* Fix MDNS infinite recursion

* Remove legacy Picoprobe

Fixes #1313
Fixes #1650
2023-08-25 09:56:52 -07:00
LinusHeu
73722b5c87
Fix I2S stop/start race condition #1656 (#1659)
Fixes  #1656
2023-08-22 08:40:23 -07:00
Earle F. Philhower, III
456b474a48
Allow re-setting identical pins without panic() (#1655)
Setting a pin to the current value is a no-op, not fatal.

Fixes #1652
2023-08-21 08:52:49 -07:00
Jimmy Hedman
f11cc4db69
Make MDNS compile with IPv6 enabled (#1651) 2023-08-20 14:47:23 -07:00
LinusHeu
ca4637d14d
SPI debugging: tiny fix & log actual baudrate (#1641) 2023-08-10 07:39:36 -07:00
Dryw Wade
1231317c9c
Fix race condition between WiFi receive and consume (#1614)
If another packet comes in between freeing `_rx_buf` and setting `_rx_buf` to 0, that new packet could get put into the same memory address and get concatenated to itself, which leads to an infinite loop.
New solution assigns a temp pointer, sets `rx_buf` to 0, then frees the memory, which guarantees `_rx_buf` always points to valid data.
2023-08-03 20:10:24 -07:00
Earle F. Philhower, III
5fd4736d8f
Handle swapped Wire IRQs properly (#1608)
When we swap the Wire objects, we need the i2c0 IRQ shim to call
Wire1.onIRQ, not the usual Wire.onIRQ.  Same for i2c1 IRQ shim.

Fixes #1607
2023-07-26 15:40:07 -07:00
Earle F. Philhower, III
67a07edccc
Fix FS upload crash (#1598)
Thanks to @pietglas for finding and fixing.  See #1590 for more info.
2023-07-17 15:17:31 -07:00
Earle F. Philhower, III
1dc0872818
Remove obsolete refs to ATOMIC_FS_UPDATE (#1597)
See #1590
2023-07-14 14:58:21 -07:00
LinusHeu
4c90b295b2
Fix: 'I2S::operator=(const I2S&)' is implicitly (#1588) 2023-07-12 03:26:43 -07:00
Earle F. Philhower, III
43aa0427ea
Reapply #1548 (#1582) 2023-07-07 13:38:04 -07:00
palmerr23
cc5d1779a3
Add MCLK support for I2S, optimize clocks for jitter-free playback (#1555)
Fixes #1065
2023-07-07 13:10:32 -07:00
Earle F. Philhower, III
0f437e4db2
Remove leftover debug printf in LWIP_Ethernet (#1572)
See #1161
2023-07-02 13:12:22 -07:00
Earle F. Philhower, III
9e89dda900
Ensure 64bit math for SD card FSInfo (#1553)
Fixes #1552

Ensure that 64 bit multiplication is done when calculating the total size
available and used for SDFS.
2023-06-23 08:25:36 -07:00
LinusHeu
0e579792d1
I2S: Don't consider _isHolding when it's an output (#1548) 2023-06-19 07:54:34 -07:00
hreintke
9b3032cd58
WebServer: Solve HTTP request delay by dropping idle connections (#1537)
Serve next wificlient (http_request) if current client does not have data
2023-06-15 07:39:02 -07:00
Earle F. Philhower, III
5b76b0668b
Addition ABM checks in PWMAudio and ADCInput (#1530)
Handle the case where the DMA manager is unable to completely allocate
needed resources (DMA channels or memory) and return `false` in ::begin()
2023-06-12 15:20:52 -07:00
Earle F. Philhower, III
d18f8dce2f
I2S check for failure of ARB and PIO allocation (#1528)
Per https://github.com/earlephilhower/arduino-pico/pull/1524#issuecomment-1587885054
2023-06-12 12:24:08 -07:00
Earle F. Philhower, III
c64cdc14b6
Call I2S::end() in I2S destructor (#1527)
Per https://github.com/earlephilhower/arduino-pico/pull/1524#issuecomment-1587562257
2023-06-12 12:12:50 -07:00
Earle F. Philhower, III
cc800713bd
Minor clean up includes (#1520) 2023-06-10 20:42:28 -07:00
Linar Yusupov
c6a0d6ecfe
Fix for invalid __channelCount in ~AudioBufferManager() (#1519) 2023-06-10 10:51:19 -07:00
hreintke
3f475ac68c
CoreMutex add portYieldFromISR for FreeRTOS (#1484) 2023-06-07 06:59:10 -07:00
Earle F. Philhower, III
273fb84dc5
Update to Adafruit TinyUSB 2.2.1 (#1511)
Fixes #1509
2023-06-07 00:05:12 -07:00
Earle F. Philhower, III
3c408dab7c
AudioBufferManager(I2s, PWMAudio, ADCInput) clicking fix (#1500)
The ABM had an off-by-one error in the DMA buffer swapover.  Instead of
setting the DMA address to the newly added buffer in active[], it set it
to the buffer that was currently running.

This would effectively disable the ping-pong and cause clicks/lost data.

Fixes #1491
2023-06-04 18:40:29 -07:00
Earle F. Philhower, III
2888f4d03d
I2S::available/availableForWrite() returns bytes (#1499)
Per the Arduino documentation, I2s::available should return bytes free,
not samples.  Adjust accordingly.
2023-06-04 16:38:12 -07:00
Earle F. Philhower, III
f57b5bc762
Add I2S::getOverUnderflow() (#1497)
See #1491.  Thanks @LinusHeu
2023-06-04 14:21:02 -07:00
Earle F. Philhower, III
35a4d57360
Fix I2s::available/availableForWrite() (#1496)
Return the actual number of samples that can be read/written, not the
number of 32-bit values there is space for.
2023-06-04 14:10:53 -07:00
hreintke
db4f79448d
CoreMutex freeRTOS Mutex acquire properly (#1481)
Since FreeRTOS has real tasks and mutexes with support for priority bumping, actually always try and take a `CoreMutex` instead of seeing if someone else already has it and aborting immediately.

This fix helps ensure things like Serial output in a multi-task system won't get lost.
2023-06-04 13:12:30 -07:00
LinusHeu
45bbcca207
AudioBufferManager: Make dma_claim_unused_channel() not panic (#1487) 2023-05-30 15:51:07 -07:00
Dominic Pearman
8e961a5667
Added setup overload to pass name. (#1483)
Co-authored-by: Dominic Pearman <dominic@phymorous.de>
2023-05-27 10:40:24 -07:00
Jan
4def2f219c
Implement the BD_ADDR(char * address_string) constructor. (#1440)
* Implement the BD_ADDR(char * address_string) constructor.

* Updating implementation to use sscanf.

There is an extra step after the sscanf that checks that we got
six bytes back and if we did not, it will set all bytes in the
address to zero.

* Example using BD_ADDR(const char * address_string)

This example shows how BD_ADDR(const char * address_string) can
be used to create BD_ADDR objects to use for comparisons etc.

* Update LEDeviceScanner.ino formatting
2023-05-25 06:54:24 -07:00
Earle F. Philhower, III
652f9f9eda
Fix FreeRTOS CoreMutex shim to handle ISRs (#1442)
* Fix FreeRTOS CoreMutex shim to handle ISRs

Automatically check, when in FreeRTOS, if we're in an ISR and
if so call the correct mutex grab.

Thanks to @caveman99 for finding and proposing a solution!

Fixes #1441

* Fix the CoreMutex destructor, too
2023-05-23 10:12:52 -07:00
LinusHeu
3b4fb295ea
Fix I2S::write(const uint8_t *buffer, size_t size) (#1461)
According to this: https://github.com/earlephilhower/arduino-pico/discussions/1450
2023-05-20 11:33:50 -07:00
Jean-Luc Béchennec
a1ae61b5b1
BT Serial connection docs for Mac (#1459) 2023-05-20 10:56:06 -07:00
Earle F. Philhower, III
a851a928d2
Merge latest FreeRTOS/SMP upstream branch (#1449)
Update to head of upstream FreeRTOS/SMP branch.  Very minor changes.

Remove the custom getreent implementation, use the one that was defined
in the upstream FreeRTOS/smp branch (callback related vs. static vars).
2023-05-16 12:13:51 -07:00
Earle F. Philhower, III
16c2e8e454
Clean up FreeRTOS, remove core freeze hacks (#1448) 2023-05-15 19:52:38 -07:00
Earle F. Philhower, III
ae908c8e9b
Use real FreeRTOS tasks to idle core during flash (#1444)
Fixes #1439

Use a real FreeRTOS task, at the highest priority, to idle the other core
while doing flash accesses.

The USB stack seems to have some timing dependent bits which get broken
if FreeRTOS switches out the current task when it's running.  Avoid any
issue by disabling preemption on the core for all tud_task calls.

The PendSV handler disable flag can live completely inside the FreeRTOS
variant port, so remove any reference to it in the main core.

Tested using Multicode-FreeRTOS, #1402 and #1441

The USB FIFO interrupts were still being serviced even when the core was
frozen, leading to crashes.  Explicitly shut off IRQs on both the victim
and the initiator core when freezing.

Removed the need for hack __holdUpPendSV flag
2023-05-15 18:10:30 -07:00
Earle F. Philhower, III
414ff23141
Remove circular dependency on WiFi/LWIP_Ethernet (#1415)
Fixes #1408

The wl_* types are required in multiple libraries which in turn seem
to have a circular dependency that Platform.IO has issues with in certain
modes.

Avoid the issue by moving the common headers into the core directories
so they will be accessible by all libs.

Move StackThunk to core directory, too
2023-05-04 19:54:24 -07:00
Earle F. Philhower, III
5a949443a5
Fix USB crashes in FreeRTOS (#1419)
Fixes #1402

The global USB mutex is auto-shadowed with a FreeRTOS semaphore while in
FreeRTOS mode.  Unfortunately, while the core was using the proper
FreeRTOS semaphore to lock access to the USB port, the actual FreeRTOS
USB task was using the naked Pico SDK mutex, leading to cases where it
could acquire the mutex even though some other FreeRTOS task actually
owned the shadowed mutex.

Properly lock the shadowed Semaphore, not mutex_t, in the FreeRTOS
USB periodic task.
2023-05-01 19:34:46 -07:00
Earle F. Philhower, III
ff9f228e1b
FreeRTOS compilation fix when no LED present (#1413)
Fixes #1412
2023-05-01 10:46:23 -07:00
Earle F. Philhower, III
f33dfd2313
Don't delete first cert, taken from ESP8266 repo (#1392)
See https://github.com/esp8266/Arduino/pull/8907
2023-04-22 15:34:59 -07:00
Earle F. Philhower, III
7ef00c8761
Update to Adafruit_TinyUSB 2.1.0 (#1387)
Fixes #1382
2023-04-21 10:20:14 -07:00
Earle F. Philhower, III
3dcb4bbf8b
Clear compile errors if BT needed but not on (#1371)
Fixes #1370

Adds a simple helper assertion to tell the user how to enable BT if it's
not enabled, instead of some odd compilation warnings about undefined
functions.
2023-04-12 08:21:24 -07:00
Earle F. Philhower, III
07781e9cf5
Rename BTstack lib to BTstackLib (#1360)
Fixes #1356

Mac and Windows have case-insensitive filesystems, so the will find
the internal (all-lowercase) "btstack.h" and not the library's "BTstack.h",
causing compilation errors.

Rename the library and header to avoid the issue.
2023-04-06 17:09:07 -07:00
Earle F. Philhower, III
0963611fc7
Add absolute mouse support (#1342)
Fixes #1338

To be revisited when TinyUSB native support is added and picked up in the SDK
2023-03-30 16:09:04 -07:00
Earle F. Philhower, III
00644db9b1
Update to fixed HID_Mouse submodule (#1340) 2023-03-30 12:24:13 -07:00
Earle F. Philhower, III
1dfd9ebac7
Add HID consumer (aka media) keys for USB, BT (#1309)
Allow sending thigns like KEY_MUTE or KEY_SCAN_NEXT from the USB and
Bluetooth Classic keyboard libraries.

BLE requires some add'l magic, not yet discovered.

Pull in latest upstream Keyboard library changes
2023-03-15 19:10:31 -07:00
Earle F. Philhower, III
3dbe5cf930
Add I2S::swapClocks() for boards w/reversed pins (#1298)
Allow users of boards like the Pico-Audiom where the LRCLK comes
before the BCLK pin, to swap the BCLK/LRCLK of the I2S interface.

Fixes #1287
2023-03-15 15:23:56 -07:00
Earle F. Philhower, III
8e8fea4b7d
Add (unsupported) BTstack Arduino library (#1305)
The BTstack driver includes a basic Arduino library as part of the ports
directory.
2023-03-15 13:02:24 -07:00
Earle F. Philhower, III
6bff270402
Manually add MDNS multicast Ethernet MACs to CYW43 (#1290)
SDK 1.5 changed the behavior of the underlying CYW43 blob, and it seems
to block MDNS multicast by default.  Manually add back the Ethernet MACs
used for MDNS multicast in IPV4 and IPV6.

Fixes #1267
2023-03-09 14:15:14 -08:00
Earle F. Philhower, III
e6c7b97b5e
Adjust LWIP intf to avoid hangs/crashes under load (#1286)
It seems possible now for TCP connection _pcbs to disappear while being
processed, due to the new async context configuration.  This would cause
LWIP to panic when a NULL pcb was passed in.

Check for and avoid passing in null PCBs in the ClientContext.

Undo special-casing of sys_check_timeouts wrapper

AdvancedWebServer with heavy F5-refresh and #1274 test both pass.

Fixes #1274
2023-03-08 11:48:23 -08:00
Tim Boldt
9e272733cf
Add instructions for making I2S input work with Adafruit microphone (#1272)
Co-authored-by: timboldt <tim.boldt@gmail.com>
2023-03-05 14:24:31 -08:00
Earle F. Philhower, III
79e1af7bde
Add Keyboard LED callback for USB and BT (not BLE) (#1265)
BLE seems to require some kind of characteristic callback that is not yeet
implemented here.  USB and BT tested and examples updated.
2023-03-04 14:18:40 -08:00
Earle F. Philhower, III
173c44417c
Allow setting names for BT/BLE HID devices (#1260) 2023-03-04 12:38:34 -08:00
Earle F. Philhower, III
7aa1c08d17
Use generic HID classes to minimize code duplic'n (#1254)
Move the Joystick, Keyboard, and Mouse into a base class which handles
the operation/input, and a subclass which will implement the reporting
as a HID device via USB, Bluetooth Classic, or Bluetooth Low Energy (BLE).

Reduce copies of library code and makes maintainability much better.
2023-03-03 11:12:09 -08:00
Earle F. Philhower, III
305e194993
Add setBattery to BLE HID devices (#1246) 2023-03-02 15:55:18 -08:00
Earle F. Philhower, III
e9df18f910
Update PicoBluetoothBLEHID.cpp 2023-03-02 08:18:02 -08:00
Earle F. Philhower, III
67c1db9957
JoystickBLE actually implements a gamepad, update appearance 2023-03-01 16:30:51 -08:00
Earle F. Philhower, III
f5a621935d
Add BLE HID libraries and examples (#1240) 2023-03-01 16:29:25 -08:00
Earle F. Philhower, III
fd1596b6c9
Update keywords.txt 2023-02-28 12:41:22 -08:00
Earle F. Philhower, III
9760efbca3
Clean up the BT HID libraries a bit (#1236) 2023-02-28 10:10:39 -08:00
Earle F. Philhower, III
d92c1025ba
Update to SDK 1.5, add alpha-level BT support, use Pico-SDK CYW43 infrastructure (#1167)
* Update to Pico-SDK v1.5
* Hook in pico_rand, use ioctl to set ipv6 allmulti
* Move into PicoSDK LWIP mutex, hack timer sizes
* Utilize much of the PicoSDK infrastructure for WiFi
* Add WiFi::begin(ssid, pass, bssid)
* WiFiMulti to use BSSID, make more robust

WiFiMulti will now be more aggressive and try all matching SSIDs, in order
of RSSI, using the BSSID to identify individual APs in a mesh.

Before, if the highest RSSI AP didn't connect, it would fail immediately.
Now, it will go down the list, ordered by RSSI, to attempt to get a link.

* Add Bluetooth support from Pico-SDK
Able to build and run the HID Keyboard Demo from the Arduino IDE, almost
as-is.

Will probably need to make BT configurable.  Enabling BT on a plain WiFi
sketch uses 50KB of flash and 16KB of RAM even if no BT is used.

* Separate picow libs, BT through menus, example

Build normal Pico.a and 4 different options for PicoW IP/BT configuration.
Use IP=>IP/Bluetooth menu to select between options.

* CMakefile rationalization

* Move BT TLV(pairing) out of last 2 flash sectors

The pairing keys for BT are stored at the end of flash by default, but
we use the last sector of flash for EPROM and the penultimate one for
the filesystem.  Overwriting those in BT could cause some real exciting
crashes down the line.

Move the store to an app-build specific address using a dummy const
array to allocate space in the application image itself.

* PicoBluetoothHID with BT Mouse, Joystick, Keyboard

Add simple Bluetooth Classic HID helper function and port the existing
USB HID devices to it.  Port their examples.

* Protect BT key storage from multicore

* Add short-n-sweet Bluetooth documents

* Add Bluetooth Serial port library

* Turn off BT when the BT libraries exit
2023-02-27 20:09:02 -08:00
crp500
83e790851f
Update PlayStereo.ino (#1210)
The PWMAudio lib is expecting an int16_t value but the example passes a sample cast to uint16_t 
So any values from the lookup table that are negative are recast to 0 i think.
So half the sine wave in the case of the example is lost.
2023-02-20 09:58:14 -08:00
Carter Nelson
ba413bb7ad
Remove extra SPI byte flip (#1202)
Fixes #1201
2023-02-17 12:42:31 -08:00
Earle F. Philhower, III
84206eb237
Fix SD.H FILE_WRITE mapping (#1178)
O_RDWR != O_READ|O_WRITE.  Posix is weird.  Thanks @mcspr
2023-02-12 17:46:50 -08:00
Earle F. Philhower, III
5e576c1a08
Update SD examples with working SPI configs (#1175)
Fixes #1172
2023-02-12 11:01:01 -08:00
Earle F. Philhower, III
fc180041aa
Implement WiFi::softAPgetStationNum (#1174) 2023-02-12 10:38:37 -08:00
Earle F. Philhower, III
09db2e6c37
Apply SD.h fix from ESP8266 (#1171)
Pull in the portion of the change correcting the flag setting from
https://github.com/esp8266/Arduino/pull/8833
2023-02-11 11:57:27 -08:00
Earle F. Philhower, III
b6cb2e7edc
Avoid race condition in I2S/PWMAudio delete (#1163)
Fixes #1162

Disable DMA interrupts while we're tearing down an AudioBufferManager
and explicitly clear any potential leftover IRQs to avoid hangs.
2023-02-09 13:29:45 -08:00
Earle F. Philhower, III
bedcbf57c6
Add ESP8266/32 WiFi.isConnected wrapper (#1166)
Fixes #1165
2023-02-09 08:39:35 -08:00
TomKong666
7df080ee92
PDM library re-port (#1160)
See #1156
2023-02-07 08:10:24 -08:00
Vishnu Mohanan
8a1e03739a
Fix SPI transfer16 return value (#1148)
The SPI transfer16() function returned wrongly oriented bytes. Replaced reverseByte() with reverse16Bit().

Fixes #1146
2023-01-31 08:09:53 -08:00
Earle F. Philhower, III
d619bf0bc1
More minor ESP8266 compatibility tweaks (#1131) 2023-01-20 17:06:40 -08:00
Earle F. Philhower, III
e3f2f87e2d
Add more ESP8266 WiFi compatibility wrappers (#1128) 2023-01-19 12:44:05 -08:00
Earle F. Philhower, III
4c234310fd
Add hook support to WebServer (#1119)
Implement the method used in the ESP8266 Web Server to allow user apps to hook into
the HTTP server (to support hooked WebSockets, etc._)

Add example of hook usage
2023-01-14 13:35:33 -08:00
Earle F. Philhower, III
aeb41f3e70
Handle slave mode I2C restarts (#1104)
Fixes #1100
2023-01-06 12:23:53 -08:00
Earle F. Philhower, III
cefea28539
Stop the I2S PIO when I2S::end called (#1103) 2023-01-06 12:23:26 -08:00
Earle F. Philhower, III
da26016edf
DMA-based ADC input (microphone, analog sensor) (#1101)
Mimics the I2S/PWMAudio/Stream interface for ease of use.

* Fix non-32b DMA size transfer calculation in ABM
* Rename wasHolding to isHolding in the I2S/PWM
  It is the **current** number of bits left, not the past number.
* Add commented microphone example
* Add docs
2023-01-05 16:00:34 -08:00
Earle F. Philhower, III
6bef238772
Update to LittleFS 2.5.1 (only minor updates) (#1099) 2023-01-03 18:51:28 -08:00
Earle F. Philhower, III
02465b48b3
Allow on-the-fly changes to PWMAudio when possible (#1098)
Also fix crash on PWMAudio::end()
2023-01-03 16:02:43 -08:00
Earle F. Philhower, III
94abf9d19f
Move analogReadTemp() to C++-only (#1097)
Now that we have a default parameter, need to only allow it in C++ since
default values are not part of C spec.  Should not affect any users since
only legacy code is in C.
2023-01-03 13:30:11 -08:00
Thomas Combriat
7a4244180b
Set Right and Left correctly for lsbj format (#1096) 2023-01-03 13:15:08 -08:00
Earle F. Philhower, III
6fe6c474f7
Add LSBJ format support for I2S (#1095)
Fixes #1094
2023-01-03 11:47:55 -08:00
Earle F. Philhower, III
be34ed1385
Reduce stack usage of several components (#1093)
Only 4K total stack, so allocating 400 bytes for a local C string
or 600 bytes for a DHCP response is dangerous.  Use static allocations
instead on the heap.
2023-01-02 11:40:51 -08:00
Earle F. Philhower, III
444bb24464
Remove debug printout warnings (#1091)
Exposed by #1090, remove ugly printf format warnings while in debug mode
2023-01-02 10:51:04 -08:00
Earle F. Philhower, III
d718b143d2
Warn when Serial.printf() format is wrong (#1090)
Let GCC check the format string to Print::printf().  Will catch when
sketches use incorrect parameters to `Serial::printf()`.
2023-01-01 15:26:15 -08:00
Earle F. Philhower, III
1228251bc3
Add stereo support, docs for PWM playback (#1084)
Limited to consecutive pins (i.e. GPIOs on the same PWM slice).
"For free" with PWM since no add'l DMA, buffers, or IRQs are needed.
2023-01-01 11:27:49 -08:00
Earle F. Philhower, III
08d37de94e
Add PWMAudio for DAC-free audio playback (#1076)
Use the PWM hardware to generate a signal suitable for filtering and
amplifying 16bps audio output.

Refactor the AudioBufferManager to allow sharing with I2S

Add example
2022-12-30 13:24:06 -08:00
Earle F. Philhower, III
c69c568f49
Fix I2S::flush volatile casting (#1074)
Also clean up unneeded includes for I2S
2022-12-29 09:43:26 -08:00
Earle F. Philhower, III
5ef04daf44
Make the AudioRingBuffer list-based (#1064)
The ring buffer worked but had issues with IRQs and the available()
procesing.  Because it was a pain to debug, move to a linked list
setup where there are filled and empty buffers to work from,
simplifying the underlying logic.

Allow I2S::available() to return free writing space in OUTPUT mode
to make it saner.

* Increase default number of buffers for 32bps

Gives 2x the time between interrutps to handle I2S callbacks.

* Add setBuffers keyword
2022-12-28 14:46:32 -08:00
Earle F. Philhower, III
dd45bb1694
Update to Adafruyit TinyUSB 1.17 (#1071)
Includes MIDI fixes
2022-12-28 09:05:20 -08:00
brabl2
fecbac2e25
Modified LowPowerMode functions in WiFiClass.cpp/.h for better connection stability (#1046)
* Modified LowPowerMode functions in WiFiClass.cpp/.h

* Added noLowPowerMode() in the WiFiClass::begin()/beginAP()
2022-12-17 11:49:16 -08:00
Earle F. Philhower, III
e2e65fd53b
Fix I2s::available() to skip currently playing (#1043)
Fixes #963

The available space calculation didn't account for the fact that one
of the buffers was currently being output, causing ::available() to
be too large and ::write() to block in that case.
2022-12-14 15:41:36 -08:00
Earle F. Philhower, III
f22ed52b75
Increase ClientContext write(Stream) to 256b chunk (#1042)
Other parts of the core use temp 256 byte chunks to transmit/move/operate
on data, so do the same here.  Will increase effective WebServer sendFile
speeds.
2022-12-14 09:14:57 -08:00
Earle F. Philhower, III
03dbd6af65
Increase WiFi.begin() default timeout to 15s (#1041)
Fixes #1031, or at least covers the case of slower associations.
2022-12-14 08:59:24 -08:00
Earle F. Philhower, III
fca7fb5e0f
Add USB drive mode to TinyUSB, SingleFileDisk (#1034)
SingleFileDisk allows for exporting a file from the onboard LittleFS
filesystem to a PC through an emulated FAT drive when connected.  The
PC can open and copy the file, as well as delete it, but the PC has no
access to the main onboard LittleFS and no actual on-flash FAT
structures are used.

This is handy for things like data loggers.  They can run connected to
USB power for some time, and then connected to a PC to dowmload the CSV
log recorded.

It's almost 2023, allow LFN (long file names) on the emulated USB disk.

Reduce the disk buffer size to 64 bytes.  The buffer is statically
allocated so it's always present, even in non-USB disk mode, meaning
all apps will pay the RAM price for it.  64 bytes is slower to read
but works and saves ~1/2KB of heap for all apps.
2022-12-09 13:59:23 -08:00
Earle F. Philhower, III
d717b58001
Speed up ClientContext::write(Stream) by chunking (#1017)
Instead of sending a single packet per byte, send out larger chunks to
TCP/IP while doing a ::write(Stream).

Fixes #999
2022-11-29 15:00:47 -08:00
Earle F. Philhower, III
d94ca66e3e
Update Wire per @chrisckc debugging (#1011)
Merge in changes @chrisckc debugged while working at 400khz on his own project.
See https://github.com/earlephilhower/arduino-pico/issues/979#issuecomment-1328237128
2022-11-28 08:50:51 -08:00
brabl2
e47e3c73c2
Fix memcpy to unallocated memory in EEPROM.cpp (#1000)
The memcpy to unallocated memory was done in two cases:
1) The 'size' parameter was not multiple of 256.
2) The begin() was called two times and the 2nd call 'size' was greater than 1st time 'size'. (e.g. 1st size=256, 2nd size=512)
2022-11-24 10:25:48 -08:00
imwoo90
a7cf5cd1ca
Fix GPIO interrupt on freeRTOS (#959) 2022-11-22 18:26:19 -08:00
Sylwester
4e6e1d6024
Use PIN_I2S_ defines if they exist in board pin definition. (#991) 2022-11-22 17:42:32 -08:00
Earle F. Philhower, III
0133ecc887
Avoid race conditions in I2C(Wire) callbacks (#995)
Fixes #979

Make sure to read the last byte of I2C data in the case where the IRQ happens
and the STOP signal is also asserted.

Also ensure all branches of the IRQ handler look at the same point in time
value for the IRQ status.
2022-11-22 17:14:44 -08:00
Maximilian Gerhardt
f9db547cf3
Do not require USB init variable for TinyUSB (#981) 2022-11-21 09:00:41 -08:00
Drzony
6bbaf64daf
Async scan + bugfixes (#947)
* Support asynchronous WiFi scan

* Fixed buffer overflow in getChipId

* ESP compatibility fixes

* fixup! ESP compatibility fixes
2022-10-31 17:01:10 -07:00
Earle F. Philhower, III
07a1484d72
Add WiFi.channel() reporting (#937)
Also return error conditions when WiFi status is inquired while not
connected.
2022-10-27 13:02:09 -07:00
Earle F. Philhower, III
9503620525
Add WiFi.BSSID() undocumented call (#936)
Using same method as #934 and Infineon wifi-host-driver sources
2022-10-27 09:09:48 -07:00
mecparts
e05a3b8ad0
Add a way to return the RSSI value (#934)
See https://forums.raspberrypi.com/viewtopic.php?t=341774
2022-10-27 08:00:59 -07:00
Earle F. Philhower, III
10090b60a9
Rewrite PicoW LWIP interface for stability (#916)
Random crashes, infinite loops, and other lockups were happening to the PicoW
while under high load from multiple clients.

This seems to have been due to two issues:

* The periodic sys_check_timeouts() call from an alarm/IRQ was happening while
  the core was in LWIP code. LWIP is not re-entrant or multi-core/thread safe
  so this is a bad thing. Some calls may not have been locked with a manual
  addition of the LWIPMutex object to hit this.
* The WiFi driver supplies packet data during an interrupt. PBUF work is
  legal in an interrupt, but actually calling netif->input() from an IRQ to
  queue up the Ethernet packet for processing is illegal if LWIP is already
  in progress.
   
Rearchitect the LWIP interface to fix these problems:
* Disable interrupts during malloc/etc. to avoid the possibility of the
  periodic LWIP timeout check interrupting and potentially calling user
  code which did a memory operation
* Wrap all used LWIP calls to note LWIP code will be executing, instead of
  manually eyeballing and adding in protection in user code.
* Remove all user code LWIPMutex blocking, the wrapping takes care of it.
* When an Ethernet packet is received by interrupt and we're in LWIP code,
  just throw the packet away for now. The upper layers can handle retransmit.
  (A possible optimization would be to set the packet aside and add a
  housekeeping portion to the LWIP wrappers to netif->input() them when safe).
* Ignore callbacks during TCP connection teardown when the ClientContext
  passed from LWIP == nullptr
2022-10-15 12:00:35 -07:00
Earle F. Philhower, III
e89ce78c79
Fix memory leak in WebServer (#914)
Fixes #908
2022-10-12 11:25:56 -07:00
Earle F. Philhower, III
98c4b921b8
Un-hardcode LED pin in AdvancedWebServer example (#909)
Partial #908
2022-10-11 09:30:41 -07:00
Earle F. Philhower, III
25ceb08f93
Clear LWIP started flag on LWIPIntfDev::end (#905)
When moving between different modes or even WiFi.begin/ends, any setting
of the IPs will fail because the internal flag _started was not cleared.
Clear _started on a ::end call.

Fixes #884
2022-10-09 18:25:24 -07:00
Dario Gogliandolo
d6628972c5
Enabled static memory allocation with example (#842)
Co-authored-by: Dario Gogliandolo <dario.gogliandolo@smartme.io>
2022-09-08 07:09:38 -07:00
Earle F. Philhower, III
e2b04e7405
Minor tweak, NULL=>nullptr (#844) 2022-09-07 14:41:04 -07:00
Earle F. Philhower, III
59bd3b5144
Update DNSServer.h 2022-09-01 21:04:41 -07:00
Earle F. Philhower, III
166f63f955
Update PicoOTA.h 2022-08-31 14:40:53 -07:00
Earle F. Philhower, III
d2beb2da19
Add upsteam multicast compatibility APIs (#821)
Fixes #747 while remaining ESP8266 compatible
2022-08-31 11:06:18 -07:00
Earle F. Philhower, III
7ef44d9878
Clean up WebServer send() methods (#820)
Avoid creating Strings when sending out results.
2022-08-31 08:21:16 -07:00
Earle F. Philhower, III
408813c387 Add SDFS header to SpeedTest to simplify use 2022-08-31 08:09:42 -07:00
Earle F. Philhower, III
4d2f64a12b
Add bidirectional bulk SPI transfer, update SdFAT (#819)
Should speed up SD transfers significantly (2.5x+).

See #801
2022-08-31 07:42:34 -07:00
Earle F. Philhower, III
9997461e3a
Shrink MIME table flash usage by ~500 bytes (#818)
Decreases WebServer sketch sizes.
2022-08-30 19:21:57 -07:00
Filipe Mendonça
024ae9bb42
Fix WiFi MAC Address string output (#812)
Fixes #811
2022-08-29 17:51:40 -07:00
Earle F. Philhower, III
38bcf4f956
Minor WebServer style/unused var cleanup (#810) 2022-08-29 13:25:32 -07:00
Earle F. Philhower, III
486caf42a0
Remove microscopic malloc() from WebServer (#809)
Don't try and heap allocate temporaty <16b chunks.
2022-08-29 12:35:14 -07:00
Earle F. Philhower, III
bde4da2b7e
Protect core/Newlib mutexes from task preemption under FreeRTOS (#798)
Fixes #795 

Replace all CoreMutex and Newlib mutex accesses with FreeRTOS calls
when in FreeRTOS mode.  Avoid issues with hange/etc. due to priority
inversion.

No changes to normal operating mode.

Add a FreeRTOS stress test that caught the issue fixed here.
2022-08-29 08:56:59 -07:00
Earle F. Philhower, III
064dd4794f
Minor header/directrory cleanup (#802) 2022-08-27 13:04:57 -07:00
Earle F. Philhower, III
257db5ac7d Update version 2022-08-27 09:33:50 -07:00
Earle F. Philhower, III
0edba2ee2a
Add WebServer, WebServerSecure, HTTPUpdateServer, HTTPUpdateServerSecure (#791)
* Add HTTP-parser lib to support ESP32 WebServer
* Add WebServer from ESP32.  Only supports HTTP
* Separate HTTP server from the network server
Instead of managing the WiFiServer/WiFiServerSecure in the same object
as the HTTP handling, split them into separate objects.  This lets
HTTP and HTTPS servers work without templates or duplicating code.
The HTTP block just gets a `WiFiClient*` and works with that to only
do HTTP processing, while the upper object handles the appropriate
server and client types.
* Add HTTPS server
* Clean up some THandlerFunction refs
* Refactor into a template-ized WebServer/WebServerSecure
* Add DNSServer examples which need WebServer
* Fix CoreMutex infinite recursion crash
Core could crash while Serial debugging was going on and prints were
happening from LWIP/IRQ land and the main app.
* Add HTTPUpdateServer(Secure)
* Add MIME include, optimize WebServer::send(size,len)
When send()ing a large buffer, the WebServer::send() call would
actually convert that buffer into a String (i.e. duplicate it, and
potential issues with embedded \0s in binary data).
Make a simple override to send(size, len) to allow writing from the
source buffer instead.
* Fix WiFiClient::send(Stream), add FSBrowser example
2022-08-23 15:51:32 -07:00
Earle F. Philhower, III
de215a6e1b Add WiFi.getHostname() call 2022-08-21 19:53:18 -07:00
Earle F. Philhower, III
0b390d7dc4
Add HTTPUpdate class to pull updates from HTTP(S) (#789)
* Add HTTPUpdate class to pull updates from HTTP(S)
* Increase GH runners for pulls
WiFi builds and examples are taking some serious time now
* HTTPUpdate tests build on Pico W
2022-08-21 18:24:59 -07:00
Earle F. Philhower, III
a3f5fee6a5
Make StreamDev stubs private to HTTPClient (#788) 2022-08-21 17:20:34 -07:00
Earle F. Philhower, III
a3f4d89bc4
Ensure OTA errors are sent in single UDP packet (#787)
OTA text error messages were getting lost because they were sent in
multiple UDP packets, one per print(). Now collect the full error and
report in a single print, allowing text messages to appear in ESPOTA.
2022-08-21 15:29:23 -07:00