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
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
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.
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.
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
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
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.
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.
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.
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)
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.
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
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