Commit Graph

54 Commits

Author SHA1 Message Date
4e9ed223a9 Allow for an optional user-defined entry macro when targeting RISC-V 2023-05-16 09:37:25 -07: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
f474817872 doc: add README to embassy-macro
Documents the main and task macros.
2022-11-22 13:57:41 +01: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
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
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
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
1c10e746b6 Re-adds embassy macros for stm32
* Hook RCC config into chip config and use chip-specific RCC init
  function
* RTC/clock setup is ignored for now
2021-05-25 13:30:42 +02:00
105c8504b6 Mark Unborrow as unsafe to implement 2021-05-19 23:29:33 +02:00
dc67d2f4a4 impl Unborrow for &'a mut T
This plays nicer with user code that's generic over peripheral traits like `Instance` or `Pin`.
2021-05-19 23:20:26 +02:00
cd0d3c4b0d Merge branch 'stm32-neo' 2021-05-17 02:16:17 +02:00
0310e4d458 Add init fn. Initializes hw and returns Peripherals. 2021-05-17 00:57:37 +02:00
bfc7f52e6d Remove stm32.
stm32 developemnt continues in the `stm32-neo` branch for now.
2021-05-17 00:57:32 +02:00
92be72e0e3 Add #[interrupt] macro to register static interrupts. 2021-05-17 00:57:20 +02:00
bd9589d0ce nrf: add support for nrf52805, nrf52811, nrf52820 2021-05-17 00:57:20 +02:00
7ef5806168 stm32: codegen interrupts 2021-05-01 03:08:52 +02:00
71cf742621 Add Priority enums to embassy-extras 2021-05-01 03:08:19 +02:00
9586365b07 Pass config directly to chip specific configure function
This removes the need to duplicate the configuration for each individual
chip, but will instead pass on the configuration specified in the config
attribute.

Update nrf, stm32, rp macros with passing the config to a per-chip
configure function which assumes the appropriate configuration to be
passed to it.

To demonstrate this feature, the stm32l0xx clock setup and RTC is added which exposes
clock configuration different from stm32f4xx (and has a different set of timers and HAL APIs).
2021-04-22 09:10:46 +02:00
97ca54fa66 Rename PeripheralBorrow to Unborrow 2021-04-14 19:59:52 +02:00
37b3d8b22c Add embassy_prefix attribute parameter to task and main macros
This allows crates depending on embassy that wants to use a different
module path to do so for the 'task' and 'main' macros, by passing the
parameter 'embassy_prefix'. The prefix defaults to '::', which will
retain the existing behavior.
2021-04-14 11:06:30 +02:00
7671605452 Add std version of embassy::main 2021-04-12 14:14:03 +02:00
02ae53e71b Fix unused import warnings 2021-03-29 21:35:25 +02:00
2cd3bdc90c rp: add initial version 2021-03-29 21:35:25 +02:00
d7c3a38efc Reexport macros at root, use eveywhere as #[embassy::task] 2021-03-29 03:00:48 +02:00
d5ab02792c nrf: add main macro support 2021-03-29 02:51:42 +02:00
4ce46df160 Code size optimizations. 2021-03-29 00:58:58 +02:00
d9aaa0edf8 Implement PeripheralBorrow for interrupts. 2021-03-29 00:58:57 +02:00
6ee9e012fc add embassy::main and implement for stm32f4 2021-03-27 17:27:39 -05:00
8c2da193b8 Add spawn/spawn_pool APIs to Task 2021-03-18 00:38:27 +01:00
5c2bf3981e Move Task into raw 2021-03-18 00:20:11 +01:00
ab01e0be3b Do not reexport atomic-polyfill 2021-03-17 02:52:21 +01:00
18f6b8ad68 thumbv6m support with emulated atomics 2021-03-04 21:56:31 +01:00
11be9170ec Cleanup interrupt package naming. Fixes #40
The `interrupt` package previously tried to be drop-in compatible with the
`interrupt` package from PACs. THis meant that there was both a PAC-style enum
value `UARTE0` and an embassy-style owned `UARTE0Interrupt` type. This made
things VERY confusing.

This drops compatibility with the PAC, improving the names for embassy interrupts.
2021-02-26 01:55:27 +01:00
465ca9086d Fix macro if user crate is not using feature(const_in_array_repeat_expressions) 2021-02-23 23:05:18 +01:00
7321ddb0b3 Update to cortex-m 0.7 2021-02-14 23:26:50 +01:00
b69f72e055 Get rid of some warnings 2021-02-13 21:41:36 -03:00
aeaa34d7a1 Executor API V2.
- It's no longer possible to call run() reentrantly from within a task (soundness issue)
- it's now possible to spawn Send tasks across threads (SendSpawner, #37)
2021-02-02 05:20:41 +01:00
9f9d808948 Fix IRQ numbers
The raw enum values are not always equal to the interrupt number
fixes #23
2021-01-17 17:28:46 +01:00
9e88718fbd Add "context" pointer to owned interrupt handlers. 2021-01-04 22:25:39 +01:00
c17954ccba Fix warnings for tasks that take mutable parameters
#[task]
pub async fn run(mut param: Param) {}

warning: variable does not need to be mutable
2020-12-31 15:38:10 +01:00
bb6f25d010 Remove use of deprecated compare_and_swap. 2020-12-30 01:07:22 +01:00