Commit Graph

304 Commits

Author SHA1 Message Date
5903e08f4b embassy: add missing docs, add warn(missing_docs). 2022-06-26 00:53:35 +02:00
f4e2686eca embassy: Improve RawMutex docs, mark it as unsafe. 2022-06-26 00:35:30 +02:00
17cab1a2d4 embassy: Clippy fixes. 2022-06-26 00:14:28 +02:00
935def4a0b executor: mark task_from_waker as safe. 2022-06-26 00:13:31 +02:00
a51df0dec6 Merge #824
824: embassy/time: round up by default in duration conversions. Fixes #823 r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-24 21:29:29 +00:00
571e4f2b01 embassy/time: round up by default in Duration::from_*. Fixes #823 2022-06-24 23:27:46 +02:00
6d3a652026 Fix new warnings for embassy docs 2022-06-23 13:01:10 +02:00
4a6f69e2d9 Merge #805
805: Preliminary Xtensa support r=Dirbaio a=MabezDev

Based on the work in #804.

I hope non-upstream target support is acceptable :).

Co-authored-by: Scott Mabin <scott@mabez.dev>
2022-06-22 15:02:09 +00:00
12dfc4dca3 Fixed a pubsub mutability inconsistency 2022-06-22 14:13:01 +02:00
5f87a34b6a arch: Xtensa
- Adds a executor for the Xtensa arch
- Light sleep implemented with assembly, so we don't pull in the
  xtensa_lx crates (yet)
- lock behind a nightly feature due to Xtensa asm support not upstream
2022-06-22 10:06:22 +01:00
9721b2bf5b Merge #817
817: Added a pubsub channel implementation r=lulf a=diondokter

This is similar to Tokio's Broadcast channel, except that it doesn't allocate.

The publishers and subscribers are dynamic. They use an &dyn channel reference because it's really annoying to have to specify the mutex and const generics every time.
Do we need fully generic types as well?

Co-authored-by: Dion Dokter <diondokter@gmail.com>
Co-authored-by: Dion Dokter <dion@tweedegolf.com>
2022-06-21 20:04:27 +00:00
78c546f356 Added example and some defmt 2022-06-21 15:47:20 +02:00
31e8006738 arch:riscv32
- Add basic riscv32 executor
- Add 16MHZ timer support
2022-06-19 22:30:26 +01:00
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
88e36a70bd Update to 2021 edition. (#820) 2022-06-18 02:15:48 +02:00
1eec7e69f1 Added some more docs 2022-06-17 15:29:42 +02:00
9887f18a51 fmt 2022-06-17 15:08:31 +02:00
949b548d45 Refactor pub/sub impls into their own files 2022-06-17 15:06:41 +02:00
4a5127aead Move the module into a folder 2022-06-17 14:45:07 +02:00
5eae020074 Created the possibility to choose between dyn channel and generic channel 2022-06-17 14:44:19 +02:00
eb304c2448 Added a function to WakerRegistration to check if it's occupied.
Created a MultiWakerRegistration that can hold multiple wakers.
Got rid of some options and the pub/sub_index
2022-06-17 13:54:34 +02:00
2a4cdd05fa Removed all unsafe 2022-06-16 22:13:26 +02:00
a614a55c7d Put most behaviour one level lower (under the mutex instead of above).
Changed the PubSubBehavior to only have high level functions.
2022-06-16 22:11:29 +02:00
dfde157337 Removed most unsafe code 2022-06-16 20:57:11 +02:00
cdacc44c5f Added unpin impls to the futures 2022-06-16 16:37:23 +02:00
f92f46f489 Added convenience methods that ignore lag 2022-06-16 14:19:16 +02:00
790426e2f6 Stream now ignores lag 2022-06-16 14:11:41 +02:00
c7cdecfc93 Renamed subscriber messages 2022-06-16 14:07:04 +02:00
98d0bb726c fmt 2022-06-16 13:51:35 +02:00
36b363a5b7 Changed names of subscriber methods and implemented the Stream trait for it 2022-06-16 13:48:26 +02:00
03996583a1 fmt 2022-06-16 12:36:39 +02:00
12a6ddfbcd Added a pubsub channel implementation 2022-06-16 12:28:12 +02:00
25ddb26be8 Improve mutex wording 2022-06-15 13:06:35 +02:00
72eb16b46d Add missing documentation for all public modules and types 2022-06-15 10:24:36 +02:00
f8f56c926d Include README.md in crate documentation 2022-06-15 09:06:18 +02:00
746bc75a8e FIx broken link warnings 2022-06-15 09:05:48 +02:00
a8703b7598 Run rustfmt. 2022-06-12 22:22:31 +02:00
fff0a03fe0 Merge #806
806: Add embassy-cortex-m crate. r=Dirbaio a=Dirbaio

- 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`.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-12 19:49:15 +00:00
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
99d19c7dcf Rename channel to mpmc
I've renamed the channel module for the MPMC as mpmc. There was a previous debate about this, but I feel that the strategy here avoids importing `channel::channel`. The change leaves `signal::Signal`, but I think that's ok. It is all a bit subjective of course. The bottom line for me is that I really like the term mpmc - it means something to me and aligns with broader naming e.g. in Tokio.
2022-06-12 15:16:56 +10:00
9efaae495b Channel clarification
This was unclear from the docs.
2022-06-03 14:27:33 +02:00
6320e30adf Update embedded-hal-async to 0.1.0-alpha.1 2022-05-29 22:34:08 +02:00
a4bf190f2f Merge #752
752: Replace embassy::io with embedded_io. r=Dirbaio a=Dirbaio

TODO:

- [x] Release embedded-io on crates.io
- [x] Remove git dep

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-05-06 23:54:07 +00:00
931a137f8c Replace embassy::io with embedded_io. 2022-05-07 01:45:54 +02:00
0ce29ca84c fixup! Use explicit return statement TaskStorage::spawn 2022-05-04 16:31:52 +02:00
34493c7ed6 Use explicit return statement TaskStorage::spawn
This commit removes the else branch in TaskStorage::spawn, and returns
explicitly from the if statement's branch, similar to what
TaskPool::spawn does.
2022-05-04 16:11:55 +02:00
c223fa3791 Rename spawn_allocate to spawn_mark_used
This commit contains a suggestion to rename TaskStorage::spawn_allocate.

The motivation for this is when reading through the code I was
expecting something else to happen in this method, due to 'allocate' in
the method name.
2022-05-03 16:52:16 +02:00
a465615196 embassy/time: derives for TimeoutError. 2022-05-03 01:08:34 +02:00
7b04c78388 Fix typo in waker.rs 2022-05-01 19:25:45 +02:00
1599009a4f executor: "send-spawn is OK if the args are Send" only holds for async fn futures.
The normal `spawn()` methods can be called directly by the user, with arbitrary hand-implemented futures.
We can't enforce they're only called with `async fn` futures. Therefore, make these
require `F: Send`, and add a "private" one only for use in the macro, which can enforce it.
2022-04-27 04:56:41 +02:00