Commit graph

101 commits

Author SHA1 Message Date
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
Jesse Braham
4e9ed223a9 Allow for an optional user-defined entry macro when targeting RISC-V 2023-05-16 09:37:25 -07:00
Ulf Lilleengen
42a8f1671d Bump versions preparing for -macros and -executor release 2023-04-27 11:54:22 +02:00
Dario Nieuwenhuis
b41ee47115 executor: unify export mod. 2023-04-03 01:11:42 +02:00
Dario Nieuwenhuis
e7a19a9725 macros/main: copy fn return to task.
This prevents this bad code from compiling.

```rust
async fn main(_spawner: Spawner) -> ! {
    // not really noreturn!
}
```
2023-03-08 02:03:39 +01:00
Dario Nieuwenhuis
a614e697d0 macros: better validation of function signatures.
Fixes #1266
2023-03-08 01:59:06 +01:00
Dario Nieuwenhuis
a054891263 cortex-m: rename Handler to DynHandler.
I want to use the name Handler for the new interrupt binding macro.
2023-03-06 00:17:51 +01:00
Dario Nieuwenhuis
b5cf332cc0 nrf: docs. 2023-02-01 01:17:41 +01:00
Brendon Fallquist
056eac998a Hide doc comments from inner function include doc comments on outer function 2022-12-24 21:21:07 -06:00
Ulf Lilleengen
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
bors[bot]
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
Ulf Lilleengen
51233c0357 doc: update cargo manifests with keywords 2022-11-22 14:51:23 +01:00
Ulf Lilleengen
f474817872 doc: add README to embassy-macro
Documents the main and task macros.
2022-11-22 13:57:41 +01:00
Sijmen Woutersen
6e1120e17e riscv support 2022-11-10 17:39:41 +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
Ulf Lilleengen
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
Dario Nieuwenhuis
478f472784 Remove Forever, switch to static_cell. 2022-08-22 16:11:40 +02:00
Quentin Smith
71e468681b Merge branch 'master' of https://github.com/embassy-rs/embassy into rtos-trace 2022-08-19 00:53:41 -04:00
Dario Nieuwenhuis
5daa173ce4 Split embassy-time from embassy-executor. 2022-08-18 01:22:30 +02:00
Dario Nieuwenhuis
fc6e1e06b3 Remove HAL initialization from #[embassy::main] macro. 2022-08-17 22:16:46 +02:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
ef9e373ec4 macros/interrupt_take: do not assume embassy-executor is a dependency of the user crate. 2022-08-17 15:03:23 +02:00
Quentin Smith
0bf178dd1b Add separate feature flag to enable interrupt tracing 2022-08-16 00:42:08 -04:00
Quentin Smith
a3c1522ce6 Add support for rtos-trace behind a feature flag 2022-08-10 05:04:13 -04: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
be6408e202 Rename unsafe_impl_unborrow to impl_unborrow 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
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
bors[bot]
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
Justin Beaurivage
c53b2fdc05 Require 1 argument in embassy::main without HAL 2022-04-29 09:32:31 -04:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
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
Dario Nieuwenhuis
293f54d134 executor: add raw::TaskPool.
This simplifies the macro code a bit.
2022-04-27 04:56:41 +02:00
Dario Nieuwenhuis
96d917992c macros: simplify task macro using "TAIT laundering". 2022-04-26 18:40:45 +02:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
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
Dario Nieuwenhuis
611961b499 macros: cleanup, make work in stable. 2022-02-12 01:16:31 +01:00
Dario Nieuwenhuis
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
Ulf Lilleengen
985c11fad5 Update rust-toolchain 2021-12-16 11:34:20 +01:00
Matous Hybl
0ca6060bfd Fix interrupt_take macro by specifying path to panic macro. 2021-11-23 11:00:37 +01:00
Wilfried Chauveau
e6abd9f5df
Fix warning for field never used. 2021-11-21 08:33:18 +00:00
Dario Nieuwenhuis
a2e7c24e00 Clippy fixes 2021-10-18 01:05:29 +02:00
Ulf Lilleengen
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
Dario Nieuwenhuis
f2623e7e9b Update lots of deps 2021-09-11 01:35:23 +02:00