Commit Graph

93 Commits

Author SHA1 Message Date
b5cf332cc0 nrf: docs. 2023-02-01 01:17:41 +01:00
056eac998a Hide doc comments from inner function include doc comments on outer function 2022-12-24 21:21:07 -06:00
04a7d97673 refactor: autodetect macro variant
Export all main macro per target architecture from embassy-macros,
and select the appropriate macro in embassy-executor.
2022-11-23 13:54:59 +01:00
2fa2c1a6fe Merge #1054
1054: riscv fixes r=lulf a=swolix

With these changes I can run embassy on our RISC-V processor, please consider merging this, feedback is very welcome.

I don't fully understand the code in the executor, but I have implemented a critical section by globally disabling interrupts, which means the wfi inside the critical section will hang the whole thing.

Co-authored-by: Sijmen Woutersen <sijmen.woutersen@gmail.com>
2022-11-23 09:24:11 +00:00
51233c0357 doc: update cargo manifests with keywords 2022-11-22 14:51:23 +01:00
f474817872 doc: add README to embassy-macro
Documents the main and task macros.
2022-11-22 13:57:41 +01:00
6e1120e17e riscv support 2022-11-10 17:39:41 +01:00
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
045ae2c29f Ensure interrupt::take works without embassy-executor
Add "rtos-trace-interrupt" feature flag on embassy-macros and enable it
for embassy-executor, to ensure that the interrupt::take! macro can be
used without depending on embassy-executor.
2022-08-25 12:46:24 +02:00
478f472784 Remove Forever, switch to static_cell. 2022-08-22 16:11:40 +02:00
71e468681b Merge branch 'master' of https://github.com/embassy-rs/embassy into rtos-trace 2022-08-19 00:53:41 -04:00
5daa173ce4 Split embassy-time from embassy-executor. 2022-08-18 01:22:30 +02:00
fc6e1e06b3 Remove HAL initialization from #[embassy::main] macro. 2022-08-17 22:16:46 +02:00
bd0aaec624 macros: remove embassy_prefix attr.
This was used in the past for reexporting the macros from drogue-device,
which is no longer using it.

Also, it is a pain to support, so we don't want it.
2022-08-17 15:04:59 +02:00
ef9e373ec4 macros/interrupt_take: do not assume embassy-executor is a dependency of the user crate. 2022-08-17 15:03:23 +02:00
0bf178dd1b Add separate feature flag to enable interrupt tracing 2022-08-16 00:42:08 -04:00
a3c1522ce6 Add support for rtos-trace behind a feature flag 2022-08-10 05:04:13 -04:00
a0f1b0ee01 Split embassy crate into embassy-executor, embassy-util. 2022-07-29 23:40:36 +02:00
4901c34d9c Rename Unborrowed -> PeripheralRef, Unborrow -> Peripheral 2022-07-23 14:00:19 +02:00
be6408e202 Rename unsafe_impl_unborrow to impl_unborrow 2022-07-23 01:33:22 +02:00
715fa51468 Reuse unsafe_impl_unborrow in other macros. 2022-07-23 01:33:22 +02:00
65a82d02d1 WIP: Make unborrow safe to use 2022-07-23 01:33:22 +02: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
a8703b7598 Run rustfmt. 2022-06-12 22:22:31 +02: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
2f43969dd4 Merge #742
742: Only 1 argument in embassy::main when there is no HAL r=Dirbaio a=jbeaurivage

There is a slight mistake in an error message from `[embassy::main]` macro. When there is no HAL specified, `main` should take only one argument.

Co-authored-by: Justin Beaurivage <justin@wearableavionics.com>
2022-04-29 14:29:26 +00:00
c53b2fdc05 Require 1 argument in embassy::main without HAL 2022-04-29 09:32:31 -04: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
6f6c16f449 executor: make send-spawning only require the task args to be Send, not the whole future. 2022-04-27 04:56:41 +02:00
293f54d134 executor: add raw::TaskPool.
This simplifies the macro code a bit.
2022-04-27 04:56:41 +02:00
96d917992c macros: simplify task macro using "TAIT laundering". 2022-04-26 18:40:45 +02:00
c4cecec10c macros: isolate the TAIT into its own mod.
This fixes type inference issues due to the TAIT's defining scope
being the whole parent mod.
2022-04-25 22:18:52 +02:00
408617266e Update Rust nightly.
Fixes a new opaque type error in the task macro.
Full error is "opaque type's hidden type cannot be another opaque type from the same scope".
This got disallwed by the lazy-TAIT PR: https://github.com/rust-lang/rust/pull/94081

Sadly there's now some weird type inference errors with pre-lazy-TAIT
nightlies, so support for those is dropped.
2022-04-24 04:24:08 +02:00
611961b499 macros: cleanup, make work in stable. 2022-02-12 01:16:31 +01:00
caf48d8a95 macros: initialize chip before executor.
The executor will call into the chip's time-driver, which may need the chip
to be initialized.
2022-01-05 13:30:46 +01:00
985c11fad5 Update rust-toolchain 2021-12-16 11:34:20 +01:00
0ca6060bfd Fix interrupt_take macro by specifying path to panic macro. 2021-11-23 11:00:37 +01:00
e6abd9f5df Fix warning for field never used. 2021-11-21 08:33:18 +00:00
a2e7c24e00 Clippy fixes 2021-10-18 01:05:29 +02:00
e24528051b Add WASM support for executor
* Adds an executor for WASM runtimes based on wasm_bindgen.
* Add time driver based on JS time handling.
* Add example that can run in browser locally.
* Update to critical-section version that supports 'std' flag
2021-09-13 16:42:39 +02:00
f2623e7e9b Update lots of deps 2021-09-11 01:35:23 +02:00
5f04d6e6c5 Fix embassy::main macros for std target 2021-09-02 14:45:54 +02:00
297de612e5 Improve executor naming. Add docs. 2021-08-31 23:59:28 +02:00
a3b56a3764 embassy-macros: Use defmt::unwrap! when spawning embassy::main
But only when `defmt` feature is enabled.
2021-08-05 22:40:12 +02:00
0ea6a2d890 time: replace dyn clock/alarm with a global Driver trait 2021-08-05 19:14:09 +02:00
53e66a383f Forward attributes to generated task function
Fixes #18

Syn considers doc comments to be attributes, so forwarding those fixes the issue.
It's probably a good idea to forward most attributes anyway.
2021-08-05 15:35:50 +10:00
7547c8d8d6 rp/timer: add 2021-07-12 03:45:57 +02:00
f5e6b37b52 STM: Change embassy main to use TIM3 instead of TIM2 2021-07-04 15:51:10 -03:00
952f525af5 Provide a way for a peripheral to query its clock frequency
Currently this looks up the frequency in the global singleton that must
be initialized by the per-chip RCC implementation. At present, this is
only done for the L0 family of chips.
2021-06-14 11:33:11 +02:00