Commit Graph

3530 Commits

Author SHA1 Message Date
Dion Dokter
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
Dion Dokter
dfde157337 Removed most unsafe code 2022-06-16 20:57:11 +02:00
Dion Dokter
cdacc44c5f Added unpin impls to the futures 2022-06-16 16:37:23 +02:00
Dion Dokter
f92f46f489 Added convenience methods that ignore lag 2022-06-16 14:19:16 +02:00
Dion Dokter
790426e2f6 Stream now ignores lag 2022-06-16 14:11:41 +02:00
Dion Dokter
c7cdecfc93 Renamed subscriber messages 2022-06-16 14:07:04 +02:00
Dion Dokter
98d0bb726c fmt 2022-06-16 13:51:35 +02:00
Dion Dokter
36b363a5b7 Changed names of subscriber methods and implemented the Stream trait for it 2022-06-16 13:48:26 +02:00
Dion Dokter
03996583a1 fmt 2022-06-16 12:36:39 +02:00
Dion Dokter
12a6ddfbcd Added a pubsub channel implementation 2022-06-16 12:28:12 +02:00
bors[bot]
fcc1db078e
Merge #816
816: Fix doc comments for BpskPacketParams r=lulf a=danbev



Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-06-16 10:19:28 +00:00
bors[bot]
23177ba7eb
Merge #813
813: Document remaining public APIs in embassy crate r=lulf a=lulf

This also includes the README.md in the toplevel crate documentation, fixing a few formatting issues with it as well. 

Please review the mutex in detail in case I've misunderstood/missed a few things there.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-06-16 07:18:43 +00:00
Daniel Bevenius
9031b8f80a Fix doc comments for BpskPacketParams 2022-06-16 07:34:59 +02:00
bors[bot]
a8920bced5
Merge #815
815: Fix typo in LoRaPacketParams::new doc r=Dirbaio a=danbev



Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-06-16 04:25:46 +00:00
Daniel Bevenius
d0edd171f8 Fix typo in LoRaPacketParams::new doc 2022-06-16 06:22:03 +02:00
bors[bot]
f9b90212d4
Merge #814
814: Extract setting of lora modulation params r=lulf a=danbev

This commit suggests extracting the lora modulation parameters into a
separate function which can then be called from both the do_tx, and
the do_rx functions.

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-06-15 14:23:16 +00:00
Daniel Bevenius
06a76cd7ce Extract setting of lora modulation params
This commit suggests extracting the lora modulation parameters into a
separate function which can then be called from both the do_tx, and
the do_rx functions.
2022-06-15 16:21:52 +02:00
bors[bot]
03c20604c3
Merge #811
811: Sync subghz peripheral support with stm32wlxx-hal r=lulf a=lulf

* A few more registers exposed 
* Fix for "sleeping"
* Updating comments

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-06-15 13:29:55 +00:00
Ulf Lilleengen
25ddb26be8 Improve mutex wording 2022-06-15 13:06:35 +02:00
Ulf Lilleengen
eb23733767 Ignore compiling rust code 2022-06-15 10:44:15 +02:00
Ulf Lilleengen
72eb16b46d Add missing documentation for all public modules and types 2022-06-15 10:24:36 +02:00
Ulf Lilleengen
aaebea00eb Ensure links get formatted correctly in cargo doc 2022-06-15 10:24:18 +02:00
Ulf Lilleengen
f8f56c926d Include README.md in crate documentation 2022-06-15 09:06:18 +02:00
Ulf Lilleengen
746bc75a8e FIx broken link warnings 2022-06-15 09:05:48 +02:00
Ulf Lilleengen
faa59efbf6 Cargo fmt 2022-06-15 09:01:22 +02:00
Ulf Lilleengen
3696226fe8 Sync subghz peripheral support with stm32wlxx-hal 2022-06-14 16:27:42 +02:00
bors[bot]
624e46ccfb
Merge #809
809: Allow compiling usb-serial without defmt r=lulf a=lulf



Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-06-13 12:46:39 +00:00
Ulf Lilleengen
0c423cc901 Allow compiling usb-serial without defmt 2022-06-13 14:45:53 +02:00
bors[bot]
db685c0404
Merge #808
808: Add rustfmt.toml with some nice settings. r=lulf a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-13 07:22:04 +00:00
Dario Nieuwenhuis
a8703b7598 Run rustfmt. 2022-06-12 22:22:31 +02:00
Dario Nieuwenhuis
6199bdea71 Add rustfmt.toml with some nice settings. 2022-06-12 22:15:28 +02:00
bors[bot]
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
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]
6b3499a5c8
Merge #807
807: Rename channel to mpmc r=huntc a=huntc

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.

Co-authored-by: huntc <huntchr@gmail.com>
2022-06-12 06:27:11 +00:00
huntc
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
Dario Nieuwenhuis
db344c2bda
common/PeripheralMutex: remove unsafe API. (#802)
Following the project's decision that "leak unsafe" APIs are not marked as "unsafe",
update PeripheralMutex to accept non-'static state without unsafe.

Fixes #801
2022-06-09 21:28:13 +02:00
bors[bot]
77c7d8f31b
Merge #797
797: Use correct index and bank for stm32 flash r=Dirbaio a=lulf

The page index was wrong because it doesn't take FLASH_BASE into account. 

For l4, the page index register also depends on a bank selection register.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-06-07 14:09:54 +00:00
Ulf Lilleengen
7d64f5cda7 Use correct index and bank 2022-06-07 15:59:22 +02:00
bors[bot]
bf09017032
Merge #796
796: nrf/twim: allow zero length transfers. r=Dirbaio a=Dirbaio

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-07 12:54:09 +00:00
Dario Nieuwenhuis
2be36122c7 nrf/twim: allow zero length transfers. 2022-06-07 14:52:45 +02:00
bors[bot]
c212f30be0
Merge #709
709: embassy-usb stm32 r=Dirbaio a=Dirbaio

TODO

- [x] Add cfgs for EP_COUNT, EP_MEMORY_ADDR. -- ended up doing it in stm32-data
- [x] Auto-enable PWR USV in stm32l5,
- [x] Auto-enable PWR on other families that need it -- didn't find any
- [ ] ~~Assert at runtime that RCC has valid 48Mhz clock?~~ -- won't do it yet, too messy without rcc cleanup
- [x] Tested on STM32L5
- [x] Tested on STM32F303ZE
- [x] Tested on STM32F103c8
- [x] Fix duplicated irqs on STM32F303 in stm32data, remove workaround in embassy-stm32
- [x] Test HID example
- [x] Test NCM example


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-07 02:01:43 +00:00
Dario Nieuwenhuis
3e4bead321 stm32: add USB driver. 2022-06-07 03:29:00 +02:00
bors[bot]
ad6943adb3
Merge #795
795: Update stm32-metapac. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-06 22:35:47 +00:00
Dario Nieuwenhuis
0aa73f58e2 Update stm32-metapac. 2022-06-07 00:28:26 +02:00
bors[bot]
62add4b2ab
Merge #792 #794
792: Add example for using a Signal. r=Dirbaio a=hydra

I didn't find an example, so I created one for the STM32H7.  Code based on the nrf mutex.rs example.

794: Fix F1 compilation by implementig AF pullup r=Dirbaio a=chemicstry

Embassy fails to compile on `STM32F103RET6`, because `set_as_af_pull` function is missing for GPIOv1:

```
error[E0599]: no method named `set_as_af_pull` found for mutable reference `&mut CLK` in the current scope
    --> C:\Users\chemi\.cargo\git\checkouts\embassy-0cff10c9b9902273\46473ae\embassy-stm32\src\sdmmc\mod.rs:1390:21
     |
1390 |             clk_pin.set_as_af_pull(clk_pin.af_num(), AFType::OutputPushPull, Pull::None);
     |                     ^^^^^^^^^^^^^^ method not found in `&mut CLK`
```

GPIOv1 actually supports pullups in AF mode, but only for inputs. The `sdmmc` driver, which was causing compile errors uses pullups for push-pull outputs and this will silently fail. But IMO not adding pullups to sdmmc interface is a hardware design problem, not HAL.

Co-authored-by: Dominic Clifton <me@dominicclifton.name>
Co-authored-by: chemicstry <chemicstry@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-06-06 15:45:03 +00:00
Dario Nieuwenhuis
fdc6cfed3e stm32: add stm32f103re to CI 2022-06-06 17:43:55 +02:00
chemicstry
b0ffd9a1cc Fix AF pullup configuration for GPIOv1 2022-06-06 17:12:52 +03:00
Dominic Clifton
1bad6a4989 Add example for using a Signal. 2022-06-06 11:54:01 +02:00
bors[bot]
34673f52c9
Merge #791
791: Channel clarification r=lulf a=diondokter

This was unclear from the docs.

Co-authored-by: Dion Dokter <diondokter@gmail.com>
2022-06-03 12:31:40 +00:00
Dion Dokter
9efaae495b
Channel clarification
This was unclear from the docs.
2022-06-03 14:27:33 +02:00