Commit graph

58 commits

Author SHA1 Message Date
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
Ulf Lilleengen
5f04d6e6c5 Fix embassy::main macros for std target 2021-09-02 14:45:54 +02:00
Dario Nieuwenhuis
297de612e5 Improve executor naming. Add docs. 2021-08-31 23:59:28 +02:00
Ben Gamari
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
Dario Nieuwenhuis
0ea6a2d890 time: replace dyn clock/alarm with a global Driver trait 2021-08-05 19:14:09 +02:00
Liam Murphy
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
Dario Nieuwenhuis
7547c8d8d6 rp/timer: add 2021-07-12 03:45:57 +02:00
Thales Fragoso
f5e6b37b52 STM: Change embassy main to use TIM3 instead of TIM2 2021-07-04 15:51:10 -03:00
Ulf Lilleengen
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
Ulf Lilleengen
0a9022d59f Enable timer clock in RCC on timer start
* Moves the tim2-specific code into macro which always uses TIM2
* For peripherals without clock specified, attempt to locate enable and
  reset registers in the RCC block matching the peripheral name. This
  could be useful for peripherals where deducing the clock name might
  not be feasible, but it remains to be tested with more chip families
  to see if it is sufficiently accurate.
2021-06-10 09:37:30 +02:00
Ulf Lilleengen
bfa999a2e0 Assume tim2 in macro and remove clock setup in chip specific rcc init
Add temporary start_tim2() fn to Clock to assist macro in starting
embassy clock
2021-05-26 21:42:07 +02:00
Ulf Lilleengen
9a21d74273 Remove debug code 2021-05-26 13:08:55 +02:00
Ulf Lilleengen
c501b162fc Enable clock by default for stm32l0
Modify init function to return a Clock instance defined by a per-chip
SystemClock type and use this in macro setup

A proof of concept implementation for STM32 L0 chips.

This allows using embassy::main macros for STM32 devices that have the
clock setup logic.
2021-05-26 12:33:07 +02:00
Ulf Lilleengen
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
Dario Nieuwenhuis
105c8504b6 Mark Unborrow as unsafe to implement 2021-05-19 23:29:33 +02:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
cd0d3c4b0d Merge branch 'stm32-neo' 2021-05-17 02:16:17 +02:00
Dario Nieuwenhuis
0310e4d458 Add init fn. Initializes hw and returns Peripherals. 2021-05-17 00:57:37 +02:00
Dario Nieuwenhuis
bfc7f52e6d Remove stm32.
stm32 developemnt continues in the `stm32-neo` branch for now.
2021-05-17 00:57:32 +02:00
Dario Nieuwenhuis
92be72e0e3 Add #[interrupt] macro to register static interrupts. 2021-05-17 00:57:20 +02:00
Dario Nieuwenhuis
bd9589d0ce nrf: add support for nrf52805, nrf52811, nrf52820 2021-05-17 00:57:20 +02:00
Dario Nieuwenhuis
7ef5806168 stm32: codegen interrupts 2021-05-01 03:08:52 +02:00
Dario Nieuwenhuis
71cf742621 Add Priority enums to embassy-extras 2021-05-01 03:08:19 +02:00
Ulf Lilleengen
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
Dario Nieuwenhuis
97ca54fa66 Rename PeripheralBorrow to Unborrow 2021-04-14 19:59:52 +02:00
Ulf Lilleengen
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
Ulf Lilleengen
7671605452 Add std version of embassy::main 2021-04-12 14:14:03 +02:00
Dario Nieuwenhuis
02ae53e71b Fix unused import warnings 2021-03-29 21:35:25 +02:00
Dario Nieuwenhuis
2cd3bdc90c rp: add initial version 2021-03-29 21:35:25 +02:00
xoviat
32ca231fe6 stm32: use embassy::main in more places 2021-03-29 09:18:48 -05:00
Dario Nieuwenhuis
d7c3a38efc Reexport macros at root, use eveywhere as #[embassy::task] 2021-03-29 03:00:48 +02:00
Dario Nieuwenhuis
d5ab02792c nrf: add main macro support 2021-03-29 02:51:42 +02:00
Dario Nieuwenhuis
4ce46df160 Code size optimizations. 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
d9aaa0edf8 Implement PeripheralBorrow for interrupts. 2021-03-29 00:58:57 +02:00
xoviat
6ee9e012fc add embassy::main and implement for stm32f4 2021-03-27 17:27:39 -05:00
Dario Nieuwenhuis
8c2da193b8 Add spawn/spawn_pool APIs to Task 2021-03-18 00:38:27 +01:00
Dario Nieuwenhuis
5c2bf3981e Move Task into raw 2021-03-18 00:20:11 +01:00
Dario Nieuwenhuis
ab01e0be3b Do not reexport atomic-polyfill 2021-03-17 02:52:21 +01:00
Dario Nieuwenhuis
18f6b8ad68 thumbv6m support with emulated atomics 2021-03-04 21:56:31 +01:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
465ca9086d Fix macro if user crate is not using feature(const_in_array_repeat_expressions) 2021-02-23 23:05:18 +01:00
Dario Nieuwenhuis
7321ddb0b3 Update to cortex-m 0.7 2021-02-14 23:26:50 +01:00
Thales Fragoso
b69f72e055 Get rid of some warnings 2021-02-13 21:41:36 -03:00
Dario Nieuwenhuis
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