67 Commits

Author SHA1 Message Date
Marc
d799af9dd8 Replace generic inner with arguments 2025-05-02 13:40:50 +02:00
Marc
2fd803f7c3 Removed instance from uart types 2025-05-02 12:17:35 +02:00
David Brown
c6e16c9e4e embassy-rp: uart: Increase RX FIFO watermark
Change the UART RX FIFO depth from 1/8 to 7/8.  This should allow for
buffered receipt of uart data with a lower IRQ load.

The PL011 fifo is pretty smart about the fifo, it has an automatic
timeout (which triggers an interrupt) of about 4 characters worth of
time, so setting this threshold doesn't affect the behavior of receipt
of a partially filled fifo.

This should not have any affect on the DMA mode, as the DMA will
generally drain the fifo as data becomes available.

The constraint for the fifo threshold should be determined by expected
interrupt latency.  The IRQ needs to be able to drain the fifo before it
fills.  As such, the proper threshold depends on system design and data
rate.  At full speed (7.8 Mbaud), the remaining 8 characters will come
in in about 10us, which is probably insufficient. But, the time is quite
adequate at lower speeds.
2025-04-07 00:56:24 +02:00
Dario Nieuwenhuis
d41eeeae79 Remove Peripheral trait, rename PeripheralRef->Peri. 2025-03-27 15:18:06 +01:00
ibuki2003
19a06d6b8a
fix(rp): use uart dreq number defined in pac 2024-11-14 02:50:04 +09:00
flippette
84def1608f Also implement embedded_io::Write for UartTx<'d, T: Instance, Blocking> 2024-11-01 23:47:25 +02:00
flippette
93dd21042c
Implement embedded_io::Write for Uart<'d, T: Instance, Blocking> (#3483)
* Implement `embedded_io::{Read,Write}` for `Uart<'d, T: Instance, Blocking>`

* Unimplement `embedded_io::Read` for `Uart<'d, T: Instance, Blocking>`

* Revert "Unimplement `embedded_io::Read` for `Uart<'d, T: Instance, Blocking>`"

* Unimplement `embedded_io::Read` for `Uart<'d, T: Instance, Blocking>` (take 2)
2024-10-31 21:14:11 +01:00
Sebastian Quilitz
313e76af04 rp: add constructor for tx-only blocking UART 2024-09-16 12:27:17 +02:00
Caleb Jamison
778241fd71 Fix CI, rename private feature, address comments from dirbaio. 2024-08-12 04:32:31 -04:00
Caleb Jamison
9a863f07fe Handle pad isolation everywhere and in the same way. 2024-08-10 17:36:28 -04:00
Caleb Jamison
b185e02a42 Initial rp235x support
Examples have been run, but there is not yet a test suite.
2024-08-08 21:35:21 -04:00
Jomer.Dev
7c1ecae53f Add read_to_break_with_count 2024-07-19 16:01:20 +02:00
Mathias
4c34132337 Correctly handle modifying LCR register after uart enable 2024-07-17 12:23:59 +02:00
Mathias
f733071908 Add split_ref fn to uart, allowing a mutable reference split into RX & TX handles. Also change order of RX and TX handles in split fn, to streamline with other HALs 2024-07-17 11:25:03 +02:00
tact1m4n3
5b2535c8a2 fix(embassy-rp): fix drop implementation of BufferedUartRx and BufferedUartTx 2024-05-17 21:51:45 +03:00
Dario Nieuwenhuis
a84b33995e rp: remove mod sealed. 2024-04-05 00:48:46 +02:00
Rafael Bachmann
255ed29853 fix minor clippy lints in embassy_rp 2024-03-18 23:28:58 +01:00
Jomer.Dev
0708ce1410 Use saturating_sub to make sure we don't overflow 2024-01-29 17:14:23 +01:00
James Munns
5e08bb8bc3 A rebase ate my doc comment! 2024-01-19 15:46:36 +01:00
James Munns
1ce96f79fb Fun Learning about the RP2040 UART impl! 2024-01-19 14:02:17 +01:00
James Munns
94290981c3 Debugging RSR 2024-01-19 14:02:17 +01:00
James Munns
fe172109be A little more cleanup 2024-01-19 14:02:17 +01:00
James Munns
24fc12667d Update with more docs and less panics 2024-01-19 14:02:17 +01:00
James Munns
9fd49fb9d6 Add a basic "read to break" function 2024-01-19 14:02:17 +01:00
Ulf Lilleengen
f4b77c967f docs: document all embassy-rp public apis
Enable missing doc warnings.
2023-12-19 14:19:46 +01:00
Ulf Lilleengen
486b67e895 docs: document spi, rtc and rest of uart for embassy-rp 2023-12-19 11:26:08 +01:00
Ulf Lilleengen
e45e3e76b5 docs: embassy-rp rustdoc and refactoring 2023-12-19 10:56:22 +01:00
James Munns
2b497c1e57 Fix nb on rp uart 2023-12-18 18:38:13 +01:00
Dario Nieuwenhuis
c6989dfbca Remove nightly and unstable-traits features in preparation for 1.75. 2023-11-29 17:26:33 +01:00
Adam Greig
0621e957a0
time: Update examples, tests, and other code to use new Timer::after_x convenience methods 2023-10-15 01:30:12 +01:00
Dario Nieuwenhuis
f26dd54f63
Update embedded-hal to 1.0.0-rc.1 (#1783) 2023-08-16 00:40:56 +02:00
pennae
e6d4043279 rp: rename gpio::Pin::io to gpio::Pin::gpio
we'll need access to the pin io bank registers for an upcoming fix, and
having both `io` and `io_bank` or similar can get confusing quickly.
rename `io` to `gpio` to avoid this, and also match the type while there.
2023-07-31 18:28:31 +02:00
Dario Nieuwenhuis
036e6ae30c
Rename embassy-hal-common to embassy-hal-internal, document it's for internal use only. (#1700) 2023-07-28 13:23:22 +02:00
Dario Nieuwenhuis
837ebe405f rp: update rp-pac. 2023-06-16 01:41:07 +02:00
Dario Nieuwenhuis
921780e6bf Make interrupt module more standard.
- Move typelevel interrupts to a special-purpose mod: `embassy_xx::interrupt::typelevel`.
- Reexport the PAC interrupt enum in `embassy_xx::interrupt`.

This has a few advantages:
- The `embassy_xx::interrupt` module is now more "standard".
  - It works with `cortex-m` functions for manipulating interrupts, for example.
  - It works with RTIC.
- the interrupt enum allows holding value that can be "any interrupt at runtime", this can't be done with typelevel irqs.
- When "const-generics on enums" is stable, we can remove the typelevel interrupts without disruptive changes to `embassy_xx::interrupt`.
2023-06-08 18:00:48 +02:00
Dario Nieuwenhuis
404aa29289 cortex-m: remove owned interrupts. 2023-06-01 03:25:19 +02:00
Alpha3__0
dc28a42fd2 Fix return definition 2023-05-25 11:55:05 -07:00
Alpha3__0
0d80a95e54 Implement eh 0.2.* serial::Write for Uart/UartTx 2023-05-25 11:33:29 -07:00
pennae
14a5d03af2 rp: remove take!, add bind_interrupts! 2023-05-15 15:24:56 +02:00
Dirk Stolle
0584312ef0 Fix some typos 2023-05-08 23:25:01 +02:00
pennae
3c31236c10 rp: remove leftovers from #1414
forgot to remove these when they were no longer necessary or useful. oops.
2023-05-02 07:40:12 +02:00
pennae
b58b9ff390 rp/uart: report errors from dma receive 2023-05-01 15:36:53 +02:00
pennae
1d5adb8974 rp/uart: extract fifo draining from blocking_read
this will also be needed for dma operations.
2023-05-01 15:32:58 +02:00
pennae
be66e0f7ce rp/uart: make dma multicore-safe
running rx and tx on different cores could lead to hangs if the dmacr
register modifys run concurrently. this is bad.
2023-05-01 15:32:58 +02:00
pennae
19588a9e6f rp/uart: rename state to buffered_state
we'll add a dma state soon as well.
2023-05-01 15:22:39 +02:00
pennae
1d2f6667df rp/uart: add set-break functions
sending break conditions is necessary to implement some protocols, and
the hardware supports this natively. we do have to make sure that we
don't assert a break condition while the uart is busy though, otherwise
the break may be inserted before the last character in the tx fifo.
2023-05-01 15:16:30 +02:00
pennae
7336b8cd88 rp/uart: add UartRx::new_blocking 2023-05-01 13:00:40 +02:00
bors[bot]
38c5b97df0
Merge #1378
1378: Add ability to invert UART pins, take 2 r=Dirbaio a=jakewins

Same PR as before, except this now works :) 

There was a minor hiccup in the UartRx code where the rx pin got passed as the tx argument, so the invert settings didn't get applied. With this fix, my local setup at least is happily reading inverted uart data.

Co-authored-by: Jacob Davis-Hansson <jake@davis-hansson.com>
2023-04-18 15:48:47 +00:00
Jacob Davis-Hansson
21ea98810a Pass rx pin to right init arg 2023-04-18 17:44:19 +02:00
Jacob Davis-Hansson
81f10e136a outover instead of inover 2023-04-15 15:13:44 +02:00