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.
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.
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.
* 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
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
* Enable proper reuse of PIO programs
Rewrite the PIOProgram helper class to properly re-use loaded programs
and to try to re-use loaded instructions before allocating a new PIO
program.
Supersedes #1524
* Less copy-pasta
The serial port reset logic was calling `sleep_ms()` which ended up doing
a task switch...while the other core was frozen and everything was supposed
to be locked.
Use `busy_wait_ms()` which is a tight loop to delay in the reset portion.
Fixes#1486
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.
Warn the user that the Pico SDK STDIO calls (stdio_init_all, stdio_usb_init,
stdio_uart_init) are not supported or needed at compile time. See multiple
issues #1433#1347#1273#1251 and others.
* 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
Call `SerialPIO::setInverted(txinv, rxinv)` before `SerialPIO::begin()` to enable.
---------
Co-authored-by: Mykle Hansen <mykle@mykle.com>
Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
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).
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