Matous Hybl
e1d7d8d841
stm32: Enable fifo for buffered uart
2022-11-30 22:17:51 +01:00
Dario Nieuwenhuis
1e2fb0459d
Switch to async-fn-in-trait
2022-11-25 21:02:06 +01:00
Guillaume MICHEL
1365ce6ab8
embassy-stm32: Fix bug when Uart::read future is dropped and DMA request was not stopped
...
fixes issue #1045
regression was introduced with PR #1031
2022-11-07 17:46:32 +01:00
bors[bot]
1f246d0e37
Merge #1034
...
1034: stm32/usart: Fix bug where USART idle flag could end a `read` prematuraly r=Dirbaio a=guillaume-michel
on STM32, when setting USART `detect_previous_overrun = true`, the idle flag is not cleared and could result in premature end of the `read` method.
This PR fixes that.
Co-authored-by: Guillaume MICHEL <guillaume@squaremind.io>
2022-10-28 11:22:53 +00:00
Guillaume MICHEL
49e1091309
embassy-stm32: Fix bug where USART idle flag could end a read
prematuraly
2022-10-28 10:49:59 +02:00
Guillaume MICHEL
79b49c6fae
embassy-stm32: remove duplicated code for USART general configuration
2022-10-28 09:32:05 +02:00
Guillaume MICHEL
f053bf742c
embassy-stm32: Add support for hardware flow control for BufferedUart
2022-10-28 09:04:36 +02:00
Guillaume MICHEL
9423987ac5
embassy-stm32: Add hardware flow control constructor for UartRx and UartTx
2022-10-28 09:04:36 +02:00
Guillaume MICHEL
9cac649fcf
stm32: Add support for read_until_idle on UART
2022-10-26 19:06:18 +02:00
Dario Nieuwenhuis
eeb072d9cb
Update Rust nightly.
2022-10-26 16:47:29 +02:00
Mathias
66611a80ca
Introduce shared new_inner for uart instantiation
2022-10-26 11:51:37 +02:00
Mathias
d1eee52625
Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-stm32/uart-flowcontrol
2022-10-26 11:47:00 +02:00
Mathias
a283c47557
Implement embedded-hal-nb for uart
2022-09-30 06:04:19 +02:00
Mathias
f9c62d4f1d
Add flowcontrol to UART
2022-09-29 09:12:17 +02:00
Mathias
dc90006982
Remove code duplication on nb_read
2022-09-29 07:58:11 +02:00
Mathias
823bd714fb
Add E-H1 uart blocking & nb implementation
2022-09-28 05:19:43 +02:00
Guillaume MICHEL
daf2744716
Rework STM32 BufferedUart internals so we can split into Rx and Tx like embassy-nrf
2022-09-26 15:32:29 +02:00
Dario Nieuwenhuis
a0487380da
Replace futures::future::poll_fn -> core::future::poll_fn.
2022-09-22 16:42:49 +02:00
Vincent Stakenburg
c4d5c047d7
make State::new()
const, consistent with others
2022-09-15 12:34:17 +02:00
Dario Nieuwenhuis
8ba421f324
Do not use cfg_if for embedded-hal-async feature gates.
...
Old code used `cfg_if!` because rustc still parses code inside disabled cfg's, and Rust stable at that time couldn't parse the new GAT where-clause location. This is not the case anymore.
2022-08-31 03:11:21 +02:00
Dario Nieuwenhuis
21072bee48
split embassy-util
into embassy-futures
, embassy-sync
.
2022-08-22 22:18:13 +02:00
Vincent Stakenburg
51359e7d24
fix lpuart implementation when there isn't one present
2022-08-19 15:27:11 +02:00
Vincent Stakenburg
a833e02363
implement support for LPUART
2022-08-19 12:05:19 +02:00
Dario Nieuwenhuis
a0f1b0ee01
Split embassy crate into embassy-executor, embassy-util.
2022-07-29 23:40:36 +02:00
Dario Nieuwenhuis
4901c34d9c
Rename Unborrowed -> PeripheralRef, Unborrow -> Peripheral
2022-07-23 14:00:19 +02:00
Dario Nieuwenhuis
8a9d2f59af
Update embassy-stm32
2022-07-23 02:40:13 +02:00
Dario Nieuwenhuis
a8703b7598
Run rustfmt.
2022-06-12 22:22:31 +02:00
Dario Nieuwenhuis
5085100df2
Add embassy-cortex-m crate.
...
- Move Interrupt and InterruptExecutor from `embassy` to `embassy-cortex-m`.
- Move Unborrow from `embassy` to `embassy-hal-common` (nothing in `embassy` requires it anymore)
- Move PeripheralMutex from `embassy-hal-common` to `embassy-cortex-m`.
2022-06-12 21:45:38 +02:00
Dario Nieuwenhuis
db344c2bda
common/PeripheralMutex: remove unsafe API. ( #802 )
...
Following the project's decision that "leak unsafe" APIs are not marked as "unsafe",
update PeripheralMutex to accept non-'static state without unsafe.
Fixes #801
2022-06-09 21:28:13 +02:00
chemicstry
1d951a54be
Reimplement BufRead for BufferedUart
2022-05-26 14:02:55 +03:00
Ralf
f4677469f9
stm32/usart: Data length is including parity. To get e.g. 8E1 you need to choose 9 data bits
2022-05-12 09:09:30 +02:00
Dario Nieuwenhuis
931a137f8c
Replace embassy::io with embedded_io.
2022-05-07 01:45:54 +02:00
Dario Nieuwenhuis
3251a21fb7
Switch to crates.io embedded-hal, embedded-hal-async.
...
This temporarily removes support for the async UART trait, since it's
not yet in embedded-hal-async.
2022-04-22 19:58:24 +02:00
chemicstry
ca88ace98d
Reset peripherals on enable
2022-03-18 00:46:46 +02:00
chemicstry
d26b751edc
Add comments
2022-03-17 19:41:44 +02:00
chemicstry
051c6350ea
Make UART futures Send
2022-03-17 18:23:47 +02:00
Ulf Lilleengen
e09bde9345
Add support for splitting stm32 usart into TX and RX
...
* Keeps existing API for usart, but wraps it in Tx and Rx sub-types
* Adds split() method similar to nRF for getting indepdendent TX and RX
parts
* Implements e-h traits for TX and RX types
* Add stm32h7 example
2022-03-15 10:35:37 +01:00
Dario Nieuwenhuis
9bad9365dc
Update rust nightly, embedded-hal 1.0, embedded-hal-async.
2022-03-11 00:38:07 +01:00
Dario Nieuwenhuis
dd828a7a92
stm32: move macrotables to embassy-stm32 build.rs
2022-02-26 03:23:09 +01:00
Timo Kröger
48f700b35c
stm32 usart: Fix RX interrupt flag handling
...
* On v1 interrupts cannot be cleared individually.
Instead they are cleared implicitly by reading or writing DR (which we do now).
* Multiple error flags can be set at the same time:
Handle them all in one go intstead of re-entering the ISR for each one so that
we do not lose any error flags on v1 hardware.
* Wake when the RX buffer becomes full: This allows fast running chips to pull data
from the buffer before receiving the next byte.
2022-02-25 14:32:39 +01:00
Dario Nieuwenhuis
17e77ede3f
stm32f1: fix wrong AF type in uart, can.
2022-02-24 00:37:15 +01:00
Dario Nieuwenhuis
1e69a8c484
stm32: move pin trait impls from macrotables to build.rs
2022-02-23 19:54:46 +01:00
Dario Nieuwenhuis
b4abb1f5c2
stm32: move dma trait impls from macrotables to build.rs
2022-02-23 19:16:37 +01:00
Dario Nieuwenhuis
340eb4eead
stm32: add rust stable support
2022-02-12 02:45:52 +01:00
Dario Nieuwenhuis
b99ab3d5d9
stm32: Add standard crate-wide macros for pin/dma traits, switch all drivers to use them.
2022-02-10 21:38:03 +01:00
Dario Nieuwenhuis
a8bd3ab952
Add missing + 'd
on unborrows.
2022-02-10 16:06:42 +01:00
Ulf Lilleengen
4032fc0655
Support unstable-trait feature for stm32
2022-01-26 22:39:06 +01:00
Dario Nieuwenhuis
c949519714
stm32/usart: expose all functionality as inherent methods.
2022-01-19 17:59:55 +01:00
bors[bot]
cdfd128185
Merge #545
...
545: Add adapter for implementing async traits for blocking types r=lulf a=lulf
This allows writing drivers relying on async traits, while still
functioning with implementations that already implement the embedded-hal
traits.
Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-01-03 14:17:21 +00:00
Nikita Strygin
a94932be02
Mark clear_interrupt_flag as unsafe
2021-12-26 18:29:41 +03:00
Nikita Strygin
6b08c70273
Port buffered uart to v1 stm32 hardware
...
- No DMA
- Create clear_interrupt_flag function to
handle differences between v1 and v2 hardware
2021-12-26 18:13:19 +03:00
Ulf Lilleengen
3811c0a401
Add adapter for implementing async traits for blocking types
...
This allows writing drivers relying on async traits, while still
functioning with implementations that already implement the embedded-hal
traits.
Add examples to stm32l4 for using this feature.
2021-12-17 12:54:51 +01:00
Ulf Lilleengen
2bbd1ddb8a
Remove unneeded rustfmt::skip
2021-12-16 11:37:53 +01:00
huntc
45ef944457
Stm flush required implementing also, along with std alloc split
2021-12-10 15:11:41 +11:00
Dario Nieuwenhuis
4ddd23d623
stm32/usart: unify v1 and v2
2021-12-08 05:12:48 +01:00
Dario Nieuwenhuis
b316d2620c
stm32/dma: improve trait docs, seal Word.
2021-12-08 03:18:15 +01:00
Matous Hybl
b2910558d3
Refactor DMA traits.
2021-12-07 21:43:47 +01:00
Bob McWhirter
44056c2e75
Less allowy.
2021-11-02 15:32:20 -04:00
Bob McWhirter
076c795ebb
Even more allowed unused.
2021-11-02 15:28:14 -04:00
Bob McWhirter
6bbf450478
Allow unused macros temporarily until U5 supports DMA.
2021-11-02 15:20:42 -04:00
Tobias Pisani
091e7e1f98
Generate USART pin definitions for stm32f1
2021-10-11 22:57:21 +02:00
Tobias Pisani
39880de958
partial alternate function configuration on STM32f1
2021-10-11 22:57:10 +02:00
Mariusz Ryndzionek
bce909ec1e
Initial STM32F1 family support with two examples for STM32F103C8 (Blue Pill)
2021-09-28 18:31:04 +02:00
Mariusz Ryndzionek
e4b37c40c9
Code review request - moving OutputType
to mod sealed
2021-09-24 19:56:48 +02:00
Mariusz Ryndzionek
d371298a27
Small adjustment to 'set_as_af' interface
...
Small adjustment to 'set_as_af' interface - v2
2021-09-24 18:39:07 +02:00
Dario Nieuwenhuis
ead987245d
embassy: Refactor module structure to remove kitchen-sink util
.
2021-09-11 02:35:35 +02:00
Ulf Lilleengen
cbff0398bb
Add IRQ-driven buffered USART implementation for STM32 v2 usart ( #356 )
...
* Add IRQ-driven buffered USART implementation for STM32 v2 usart
* Implementation based on nRF UARTE, but simplified to not use DMA to
avoid complex interaction between DMA and USART.
* Implementation of AsyncBufRead and AsyncWrite traits
* Some unit tests to ring buffer
* Update polyfill version
* Update sub module to get usart IRQ fix
2021-08-16 17:16:49 +02:00
Dario Nieuwenhuis
9bd34429f3
stm32: add missing + 'a
bounds on trait GATs
2021-08-04 19:39:54 +02:00
Ulf Lilleengen
0d02342b2d
Rename bread -> read_blocking
2021-08-04 08:34:30 +02:00
Ulf Lilleengen
6ff0614cb6
Add uart::Read DMA-based implementation
...
* Rename existing read() to bread() (blocking)
2021-08-03 15:31:24 +02:00
Dario Nieuwenhuis
7bfb763e09
Rename embassy-extras to embassy-hal-common
2021-07-29 13:44:51 +02:00
Dario Nieuwenhuis
3655048e0f
stm32/dma: add MuxChannel trait to distinguish DMAMUX1 and DMAMUX2 channels.
2021-07-17 07:54:16 +02:00
Dario Nieuwenhuis
54b5012c56
stm32/dma: update codegen+macrotables for new stm32-data
2021-07-17 07:35:59 +02:00
Dario Nieuwenhuis
d0f2dc3abd
Fix rustfmt
2021-07-16 14:41:20 -04:00
Dario Nieuwenhuis
3d1391ef2d
stm32/dma: impl all variants
2021-07-16 14:41:20 -04:00
Dario Nieuwenhuis
4361cb15f1
stm32/usart: merge v2 and v3 (they're identical)
2021-07-15 00:52:37 +02:00
Bob McWhirter
43cb8de434
Remove gratuitous NoDmaMarker.
2021-07-14 14:37:42 -04:00
Bob McWhirter
38b1359c40
Remove pub and cfg's, since they will be implied by the existance of TxDma<T> in theory.
2021-07-14 14:35:03 -04:00
Bob McWhirter
a88f0028ef
First shot at async dma usart for stm32.
2021-07-14 14:14:14 -04:00
Bob McWhirter
f01ddd5f5c
Mix dmamux into bdma_v1.
2021-07-13 10:09:35 -04:00
Bob McWhirter
043f0ea508
Checkpoint DMAMUX channel setup.
2021-07-13 10:08:43 -04:00
Thales Fragoso
91521a86a0
F0: usart + DMA working
2021-07-13 10:08:43 -04:00
Thales Fragoso
a56ddfdc04
STM: Add usart v2
2021-07-13 10:08:43 -04:00
Bob McWhirter
8f94123ca4
argh, intellij.
2021-07-01 11:37:01 -04:00
Bob McWhirter
0920c0cb1d
Make UART pins Rx/Tx/etc in addition to USART.
2021-07-01 11:30:54 -04:00
Bob McWhirter
54ada5bae1
Stub in the DMA bits that aren't yet there.
2021-07-01 11:30:54 -04:00
Bob McWhirter
bf3bc92525
Re-enable because intellij.
2021-07-01 11:30:54 -04:00
Bob McWhirter
497d3aa153
Add USARTv3 support.
2021-07-01 11:30:54 -04:00
Bob McWhirter
cf5b7dc943
Because IntelliJ makes life hard.
2021-06-30 10:03:18 -04:00
Bob McWhirter
6a0b0f3162
Enable RCC within the USART itself.
2021-06-30 09:57:27 -04:00
Bob McWhirter
07a6686879
Protect DMA-related things with cfg.
2021-06-29 13:00:52 -04:00
Bob McWhirter
c53ab325c1
Wire up DMA with USART v1.
2021-06-29 11:01:57 -04:00
Bob McWhirter
b88fc2847a
Checkpoint with lifetime issues.
2021-06-29 11:01:57 -04:00
Bob McWhirter
00892c7362
Migrate USART to macro tables.
2021-06-03 13:12:38 -04:00
Dario Nieuwenhuis
d8e4421fc6
Add stm32-metapac crate, with codegen in rust
2021-05-31 02:40:58 +02:00
Lucas Kent
82f9242df2
Fix warnings for embassy-stm32 and embassy-stm32-examples
2021-05-20 22:25:12 +10:00
Dario Nieuwenhuis
f7858631d8
stm32: fix build, add ci
2021-05-17 03:16:58 +02:00
Dario Nieuwenhuis
2303364322
Standardize module structure, fix some build failures
2021-05-17 02:04:51 +02:00
Dario Nieuwenhuis
bdc3ada4b2
WIP: dma
2021-05-17 01:08:30 +02:00
Dario Nieuwenhuis
befc052cba
stm32/usart_v1: add read
2021-05-17 01:04:51 +02:00