Andres Vahter
188ee59ba6
stm32: fix setting uart databits
2023-10-23 22:40:24 +03:00
Andres Vahter
591612db7e
stm32 uart: return error if rx and tx not enabled
2023-10-23 22:39:24 +03:00
Scott Mabin
a6bbb130c5
make set_config concrete methods public again
2023-10-12 23:03:33 +01:00
pbert
ecdd7c0e2f
enable clock first
2023-10-12 11:04:44 +02:00
pbert
f65a96c541
STM32: combine RccPeripherals reset() and enable() to reset_and_enable()
2023-10-12 11:04:19 +02:00
xoviat
05218a52e6
stm32: update set_config
2023-10-01 09:39:10 -05:00
Dario Nieuwenhuis
44bb405683
stm32/usart: enable fifo mode on usartv4.
2023-09-26 04:38:53 +02:00
Dario Nieuwenhuis
5d8817d109
stm32/usart: return error instead of panicking on bad baudrate.
2023-09-26 00:19:27 +02:00
Scott Mabin
88eb5cca71
stm32: Implement set_config
for Uart structs
2023-09-17 18:38:03 +01:00
Mathias
49847ff432
Implement blocking embedded-io::Write for Uart & UartTx
2023-09-14 10:09:09 +02:00
cumthugo
582ef90994
stm32/usart: fix usart not wake up issue
2023-09-13 23:47:46 +08:00
xoviat
274f63a879
stm32: fix refcounts for usart, spi, and i2c
2023-09-04 15:47:33 -05:00
Dion Dokter
a5484cd119
Modified the brr calculation to be fully 32-bit
2023-08-22 20:52:02 +02:00
Dario Nieuwenhuis
f26dd54f63
Update embedded-hal to 1.0.0-rc.1 ( #1783 )
2023-08-16 00:40:56 +02:00
Dario Nieuwenhuis
5d5cd23715
Update to embedded-io 0.5 ( #1752 )
2023-08-07 13:43:09 +02:00
Grant Miller
d49f40dd5c
embassy-stm32: Misc clippy fixes
2023-08-06 15:00:39 -05:00
xoviat
bae31ebce7
stm32/dma: rename ringbuf
2023-07-29 19:25:18 -05: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
xoviat
3c41784de8
stm32/usart: fix error msg for lptim
2023-07-24 18:08:23 -05:00
Alessandro Pezzato
36ff688fab
stm32/uart: optimize swap_rx_tx
2023-07-19 10:50:40 +02:00
Alessandro Pezzato
3df2c71e6c
stm32/uart: add swap_rx_tx
2023-07-19 10:26:47 +02:00
Dario Nieuwenhuis
e892014b65
Update stm32-metapac, includes chiptool changes to use real Rust enums now.
2023-06-29 02:01:33 +02:00
Dario Nieuwenhuis
558918651e
stm32: update stm32-metapac.
2023-06-19 03:22:12 +02:00
Peter Gibson
b4f96e192c
Don't read data register to clear flags on usart v3 ^& v4
2023-06-18 08:45:58 +10:00
Peter Gibson
d236f3dbf9
actually fix formatting
2023-06-15 18:35:58 +10:00
Peter Gibson
d23717904b
fix formatting
2023-06-15 18:33:01 +10:00
Peter Gibson
837950cd74
ensure DR is read to clear idle/overflow interrupt when they occur independently of the rxne
2023-06-15 13:24:49 +10: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
xoviat
aba0f8fd6c
stm32/uart: refactor rx ringbuffer
...
- remove some race conditions
- allow full use of rx buffer
2023-05-29 14:49:43 -05:00
Rasmus Melchior Jacobsen
cb5df138d6
Use found divider instead of re-reading brr
2023-05-26 23:48:49 +02:00
Rasmus Melchior Jacobsen
f616b22159
Fix yet another v1 error
2023-05-25 18:16:46 +02:00
Rasmus Melchior Jacobsen
c5bf36eebf
Fix oversampling message for usart v1
2023-05-25 17:56:52 +02:00
Rasmus Melchior Jacobsen
387a4fcb8e
Exclude usart_v1
2023-05-25 17:24:22 +02:00
Rasmus Melchior Jacobsen
cd6256a924
Add assume_noise_free to usart configuration
...
Effectively setting cr3.onebit
2023-05-25 17:24:22 +02:00
xoviat
316be179af
stm32: move to bind_interrupts
...
disable lora functionality for now
2023-05-24 17:29:56 -05:00
Timo Kröger
977a7906e4
stm32 uart: Fix error flag handling for blocking operations
...
Clear and report the error flags one by one and pop the data byte only
after all error flags were handled.
For v1/v2 we emulate the v3/v4 behaviour by buffering the status
register because a read to the data register clears all flags at once
which means we might loose all but the first error.
2023-05-14 21:10:37 +02:00
Dirk Stolle
0584312ef0
Fix some typos
2023-05-08 23:25:01 +02:00
Dario Nieuwenhuis
a61701b756
stm32/usart: add OVER8 and PRESC support, update PAC
2023-05-02 19:36:00 +02:00
Dario Nieuwenhuis
96e8a7ddb9
stm32/uart: feature-gate ringbuffer out when using gpdma, not supported yet.
2023-05-01 22:43:23 +02:00
Rasmus Melchior Jacobsen
45843034ec
Actually clear idle flag
2023-05-01 22:42:36 +02:00
Rasmus Melchior Jacobsen
7757405908
Remove unused import
2023-05-01 22:42:36 +02:00
Rasmus Melchior Jacobsen
fc268df6f5
Support overflow detection for more than one ring-period
2023-05-01 22:42:36 +02:00
Rasmus Melchior Jacobsen
4ea6662e55
Do not disable dma request when idle line is detected
2023-05-01 22:42:36 +02:00
Rasmus Melchior Jacobsen
49455792cb
Ring-buffered uart rx with one-period overrun detection
2023-05-01 22:42:36 +02:00
xoviat
b77794c9a7
stm32/uart: abort on error
2023-04-28 21:43:03 -05:00
Dario Nieuwenhuis
173c65b543
stm32/dma: refactor.
2023-04-18 16:37:35 +02:00
Dario Nieuwenhuis
f681b9d4e5
Remove the _todo_embedded_hal_serial impls. EH will probably not have these serial traits.
2023-04-15 00:58:58 +02:00
Mathias
472dc6b7d1
Fix interrupt handling so it is similar to before the rework, and fix examples
2023-03-31 15:57:35 +02:00
Mathias
cfbe93c280
Rework bufferedUart to get rid of PeripheralMutex in a similar fashion as nrf & rp. Also adds embedded-hal traits to bufferedUart
2023-03-31 10:43:30 +02:00
Mathias
14f6bc88ea
Remove unnecessary lifetime
2023-03-28 14:34:36 +02:00
Mathias
2d7f35cf57
Add embedded-io blocking Read + Write for BufferedUart
2023-03-28 14:28:44 +02:00
bors[bot]
c8a7b74bc2
Merge #1192 #1193
...
1192: stm32/usart: implement stop_bits configuration r=Dirbaio a=pattop
1193: stm32/usart: fix LPUART clock multiplier r=Dirbaio a=pattop
According to RM0351 Rev 9 (L4) and RM0399 Rev 3 (H7):
baud = (256 * clock) / LPUARTDIV
Co-authored-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
2023-02-06 13:39:37 +00:00
Patrick Oppenlander
fda36fd81b
stm32/usart: fix LPUART clock multiplier
...
According to RM0351 Rev 9 (L4) and RM0399 Rev 3 (H7):
baud = (256 * clock) / LPUARTDIV
2023-02-06 11:22:41 +11:00
Patrick Oppenlander
64ebb9b7fe
stm32/usart: implement stop_bits configuration
2023-02-06 09:44:15 +11:00
huntc
6ab4ecaf83
Stop sampling when exiting the Saadc methods
...
Prior to this commit, the onDrop function was being dropped immediately and not on exiting the Saadc sampling methods.
2023-01-18 14:51:46 +11:00
Rasmus Melchior Jacobsen
16590732f8
Update mod.rs
2023-01-14 07:13:29 +01:00
Rasmus Melchior Jacobsen
816b214403
Only implement Write
2023-01-14 07:12:43 +01:00
Rasmus Melchior Jacobsen
4c4b47f78a
feat(stm32): Add embedded-io traits for UartRx and UartTx
2023-01-06 14:24:29 +01:00
Rasmus Melchior Jacobsen
5aa59e9737
feat(stm32): Let uart implement embedded-io Read/Write
2023-01-04 12:57:19 +01:00
Dario Nieuwenhuis
10c9cc31b1
Remove unnecessary use of atomic-polyfill.
...
Only use it when CAS is actually needed.
2022-12-23 20:46:49 +01:00
Vincent Stakenburg
236d104844
embassy-stm32: add rs485 driver enable to uart
2022-12-09 14:26:09 +01:00
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