Commit graph

23 commits

Author SHA1 Message Date
Earle F. Philhower, III
c79e543c41
Move to Arduino API 10501 (#2797)
* Move to Arduino API 10501

Track upstream Arduino API headers

* IPAddress V4/V6 compatiblity restored

* Fix WiFiUDP includes

* String differences in example

* HardwareSerial using exported
2025-02-08 22:45:10 -08:00
Earle F. Philhower, III
226a318897
Add serial inversion for UART and SerialPIO (#2395)
Use real GPIO pad inversion to allow inverted RX, TX, and controls for
the hardware UART and software PIO-emulated serial ports.

Adds ``setInvertTX(bool)`` and ``setInvertRX(bool)`` calls to both ports,
with ``setInvertControl(bool)`` for the HW UARTS.
2024-08-31 07:46:11 -07:00
Earle F. Philhower, III
f45db86cc2
Migrate to 2.0.0 SDK (#2336)
* Update to 2.0.0 SDK
* Board type needs to be set before earliest SDK setup
* Platform includes update
* Boot2 files
* Simple compilation issues
* Build and link
* PIO rebuild with version
* Newlib wrapper update
* Force inclusion of runtime_init_* fcns
The linker was dropping all references to the library's included
runtime_init_xxx functions and hence things like the IRQ vector
table and mutexes and alarms weren't properly set up leading to
instant crashes on start up..

Explicitly call out one function from the object file stored in
the .A to force the inclusion of all the functions.  May be a better
way, heppy to hear any ideas.
* Fix SPI GPIO calls
* Fix Ethernet GPIO
* Remove SDK warnings
Remove the skipped error messages once the following PR merged:
https://github.com/raspberrypi/pico-sdk/pull/1786
* BTStack moved SBC encode/decode paths
* Platform.IO fixes
* BT No longer has special absolute mouse
* Rebuild and update OTA
* Rebuild BearSSL, too
* Update liker file to latest SDK
* Clean up libpicocmake
* Clean up LWIP/BT library names
2024-08-17 10:39:13 -07:00
Gavin Hurlbut
9a241b0e43
Add Serial UART break reporting (#1130)
Added SerialUART::getBreakReceived()
2023-01-20 16:54:31 -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
85d39cf242
Restore GPIO functions on SerialUART::end (#836)
Fix #834
2022-09-04 19:23:51 -07:00
Earle F. Philhower, III
3ee031abc9
Add ::overflow() return to SerialUART/SerialPIO (#547)
Matching the Arduino SoftwareSerial API
2022-04-24 14:44:23 -07:00
Earle F. Philhower, III
061b38f0b8
Add RTS/CTS to Arduino Nano Connect Serial2(NINA) (#525)
Fixes #524
2022-03-30 14:12:24 -07:00
Earle F. Philhower, III
53043830e7
Avoid "chunkiness" of UART FIFO availability (#511)
* Avoid "chunkiness" of UART FIFO availability

The UART FIFO will generate an IRQ to transfer data into the SerialUART
FIFOs either every 4 received bytes, or every 4 idle byte times.  This
causes the ::available count to report "0" until either of those two
cases happen, causing a potentially delay in data becoming available to
the app.

Change the code to pull data from the HW FIFO on a read/available/peek.
Use a non-blocking mutex and IRQ disabling to safely empty the FIFO from
user space.  The mutex added to the IRQ is non-blocking and will be
a single CAS the vast majority of the time, so it should not impact the
Serial performance.

Fixes #464 and others where `setPollingMode()` was needed as a workaround.

Make sure we have all mutexes locked before we disable the port and free
the queue to avoid evil cases.

Only init the mutexes once, on object creation.

In polled mode, don't bother acquiring/releasing the fifo mutex.

When begin() is called on an already running port, call end() to clean
up the old data/etc. before making a new queue/config.  This avoids a
memory leak and potential write-after-free case.
2022-03-16 08:46:20 -07:00
Pontus Oldberg
f8e8a7b72e
Updating LoRa board pins and UART hw flow. (#499)
* Added missing SERIAL2 and LoRa module GIO pins.
* Added support for enabling UART CTS and RTS pins.
2022-02-22 01:45:24 -08:00
Earle F. Philhower, III
44cd697b29
Add SerialUART::setPollingMode() (#473)
Fixes #472

Instead of using interrupts, explicitly call the IRQ handler dueing Serial
read/peek/available calls.

Add to keywords.txt for syntax hilighting.

Add poll calls in the SerialUART::write-like calls (write,
flush, etc.)

Really remove division from IRQ routines/
2022-02-10 12:22:27 -08:00
Earle F. Philhower, III
576f8941d6
Add setFIFOSize to UART Serial ports (#410)
Allow setting the size of the receive buffer by the application using a
call to Serial1/2.setFIFOSize(xxx) before the begin() call.
2022-01-04 19:02:38 -08:00
Earle F. Philhower, III
dc1198bd9c
Use interrupts to capture Serial UART data, not polling (#393)
PR #379 was an ugly hack which works only if you poll the Serial port more
frequently than ~8 byte times.

This PR replaces the polling with an IRQ based lockless writer/reader queue
so that even if you only read every 32 byte times, the Serial1/2 port should
not lose data.  It also should use less CPU and allow for somewhat higher
throughput.
2021-12-28 08:21:03 -08:00
Earle F. Philhower, III
a58f49018a
Add a poor-man's software FIFO for serial UART reads (#379)
Because the hardware FIFO is quite small and doesn't report the actual number
of bytes available, implement a software FIFO that will pull all available
bytes out of the HW FIFO on any Serial call.  It's not as efficient or as
bulletproof as an IRQ based method, but it is simpler to implement and can
help with issues like #378
2021-12-23 07:41:34 -08:00
Earle F. Philhower, III
8016a932f3
Add astyle format, boards.txt, and package check (#166)
Miscellaneous CI checks for code style, boards.txt update, and that all
referenced packages are available.
2021-05-24 15:01:03 -07:00
Earle F. Philhower, III
6e51516d6c
Set default pins for peripherals per datasheet (#103)
Using the official Raspberry Pi Pico datasheet and the Adafruit Feather
RP2040 schematic, set the default pins for peripherals to match.

Fixes #92
2021-04-16 10:23:43 -07:00
Earle F. Philhower, III
a536d9ce96 Update ArduionApi to include Print::printf
Instead of duplicating output call in all children, fork ArduinoApi and
add it in the Print base class.
2021-04-02 12:58:26 -07:00
Earle F. Philhower, III
09ec5e0d22 Refactor USB/UART mutexes, code cleanup, CoreMutex addition
Add a CoreMutex class which implements a deadlock-safe mutex and reqork
the SerialUSB and SerialUART classes to use it to synchronize output
when in a multicore sketch.
2021-03-27 09:41:23 -07:00
Earle F. Philhower, III
b463825374 Rationalize pin selection using readable template
Use a constexpr template to calculate the valid pins for different IO
hardware.  This lets us have an easily readable list of pin numbers that
we can adjust/check.
2021-03-25 17:54:46 -07:00
Earle F. Philhower, III
c4bbccdead Add serialEvent support for USB, UART0, UART1 2021-03-25 12:42:05 -07:00
Earle F. Philhower, III
25d351f404 Remove PIO global headers from UART object 2021-03-20 20:17:08 -07:00
Earle F. Philhower, III
55429cedd0 Add printf() to SerialUSB/SerialUART
Arduino API doesn't support printf on Print objects, so bring our own.
2021-03-17 10:19:41 -07:00
Earle F. Philhower, III
f6fcfd147b Add hardware Serial UARTs 2021-03-13 10:24:18 -08:00