Commit Graph

53 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
46961cfdf7 Fix tests. 2023-05-29 19:46:28 +02:00
Dirk Stolle
0584312ef0 Fix some typos 2023-05-08 23:25:01 +02:00
xoviat
776e001b5b stm32: remove TIMX singleton when used on timer driver
fixes #1316.
2023-04-16 17:47:25 -05:00
Dario Nieuwenhuis
9a677ab618 common/peripheral: do not require mut in PeripheralRef clone_unchecked. 2023-04-11 23:09:02 +02:00
Rasmus Melchior Jacobsen
7be385dbb1
Add must_use to OnDrop 2023-03-17 11:40:19 +01:00
Patrick Oppenlander
78974dfeb4 hal-common/atomic_ring_buffer: add push_bufs() push_slices()
This allows a writer to access all of the free space in the buffer, even
when it's wrapping around.
2023-03-02 14:11:49 +11:00
Dario Nieuwenhuis
f95aafc90e common: allow atomic ringbuf to fill up to N instead of just N-1.
This allows the ringbuf to be filled up to `N` instead of just `N-1`, using some fun tricks on the indices.

The advantage is better performance: Before, the first write would fill N-1 bytes, The second would write just the 1 byte left before wrapping, then N-2. Then 2, then N-3, and so on. This would result in more smaller chunks, so worse perf. This problem is gone now.
2023-03-02 01:01:19 +01:00
Dario Nieuwenhuis
a432d91d82
PeripheralRef docs improvements. 2023-02-03 06:36:10 +01:00
Dario Nieuwenhuis
b5cf332cc0 nrf: docs. 2023-02-01 01:17:41 +01:00
Timo Kröger
a24037edf9 rp: Fix BufferedUart drop code
Only unregister the interrupt handler when both parts are inactive
2023-01-04 15:59:03 +01:00
Dario Nieuwenhuis
5b72410828 hal-common/atomic_ring_buffer: Add push_slice, pop_slice. 2022-12-19 01:22:41 +01:00
Dario Nieuwenhuis
feaeb533fb hal-common/atomic_ring_buffer: fix crashes when len=0 2022-12-19 01:22:41 +01:00
Dario Nieuwenhuis
7b838d0336 rp/uart: use lockfree ringbuffer.
This gets rid of another PeripheralMutex usage.
2022-11-25 22:30:47 +01:00
chrysn
6718ca3a94 all Cargo.toml: Add license to all crate Cargo.toml files
Closes: https://github.com/embassy-rs/embassy/issues/1002
2022-10-07 12:41:56 +02:00
Daniel Bevenius
34ed3441ce Fix typo in peripheral.rs 2022-09-08 17:01:45 +02:00
Dario Nieuwenhuis
fe38d240e5 hal-common: Remove unused dep 2022-08-18 11:10:51 +02:00
Dario Nieuwenhuis
a0f1b0ee01 Split embassy crate into embassy-executor, embassy-util. 2022-07-29 23:40:36 +02:00
Dario Nieuwenhuis
709df0dc1d nrf: replace PhantomData usages with PeripheralRef. 2022-07-23 15:13:47 +02:00
Dario Nieuwenhuis
f02ba35482 Remove PeripheralRef::into_inner() 2022-07-23 14:27:45 +02:00
Dario Nieuwenhuis
a158295782 Add docs to PeripheralRef::map_into. 2022-07-23 14:04:43 +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
be6408e202 Rename unsafe_impl_unborrow to impl_unborrow 2022-07-23 01:33:22 +02:00
Dario Nieuwenhuis
f9f2de3dfb wip 2022-07-23 01:33:22 +02:00
Dario Nieuwenhuis
715fa51468 Reuse unsafe_impl_unborrow in other macros. 2022-07-23 01:33:22 +02:00
Grant Miller
65a82d02d1 WIP: Make unborrow safe to use 2022-07-23 01:33:22 +02:00
Dario Nieuwenhuis
ffbd9363f2 Change steal() from trait to inherent fns. 2022-07-22 16:32:19 +02:00
Dario Nieuwenhuis
a77ff72197 Remove unused std_peripherals. 2022-07-22 16:30:16 +02:00
Dario Nieuwenhuis
1f746e0939 Remove the authors field from Cargo.tomls
It currently contains whoever was first to write some code for the crate,
even if many more people have contributed to it later.

The field is "sort of" deprecated, it was made optional recently:
https://rust-lang.github.io/rfcs/3052-optional-authors-field.html

Due the the reasons listed there I believe removing it is better than
setting it to generic fluff like "The Embassy contributors".
2022-06-18 02:16:40 +02:00
Dario Nieuwenhuis
88e36a70bd
Update to 2021 edition. (#820) 2022-06-18 02:15:48 +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
Dario Nieuwenhuis
fc32b3750c Remove embassy_hal_common::usb.
The replacement is `embassy-usb`. There's a WIP driver for stm32 USBD in #709,
there's no WIP driver for stm32 USB_OTG. This means we're left without
USB_OTG support for now.

Reason for removing is I'm going to soon remove `embassy::io`, and
USB uses it. I don't want to spend time maintaining "dead" code
that is going to be removed. Volunteers welcome, either to update
old USB to the new IO, or write a USB_OTG driver fo the new USB.
2022-05-04 01:41:37 +02:00
Dario Nieuwenhuis
9bad9365dc Update rust nightly, embedded-hal 1.0, embedded-hal-async. 2022-03-11 00:38:07 +01:00
Dario Nieuwenhuis
8acec146e0 common/serial/usb: fix hang when write buffer gets full and then the bus resets.
Fixes #654
2022-03-07 00:32:31 +01:00
Dario Nieuwenhuis
88d9599a63 common/usb/serial: add some trace logging. 2022-03-07 00:32:31 +01:00
Daniel Bevenius
cdb4f70646 Fix typo in defuse doc comment 2022-01-14 12:49:37 +01:00
Jacob Rosenthal
e5dc63e8e9 usb feature gate 2021-12-12 21:39:59 -07:00
huntc
7256ff3e71 Provides AsyncWrite with flush
As per Tokio and others, this commit provides a `poll_flush` method on `AsyncWrite` so that a best-effort attempt at wakening once all bytes are flushed can be made.
2021-12-10 12:16:08 +11:00
Bob McWhirter
c2da498263 Update to defmt 3.0ish.
Lots of gitrevs deps.
2021-11-15 11:09:08 -05:00
Dario Nieuwenhuis
a2e7c24e00 Clippy fixes 2021-10-18 01:05:29 +02:00
Dario Nieuwenhuis
ead987245d embassy: Refactor module structure to remove kitchen-sink util. 2021-09-11 02:35:35 +02:00
Dario Nieuwenhuis
f2623e7e9b Update lots of deps 2021-09-11 01:35:23 +02:00
Ulf Lilleengen
e6eb45eaee Cargo fmt 2021-09-02 10:46:49 +02:00
Ulf Lilleengen
7ad6280e65 Add HAL for SubGhz peripheral for STM32 WL series
Based on the HAL from stm32wl, the peripheral driver has been
modified to fit into embassy, using the embassy APIs, providing
operation of the radio peripheral.

The initial version does not offer any async APIs, but the example
shows how the radio IRQ can be used to perform async TX of the radio.
2021-09-02 10:39:56 +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
3f28bb6c77 common: Initialize PeripheralMutex state with closure to ensure it's done in-place. 2021-08-02 20:13:41 +02:00
Dario Nieuwenhuis
e238079d7d Make const the states when able. 2021-08-02 19:59:02 +02:00
Dario Nieuwenhuis
63ac7ac799 Mark news as unsafe due to not being leak-safe. 2021-08-02 19:55:04 +02:00