1080 Commits

Author SHA1 Message Date
16151cce02 hack: disallow stalling in rp2040 2024-10-12 16:42:32 +02:00
da9ce32909 feat(hid): allow specifying in & out packet size separately 2024-10-12 16:21:33 +02:00
d091b3f0a4 Merge pull request from embassy-rs/prepare-nrf-release
Prepare some crate releases
2024-08-05 07:05:57 +00:00
886580179f update dates 2024-08-05 08:58:56 +02:00
187093e147 Prepare to release embassy-boot-rp 2024-08-05 08:56:29 +02:00
f605302791 Prepare to release embassy-rp 2024-08-05 08:56:29 +02:00
ec9a07d143 Prepare to release embassy-boot-nrf 2024-08-05 08:56:29 +02:00
1588fbc256 Prepare to release embassy-boot 2024-08-05 08:56:29 +02:00
37d7b0cd06 prepare release embassy-executor 2024-08-05 08:56:29 +02:00
61bda59d83 Prepare to release embassy-usb 2024-08-05 08:56:29 +02:00
ffb55754c8 Prepare release embassy-net-driver-channel 2024-08-05 08:56:29 +02:00
2f3b3335e1 Prepare for embassy-nrf release 2024-08-05 08:56:29 +02:00
44282b18fa Prepare embassy-time release 2024-08-05 08:56:29 +02:00
fb0ab1e42a Prepare release of embassy-hal-internal 2024-08-05 08:56:29 +02:00
5767c003cc Prepare release of embassy-embedded-hal 0.2.0 2024-08-05 08:56:29 +02:00
e173b973ae Merge pull request from barafael/patch-1
Fix possible typo in embassy-rp README.md
2024-08-04 18:49:16 +00:00
2a1ace29a3 Fix possible typo in embassy-rp README.md
There is no feature `time` in embassy-rp. Is it `time-driver`? Is it something else?
2024-08-03 15:32:39 +02:00
03b8e36532 Merge pull request from embassy-rs/otg-bounds-checks
usb-synopsys-otg: ensure ep alloc fails when endpoint_count < MAX_EP_COUNT.
2024-08-02 22:21:23 +00:00
7d65c5c4fa usb-synopsys-otg: ensure ep alloc fails when endpoint_count < MAX_EP_COUNT.
Before, it would alloc the endpoint fine and then panic later due to out of range.
This ensures it falis at ep alloc time, and with a panic message that says
what's the actual problem: "no free endpoints available".
2024-08-03 00:15:45 +02:00
a2ea2630f6 Merge pull request from towynlin/adin1110-readme
Fix broken link to OPEN Alliance spec for ADIN1110
2024-08-02 15:49:23 +00:00
4e905bfcba Fix broken link to OPEN Alliance spec for ADIN1110 2024-08-02 08:39:37 -07:00
f2c29ba9d8 Merge pull request from JomerDev/add-count-to-read_to_break
RP2040: Add read_to_break_with_count
2024-08-02 13:50:32 +00:00
2b031756c6 Merge pull request from bobrippling/fix/bootloader-overflow
Fix bootloader-rp's bootloader memory region overflow
2024-07-31 17:20:44 +00:00
ec53b9187d Fix bootloader-rp's bootloader memory region overflow
The bootloader region (`FLASH`) mentioned below overflows into the
`BOOTLOADER_STATE` region by `0x100` bytes

```
0x10000100 + 24K = 0x10006100
```

32adddff9c/examples/boot/bootloader/rp/memory.x (L3-L8)
2024-07-31 18:16:04 +01:00
32adddff9c Merge pull request from wllenyj/lazy-lock
embassy-sync: fix the data of LazyLock never drop
2024-07-31 16:28:06 +00:00
91f135e25b Merge pull request from diondokter/hsem
Add function to get the active HSEM interrupt
2024-07-31 14:34:11 +00:00
05562b92af embassy-sync: more unit-test for LazyLock
Signed-off-by: wanglei <wllenyj@gmail.com>
2024-07-31 10:32:44 +08:00
93696c912e embassy-sync: fix the data of LazyLock never drop
Using `union` can save more space.

And the `MaybeUninit<T>` will never drop the T, when dropping the
`MaybeUninit<T>`. Fixed it.

Signed-off-by: wanglei <wllenyj@gmail.com>
2024-07-31 10:31:56 +08:00
e89ff7d129 Merge pull request from mirkomartn/bound-dns-servers
embassy-net: dns: bound the dns_servers slice
2024-07-29 21:36:35 +00:00
c5d077a2c6 embassy-net: dns: bound the dns_servers slice
`smoltcp::socket::dns::Socket::update_servers()` will
panic if a slice exceeding a fixed length is passed
to it. This is can be especially inconvenient when
using DHCP config.

Avoid panicking by using at most `DNS_MAX_SERVER_COUNT`
DNS servers from the config.
2024-07-29 23:24:44 +02:00
7d3c852613 Merge pull request from samueltardieu/lazy-lock
embassy-sync: add LazyLock
2024-07-29 12:01:17 +00:00
05e0f12846 embassy-sync: add LazyLock
`LazyLock` is inspired by Rust 1.80.0's `std::sync::LazyLock` type.
2024-07-29 11:04:59 +02:00
4e5a646f8b Merge pull request from samueltardieu/f1-flash-bsy
embassy-stm32: wait for BSY flag to clear before flashing
2024-07-27 19:35:25 +00:00
8680c86894 embassy-stm32: wait for BSY flag to clear before flashing
While not waiting for the BSY flag to clear works on STM32F103C8T6, it
does not on APM32F103C8T6. Only one half-word gets written while the
other one gets lost.
2024-07-27 15:07:04 +02:00
b88dc137e7 Merge pull request from busslina/original-mirror-main-fixing-missing-reexport
Fixing missing re-export
2024-07-25 18:07:20 +00:00
29d79d3af2 Added doc comment to a public enum variant 2024-07-25 20:01:19 +02:00
da5ecd29f1 Formmating 2024-07-25 19:55:54 +02:00
6eb447eb58 Adding pub struct docs
cyw43::ScanOptions
2024-07-25 19:45:52 +02:00
3efbd60a90 Fixing missing re-export
cyw::control::ScanOptions
2024-07-25 19:24:37 +02:00
8c4f044ae7 Merge pull request from diondokter/fix-opamp-lifetimes
Add extra lifetime to opamp-using structs
2024-07-25 15:14:10 +00:00
43b878708d Merge pull request from embassy-rs/rust180
Update to Rust 1.80, make check-cfg unconditional.
2024-07-25 14:09:24 +00:00
4a8abe8028 Relax lifetimes again 2024-07-25 16:01:27 +02:00
2d678d6956 Update to Rust 1.80, make check-cfg unconditional. 2024-07-25 15:53:00 +02:00
8b4bb625be Merge pull request from embassy-rs/rp-timer-test
tests/rp: add timer test.
2024-07-25 10:25:05 +00:00
6ef9e564ca Add extra lifetime to opamp-using structs 2024-07-25 12:22:55 +02:00
1598dd55e4 tests/rp: add timer test. 2024-07-25 12:22:49 +02:00
2436335f9b ci: add instructions to install cargo-batch if not installed. 2024-07-24 17:17:04 +02:00
2537fc6f4f Merge pull request from ninjasource/sdmmc-dma-buffers
embassy-stm32: Allow cmd block to be passed in for sdmmc dma transfers
2024-07-22 19:44:00 +00:00
ea4c2ca95d Merge pull request from Dygear/main
Documentation Link Fixes
2024-07-22 11:48:12 +00:00
4811c14cc8 Updated cargo toml section links. 2024-07-22 07:26:55 -04:00
dc6639fa4d Updated github branch from master to main. 2024-07-22 06:59:13 -04:00
7c1ecae53f Add read_to_break_with_count 2024-07-19 16:01:20 +02:00
e7270e00f6 Added set_cmd_block for dma memory compatibility 2024-07-19 02:03:53 +01:00
2766993099 Merge pull request from kalkyl/shared-bus
Add example for shared I2C and SPI buses
2024-07-18 15:11:54 +00:00
5e625f274a Merge pull request from MathiasKoch/embassy-rp/uart-split-ref
(embassy-rp): Add split_ref fn to uart, allowing a mutable reference split into RX & TX handles
2024-07-18 12:10:37 +00:00
024097d833 Merge pull request from michelrandahl/f303-tsc-example
add TSC examples
2024-07-18 12:10:02 +00:00
c83d940005 Merge pull request from nerwalt/nrf9151
nrf9151 support
2024-07-18 12:07:15 +00:00
f32b711e4a Merge pull request from MathiasKoch/embassy-net/socket-timeout
(embassy-net): Allow setting socket timeout for embedded-nal TcpClient
2024-07-18 11:49:59 +00:00
14de5e5a3c Merge pull request from mirkomartn/fix-doc
embassy-net: fix minor typo in doc
2024-07-18 11:49:38 +00:00
2e4374df1b Merge pull request from kalkyl/fmc-a13
stm32: Add 13bit address sdram constructors
2024-07-18 11:38:19 +00:00
dc84b4f45a embassy-net: fix minor typo in doc 2024-07-18 13:37:47 +02:00
94b2143463 Merge pull request from MathiasKoch/chore/flash-partition-clone
chore(embassy-embedded-hal): Add Clone impl to flash Partition
2024-07-18 11:36:47 +00:00
5236df97c6 Merge pull request from taaki2311/main
Reduced the definition for 'unreachable!' to a single macro rule
2024-07-18 11:36:15 +00:00
ccc2ddab66 Hand-roll Clone impl instead of derive 2024-07-18 12:14:56 +02:00
20bf995c3b Add Clone derive to flash Partition in embassy-embedded-hal 2024-07-18 11:15:18 +02:00
255864f46c Merge branch 'embassy-rs:main' into main 2024-07-17 17:07:01 -04:00
a716a3f006 Reduced define for 'unreachable!' to a single macro rule 2024-07-17 17:05:52 -04:00
a4ca71bc23 stm32: Add 13bit address sdram constructors 2024-07-17 18:16:56 +02:00
32019ed9b7 Allow cmd buffer to be passed in for dma memory 2024-07-17 17:12:37 +01:00
4c34132337 Correctly handle modifying LCR register after uart enable 2024-07-17 12:23:59 +02:00
d1207706c0 Fix example after swapping bufferedUart rx and tx in split fn 2024-07-17 12:07:58 +02:00
f733071908 Add split_ref fn to uart, allowing a mutable reference split into RX & TX handles. Also change order of RX and TX handles in split fn, to streamline with other HALs 2024-07-17 11:25:03 +02:00
01f709c1d9 Allow setting socket timeout for embedded-nal TcpClient, such that every new socket from that client gets the timeout 2024-07-17 11:23:12 +02:00
e54c753537 Merge pull request from embassy-rs/nightly-update-more
Update nightly, fix error with rp inline asm.
2024-07-16 14:48:00 +00:00
a0f8948c1c Update nightly, fix error with rp inline asm. 2024-07-16 16:40:54 +02:00
e1e99879a6 Merge pull request from JuliDi/bump-udbd-hid
Bump usbd-hid from 0.7.0 to 0.8.1 to fix compile errors in rp examples
2024-07-16 12:02:07 +00:00
d78ce3c6ab bump more udbd-hid usages to 0.8.1 2024-07-16 12:38:16 +02:00
2571e0416f bump usbd-hid from 0.7.0 to 0.8.1 2024-07-16 12:26:51 +02:00
2e1b5ef58b Fixing 9151 s and ns ci example builds 2024-07-15 13:46:55 -06:00
238cc004f0 saddc regression fix 2024-07-15 13:41:32 -06:00
0dd0e593c2 cargo fmt examples 2024-07-15 13:35:21 -06:00
0567ad5e74 cargo fmt 2024-07-15 13:30:16 -06:00
8a6cb98e45 Adding _nrf91 feature
Combining _nrf9160 and _nrf9120 in many places to reduce cfgs
2024-07-15 13:21:30 -06:00
4340d74e19 Adding 9120 to ci.sh 2024-07-15 12:02:12 -06:00
2c3de1eeec Merge branch 'main' into nrf9151 2024-07-15 11:33:53 -06:00
a978234cc5 Connecting GPIOTE interrupts 2024-07-15 10:12:22 -06:00
042d234f11 Putting never used/constucted items behind feature flag 2024-07-15 09:23:58 -06:00
639acdd2a3 Using published nrf9120-pac 2024-07-15 09:23:16 -06:00
4472e08bca Merge pull request from 1-rafael-1/impl-ReadReady-for-buffered-uart
Impl read ready for buffered uart
2024-07-14 17:14:37 +00:00
d9ea5cb015 stm after cargo fix 2024-07-14 17:56:56 +02:00
f5ebdebd96 nrf after cargo check 2024-07-14 17:34:50 +02:00
c7f775dc20 stm 2024-07-14 16:42:54 +02:00
08f1454527 nrf 2024-07-14 16:35:05 +02:00
f5e3f31df7 Merge pull request from wyager/main
Change const asserts to `core::assert` to avoid invoking `defmt::assert`
2024-07-14 06:54:48 +00:00
a5c0d1b79f Change const asserts to core::assert to avoid invoking defmt::assert 2024-07-13 15:55:24 -04:00
eefaf1b02e Merge branch 'main' into nrf9151 2024-07-12 14:05:39 -06:00
3937c53fd8 Merge pull request from neuschaefer/dev
Minor fixes
2024-07-12 15:52:22 +00:00
de1dc272e0 net-adin1110: Fix typo in comment 2024-07-12 02:06:13 +02:00
0a19879c5d executor: Use spawner.must_spawn(...) for wasm too
All other architectures use must_spawn instead of spawn+unwrap, so use
it for wasm as well.
2024-07-12 02:05:59 +02:00
38d8abef26 Merge branch 'main' into nrf9151 2024-07-11 06:58:05 -06:00
ed3da1721a Merge pull request from 1-rafael-1/impl-ReadReady-for-BufferedUart-in-embassy-rp
Impl read ready for buffered uart in embassy rp
2024-07-10 21:40:36 +00:00
d8821dd7d7 rustfmt 2024-07-10 22:56:12 +02:00
68b3fbe348 implement read_ready method in BufferedUart 2024-07-10 22:54:48 +02:00
10a1a27cc3 add async TSC example for STM32L073 2024-07-10 20:59:18 +02:00
52f40b9c9d add blocking TSC examples 2024-07-10 13:26:18 +02:00
4972dbd91b Add function to get the active HSEM interrupt 2024-07-09 11:49:16 +02:00
6636a5835b Merge pull request from 1-rafael-1/add-rp-sample-distribute-resources
add assign_resources rp example
2024-07-08 21:29:25 +00:00
2f62376a15 add faq 2024-07-08 23:27:42 +02:00
af9c7379f9 Add link to example in book 2024-07-08 22:53:50 +02:00
52c43f0249 rustfmt 2024-07-08 22:26:32 +02:00
91e6aa3166 rustfmt 2024-07-08 22:20:23 +02:00
376f65e1d3 add assign_resources example 2024-07-08 22:07:38 +02:00
03f3a3389d Add example for shared I2C and SPI buses 2024-07-08 21:48:19 +02:00
d8bd5907ca Merge pull request from kalkyl/sharing
Add example for sharing things between tasks
2024-07-08 15:19:48 +00:00
028ca55f9c Add more docs and cross-links 2024-07-08 17:16:35 +02:00
87f6634349 Add example for sharing things between tasks 2024-07-08 13:58:36 +02:00
462daeeb49 Merge pull request from Dicklessgreat/main
Fix BDMA example for soundness
2024-07-07 16:54:37 +00:00
3408e1ddbf Fixed to reserve as much space as it uses. 2024-07-07 04:39:39 +09:00
e2aa5ef376 Merge branch 'main' of https://github.com/Dicklessgreat/embassy into main 2024-07-06 17:46:53 +09:00
b90eef293b [ ] Replaced static raw array with GroundedArrayCell 2024-07-06 17:36:22 +09:00
f91244bae6 Merge pull request from Dicklessgreat/main
add SAI example
2024-07-04 18:32:51 +00:00
4f649caa81 cargo +nightly fmt 2024-07-05 03:29:25 +09:00
49546abfec rustfmt 2024-07-05 03:17:04 +09:00
4ecdf31f9b add SAI example 2024-07-05 02:33:30 +09:00
e2f9a48457 Merge pull request from andresv/stm32-adc-blocking_read
stm32 adc: introduce blocking_read
2024-07-03 12:45:58 +00:00
f851081e09 stm32 adc: introduce blocking_read 2024-07-03 15:20:31 +03:00
ac5b7edb05 Merge pull request from Stupremee/better-clock-messages
Better panic message when peripheral clock is not enabled
2024-07-03 09:30:24 +00:00
914d7c7919 Merge pull request from andresv/stm32-adc-dma-v3
STM32 ADC v3 and V4 DMA support
2024-07-03 08:13:26 +00:00
09cfa28a21 stm32g0: add adc_dma example 2024-07-03 10:59:20 +03:00
8c54df1042 Merge pull request from embassy-rs/nrf-radio-fixes
fix cancellation hanging on event never occuring
2024-07-03 07:45:14 +00:00
ef78e3283b Merge pull request from andresv/stm32-ringbuffered-adc-docs
stm32 ringbuffered adc docs
2024-07-03 07:33:10 +00:00
b6f76b5ab2 Merge pull request from liarokapisv/adc_v4_averaging
stm32 - Adc v4 - Add averaging support.
2024-07-03 07:22:34 +00:00
3e70601fc7 Merge pull request from Adancurusul/dev
Add adc oversampling support
2024-07-03 07:22:03 +00:00
b07570fce5 remove unused logging 2024-07-03 09:04:47 +02:00
a07702ba7b fix cancellation hanging on event never occuring
- The end event is not triggered by stop and might therefor never occur
- Clear the end_event after operation is done instead of disabled
2024-07-03 09:03:25 +02:00
9e4e536769 Better panic message when peripheral clock is not enabled 2024-07-03 08:32:00 +02:00
5223923bd2 Merge pull request from Eekle/feature/async_tsc
Add async API to TSC
2024-07-02 18:51:50 +00:00
d3f8905e93 Use crate level PeriMode 2024-07-02 20:46:05 +02:00
14435d095f Merge pull request from embassy-rs/compile-time-asserts
make some embassy-boot asserts const
2024-07-02 17:33:34 +00:00
5137ebab56 Merge pull request from oro-os/wiznet-version-check
wiznet: add version check to initialization sequence
2024-07-02 16:58:00 +00:00
d4ff7616f9 stm32 ringbuffered adc docs improvements 2024-07-02 17:35:15 +03:00
a4e62314af stm32: adc v3: fix for newest pac 2024-07-02 17:15:22 +03:00
c120efad5b stm32 adc read_async: add asserts for buf len 2024-07-02 17:07:18 +03:00
5e2fd8623a stm32 adc v3 read_async 2024-07-02 17:07:18 +03:00
70061e74b2 add async dma read example 2024-07-02 17:07:18 +03:00
02b096915f add asynchrous sequence read support to adc v4 2024-07-02 17:07:18 +03:00
9bdb697cd9 Merge pull request from andresv/update-stm32-metapac
update stm32-metapac
2024-07-02 14:01:02 +00:00
dd69efe708 stm32 ringbuffered adc: add buf size assert 2024-07-02 16:56:19 +03:00
b88e1a5d71 stm32 ringbuffered adc docs 2024-07-02 16:53:49 +03:00
8f52ee469e make some embassy-boot asserts const 2024-07-02 12:37:36 +02:00
1f30ad595b stm32 ringbuffered adc: fix for metapac changes 2024-07-02 09:21:27 +03:00
8cbb64226b update stm32-metapac 2024-07-02 09:15:01 +03:00
6f21d5e478 Merge pull request from sethkrie/adc-v2-ringbuf
ring buffered adc v2
2024-07-02 01:05:49 +00:00
d6e4086a15 Merge pull request from qwerty19106/stm32_uart_half_fix_sequential_read_write
WIP: STM32 Half-Duplex: fix sequential reads and writes
2024-07-02 00:58:54 +00:00
c0cd851fb9 Merge pull request from liarokapisv/circular_half_transfer_ir
Enables half transfer ir when constructing a ReadableDmaRingBuffer
2024-07-02 00:51:05 +00:00
a862334dae STM32 Half-Duplex: fix sequential reads and writes 2024-07-02 02:45:06 +02:00
f3fdeb26a4 Merge pull request from shufps/feat/dds-example
Feat/dds example
2024-07-01 23:50:35 +00:00
3d8cec3b47 Merge pull request from trepidacious/ready_ready_and_write_ready_fix
Update `ReadReady` and `WriteReady` implementations
2024-07-01 23:21:10 +00:00
976e9f7fba Merge pull request from birdistheword96/main
Fix: Ensure I2C bus is free before master-write operation
2024-07-01 23:18:55 +00:00
00babd2ec4 Merge pull request from ninjasource/stm32-ltdc
Add support for the stm32 LTDC display peripheral
2024-07-01 23:18:15 +00:00
abe7f9921e Update ReadReady and WriteReady implementations
Update `ReadReady` for `TcpReader` to match implementation for `TcpSocket`
Update `WriteReady` implementations to use `can_recv()` rather than `may_recv()`, since this will check that the transmit buffer is not full.
2024-07-01 20:59:27 +01:00
92eb6011d6 Merge pull request from igiona/AllowDrivingStrengthInPwm
feat(pwm): allow specifying OutputDrive for PWM channels
2024-07-01 17:51:53 +00:00
f418006508 fixup! feat(pwm): allow specifying OutputDrive for PWM channels 2024-07-01 18:06:14 +02:00
98263ac220 Merge branch 'main' into nrf9151 2024-07-01 10:03:24 -06:00
e9bbfb349c Clean up 2024-07-01 10:02:03 -06:00
7884babb9d feat(pwm): allow specifying OutputDrive for PWM channels 2024-07-01 17:33:24 +02:00
27652798c7 fix typo, add spaces after // 2024-07-01 06:44:47 -07:00
3c6bf3a31a Merge pull request from embassy-rs/nrf-egu-irq
expose enabling and disabling irq for triggers
2024-07-01 12:08:44 +00:00
0b8a8e54dc expose enabling and disabling irq for triggers 2024-07-01 10:26:45 +02:00
2a38787a83 Merge pull request from kkrolczyk/kk/i2c-addr-flexibility
rp/i2c: add address flexibility and example
2024-07-01 06:38:33 +00:00
c4b88b5781 wiznet: add version check to initialization sequence 2024-06-30 23:56:17 +02:00
e0c0a618bd Merge pull request from trepidacious/read_ready_smoltcp_fix
Add check for closed connection to `read_ready()`
2024-06-30 21:05:52 +00:00
c3be54f96b Add check for closed connection to read_ready() 2024-06-30 17:47:04 +01:00
67f5b8d974 Update example 2024-06-30 11:06:32 +02:00
1d1fc9afea Add async and blocking variants 2024-06-30 11:03:29 +02:00
bd0243d12f Merge pull request from dflemstr/less-implicit-panics
Less implicit panics
2024-06-28 23:41:02 +00:00
662e97f7b5 Panic on index-out-of-bounds when releasing RCC node 2024-06-29 01:37:35 +02:00
114dda2fd1 Avoid accidental copy of static var before creating mut ref 2024-06-29 01:34:07 +02:00
2f750a82bf Swat some other occurrences of .unwrap() that pull in panicing infra 2024-06-28 22:52:21 +02:00
73d937dc33 Remove implicit bounds checking from rcc module 2024-06-28 22:52:10 +02:00
cbc67469d3 Route sources of panics to the crate's fmt macros 2024-06-28 22:52:03 +02:00
96cdf9c9e0 rp/i2c: add address flexibility and example
Previous i2c examples are using either blocking Embassy API
or e-h traits, this example uses Embassy pub API directly.

Signed-off-by: Krzysztof Królczyk <Krzysztof.Krolczyk@o2.pl>
2024-06-28 19:51:33 +02:00
6edf7b4688 Applied formatting 2024-06-28 18:17:17 +01:00
79f00e54cc Moved ltdc example to its own crate 2024-06-28 18:11:34 +01:00
317e065517 Adding uart example to 9151-ns
Updated README
2024-06-28 08:59:22 -06:00
1123e3fd41 Get dsi_bsp example to compile again 2024-06-28 15:12:17 +01:00
5e1a6a9753 Adding support for 9120 2024-06-28 07:11:50 -06:00
2462a22140 format 2024-06-28 14:52:21 +02:00
b2a0eb3cb4 added comment 2024-06-28 14:43:39 +02:00
ece6203a99 added DDS example 2024-06-28 14:42:19 +02:00
47c7bb2bb5 Updated metapac dependency to latest for LTDC support 2024-06-28 11:35:38 +01:00
8a6b71b0bb Adding initial support for nrf9151 s and ns
Adding s and ns examples, including a reference TFM
2024-06-27 14:07:26 -06:00
0e84bd8a91 Add support for the stm32 ltdc display peripheral 2024-06-27 20:13:20 +01:00
26e660722c Merge pull request from neuschaefer/input
docs: Fix mention of ExtiInput
2024-06-27 14:51:56 +00:00
e3b495908c docs: Fix mention of ExtiInput
The struct is called ExtiInput, not ExtiButton.
2024-06-27 16:48:48 +02:00
a0799bf270 Add adc oversampling support 2024-06-27 17:04:26 +08:00
a2acb3e3dc Merge pull request from embassy-rs/nrftests
nRF uart fixes, better tests.
2024-06-25 22:02:12 +00:00
9a21f70c9f tests/nrf: add non-buffered uart tests. 2024-06-25 23:57:19 +02:00
b870e7f257 tests/nrf: generalize buffereduart tests for all chips. 2024-06-25 23:56:59 +02:00
1ce9418bca nrf/buffered_uart: take into account EASYDMA_SIZE. fixes nrf52832 2024-06-25 23:55:07 +02:00
c48547b475 nrf: fix wrong order configuring gpios.
Docs say "PSEL.RXD, PSEL.RTS, PSEL.RTS, and PSEL.TXD must only be configured when the UARTE is disabled."
For some reason nrf52 doesn't care but nrf91 does.
2024-06-25 23:18:16 +02:00
e4c4036a46 Merge pull request from embassy-rs/nrftests
tests/nrf: unify, add nrf52832, nrf52833, nrf5340, nrf9160
2024-06-25 20:50:08 +00:00
292dbcc991 nrf/gpiote: fix port1 on nrf5340 2024-06-25 22:29:07 +02:00
cab17434d5 tests/nrf: unify, add nrf52832, nrf52833, nrf5340, nrf9160 2024-06-25 22:29:07 +02:00
3ae2f140f9 Merge pull request from diondokter/rp-boot2-none
RP: Shut up missed warning boot2-none
2024-06-25 15:48:11 +00:00
5dbc531671 RP: Shut up missed warning boot2-none 2024-06-25 16:54:34 +02:00
bce7c73a3a Merge pull request from diondokter/rp-boot2-none
RP: add option to provide your own boot2
2024-06-25 12:58:56 +00:00
957be1980d Fix syntax error? 2024-06-25 14:43:30 +02:00
92343551aa RP: add option to provide your own boot2 2024-06-25 14:31:15 +02:00
89cd0e7cca Merge pull request from 9names/rp-example-fixes
RP network example fixes
2024-06-25 11:09:37 +00:00
080b5869da Fix rngcore imports in examples 2024-06-25 21:07:09 +10:00
1456900281 Replace joke seed with best RNG available 2024-06-25 20:47:27 +10:00
7b9215c8b9 Use published version of reqwless 2024-06-25 20:33:55 +10:00
dfdbcb400c Merge pull request from 1-rafael-1/add-http-request-example-to-rp
Add http request example to rp
2024-06-25 09:35:36 +00:00
6926e9e071 CI 2024-06-24 23:15:00 -07:00
7056783fa2 second adc added to example + API todos completed 2024-06-24 17:53:59 -07:00
27b83fdbcf fmt 2024-06-24 17:15:16 -07:00
f64dd8228b new PR, taking Dirbao's advice to make the DMA impl in a separate struct that consumes Adc<T> to make RingBufferedAdc<T>. Handling overrun similar to RingBufferedUart 2024-06-24 17:09:43 -07:00
b927c22ac0 rustfmt 2024-06-24 22:12:18 +02:00
6dae3c02c0 comment the comments 2024-06-24 22:08:59 +02:00
d05817f89d rustfmt again 2024-06-24 21:33:42 +02:00
67e7532b4a rustfmt 2024-06-24 21:16:56 +02:00
32e9867b4e need to bring down binary size or flashing will corrupt the device 2024-06-24 20:51:31 +02:00
ab3cc7226a Merge pull request from tshakah/patch-1
Fix typo in README
2024-06-24 10:14:07 +00:00
b7dd04e3b1 Fix typo in README 2024-06-24 10:59:43 +01:00
b05217b356 add wifi_webrequest example 2024-06-23 23:04:47 +02:00
7eb605d116 fmt 2024-06-23 16:55:36 +02:00
2655426cd8 Add async wait to TSC 2024-06-23 16:43:12 +02:00
3883a5b2de Enables adc v4 averaging support.
The Adc v4 peripheral includes a hardware oversampler.
This PR adds an averaging interface that keeps most of the current
interface backwards compatible while allowing for the common use-case
of hardware-averaging. A more comprehensive oversampler interface may
be exposed in the future.
2024-06-23 12:43:24 +03:00
00ff1409cd Enables half transfer ir when constructing a ReadableDmaRingBuffer
The half transfer irq needs to be enabled in order for the hardware to
notify the waker when the transfer is at half. This is needed to ensure
no overuns occur when using `ReadableDmaRingBuffer`'s `read_exact`.
Otherwise we are only notified when the DMA has completed its cycle and
is on its way to start overwriting the data. The docs in the dma_bdma
buf module also seem to imply that the half transfer irq must be enabled for
proper operation. The only consumers of the `ReadableDmaRingBuffer` api
are the sai module and the `RingBufferedUartRx`. The former enables the
irq manually when constructing the transfer options while the
latter does not. This may also be the cause for .
2024-06-23 11:43:50 +03:00
cfe8561550 Merge pull request from kalkyl/adc-multi
rp: Add multichannel ADC
2024-06-22 21:05:17 +00:00
0888183666 Change pin in HIL test 2024-06-22 23:02:38 +02:00
e3891b09dc Add comment about internal api 2024-06-22 16:39:23 +02:00
95d0cae897 Merge pull request from aurelj/with_timeout
implement with_timeout()/with_deadline() method style call on Future
2024-06-22 14:14:35 +00:00
8b0c883443 Merge pull request from Adancurusul/g0_development
Add PWM examples for stm32g0
2024-06-22 14:11:50 +00:00
f6bd4a3f37 Merge pull request from romainreignier/feature/stm32wb_doc_fix
examples: stm32wb: remove comment about memory.x file
2024-06-22 14:10:32 +00:00
18ba56534b Fix Formatting Issues 2024-06-21 15:29:02 +01:00
060d1f6e6f Fix: Ensure I2C bus is free before master-write operation
The I2C master-write function was failing when executed immediately after an I2C read operation, requiring manual delays to function correctly. This fix introduces a check to ensure the I2C bus is free before initiating the write operation.

According to the RM0399 manual for STM32H7 chips, the BUSY bit (Bit 15 in the I2C ISR register) indicates whether a communication is in progress on the bus. The BUSY bit is set by hardware when a START condition is detected and cleared when a STOP condition is detected or when PE = 0.

This fix prevents the write operation from starting until the BUSY bit is cleared.
2024-06-21 15:09:57 +01:00
d5badb94d2 Merge pull request from ROMemories/patch-1
docs(gpio): fix a typo regarding GPIO speed
2024-06-20 22:28:58 +00:00
4b0615957f docs(gpio): fix a typo regarding GPIO speed 2024-06-20 12:09:30 +00:00
c65ee20cdd examples: stm32wb: remove comment about memory.x file
File removed in commit c19967dcf2
2024-06-20 14:06:44 +02:00
a3c6626f40 Update pwm_complementary.rs 2024-06-19 11:04:40 +08:00
0579d248ef Add PWM examples for stm32g0 2024-06-19 10:57:18 +08:00
b0172bb582 Merge pull request from tarfu/patch-1
Update rust-toolchain-nightly.toml to compile with changes to fmt.rs
2024-06-18 14:56:20 +00:00
bd6fad6b61 Update rust-toolchain-nightly.toml to compile with changes to fmt.rs 2024-06-18 16:42:22 +02:00
a0231ed74c Merge pull request from embassy-rs/nrf-egu-peri
add HAL and example for using nRF EGU peripheral
2024-06-18 11:25:51 +00:00
91476eea12 cargo fmt 2024-06-18 13:22:38 +02:00
a44ee963ef add HAL and example for using nRF EGU peripheral 2024-06-18 13:13:33 +02:00
94af383809 Merge pull request from Adancurusul/add_G0_examples
Add examples for stm32g0
2024-06-18 11:09:25 +00:00
bbe8d3d38a Add stm32g0 examples 2024-06-18 17:01:37 +08:00
3c414e99cb Merge pull request from ProfFan/patch-2
Update Cargo.toml to latest `stm32-metapac`
2024-06-17 18:24:04 +00:00
478cbc6a41 Update Cargo.toml to latest stm32-metapac 2024-06-17 14:09:53 -04:00
86c48dde41 Merge pull request from embassy-rs/collapse
Add collapse_debuginfo to fmt.rs macros.
2024-06-16 23:47:47 +00:00
6a4ac5bd60 Add collapse_debuginfo to fmt.rs macros.
This makes location info in defmt logs point to the code calling the macro,
instead of always to fmt.rs as before. Fix works with nightlies
starting with today's, and stable 1.81+.
2024-06-17 01:38:57 +02:00
1e268a4d3d Merge pull request from sjoerdsimons/ucpd-missing-packets
Improve stm32 ucpd packet reception
2024-06-16 19:57:14 +00:00
633c15c2d8 Merge pull request from honzasp/pin-af
stm32/gpio: refactor AfType
2024-06-16 19:36:06 +00:00
94007ce6e0 stm32/gpio: refactor AfType 2024-06-16 21:11:55 +02:00
9e8035cfb9 [USPD] clear interrupt flags right after reception
Clearing the interrupt flags at beginning of reception will masks
overruns and cause corrupted packets to be received. Instead clear the
flags right after disabling the interrupt/after reception, so overruns
on the next receive can be caught.

Tested by forcing overruns due to explicit sleeps

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2024-06-16 11:00:56 +02:00
84cbf1d198 [UCPD] Don't disable ucpd rx after each reception
When disabling the UCPD RX after every reception it's relatively easy to
drop packets. This seems to happen in particular with GoodCRC packets
which can be sent very quickly by a receiver. To avoid this enable
reception as soon as the pd phy get split out (preparing for packet
processing) and only disable again when the pd phy gets dropped.
2024-06-16 10:59:21 +02:00
1a2c8cecde Merge pull request from markszente/dsihost-format-derive
Add Format derive to DSI HOST Error
2024-06-15 21:06:23 +00:00
9daa233b61 Merge pull request from 1-rafael-1/fix---binary-format-in-rp-examples
--binary-format bin in rp examples
2024-06-15 17:44:05 +00:00
8b903e8873 --binary-format bin in rp examples 2024-06-15 14:39:41 +02:00
3cf94958c6 Add Format derive 2024-06-15 14:21:15 +02:00
c818125c22 Merge pull request from 1-rafael-1/typo-in-rp-examples
typo: was missing "bin"
2024-06-15 08:20:45 +00:00
a8581e242b typo: was missing "bin" 2024-06-14 21:43:12 +02:00
6bbb870bfa Merge pull request from Eekle/main
Update stm32 to latest generated data
2024-06-14 17:19:34 +00:00
b64b555bbf Update stm32 to latest generated data 2024-06-14 18:58:01 +02:00
8ec2e193e2 implement with_timeout()/with_deadline() method style call on Future 2024-06-14 17:46:32 +02:00
74739997bd Merge pull request from 1-rafael-1/uploading-cyw-fw-new-format
probe-rs download 43439A0.bin --format bin deprecated
2024-06-13 21:32:19 +00:00
597b5d6337 probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 yields:
Error: --format has been renamed to --binary-format. Please use --binary-format bin instead of --format bin
2024-06-13 22:47:24 +02:00
e6a1fde3ac Merge pull request from embassy-rs/rust1-79
Update to Rust 1.79
2024-06-13 18:57:44 +00:00
7ad76f5f60 Use raw slices .len() method instead of unsafe hacks.
Stabilized in 1.79.
2024-06-13 20:41:08 +02:00
4d9115b3fb Update stable to Rust 1.79. 2024-06-13 20:40:04 +02:00
68c8238812 Merge pull request from nautd/add-tsc-example
Add example for touch sensitive controller
2024-06-13 18:01:06 +00:00
54fa33cbae Add example for touch sensitive controller 2024-06-13 13:46:10 -04:00
8d79679bb2 Merge pull request from zjp-CN/waker-getters
minimize cfg code in task_from_waker
2024-06-13 00:17:26 +00:00
zjp
dd6a873447 minimize cfg code in task_from_waker 2024-06-13 07:59:28 +08:00
e80ca5fc67 Merge pull request from zjp-CN/waker-getters
use nightly waker_getters APIs
2024-06-12 23:40:53 +00:00
zjp
b780df5f76 put cfg code inside task_from_waker function 2024-06-13 07:33:40 +08:00
3d8c028864 Merge pull request from embassy-rs/update-stm32-data-99
stm32: update stm32-metapac, fixes memory.x for many families.
2024-06-12 19:51:11 +00:00
72029ca0c6 stm32: update stm32-metapac, fixes memory.x for many families. 2024-06-12 21:39:39 +02:00
8b0cfde9a6 Clarified comments about the cortex_m::asm::delay functionality in al… ()
* Clarified comments about the cortex_m::asm::delay functionality in all multiprio.rs examples

* fixed formatting

* Changed to using embassy_time::block_for()

* removed my formatting scripts

* specify embassy_time::Duration
2024-06-12 19:40:28 +02:00
dbe21730cd Merge pull request from mikkelens/patch-1
Add missing word "pin" in rp pwm documentation
2024-06-12 13:05:26 +00:00
d08639f643 Add missing word "pin" in rp pwm documentation
It is confusing to read without. The corrected line reads like its 'b' pin counterpart (few lines below).
2024-06-12 14:56:21 +02:00
5154de3b7e Merge pull request from aurelj/dns_qtype_either
dns: properly handle AddrType::Either in get_host_by_name()
2024-06-11 18:53:14 +00:00
7f3805437c dns: properly handle AddrType::Either in get_host_by_name() 2024-06-11 11:39:07 +02:00
ad7d739ddc Merge pull request from kkrolczyk/kk/bootloader-typos
fix docu typos, linker addr example
2024-06-10 20:48:41 +00:00
453aa58b7f stm32/boot: update linker file in example
Signed-off-by: Krzysztof Królczyk <Krzysztof.Krolczyk@o2.pl>
2024-06-10 11:50:20 +02:00
268430bd9f stm32/docs: correct typos, links
Signed-off-by: Krzysztof Królczyk <Krzysztof.Krolczyk@o2.pl>
2024-06-10 11:25:43 +02:00
3e2b015dc4 Merge pull request from dvdsk/clonable-errors
Add Clone and Copy to Error types
2024-06-09 09:47:26 +00:00
zjp
6b9470be2c fix warning on unused import 2024-06-09 11:50:32 +08:00
zjp
3f45ec6ead use nightly waker_getters APIs
Since https://github.com/rust-lang/rust/issues/96992 has stalled,
to prevent potential unsoundness caused by transmuting to &WakerHack,
we can use nightly waker_getters APIs by gating it behind nightly
feature in embassy-executor without waiting for it to be stablized.
2024-06-09 11:39:47 +08:00
e5495b51b4 Merge pull request from dvdsk/docs-net-size
Document w5500 State and add w5500 example for stmf4
2024-06-07 23:00:56 +00:00
ab31a02e17 cargo fmt 2024-06-08 00:30:52 +02:00
1812ccd276 Adds an example for using the w5500 with an stm32f4
This example takes into account the lower memory on the stm32f4. That
should prevent anyone wanting to use the w5500 on any stm from adapting
the w5500 example for the rp which uses a lot more RAM.
2024-06-07 23:46:59 +02:00
72c2b06520 Explain the const params N_RX & N_TX in the docs of State
On chips with a low amount of ram it's easy to run out of ram. When
looking at the current docs for the State struct it is not easy to
see that these params can cause a lot of ram usage.
2024-06-07 23:06:30 +02:00
871fe3a549 Add Clone and Copy to Error types
None of them are `non-exaustative`, they are all small enough to be copy
(I estimate none are larger than 4 bytes).
2024-06-06 23:19:07 +02:00
4a4b8c9b8d Merge pull request from jvatic/main
embassy-sync: remove T: Send for Signal<M, T>
2024-06-06 06:47:39 +00:00
3e85fb4f52 embassy-sync: remove T: Send for Signal<M, T> 2024-06-05 20:22:48 -04:00
72a5523c64 Merge pull request from ant32/queue
add send_queue and recv_queue to embassy-net
2024-06-05 22:02:02 +00:00
673d11f49f add send_queue and recv_queue 2024-06-05 15:28:18 -06:00
044b5c8921 Merge pull request from embassy-rs/embassy-time-0.3.1
prepare for embassy-time 0.3.1 release
2024-06-05 13:36:24 +00:00
5af0fe8a58 Merge pull request from GustavToft/fix_main
Adding function to close soft AP.
2024-06-05 12:06:30 +00:00
bf36bec9bb rp: Add multichannel ADC 2024-06-05 09:42:08 +02:00
3610799618 Added docs. 2024-06-05 08:33:55 +02:00
a516dbd5e2 CYW43: Add function to close existing soft AP 2024-06-05 08:14:35 +02:00
319e18b399 Merge branch 'main' of https://github.com/embassy-rs/embassy into fix_main 2024-06-05 08:11:50 +02:00
4ebd8af96f add convenience script to bump dependency version 2024-06-04 09:19:07 +02:00
30918c355b prepare for embassy-time 0.3.1 release 2024-06-04 09:02:41 +02:00
5f9bc6def7 Merge pull request from kalkyl/zerocopy
rp: Add zerocopy channel example
2024-06-04 06:37:45 +00:00
f9d8c68fc8 Add description 2024-06-04 01:20:19 +02:00
874d5f7c65 core atomic 2024-06-04 00:53:51 +02:00
03d8f99aa5 rp: Add zerocopy channel example 2024-06-04 00:38:51 +02:00
9856d21693 Merge pull request from honzasp/harmonize-new
stm32: Make initialization of I2C and USART consistent with SPI
2024-06-03 21:26:43 +00:00
f3703ff6bf stm32/usart: set refcount even if initialization failed 2024-06-03 20:12:33 +02:00
039d8ed671 Merge pull request from embassy-rs/fix-book-refs
fix broken links to embassy book
2024-06-03 12:12:18 +02:00
d2045be9f3 fix broken links to embassy book 2024-06-03 08:45:05 +02:00
ecd7888ba9 Merge pull request from embassy-rs/spi-nosck-fix
stm32/spi: fix blocking_write on nosck spi.
2024-06-02 23:03:53 +00:00
348c87fc2f stm32/spi: fix blocking_write on nosck spi.
Fixes .
2024-06-03 00:57:53 +02:00
7b590334e6 Merge pull request from cschuhen/feature/fdcan_no_generics2
Remove generic argument from FDCAN CanBuilder.
2024-06-02 19:25:44 +00:00
900b104860 Remove generic argument from CanBuilder. 2024-06-02 21:47:14 +10:00
5f8f867eae Merge pull request from cschuhen/feature/bxcan_no_generics2
Remove more BXCAN generics.
2024-06-02 10:33:14 +00:00
58ef2594e5 Fix F7 example. 2024-06-02 20:16:57 +10:00
367a22cc0e Remove more BXCAN generics. 2024-06-02 20:11:56 +10:00
664e4a5c03 stm32/usart: move init code to function that's not generic in T 2024-06-01 19:46:39 +02:00
44e4a2c9e9 stm32/buffered-usart: use new_pin! and disconnect pins on drop 2024-06-01 19:46:39 +02:00
ade27b7f21 stm32/usart: disconnect pins of RingBufferedUartRx on drop 2024-06-01 19:46:39 +02:00
41711195e3 stm32/i2c: use new_pin! macro 2024-06-01 19:46:39 +02:00
ca3c15658d stm32/spi: move init code to function that's not generic in T 2024-06-01 19:46:39 +02:00
e61136fa4a Merge pull request from embassy-rs/check-cfg-fix
stm32/spi: restrict txonly_nosck to SPIv1, it hangs in other versions.
2024-05-31 21:02:40 +00:00
8a1658ab0e stm32/spi: test zero-length transfers in more cases. 2024-05-31 22:58:53 +02:00
339dd85968 stm32/spi: restrict txonly_nosck to SPIv1, it hangs in other versions. 2024-05-31 22:58:53 +02:00
7baa14371b Merge pull request from embassy-rs/check-cfg-fix
Fix all check-cfg errors, fix stm32 spi rxonly.
2024-05-31 21:59:06 +02:00
f594ddceec stm32/spi: add blocking rxonly test. 2024-05-31 21:54:42 +02:00
da197b6016 stm32/spi: fix spiv1 rxonly hanging. 2024-05-31 21:54:42 +02:00
999a2ad829 Fix all check-cfg errors in the entire repo.
the main ci.sh now passes if running with nightly.
2024-05-31 21:54:42 +02:00
ba940017ee Merge pull request from brunob45/pwm_input
Add PWM Input for STM32
2024-05-31 18:09:27 +00:00
4452a06e76 Merge pull request from andresovela/timestamp-uptime-features
embassy-time: add timestamp features
2024-05-31 17:43:55 +00:00
441ca8f64d Merge pull request from honzasp/check-cfg
Emit cargo:rustc-check-cfg instructions from build.rs
2024-05-31 17:32:29 +00:00
bfb380e8ca Copy build_common.rs into each crate, to make cargo publish happy 2024-05-31 08:07:51 +02:00
7d86919257 rust fmt really does not want blank space there 2024-05-30 17:54:49 -04:00
83b5797b8d fix fmt (again) 2024-05-30 17:53:38 -04:00
713d84f778 fix fmt 2024-05-30 17:51:48 -04:00
4d307b5a77 undo changes in input_capture 2024-05-30 17:49:20 -04:00
84707af5d7 create functions in inner to handle register modification 2024-05-30 17:43:53 -04:00
6eaa259342 embassy-time: add timestamp features 2024-05-30 22:16:56 +02:00
368893c9cb Emit cargo:rustc-check-cfg instructions from build.rs 2024-05-30 18:28:29 +02:00
694ac3a515 Merge pull request from liarokapisv/i2s-spi_v3
Add spi v3 & Full-duplex support to the I2S driver.
2024-05-30 12:31:59 +00:00
d21e9caa80 Merge pull request from mat-kie/follower-opamp
Make OpAmp usable in follower configuration for internal DAC channel
2024-05-30 12:23:53 +00:00
b378ec4558 Merge pull request from cschuhen/feature/bxcan_no_generics
Remove generics for BXCAN.
2024-05-30 12:16:17 +00:00
b4a2f7fb70 Use phantom for lifetime holder instead of not used pointer to pointer. 2024-05-30 22:10:46 +10:00
28f5f0baba add dac buffer function 2024-05-30 14:07:47 +02:00
7fd79857c3 Fix example. 2024-05-30 22:00:02 +10:00
39c5a6c3f7 Merge pull request from honzasp/rcc-info
stm32/rcc: replace generated enable/disable code with runtime info
2024-05-30 11:50:40 +00:00
245c895d09 Remove generics for BXCAN. 2024-05-30 21:39:11 +10:00
7bc71a8262 Merge pull request from embassy-rs/rtc-lowpower-mod
stm32/rtc: move lowpower stuff to a separate mod.
2024-05-30 11:34:46 +00:00
2c691baadd stm32/rtc: move lowpower stuff to a separate mod. 2024-05-30 13:26:14 +02:00
62f4b4ee1e Merge pull request from embassy-rs/nopacpointer
stm32: remove pointer-to-pointer-to-registers.
2024-05-30 11:17:51 +00:00
c46172acac stm32: remove pointer-to-pointer-to-registers.
in chiptool pacs the register block struct is already a pointer, so
using pointers to it is redundant.
2024-05-30 13:07:18 +02:00
7532a06f67 Merge pull request from liarokapisv/spi_v3-fix-rx
Add proper rxonly support for spi_v3 and force tx dma stream requirem…
2024-05-30 10:44:48 +00:00
e9cb9badf7 Merge pull request from cschuhen/feature/fdcan_no_generics
Remove generic argument for STM32 FDCAN.
2024-05-30 10:42:53 +00:00
d3c3670a96 Merge branch 'main' of https://github.com/embassy-rs/embassy into fix_main 2024-05-30 09:56:09 +02:00
50210e8cdc Merge pull request from lucasgranberg/main
add set_as_analog to stm32 gpio Flex
2024-05-29 14:22:44 +00:00
a87b333034 fix fmt 2024-05-29 10:02:54 -04:00
292c1dd0b8 rename get_width_ticks and add info!() in examples 2024-05-29 09:59:00 -04:00
a23fa8dcb2 Apply suggestions from code review
Co-authored-by: Romain Reignier <romainreignier@users.noreply.github.com>
2024-05-29 09:14:05 -04:00
b282edcc6e add set_as_analog to stm32 gpio Flex 2024-05-29 14:56:29 +03:00
56235c97bc Merge pull request from embassy-rs/embassy-sync-release
Prepare for embassy-sync 0.6.0 release
2024-05-29 10:40:02 +00:00
52965ae96a remove duplicate entry 2024-05-29 12:38:33 +02:00
d040dfaff9 add missing entries to changelog 2024-05-29 12:21:41 +02:00
cf0d227cca Prepare for embassy-sync 0.6.0 release 2024-05-29 12:09:55 +02:00
35feb1bf23 Remove generic argument for STM32 FDCAN. 2024-05-29 20:07:17 +10:00
53dedd2ff5 Merge pull request from valleyflowerbear/main
Fix watchdog CTRL register getting overwritten
2024-05-29 07:39:06 +00:00
9031ce7fa7 rp: fix watchdog CTRL register getting overwritten 2024-05-29 06:30:41 +01:00
7f4803ddaf fix fmt again 2024-05-29 00:55:49 -04:00
66122aa60f Merge branch 'pwm_input_f103' into pwm_input 2024-05-29 00:53:09 -04:00
61f1f80e90 fix fmt 2024-05-29 00:52:55 -04:00
69badfb845 remove dev files 2024-05-29 00:37:50 -04:00
50039b17a7 fix F103 example 2024-05-29 00:33:35 -04:00
521332bdd1 pwm_input is working on F446 2024-05-29 00:28:26 -04:00
a6c419d096 add f103 example for input_capture 2024-05-28 23:12:08 -04:00
f1d5f4ca21 undo minor changes 2024-05-28 22:43:23 -04:00
a52841041d use timer LL 2024-05-28 22:38:08 -04:00
7c1e1ee288 example is working now 2024-05-28 22:30:10 -04:00
41b9a12574 compile pwm_input example 2024-05-28 20:36:23 -04:00
642465a7da add stm32f446 files 2024-05-28 20:20:15 -04:00
4f76f6b9df add spi_dma rx-only test 2024-05-28 16:08:36 +03:00
000b022ae2 Merge pull request from de-vri-es/bxcan-tx-fifo-scheduling
embassy_stm32: implement optional FIFO scheduling for outgoing frames
2024-05-28 11:12:37 +00:00
4d1fbcd9cd address review comments 2024-05-28 13:38:27 +03:00
46fc15783d add spi_v4 and spi_v5 support but block i2scfg rx-only configuration 2024-05-28 12:50:24 +03:00
34bc439f17 Merge pull request from plaes/docs-faq-fix-bdma-link
docs: faq: Fix link to bdma example and improve wording.
2024-05-28 10:58:20 +02:00
4d431b3080 docs: faq: Fix link to bdma example and improve wording. 2024-05-28 11:27:21 +03:00
9a6ed79ad1 remove rx-only support for new spi versions with missing I2SCFGR register 2024-05-27 20:51:50 +03:00
1d05015a1c broaden tsize read support to other spi versions 2024-05-27 20:47:24 +03:00
76fbec74da fix spi panic on read due to i2s configuration conversion check 2024-05-27 20:43:24 +03:00
8d7c3f7de1 Merge pull request from aurelj/stm32-rcc-hsi
stm32: ensure the core runs on HSI clock while setting up rcc
2024-05-27 17:28:13 +00:00
ec6cfc1f21 stm32: ensure the core runs on HSI clock while setting up rcc 2024-05-27 17:31:29 +02:00
25cc5241b1 Add i2s support for spi_v3. 2024-05-27 18:06:20 +03:00
f9324201b1 add proper rxonly support for spi_v3 and force tx dma stream requirement on others 2024-05-27 17:49:47 +03:00
807e573994 embassy_stm32: allow scheduling lower priority frames in bxcan driver 2024-05-27 16:10:08 +02:00
854ae5da8f embassy_stm32: implement optional FIFO scheduling for outgoing frames 2024-05-27 16:10:08 +02:00
8b9e2efec2 Merge pull request from embassy-rs/rp-spinlock-fix
rp: fix spinlocks staying locked after reset.
2024-05-26 22:18:40 +00:00
d18a919ab9 rp: wait until read matches for PSM accesses. 2024-05-27 00:14:44 +02:00
ec185b2fd2 Merge pull request from embassy-rs/jamesmunns-patch-1
FAQ: One vs Many tasks
2024-05-25 18:22:31 +00:00
ad45725a24 Update docs/pages/faq.adoc 2024-05-25 19:33:13 +02:00
9c32c43cf8 FAQ: One vs Many tasks
Copy and paste from chat
2024-05-25 19:32:02 +02:00
081afca3f0 stm32/rcc: replace generated enable/disable code with runtime info 2024-05-25 18:44:55 +02:00
33bdc9e85f rp: fix spinlocks staying locked after reset.
Fixes 
2024-05-24 20:04:14 +02:00
01c1cb2764 Merge pull request from embassy-rs/fix-book-link
fix link to embassy book
2024-05-24 15:34:01 +00:00
8e89e6a313 fix link to embassy book 2024-05-24 17:31:14 +02:00
a5763b4df4 Merge pull request from joelsa/add-miso-pullup
Add miso pullup to spi configuration
2024-05-24 15:01:18 +00:00
ac76a713e1 Remove wrong modulo 2024-05-24 16:54:04 +02:00
891ec5fa5d Merge pull request from joelsa/fix-gpiov1
gpiov1: Do not call set_speed for AFType::Input
2024-05-24 13:12:37 +00:00
b48cf5357c Merge pull request from joelsa/add-nrf52810-example
Add nrf52810 example
2024-05-24 13:12:13 +00:00
92988a3939 Correct chip in comment 2024-05-24 14:22:30 +02:00
e1d2ba07a7 Formatting 2024-05-24 14:15:10 +02:00
c4b3488f7f Add body to match statement 2024-05-24 14:12:01 +02:00
fab434ae84 Use match instead of if 2024-05-24 14:09:29 +02:00
06234e7839 Add example to CI 2024-05-24 14:04:44 +02:00
201b5c6ec1 Add NRF52810 example 2024-05-24 14:03:27 +02:00
32a75cb764 Fix naming 2024-05-24 13:53:19 +02:00
bfc5929f50 gpiov1: Do not call set_speed for AFType::Input
Co-authored-by: Toby Fleming <tobywf@users.noreply.github.com>
2024-05-24 13:46:55 +02:00
5cba97821f Naming: Change pullup to pull 2024-05-24 01:05:56 +02:00
f285a545be Change bool to Pull 2024-05-23 23:52:59 +02:00
8226904b34 Merge pull request from honzasp/usart-nogeneric
stm32/usart: Remove BasicInstance generic
2024-05-23 17:04:52 +00:00
85cfacd3cf Merge pull request from jamesmunns/james/license-book
Explicitly license the book prose CC-BY-SA
2024-05-23 16:09:49 +00:00
183f2f6913 stm32/usart: remove instance generic params 2024-05-23 16:32:15 +02:00
0a5820e3ed Merge branch 'embassy-rs:main' into add-miso-pullup 2024-05-23 15:34:16 +02:00
ded1f9d335 Merge pull request from MabezDev/ringbuf-reconfigure
stm32 ringbuffered usart: don't teardown during reconfigure
2024-05-23 10:10:57 +00:00
e5c579d9fb Merge pull request from rumcake-rs/stm32-adc-anyadcchannel
stm32/adc: add AnyAdcChannel type
2024-05-23 10:09:45 +00:00
495a29ad6e Explicitly license the book prose CC-BY-SA
This matches the Rust Embedded books
2024-05-23 09:57:10 +02:00
4e9206efb8 remove InternalChannel and AdcPin 2024-05-22 19:00:48 -04:00
27e8ef6e7e Remove Speed::Input in order to move it into separate PR 2024-05-22 23:49:48 +02:00
89017d338f Cargo format 2024-05-22 23:45:26 +02:00
2f7bba4668 Use ODR register for Pull::Up or Down 2024-05-22 23:44:34 +02:00
94e559eba7 Don't teardown during reconfigure 2024-05-22 22:28:03 +01:00
4e2296e344 Merge pull request from sourcebox/sync-additions
embassy-sync: Add clear function to all channels
2024-05-22 13:01:16 +00:00
bbeba7f014 embassy-sync: Add clear function to all channels 2024-05-22 14:54:09 +02:00
1d4cd85f71 Merge pull request from sourcebox/sync-additions
embassy-sync: fixed some documentation typos
2024-05-22 13:03:30 +02:00
41e11d86b9 make AdcChannel required for InternalChannel 2024-05-21 19:08:01 -04:00
ddbb6c8c31 add back InternalChannel and implement it where its missing 2024-05-21 19:03:14 -04:00
aee9d5902a embassy-sync: fixed some documentation typos 2024-05-22 00:54:52 +02:00
68e784ccd6 Merge pull request from reneherrero/main
Added a CAN example for the stm32l4
2024-05-21 22:34:13 +00:00
608c953fc8 Merge pull request from embassy-rs/qspi-nodma
stm32/qspi: remove DMA generic param.
2024-05-21 22:27:15 +00:00
e7161aa085 stm32/qspi: remove DMA generic param. 2024-05-22 00:23:42 +02:00
2f2869f195 Merge branch 'main' of github.com:reneherrero/embassy 2024-05-21 17:20:18 -05:00
ec32159576 added CAN example 2024-05-21 17:14:31 -05:00
6fa608f516 Merge pull request from nautd/kkoppul2/update_ospi
Remove OSPI generic DMA
2024-05-21 22:09:44 +00:00
7a26cc3764 Merge pull request from andelf/fix/stm32wl-msi-crash
Fix crash caused by using higher MSI range as sysclk on STM32WL
2024-05-21 22:07:50 +00:00
5ecc9b805d Merge pull request from aurelj/stm32-rcc-hsi
stm32: ensure the core runs on HSI clock while setting up rcc
2024-05-21 22:06:24 +00:00
9a4c4fe2c7 Merge pull request from ismet55555/pwm-change
Remove Generics from `embassy-rp` `Pwm` struct
2024-05-21 21:48:21 +00:00
ba7ef3c919 Merge pull request from embassy-rs/remove-cargo-install-probe-rs
Remove "cargo install probe-rs", point users to probe.rs instead.
2024-05-21 21:48:21 +00:00
3b01023636 Remove "cargo install probe-rs", point users to probe.rs instead.
Fixes 
2024-05-21 23:45:01 +02:00
e55f31bdc6 rp/pwm: rename channel->slice in args, misc fix. 2024-05-21 23:41:45 +02:00
24032d0853 Remove generics from embassy-rp 2024-05-21 23:35:06 +02:00
ae49e58993 Merge pull request from taunusflieger/feature/HSEM
HSEM support for embassy-stm32
2024-05-21 21:34:50 +00:00
4b5026e197 Merge pull request from qwerty19106/fix_uart_half_fifo_flush
Fix uart::flush with FIFO at Half-Duplex mode
2024-05-21 21:26:04 +00:00
afd61ed610 stm32/hsem: misc fixes. 2024-05-21 23:22:47 +02:00
7d350fb4c8 HSEM support for embassy-stm32 2024-05-21 23:08:44 +02:00
c7c5723f8b Merge pull request from sourcebox/sync-additions
embassy-sync: fixed some clippy warnings
2024-05-21 21:08:40 +00:00
73e523ab14 embassy-sync: fixed some clippy warnings 2024-05-21 22:59:39 +02:00
2d8ec70f71 Merge pull request from nautd/kkoppul2/tsc
TSC implementation
2024-05-21 20:55:41 +00:00
e85242af2c Merge pull request from joelsa/add-dsihost-example
Add dsihost example
2024-05-21 20:46:17 +00:00
a636bace98 Merge pull request from embassy-rs/spi-nogenerics
stm32/i2c: remove peripheral generic param.
2024-05-21 20:46:03 +00:00
4e42eaef7c Add dsi example 2024-05-21 22:44:40 +02:00
2da2e57b38 Merge pull request from mattico/xcvrdly
usb: add transceiver delay option
2024-05-21 20:41:29 +00:00
9d6746e650 usb: add transceiver delay option 2024-05-21 14:42:37 -05:00
bb82a1bd60 Merge pull request from embassy-rs/update-book-script-perm
update script permission
2024-05-21 08:24:27 +00:00
cab46a7a8c update script permission 2024-05-21 10:21:45 +02:00
cd27439fca Merge pull request from embassy-rs/embassy-book-refactor
Embassy book refactor
2024-05-21 08:11:34 +00:00
bb9c687a39 update crate paths 2024-05-21 10:05:21 +02:00
06218f9536 fix internal refs 2024-05-21 10:05:21 +02:00
38946114d8 update links 2024-05-21 10:05:21 +02:00
d90e35980f update example path 2024-05-21 10:05:21 +02:00
797f5c1e5e add book ci script 2024-05-21 10:05:21 +02:00
2991099daa move images and add makefile 2024-05-21 10:05:21 +02:00
739e5861c2 convert from antora to asciidoctor 2024-05-21 10:05:21 +02:00
7cdbae2a5d add AnyAdcChannel 2024-05-20 21:29:20 -04:00
45a12fd41f stm32/i2c: remove peripheral generic param. 2024-05-21 01:25:49 +02:00
6a508b3210 stm32: use funcs for info/state, const for ENABLE_BIT. 2024-05-21 01:24:10 +02:00
51d5530925 Merge pull request from embassy-rs/spi-nogenerics
stm32/spi: remove peripheral generic param.
2024-05-20 21:48:48 +00:00
2b09f9efd7 stm32/spi: check that the RCC enable bit is disabled on drop. 2024-05-20 23:43:10 +02:00
ca2eef5387 stm32/spi: remove peripheral generic param. 2024-05-20 23:43:10 +02:00
eeb6ffce4c stm32/rcc: add ClockEnableBit struct. 2024-05-20 23:37:20 +02:00
8e7361f4ca Merge pull request from diondokter/pubsub-cleanup
Pubsub cleanup
2024-05-20 18:30:19 +00:00
c74acae7c0 Merge pull request from cacharle/patch-1
Fix typo in sharing_peripherals.adoc
2024-05-20 18:29:54 +00:00
98b06d7646 Fix typo in sharing_peripherals.adoc 2024-05-20 20:28:13 +02:00
5bc1e1793d Merge pull request from mattico/usb-ep-send
embassy-usb-synopsys-otg: impl Sync for EpState
2024-05-20 17:30:04 +00:00
5a8ac21f6b embassy-usb-synopsys-otg: impl Sync for EpState
This restores the Send/Sync impls for EpState, which were incidentally
removed in . This allows the Endpoints to be send to tasks, e.g.
as part of a custom class implementation.
2024-05-20 12:21:55 -05:00
a4350e0398 vscode: improve docs in settings.json 2024-05-20 11:33:13 -05:00
5cffaf323b Add little migration sentence to changelog 2024-05-20 15:52:32 +02:00
daaaf50298 Merge pull request from si14/si14/embassy-usb-logger-release
Add a CHANGELOG to embassy-usb-logger and bump its version
2024-05-20 15:50:37 +02:00
f3008597aa Fix cyw43 2024-05-20 15:49:11 +02:00
07f2240a19 Add to changelog 2024-05-20 15:38:28 +02:00
a76082b104 Expose new length functions in the subs and pubs 2024-05-20 15:34:03 +02:00
b843f2546f Add a CHANGELOG to embassy-usb-logger and bump its version 2024-05-20 14:25:32 +01:00
2a4a714060 Make behaviour trait sealed 2024-05-20 15:18:10 +02:00
b33ef0d7dd Merge pull request from embassy-rs/jamesmunns-patch-1
embassy-usb - update 0.2 changelog
2024-05-20 13:29:42 +02:00
aa7fcec009 embassy-usb - update 0.2 changelog 2024-05-20 13:27:54 +02:00
3a24e6b465 Merge pull request from andelf/add-ch32-hal-to-list
Add ch32-hal to HAL list, support WCH's CH32V family
2024-05-20 13:23:42 +02:00
e5fb96abe8 Merge pull request from FransUrbo/uart_r503
Added PIO UART examples for rp to talk to an R503 fingerprint scanner.
2024-05-20 13:03:14 +02:00
7f3872ab98 Merge pull request from joelsa/add-dsihost
Add stm32 dsihost driver
2024-05-20 10:49:27 +00:00
34a0f74456 Merge pull request from Ragarnoy/u16-spidevice
Make SpiDevice generic over Word size and implement u16 transfer
2024-05-20 11:30:28 +02:00
78cdebbc95 embassy-embedded-hal: add support for all word sizes to async shared spi. 2024-05-20 10:56:43 +02:00
31887b47bc embassy-embedded-hal: remove Word generic for blocking SpiDeviceWithConfig. 2024-05-20 10:56:43 +02:00
d64f46ff9e PR remarks 2024-05-20 10:56:43 +02:00
44cb4159a6 rustmft 2024-05-20 10:56:43 +02:00
4dbec3402e Remove old embedded-hal trait implementations 2024-05-20 10:56:43 +02:00
02ee59fa1e Add Copy and 'static constraint to Word type in SPI structs 2024-05-20 10:56:43 +02:00
6df737a48c rustfmt 2024-05-20 10:56:43 +02:00
c5a183fa82 Improve flexibility by introducing SPI word size as a generic parameter 2024-05-20 10:56:43 +02:00
621dbeceda Merge pull request from brunob45/simple_capture
STM32 Input Capture
2024-05-20 08:49:12 +00:00
a266948a7a Merge pull request from tact1m4n3/uart-fix
Fix drop implementation of `BufferedUartRx` and `BufferedUartTx` in `embassy-rp`
2024-05-20 08:44:01 +00:00
c74729bddf Merge pull request from sourcebox/sync-additions
Consistent functions for Channel, PriorityChannel and PubSubChannel to return capacity and filling
2024-05-20 10:38:24 +02:00
729f143269 Merge pull request from avsaase/rp-async-multiwritenorflash
rp/flash: implement `embedded_storage_async::nor_flash::MultiwriteNorFlash`
2024-05-19 11:02:05 +00:00
e3e3728dae rp/flash: implement embedded_storage_async::nor_flash::MultiwriteNorFlash 2024-05-18 23:28:37 +02:00
ab89993451 embassy-sync: Add capacity, free_capacity, len, is_empty and is_full functions to PubSubChannel 2024-05-18 14:01:23 +02:00
f361c2e81c embassy-sync: Add capacity, free_capacity, len, is_empty and is_full functions to PriorityChannel 2024-05-18 13:48:40 +02:00
3d9b502c7a embassy-sync: Add capacity and free_capacity functions to Channel 2024-05-18 13:37:51 +02:00
5b2535c8a2 fix(embassy-rp): fix drop implementation of BufferedUartRx and BufferedUartTx 2024-05-17 21:51:45 +03:00
fa94b5cec0 Merge pull request from embassy-rs/jamesmunns-patch-1
FAQ: Fix section nesting
2024-05-17 12:13:21 +00:00
c590e91c0b FAQ: Fix section nesting 2024-05-17 14:11:42 +02:00
86221cc040 Merge pull request from embassy-rs/jamesmunns-patch-1
FAQ: "How to add support for a new chip"
2024-05-17 12:59:39 +02:00
4722bac07c FAQ: "How to add support for a new chip"
This adds an opinionated process for supporting a brand new (family of) chip(s) in Embassy.
2024-05-17 11:07:47 +02:00
128575aebe Merge pull request from felipebalbi/add-stm32g0-i2c-async-example
stm32g0: add i2c_async example
2024-05-16 19:17:48 +00:00
57d9bfd343 stm32g0: add i2c_async example
This example will help those having difficulties understanding how to
bind interrupts on stm32g0 devices.
2024-05-16 12:15:43 -07:00
d45638be1b Merge pull request from felipebalbi/add-shared-bus-example
stm32h7: add shared bus example
2024-05-16 16:41:23 +00:00
3ef62eef53 stm32h7: add shared bus example 2024-05-16 09:38:13 -07:00
17dde65ac2 net-esp-hosted: fix missing enabling defmt feature in heapless. 2024-05-15 22:28:51 +02:00
cc6998be30 Cargo format 2024-05-15 14:12:44 +02:00
db56c4fe6f Add miso pullup to spi configuration, add input as field for speed 2024-05-15 12:54:30 +02:00
3e399a9690 update to remove dma generics 2024-05-14 12:45:07 -04:00
620d182c5a Use read_busy function 2024-05-14 13:53:02 +02:00
663b5b094d Add helper functions 2024-05-14 13:45:37 +02:00
48719d742c Add unwrap to write 2024-05-14 12:22:27 +02:00
94cf606892 Improve write_cmd parameters 2024-05-14 12:16:43 +02:00
9005d26fca Remove comments, add some comments, minor fixes to dsihost.rs 2024-05-14 12:14:34 +02:00
ea70b440cd Merge pull request from qiuweishengx/main
Fix: typo
2024-05-14 07:51:34 +00:00
QWS
c3db435011 Fix: typo 2024-05-14 15:48:00 +08:00
e1435195cb Merge pull request from embassy-rs/u0-hil
stm32/tests: add stm32u0 hil.
2024-05-13 14:23:05 +00:00
7089e5b586 stm32/tests: add stm32u0 hil. 2024-05-13 16:20:52 +02:00
3c52ef60b1 Merge pull request from qiuweishengx/main
In the start_xosc function, the frequency range is set twice.
2024-05-13 12:39:36 +00:00
QWS
75cf17994f In the start_xosc function, the frequency range is set twice. Remove the redundant one. 2024-05-13 19:48:23 +08:00
763b57449f Merge pull request from bobrippling/feat/usb-stall
rp: implement usb stall
2024-05-13 01:38:47 +02:00
aaf4cb0cb2 Merge pull request from embassy-rs/example-papercuts
Fix misc example papercuts.
2024-05-12 23:16:57 +00:00
b131108396 examples/stm32h7rs: add i2c example. 2024-05-13 01:11:49 +02:00
66e3d4da8d examples/stm32: do not enable vbus detect by default, it doesn't work on all boards. 2024-05-13 01:11:49 +02:00
09781db85d embassy-usb-synopsys-otg: default vbus_detect to false. 2024-05-13 01:11:49 +02:00
e2dfdcb509 examples/stm32: reduce packet queue count to avoid OOM on smaller chips. 2024-05-13 01:11:49 +02:00
fd97c52d78 Merge pull request from timbod7/timbod7-rp-usb-serial-example
refactor rp usb_serial example to use a task to run the usb
2024-05-12 23:07:48 +00:00
b56a0419bd Merge pull request from embassy-rs/update-stable
Update stable Rust.
2024-05-12 22:39:17 +00:00
1c9bb7c2e1 time/generic-queue: fix ub in tests. 2024-05-13 00:35:46 +02:00
a8f578751f tests/riscv32: workaround linking bug, update deps.
https://github.com/rust-embedded/riscv/issues/196
2024-05-13 00:16:24 +02:00
a14319f51e stm32: allow some unused. 2024-05-13 00:00:36 +02:00
623d3ec306 stm32/ospi: remove unused trait. 2024-05-12 23:41:46 +02:00
43d51884e2 hal-internal: fix failing test due to not initializing ringbuf. 2024-05-12 23:40:32 +02:00
9556e935f1 Merge pull request from embassy-rs/jamesmunns-patch-1
FAQ: add `patch.crates-io` example
2024-05-12 21:33:19 +00:00
f30b298b0e Update stable Rust. 2024-05-12 23:31:42 +02:00
61fa95f353 Update docs/modules/ROOT/pages/faq.adoc 2024-05-12 21:09:51 +02:00
3294ca36ce FAQ: add patch.crates-io example 2024-05-12 21:07:37 +02:00
9d783d3b35 refactor rp usb_serial example to use a task to run the usb 2024-05-12 21:43:01 +10:00
4cade64ebd Merge pull request from kalkyl/sdmmc
rp: Add embedded-sdmmc example
2024-05-11 16:59:47 +00:00
17d4f0173c spinlock + loop at end to allow defmt to flush properly 2024-05-11 16:09:20 +02:00
fd5412ffc5 rp: Add embedded-sdmmc example 2024-05-11 15:16:20 +02:00
a0da566d22 Merge pull request from qiuweishengx/main
Fix: typo
2024-05-11 11:45:26 +02:00
84cd0c672b rp usb: wake ep-wakers after stalling 2024-05-10 16:27:08 +01:00
94b38449bd rp usb: add stall implementation 2024-05-10 16:27:08 +01:00
QWS
fe68308958 Fix: typo 2024-05-10 22:22:24 +08:00
9cbbedef79 Merge pull request from timokroeger/ucpd-refactor
[UCPD] Use `ChannelAndRequest` helper
2024-05-10 08:49:07 +00:00
5c93e9dadd [UCPD] Use ChannelAndRequest helper 2024-05-10 10:37:56 +02:00
4b4777e6bb Merge pull request from Mirror0/qspi-example
Example usage of QSPI
2024-05-10 07:34:57 +00:00
ee22e98fe1 feat(qspi): add example usage of QSPI 2024-05-10 07:58:30 +02:00
a7eb9bced1 Merge pull request from kalkyl/interrupt
rp: Add raw interrupt handler example
2024-05-09 10:31:15 +00:00
108bfae30d rustfmt 2024-05-09 11:14:09 +02:00
dc108ca31d rp: Add raw interrupt handler example 2024-05-09 11:04:31 +02:00
4a15945395 Merge pull request from plaes/stm32h7rs-cargo-warning
stm32: examples: Use unique crate name for stm32h7rs examples
2024-05-08 21:41:52 +00:00
e94d4e6416 examples: Use unique crate name for stm32h7rs examples
Current name clashes with "regular" stm32h7 thus generating cargo
warning.
2024-05-08 10:13:51 +03:00
1166bcd799 Merge pull request from embassy-rs/fix-peripheralref-deref
Fix PeripheralRef soundness issue allowing &T.
2024-05-07 21:32:45 +00:00
b13ad7e80b Fix PeripheralRef soundness issue allowing &T.
Fix soundness issue introduced in a previous soundness fix https://github.com/embassy-rs/embassy/pull/2602 .
PeripheralRef must not implement DerefMut itself, but the blanket impl must still require DerefMut. Otherwise
you can create two instances of a driver on the same uart by using `&my_uart`.
2024-05-07 23:26:15 +02:00
0f11fecff6 Merge pull request from davidskula/main
impl ReadReady for tcp call can_recv() insted of may_recv()
2024-05-07 20:40:45 +00:00
87aca974b1 impl ReadReady for tcp call can_recv() insted of may_recv() 2024-05-07 16:07:00 +02:00
dc30bcfa2e Merge pull request from wetheredge/mutex-trait-parity
embassy_sync::Mutex: Implement traits to match std
2024-05-07 13:00:43 +00:00
969933cb7b fix fmt for ci 2024-05-06 02:52:22 -04:00
55c8d3f474 add async capture 2024-05-06 02:47:42 -04:00
cc4ff9ef2d embassy_sync::Mutex: Implement traits to match std 2024-05-05 23:10:00 -05:00
b662dfb183 format timer/mod.rs 2024-05-05 23:15:00 -04:00
7b04b0166b cleanup for PR 2024-05-05 23:05:06 -04:00
29d6fa0a4a add get_input_interrupt 2024-05-05 23:00:48 -04:00
431a60ca63 formatting 2024-05-05 22:30:16 -04:00
ad66dc3aab create input_capture 2024-05-05 21:58:54 -04:00
15c3ae8ef6 Merge pull request from onestacked/embassy-net-remove-unused-deps
Removes some unused dependencies in embedded-net.
2024-05-05 18:48:47 +00:00
1da9e326bb Removes some unused dependencies in embedded-net. 2024-05-05 19:43:35 +02:00
0cbdd8b9c8 Merge pull request from PegasisForever/bdma_example
Add example for bdma
2024-05-04 20:03:07 +00:00
2ba8a7b015 Merge pull request from honzasp/timer-get-clock-frequency
stm32/timer: add `low_level::Timer::get_clock_frequency()`
2024-05-04 20:01:52 +00:00
7b3939ca80 stm32/timer: add low_level::Timer::get_clock_frequency() 2024-05-04 19:44:03 +02:00
07c2f169f5 Add versioning for group checks 2024-05-03 19:47:42 -04:00
a91f686544 Check group configuration validity 2024-05-03 19:45:26 -04:00
8e92e8718d Add example documentation 2024-05-03 19:45:26 -04:00
1c10339f47 format 2024-05-03 08:17:29 -04:00
3e87dae578 add example for bdma 2024-05-03 08:14:32 -04:00
0f8b3b8c65 Functional touch sensing 2024-05-02 17:19:08 -04:00
3cd6232d43 update num groups definition 2024-05-02 17:19:08 -04:00
4bf2178de7 remove remaining warnings 2024-05-02 17:17:39 -04:00
253f6c42ee Address versioning and format issues raised by CI 2024-05-02 17:17:39 -04:00
fd69247d70 hyperspecific constructor 2024-05-02 17:17:39 -04:00
af357d2ad0 Prevent invalid config sets 2024-05-02 17:17:39 -04:00
87d2c66ef4 Add io pin masking 2024-05-02 17:17:39 -04:00
0b606b57f1 Add crate documentation 2024-05-02 17:17:39 -04:00
bcd923a4b0 fix create build pin traits 2024-05-02 17:17:39 -04:00
bef76ee057 initial set of io changes 2024-05-02 17:17:38 -04:00
0febc24de7 Initial fill out of driver without IO considerations 2024-05-02 17:17:38 -04:00
bcbb486311 Feature-gate u5 2024-05-02 15:57:52 +02:00
f29deb2488 Add feature gate for f7 2024-05-02 15:39:53 +02:00
4c55931b6a Remove redundant dsi_phy: None from rcc 2024-05-02 14:58:38 +02:00
d5f0bceb7c Clear Receiver enable flag before write in Half-Duplex mode 2024-05-02 15:59:42 +04:00
f468d84a5b Cargo format 2024-05-02 13:50:07 +02:00
9fe50a7639 Add stm32 dsihost driver 2024-05-02 13:43:42 +02:00
45a2abc392 Merge pull request from embassy-rs/h7rs
stm32/i2c: actually add h7rs support.
2024-05-01 17:21:48 +02:00
366f6215c3 stm32/i2c: actually add h7rs support. 2024-05-01 17:00:02 +02:00
7e7d818b87 Merge pull request from embassy-rs/h7rs
stm32/i2c: add h7rs support.
2024-05-01 14:46:48 +00:00
b3ca42f8f9 stm32/i2c: add h7rs support. 2024-05-01 16:33:34 +02:00
1b582c6830 Merge pull request from kalkyl/webusb-win
rp: WebUSB example - add Windows compatibility
2024-05-01 16:31:45 +02:00
66ee0c44d3 Example and documentation on how to Calculate correct checksum.
+ Include the package format documentation.
+ Cycle through all three colours in three different speed.
- Remove the `write_cmd_bytes()`. Superfluous.
2024-05-01 12:08:13 +01:00
61d0c068ff Finish the read part.
* Don't need separate task for this.
* **Must** read one byte at a time, then merge them into one Vec.
* To better demonstrate, cycle through the three colours Red, Blue,
  Purple.
2024-05-01 12:08:13 +01:00
c24805b83d Added PIO UART examples for rp to talk to an R503 fingerprint scanner. 2024-05-01 12:08:13 +01:00
318425040a Merge pull request from embassy-rs/h7rs
stm32: add support for STM32H7[RS] "bootflash line", add HIL tests.
2024-05-01 02:34:58 +02:00
fb67fe0a6c stm32: add support for STM32H7[RS] "bootflash line", add HIL tests. 2024-05-01 02:24:45 +02:00
5568cb89c3 Add ch32-hal to HAL list 2024-05-01 08:15:22 +08:00
ecc910b76d Release embassy-usb-synopsys-otg v0.1.0 2024-04-30 17:24:32 +02:00
7896e8aba7 rp: WebUSB example - add Windows compatibility 2024-04-30 09:59:06 +02:00
56a7b10064 Merge pull request from embassy-rs/update-metapac-42
stm32: add support for H5[23], U5[FG], WBA5[045].
2024-04-29 22:12:12 +00:00
b3d94160b4 stm32: add support for H5[23], U5[FG], WBA5[045]. 2024-04-30 00:09:49 +02:00
e6d90b18c0 Merge pull request from embassy-rs/update-metapac-42
stm32: update metapac. Adds U5 LPDMA, fixes ADC_COMMONs.
2024-04-29 22:02:37 +00:00
1ed2a0504a stm32/dma: add support for same channel with different req in different DMAs/DMAMUXes. 2024-04-29 23:56:15 +02:00
7fb74ff756 stm32: rustfmt generated files in build.rs 2024-04-29 23:51:33 +02:00
2410e91785 Merge pull request from pkoevesdi/main
fixed: example loops crashing after 256 passes
2024-04-29 21:09:03 +00:00
56b4d39df9 Update wdt.rs: reverted change, probably unneccesary here 2024-04-29 22:45:02 +02:00
a2ea307114 Update wdt.rs: reverted changes, probably unneccesary 2024-04-29 22:42:46 +02:00
5df703cf4b Update wdt.rs: added missing type 2024-04-29 22:38:58 +02:00
b6f9dbfb5b fixed: example loops crashing after 256 passes 2024-04-29 22:31:16 +02:00
6f44d7a9df stm32: update metapac. Adds U5 LPDMA, fixes ADC_COMMONs. 2024-04-29 20:52:27 +02:00
679160a1c5 Merge pull request from jamesmunns/james/stm32-i2cv1-errata
stm32: Add workaround for STM32 i2cv1 errata
2024-04-29 12:06:08 +00:00
49a90a3b90 Merge pull request from adamgreig/stm32-dac-new-int
stm32: dac: fix new_internal not setting mode as documented
2024-04-29 11:58:50 +00:00
5ce3a6b61e Add workaround for STM32 i2cv1 errata 2024-04-29 12:32:33 +02:00
cb60f06594 stm32: dac: fix new_internal not setting mode as documented 2024-04-29 02:28:20 +01:00
51a4a73323 Merge pull request from CirrusNeptune/cyw43-precomputed-psk
cyw43: Add function to join WPA2 network with precomputed PSK.
2024-04-28 23:16:53 +00:00
3db771f4b6 Make join_wpa2_passphrase_info private 2024-04-28 16:04:52 -07:00
7432c4069b passphrase_info does not have to be passed &mut 2024-04-28 15:34:54 -07:00
d2f6ce5afd cyw43: Add function to join WPA2 network with precomputed PSK.
With flags = 0 in PassphraseInfo, CYW firmware skips the PBKDF2 PSK
derivation. This makes it possible avoid storing unhashed passwords.

The wpa_passphrase utility may be used to generate this PSK.
2024-04-28 15:22:11 -07:00
08314b0940 Merge pull request from AtoVproject/feature/web-usb-class
WebUSB implementation
2024-04-28 21:24:21 +02:00
14225eb3a0 Merge pull request from ftk/timer32fix
stm32 timer: fix 32bit timer off by one ARR error
2024-04-28 21:24:14 +02:00
f60c094891 Merge pull request from eZioPan/h5-low-power
low power for h5
2024-04-28 18:39:35 +00:00
bbedcf9b0b Merge pull request from qwerty19106/patch-1
Improve Uart::new_half_duplex docs
2024-04-28 18:37:14 +00:00
095af92791 feature: WebUSB capability implementation
This adds the WebUSB implementation as per
https://wicg.github.io/webusb/, using one in-endpoint and one
out-endpoint as well as an example for the RP2040 to illustrate this
capability.
2024-04-27 23:14:16 +02:00
4617f6c754 Merge pull request from cyril-marpaud/patch-2
fix: typo
2024-04-27 19:54:50 +00:00
0b0027aac3 Merge pull request from bugadani/ep_count
Synopsys: Make max EP count configurable
2024-04-27 19:54:27 +00:00
d9e59e8e42 low power for h5 2024-04-28 00:33:02 +08:00
887d7e1430 Configure MAX_EP_COUNT via const generics 2024-04-27 18:01:45 +02:00
61e3ca049c Only access the necessary parts of State 2024-04-27 17:57:11 +02:00
7b4d2ab1be Group endpoint states into a per-endpoint struct 2024-04-27 17:18:40 +02:00
ede07883fe fix: typo 2024-04-27 16:39:21 +02:00
ftk
e7bfd7bac9 stm32 timer: fix 32bit timer off by 1 ARR error 2024-04-27 15:49:30 +03:00
c929ad226b Improve Uart::new_half_duplex docs 2024-04-27 12:22:35 +04:00
34074e6eb0 Merge pull request from embassy-rs/cleanups
Misc cleanups.
2024-04-26 21:59:31 +00:00
5732ee7ca9 Reduce use of the full futures crate. 2024-04-26 23:22:25 +02:00
597315873d Remove leftover cargo new boilerplate. 2024-04-26 22:59:50 +02:00
a8401ec94e stm32/usart: remove wildcard import. 2024-04-26 22:59:11 +02:00
026445d010 Merge pull request from chrysn-pull-requests/prep-embedded-nal-async-udp
net/udp: Relay full UdpMetadata instead of only remote endpoint in poll_ functions
2024-04-26 20:34:33 +00:00
1b36bef4b8 Merge pull request from alexmoon/wait-disabled
Add `wait_disabled` method to `embassy_nrf::usb::Endpoint`
2024-04-26 20:31:09 +00:00
f2c95b86e7 Merge pull request from Dygear/doc-updates
Link back to Cargo.toml section.
2024-04-26 20:28:34 +00:00
5b0735688d Merge pull request from BjornTheProgrammer/main
Added PIO pwm examples for rp
2024-04-26 20:24:30 +00:00
49b143ec6d Merge pull request from bugadani/synopsys
Extract Synopsys USB OTG driver from embassy-stm32
2024-04-26 20:23:09 +00:00
7bc92584e1 Merge pull request from jamesmunns/james/embassy-usb-0_2
embassy-usb: Update version and add changelog
2024-04-26 20:22:46 +00:00
b7479e36e1 Merge pull request from bsodmike/add_trace_logging_for_uart
Add trace logging for USART
2024-04-26 20:22:22 +00:00
b7841ec669 Merge pull request from HaoboGu/main
doc: add RMK to embassy in the wild
2024-04-26 20:21:57 +00:00
0d07a7b95d Add embassy-usb-synopsys-otg to docs build. 2024-04-26 22:21:04 +02:00
bc0408dc4b Remove extra disable call 2024-04-26 22:16:45 +02:00
3dc54c8c44 Add some metadata 2024-04-26 18:28:41 +02:00
7ce2594eb7 Reset inited flag to allow re-enabling 2024-04-26 18:18:08 +02:00
50aefb4174 Hide the Dir trait 2024-04-26 18:13:15 +02:00
91c42e0b9e Extract synopsys otg driver 2024-04-26 17:58:23 +02:00
5002ff00de doc: add RMK to embassy in the wild
Signed-off-by: Haobo Gu <haobogu@outlook.com>
2024-04-25 23:50:51 +08:00
02bb85a791 Add trace logging for USART 2024-04-24 01:59:00 +05:30
0d0d8e14e2 Update dependent versions 2024-04-23 19:48:16 +02:00
8c98809f1e Update version and add changelog 2024-04-23 19:44:34 +02:00
4d4cbc0dd3 Merge pull request from borisfaure/mut-hid-request-handler
usb::hid::RequestHandler::set_report(&mut self, ...)
2024-04-23 17:42:56 +00:00
1de44e7086 Merge pull request from MaxiluxSystems/feature/fdcan-runtime-cfg
stm32: can: fd: Properties for common runtime get/set operations
2024-04-23 13:46:09 +00:00
e15fd5895f stm32: can: fd: Properties: simplify reg accesses 2024-04-23 12:46:42 +01:00
521c132e34 stm32: can: fd: introduce BusErrorMode with docs and Properties getter 2024-04-23 12:34:17 +01:00
6ca7e0feab stm32: can: fd: fix a couple doc comments 2024-04-23 12:34:02 +01:00
511bee7230 Merge pull request from ericyanush/feat/add-bxcan-sleep-wakeup
Add stm32 bxCAN sleep/wakeup functionality
2024-04-22 22:57:22 +00:00
7b47d53de2 Update sharing_peripherals.adoc
Fixed Typo.
2024-04-22 17:01:22 -04:00
ebb3148124 Update time_keeping.adoc
Fixed Typo.
2024-04-22 17:00:44 -04:00
5c56aff9c2 rustfmt fixes 2024-04-22 14:05:28 -06:00
e65503e255 Add sleep/wakeup handling for bxCAN peripherals 2024-04-22 14:04:39 -06:00
3e00c1ac52 rustfmt whitespace fixes 2024-04-22 14:01:48 -06:00
e581c9f027 Merge pull request from joelsa/add-vbus-faq
Add information about vbus_detection to the FAQ and link it in all USB examples.
2024-04-22 13:29:38 +00:00
846abfae2b examples: stm32: can: fix build 2024-04-22 13:31:01 +01:00
543c02e649 stm32: can: fd: fix test build for all relevant chips 2024-04-22 13:30:57 +01:00
263071d016 stm32: can: fd: Properties: rm &mut refs; make !Sync; rename getters 2024-04-22 13:14:32 +01:00
7f55a28a50 stm32: can: fd: Properties for common runtime get/set operations 2024-04-22 13:14:32 +01:00
a9878a243d Merge pull request from nerwalt/channel-ready-to-receive
Adding ready_to_receive to Channel and Receiver
2024-04-22 10:25:02 +00:00
68a4fd8f4a Enable LEC interrupt as well 2024-04-22 01:52:10 -06:00
6e1290b3f1 Ensure bus errors are forwarded only once, enable bus off/passive/warning interrupts 2024-04-22 01:46:24 -06:00
01b36a4434 rustfmt usb examples 2024-04-22 01:06:59 +02:00
896d0e7cd8 Add comment on vbus_detection to all USB examples 2024-04-22 00:52:37 +02:00
152d514f52 Fix spelling in vbus_detection doc comment 2024-04-22 00:39:59 +02:00
79fbdb1fe0 Add USB debugging section to FAQ 2024-04-22 00:38:09 +02:00
a5b006268b Merge pull request from jannic/pio_pull_doc_improvement
Add a comment to the pio rx fifo pull function
2024-04-21 21:32:18 +00:00
3f8736e872 Add a comment to the pio rx fifo pull function 2024-04-21 21:24:15 +00:00
d2ba751c06 Changed attach to new 2024-04-21 10:00:57 -07:00
7658966486 Merge branch 'main' of https://github.com/embassy-rs/embassy 2024-04-20 22:12:28 -07:00
0a2d58ec5b Added PIO pwm examples for rp
Two additionally `rp` examples, `pio_pwm.rs`, which is a baremetal example of how to do pwm with pio, and `pio_servo.rs`, which is a more extended example of pwm and pio with servos.
2024-04-20 22:12:24 -07:00
b03f23ab64 Update sharing_peripherals.adoc 2024-04-19 21:36:03 -04:00
b2f7ce99d6 Update time_keeping.adoc 2024-04-19 21:35:25 -04:00
30dcc88093 Adding ready_to_receive to Channel and Receiver
Adding ReceiveReadyFuture
2024-04-19 12:16:12 -06:00
49435f79b3 fixup! net/udp: Relay full UdpMetadata instead of only remote endpoint in poll_ functions 2024-04-19 15:54:56 +02:00
2c7c39d1db fixup! net/udp: Relay full UdpMetadata instead of only remote endpoint in poll_ functions 2024-04-19 15:51:27 +02:00
e6bf6c7a49 Merge branch 'main' into prep-embedded-nal-async-udp 2024-04-19 15:22:57 +02:00
da86c08651 Merge pull request from retif/patch-1
Update layer_by_layer.adoc to fix a typo
2024-04-19 10:40:34 +00:00
0dcf034857 Update layer_by_layer.adoc
Fixed typo
2024-04-19 13:37:58 +03:00
00708d8c27 Merge pull request from qwerty19106/stm32_fix_half_duplex_uart
Allow Uart::new_half_duplex for any usart version
2024-04-18 14:49:11 +00:00
0ee7748811 Merge pull request from MaxiluxSystems/feature/fdcan-bus-off
stm32: can: fd: implement bus-off recovery
2024-04-18 14:48:13 +00:00
ce58cd0f1c Allow Uart::new_half_duplex for all usart_vx 2024-04-18 10:34:52 +04:00
78ca904e96 Merge pull request from cyril-marpaud/patch-1
fix: typo
2024-04-17 15:56:31 +00:00
80b3db4ea6 stm32: can: fd: implement bus-off recovery
as per RM0492 and other relevant RMs, bus-off recovery is not automatic.
CCCR.INIT is set by the device upon bus-off; the CPU must reset
CCCR.INIT to initiate the recovery.
2024-04-17 14:58:08 +01:00
901bdfc7b8 stm32: can: fd: on_interrupt: simplify, rm redundant code
PED, PEA are never enabled in the interrupt enable code in
peripheral.rs; no need to process the flags here
2024-04-17 14:57:58 +01:00
34362b77cc fix: typo 2024-04-17 12:56:18 +02:00
10ee1c1ae8 stm32: ensure the core runs on HSI clock while setting up rcc 2024-04-16 23:36:47 +02:00
bab4affe7c Merge pull request from diondokter/u0-dion
More U0 support
2024-04-16 18:45:09 +00:00
38e71a2438 ci: add u0 examples. 2024-04-16 20:38:09 +02:00
2bd5095991 stm32/usb: enable USV for U0. 2024-04-16 20:37:42 +02:00
e5e9fb78af update stm32-metapac. 2024-04-16 20:37:10 +02:00
40ad87730f Merge pull request from idaniel86/stm32-g4-adc-channel-number-issue
Bug: There are at most 18 channels for the STM32G4 ADCs.
2024-04-16 18:35:56 +00:00
32b1b4067f Bug: There are at most 18 channels for the ADC. 2024-04-16 20:27:12 +02:00
34668bae5c Add wait_disabled method to embassy_nrf::usb::Endpoint 2024-04-16 12:14:22 -04:00
bd13b5c060 More probe-run -> probe-rs run. 2024-04-16 17:07:13 +02:00
b66736a4d3 Merge pull request from embassy-rs/jamesmunns-patch-1
L4 Example: probe-run to probe-rs
2024-04-16 17:05:53 +02:00
4202dac8a6 L4 Example: probe-run to probe-rs
Reverts some change made in https://github.com/embassy-rs/embassy/pull/1792
2024-04-16 17:03:44 +02:00
90f1d29c24 Fix rng clock 2024-04-16 16:36:10 +02:00
b3710a31f0 Merge pull request from MaxiluxSystems/fix/adc-blocking-delay-overflow
stm32: adc: fix blocking_delay_us() overflowing when sys freq is high
2024-04-16 14:22:39 +00:00
d928663bae stm32: adc: fix blocking_delay_us() overflowing when sys freq is high
e.g. H503 running at 250 MHz resulted in an upper bound of 17 us here.
casting up to u64 for intermediate calc allows the upper bound to be
increased by a factor of 1e6
2024-04-16 15:13:31 +01:00
a5f754238b Add spi, i2c and fix usart 2024-04-16 15:33:23 +02:00
53cb84d3d6 Added RTC example 2024-04-16 15:24:20 +02:00
e421215dff Merge pull request from embassy-rs/jamesmunns-patch-1
FAQ: Common STM32 stumbling blocks
2024-04-16 12:05:40 +00:00
c8c7c718f3 Merge branch 'master' into u0-dion 2024-04-16 13:48:18 +02:00
ca139b9177 Merge pull request from jamesmunns/james/usb-otg-errata
Add critical sections to avoid USB OTG Errata
2024-04-16 11:41:59 +00:00
2315a39293 Remove nested CS 2024-04-16 13:39:00 +02:00
75352d181c Add critical sections to avoid USB OTG Errata 2024-04-16 12:07:40 +02:00
8988df9ac1 FAQ: Common STM32 stumbling blocks
Adds some commonly encountered issues.

Help wanted: if anyone has a working BDMA linker script setup, it would be good to add here.
2024-04-16 11:07:42 +02:00
e38f1011d6 Merge pull request from embassy-rs/usart-nodma
stm32/usart: remove DMA generic params.
2024-04-16 00:05:43 +00:00
d6b1233f16 stm32/usart: remove DMA generic params. 2024-04-16 02:00:55 +02:00
524c24c8b3 Merge pull request from MaxiluxSystems/feature/stm32h50-flash-swap-banks
stm32: flash: h50: implement bank swapping
2024-04-15 22:35:07 +00:00
6d122c274f Merge pull request from wagcampbell/wgc/u5-flash-non-secure
Support non-secure flash operations on STM32U5
2024-04-15 22:28:34 +00:00
c5119c6318 Add support for using secure registers 2024-04-15 18:02:29 -04:00
76bf3f733d Merge pull request from embassy-rs/i2c-nodma
stm32/i2c: remove DMA generic params.
2024-04-15 21:45:08 +00:00
913bb19a34 stm32/i2c: remove DMA generic params. 2024-04-15 23:40:12 +02:00
2eab099b85 stm32/spi: rename rxdma, txdma -> rx_dma, tx_dma. 2024-04-15 21:56:08 +02:00
09a284e959 stm32: rename mod traits to macros. 2024-04-15 21:52:40 +02:00
02da66aec8 stm32/dma: add ChannelAndRequest helper. 2024-04-15 21:52:40 +02:00
d66c054aae Merge pull request from embassy-rs/spi-nodma
stm32/spi: remove DMA generic params.
2024-04-15 19:33:12 +00:00
be087e5d43 stm32/spi: remove DMA generic params. 2024-04-15 21:23:49 +02:00
2fa0bb7d6e Use non-secure registers for u5 flash 2024-04-15 14:59:31 -04:00
27ba2ad5b0 Merge pull request from ImTheSquid/main
Add MAC address getter to cyw43 controller
2024-04-15 18:21:39 +00:00
40e7ea47ba temporarily disable stm32l152re/usart_rx_ringbuffered test. 2024-04-15 20:20:48 +02:00
aeb4daa22f Merge branch 'embassy-rs:main' into main 2024-04-15 14:15:53 -04:00
6ffecb1250 Added MAC address getter to cyw43 controller 2024-04-15 14:11:28 -04:00
ae4fb433ae usb-hid: all the RequestHandler method accept &mut self 2024-04-15 19:57:18 +02:00
9341ef3b47 examples: request_handler is mutable 2024-04-15 19:57:18 +02:00
41415fae0d usb/hid: make RequestHandler::set_report(&mut self,…)
That way, it is possible to change some fields in the RequestHandler based
on outside report.
2024-04-15 19:57:18 +02:00
3f4e326ec5 Merge pull request from embassy-rs/mux-nonexhaustive
stm32/rcc: make ClockMux non_exhasutive.
2024-04-15 13:57:10 +02:00
f66b63017c stm32: flash: h50: implement bank swapping 2024-04-15 11:37:40 +01:00
8fe88847d8 fixup! net/udp: Relay full UdpMetadata instead of only remote endpoint in poll_ functions 2024-04-15 10:02:35 +02:00
fcaa7de87e stm32/rcc: make ClockMux non_exhasutive. 2024-04-15 01:12:28 +02:00
8e850de592 Merge pull request from c410-f3r/main
Add `map` method
2024-04-15 01:07:11 +02:00
a25cae46c5 ci: test embassy-sync on miri. 2024-04-15 00:52:42 +02:00
86706bdc14 Add map method 2024-04-14 19:35:59 -03:00
953e1cd6f6 Merge pull request from embassy-rs/update-nightly
update nightly.
2024-04-15 00:02:45 +02:00
1741209ba2 update nightly.
Fixes docs build.
2024-04-14 23:59:38 +02:00
7989e3b59d Merge pull request from plaes/nrf-changelog
nrf: Add basic CHANGELOG summarizing changes in embassy-nrf
2024-04-14 23:46:33 +02:00
70283f128a Merge pull request from simpkins/futures_test
Fix embassy-futures test failure
2024-04-14 22:30:46 +02:00
e147f29b5c ci: test embassy-futures. 2024-04-14 22:30:31 +02:00
5178c24cf4 Fix embassy-futures test failure
Running `cargo test` in embassy-futures was failing.  The `no_run` tag
on this doc example caused it to still try and compile this example,
just not run it, and compilation failed.  This updates the example so
that it can successfully compile and run.
2024-04-14 22:30:14 +02:00
2f5023f4a7 Merge pull request from embassy-rs/u0
Add STM32U0 support.
2024-04-14 22:29:35 +02:00
65c085ce91 Add stm32u0 support. 2024-04-14 22:29:07 +02:00
87b79d4499 Merge pull request from chemicstry/rcc_methods
Expose RCC enable and disable methods
2024-04-14 20:14:46 +00:00
b6d06661bd Merge pull request from taunusflieger/feature/fix-spi
Fix for SPI and CRC reg changes in stm32-data
2024-04-14 20:09:30 +00:00
4079a8acf8 stm32/adc: update g4 for new pac. 2024-04-14 22:06:41 +02:00
1f3b690f76 stm32/flash: remove otp flash regions (removed in newer metapacs). 2024-04-14 22:06:41 +02:00
ffc61f78b0 stm32/spi,crc: update for new PAC 2024-04-14 22:06:41 +02:00
e224e6cef4 Add CRC 2024-04-14 01:10:20 +02:00
ca84be80bc Add wdt and flash 2024-04-14 00:45:53 +02:00
0a785585bc Remove temp variable 2024-04-14 00:08:06 +02:00
b659e3d529 Add ADC 2024-04-14 00:04:13 +02:00
5f23e39052 Add some examples.
- usart works
- dac works
- rng gets stuck on while loop
- usb_serial works, but cannot test due to lack of user usb port
- adc needs work and does not work yet
2024-04-13 18:40:46 +02:00
af03e1653a Disable the speed limitation 2024-04-13 14:07:01 +02:00
ec6ff217ca Add stm32u0 support. 2024-04-13 03:57:21 +02:00
52bd24499c stm32/adc: update g4 for new pac. 2024-04-13 03:34:28 +02:00
d9426549c3 stm32/flash: remove otp flash regions (removed in newer metapacs). 2024-04-13 03:33:16 +02:00
9f4d320d67 stm32/spi,crc: update for new PAC 2024-04-13 03:33:04 +02:00
64b806db0b Expose RCC enable and disable methods 2024-04-12 18:07:44 +03:00
b1902957c9 Merge pull request from embassy-rs/f4-otg-hs-fix
stm32/otg: fix OTG_HS in FS mode.
2024-04-12 01:37:01 +00:00
499c6e84a3 stm32/otg: fix OTG_HS in FS mode. 2024-04-12 03:33:20 +02:00
2a157585d1 Merge pull request from VegaDeftwing/spelling-and-shellcheck
Spelling and whitespace fixes
2024-04-11 22:59:50 +02:00
b74a4394db Merge pull request from borisfaure/stm32-usb-typo-in-doc
stm32: fix typo in doc
2024-04-11 22:58:42 +02:00
98b4eb4491 stm32: fix typo in doc 2024-04-11 22:51:34 +02:00
a3f8048877 Revert xargs changes 2024-04-11 20:21:30 +00:00
80fadada70 .sh whitespace and shellcheck fixes 2024-04-11 19:47:31 +00:00
9053b6b5b3 Fix spelling and white space mistakes 2024-04-11 19:45:38 +00:00
f5f776f815 Merge pull request from GustavToft/main
embassy-net: Implement RAW sockets
2024-04-11 08:54:01 +00:00
b578d3e645 Removed generic type parameter. 2024-04-11 10:34:17 +02:00
fd5113eeb0 Restore vscode settings 2024-04-11 09:08:10 +02:00
fc260fbb01 Merge branch 'main' of https://github.com/embassy-rs/embassy 2024-04-11 09:07:38 +02:00
ec0896037a Removed Result for send and poll_send. 2024-04-11 08:29:06 +02:00
d4ba6ccc37 Merge branch 'main' of https://github.com/GustavToft/embassy 2024-04-11 08:27:30 +02:00
b109263705 Merge pull request from andresv/stm32-adc-eh1-delayns
stm32 adc: remove delay trait
2024-04-10 19:27:08 +00:00
6e24dc58c6 stm32 adc: use fn blocking_delay_us(us: u32) 2024-04-10 22:23:49 +03:00
4ffe35c840 Merge branch 'main' of https://github.com/embassy-rs/embassy 2024-04-10 13:26:59 +02:00
11bf2ca987 Fixed commented issues 2024-04-10 13:26:12 +02:00
fcb270bced nrf: Add basic CHANGELOG summarizing changes in embassy-nrf 2024-04-10 11:02:35 +03:00
fd901fc7e0 stm32: update adc examples 2024-04-10 10:57:52 +03:00
68b1a840c6 stm32 adc: remove DelayNs 2024-04-10 10:33:15 +03:00
ab36329dce Merge branch 'main' of https://github.com/embassy-rs/embassy 2024-04-10 09:20:46 +02:00
6663be0b36 Fixed commented issues. 2024-04-10 09:07:20 +02:00
fd802ffdfd stm32: use embedded_hal_1::delay::DelayNs
This makes delay compatible with https://lib.rs/crates/rtic-monotonics.
2024-04-09 22:32:09 +03:00
c575c7dc6c Merge pull request from simpkins/usb_mps
USB: fix comments about the config.max_packet_size_0 field
2024-04-09 17:40:57 +00:00
03a87add15 USB: fix comments about the config.max_packet_size_0 field
Fix the comment about the default value: this defaults to 64 rather
than 8 bytes.

It seems like the max packet size for endpoint 0 should normally be
selected automatically, rather than being part of the config.  At best
it seems like this setting should just be a hint that gets used if when
the bus is operating at full speed.  The contents of the device
descriptor should ideally be updated with the correct max packet size
after bus enumeration completes.  In practice always using 64 is
probably fine if low speed environments never need to be supported.
(Super speed requires a max packet size of 512 bytes, which I didn't
list in the comments here.)
2024-04-09 10:31:19 -07:00
7f1bedcee0 net/udp: Relay full UdpMetadata instead of only remote endpoint in poll_ functions
This is a breaking change for users of the poll_ functions. (Some might
not notice if they already pass in an IpEndpoint into poll_send_to, or
discard that item in poll_recv_from).
2024-04-08 11:59:21 +02:00
029636e6fc Merge pull request from sourcebox/sync-additions
embassy-sync: Add len, is_empty and is_full functions to Channel.
2024-04-07 23:06:23 +00:00
fa05256f05 embassy-sync: Add len, is_empty and is_full functions to Channel. 2024-04-08 00:40:42 +02:00
803b76df86 Fix crash caused by using higher MSI on STM32WL 2024-04-08 01:23:49 +08:00
a4eebdcc68 Merge pull request from barnabywalters/stm32-multiprio
[embassy-stm32] added comments explaining multiprio interrupts
2024-04-07 16:16:13 +00:00
effc08dde3 Incorporated adam’s suggestion into all multiprio comments 2024-04-07 16:22:42 +02:00
56d34eefaa Apply suggestions from code review
Co-authored-by: becothas <41289937+becothas@users.noreply.github.com>
2024-04-07 15:33:51 +02:00
cf0097162c [embassy-stm32] added comments explaining multiprio interrupts 2024-04-07 15:19:56 +02:00
328cb99068 Merge pull request from barnabywalters/patch-1
Add VBUS detection blackpill comment
2024-04-05 20:28:15 +00:00
99ea564f1c Add VBUS detection blackpill comment 2024-04-05 22:11:01 +02:00
9884460787 Merge pull request from Dillonmcewan/rcc-docs-typo
Fix 'clocok' typo in RCC docs
2024-04-05 17:27:18 +00:00
2ad82c2adf Fix 'clocok' typo in RCC docs 2024-04-05 10:07:15 -07:00
370436d675 Merge pull request from MaxiluxSystems/fix/adc-h5-ch0
stm32: adc: v3: [h5] set OR.OP0 to 1 when ADCx_INP0 is selected, per RM
2024-04-05 12:59:13 +00:00
c953b9045b stm32: adc: v3: [h5] set OR.OP0 to 1 when ADCx_INP0 is selected, per RM 2024-04-05 13:00:33 +01:00
20110ce6c7 Merge pull request from embassy-rs/qspi-autolen
stm32/qspi: autodeduce transfer len from buffer len.
2024-04-04 23:47:02 +00:00
c2b8ddaa83 stm32/qspi: autodeduce transfer len from buffer len.
mirrors change made in .
2024-04-05 01:41:47 +02:00
485bfd165c Merge pull request from pawel00100/rp_pwm_input_pull-up_and_pull-down
Add parameter for enabling pull-up and pull-down in RP PWM input mode
2024-04-04 23:21:56 +00:00
143b288333 Add parameter for enabling pull-up and pull-down in RP PWM input mode 2024-04-05 01:20:34 +02:00
9d0b682b2d Merge pull request from eZioPan/stm32-timer-api-leak
stm32: fix timer api leaking
2024-04-04 23:04:38 +00:00
3d7d3e0286 stm32/time-driver: always use CC interrupt.
This avoids cfg's, because it works both for timers that have a a dedicated CC interrupt
line, and timers where all interrupts go to a single interrupt line.
2024-04-05 00:56:21 +02:00
8294bbc99d Merge pull request from embassy-rs/unsealedify
nrf,rp,stm32: remove mod sealed.
2024-04-04 22:55:31 +00:00
5dc3738bc2 add missing interrupt for timer 2024-04-05 00:51:20 +02:00
78b9cb98d4 "separate CC interrupt" is for AdvCh4 only 2024-04-05 00:51:20 +02:00
348a46b110 move enable_outputs to private trait ...
... to avoid API leaking.
2024-04-05 00:51:20 +02:00
d597815c9a stm32: remove last few mod sealed's. 2024-04-05 00:48:46 +02:00
a84b33995e rp: remove mod sealed. 2024-04-05 00:48:46 +02:00
ab85eb4b60 nrf: remove mod sealed. 2024-04-05 00:48:46 +02:00
0e1208947e Merge pull request from schmettow/patch-1
Added YLab project to "in the wild"
2024-04-04 21:44:40 +00:00
a0439479f7 Merge pull request from sgoll/i2c-async-transaction
stm32/i2c(v1): Implement asynchronous transactions
2024-04-04 21:43:21 +00:00
921fa9af80 Merge pull request from nautd/karun/main_octospi_implementation
Octospi implementation
2024-04-04 21:41:34 +00:00
6c35a1769d Merge pull request from eZioPan/stm32-cordic
stm32 CORDIC driver
2024-04-04 21:32:27 +00:00
a373633d0d Merge branch 'main' of https://github.com/GustavToft/embassy 2024-04-04 15:52:44 +02:00
0427c442ea Implement raw sockets in embassy-net 2024-04-04 15:51:25 +02:00
067e422863 Merge pull request from msrd0/multiprio-example-stm32h7
Add multiprio example for stm32h7 inspired by stm32f4
2024-04-04 12:55:03 +00:00
8fbd21d216 Add multiprio example for stm32h7 inspired by stm32f4 2024-04-04 13:22:52 +02:00
027a1e6f32 Merge pull request from davidzwa/patch-1
Update faq.adoc with memory.x definition helping hand
2024-04-04 05:05:25 +00:00
f873e5944e Merge pull request from alexmoon/semaphore-fix
Fix `FairSemaphore` bugs
2024-04-04 05:04:19 +00:00
c9acebf783 Fix FairSemaphore bugs
- `acquire` and `acquire_all` futures were `!Send`, even for `M: RawMutex + Send` due to the captured `Cell`.
- If multiple `acquire` tasks were queued, waking the first would not wake the second, even if there were permits remaining after the first `acquire` completed.
2024-04-03 19:13:57 -04:00
330a3b0488 Fix passing of dual quad param to inner constructor 2024-04-03 16:42:16 -04:00
4ea7dfce17 Fix build errors
Add empty checks/peripheral busy waits
2024-04-03 16:36:02 -04:00
446965a903 Update faq.adoc 2024-04-03 22:33:21 +02:00
7aef047def Update faq.adoc
github link
2024-04-03 22:32:28 +02:00
54be08afe4 Update faq.adoc with memory.x definition helping hand 2024-04-03 22:24:09 +02:00
80aeea93fd Configure dual-quad setting by constructor 2024-04-03 16:05:23 -04:00
b3bbf42b8b Remove data length from transfer config
Remove non hal traits
Fix function comments
2024-04-03 15:58:20 -04:00
630fd90d26 Address PR comments 2024-04-03 14:01:40 -04:00
a031b3b79e Update metapac 2024-04-03 13:42:38 -04:00
6efac5562a Merge remote-tracking branch 'upstream/main' into i2c-async-transaction 2024-04-03 16:53:45 +02:00
66a7b62909 Add octospi version dependency for max transfer support 2024-04-02 16:24:31 -04:00
1fd260e4b1 Merge pull request from borisfaure/stm32-typo-in-doc
stm32: fix typo in doc
2024-04-02 20:21:56 +00:00
1e399fbf9d stm32: fix typo in doc 2024-04-02 22:16:11 +02:00
166c95be6c Update to use private supertrait, following PR#2730 2024-04-02 16:14:10 -04:00
9344f55ff3 Merge branch 'main' into karun/main_octospi_implementation 2024-04-02 15:51:50 -04:00
2caea89b6a Update build dependency as well 2024-04-02 15:50:57 -04:00
d62615b536 Update metapac to use PR with octospi rcc updates 2024-04-02 15:48:39 -04:00
990f271767 Merge pull request from alexmoon/sync-semaphore
Semaphore synchronization primitive
2024-04-02 19:15:36 +00:00
0e709ab0ea Merge pull request from UPB-FILS-MA/rp_rename_pwm_channel_to_slice
rp2040: rename all usages of pwm channel to pwm slices
2024-04-02 17:10:27 +00:00
7c36e8dbc7 rename pins data type and the macro 2024-04-02 20:05:46 +03:00
d35572c11f rename pwm channels to pwm slices, including in documentation 2024-04-02 19:50:30 +03:00
7b9546c9c8 rename the Channel trait to Slice and the PwmPin to PwmChannel 2024-04-02 19:42:37 +03:00
7506519a13 Merge remote-tracking branch 'upstream/main' into i2c-async-transaction 2024-04-02 18:10:25 +02:00
47b492ba05 retrigger checks 2024-04-02 12:01:33 -04:00
e29b5619d1 Merge pull request from UPB-FILS-MA/rp_rename_pwm
rp2040: Rename PWM_CH to PWM_SLICE
2024-04-02 14:37:46 +00:00
aa9eb2ab01 rename PWM_CH to PWM_SLICE 2024-04-02 17:20:35 +03:00
804b19b116 Merge remote-tracking branch 'upstream/main' into i2c-async-transaction 2024-04-02 16:06:15 +02:00
016d552d1a Merge pull request from embassy-rs/stm32-bxcan-flatten
stm32/can: simplify bxcan api, merging bx::* into the main structs.
2024-04-02 10:32:19 +00:00
c8936edb6c stm32/can: simplify bxcan api, merging bx::* into the main structs.
The bx::* separate structs (Can, Rx, Tx) and separate `Instance` trait
are a relic from the `bxcan` crate. Remove them, move the functionality
into the main structs.
2024-04-02 11:08:03 +02:00
e0f0430e2c Merge pull request from tyler-gilbert/add-async-stop-stm32-dma_bdma
Add async stop() function to stm32 bdma_dma
2024-04-01 16:29:53 +00:00
cb01d03835 Add async stop() function to stm32 bdma_dma 2024-03-31 16:31:47 -05:00
0549dd5fd7 Merge pull request from Frostie314159/ticker_send_sync
Made `Ticker::next` `Send+Sync`.
2024-03-31 20:23:30 +00:00
67c9cc2c4b Merge branch 'embassy-rs:main' into ticker_send_sync 2024-03-31 20:48:05 +02:00
6564fab092 Merge remote-tracking branch 'upstream/main' into i2c-async-transaction 2024-03-31 19:13:42 +02:00
a2f9aa592e Made Ticker::next Send+Sync. 2024-03-31 15:07:01 +02:00
f8a6007e1c Semaphore synchronization primitive
This provides both a "greedy" and "fair" async semaphore implementation.
2024-03-30 22:25:41 -04:00
6634cc90bc Merge pull request from UPB-FILS-MA/alexandruradovici-patch-1
Fix a typo in embassy-sync
2024-03-30 21:41:03 +00:00
a38cbbdc59 fix typo 2024-03-30 22:36:30 +02:00
1b505bf18e Merge remote-tracking branch 'upstream/main' into i2c-async-transaction 2024-03-28 22:39:52 +01:00
81cf9d1143 Merge pull request from Frostie314159/reset-at-after
Introduce `reset_{at|after}` functions for ticker.
2024-03-28 19:04:26 +00:00
2ea1040e07 Adjusted behavior. 2024-03-28 19:41:50 +01:00
f10ee07a90 Update embassy_in_the_wild.adoc
corrected link to Ystudio project
2024-03-28 14:35:24 +01:00
393de9e19f Merge pull request from cschuhen/feature/bxcan_use_fdcan_api
Synchronise the feature sets and API between BXCAN and FDCAN.
2024-03-28 00:10:11 +00:00
25618cd93d RTR fix. 2024-03-28 09:53:30 +10:00
a9f0c8c3a9 Fixes for no-time. 2024-03-28 09:32:13 +10:00
8d43fb4da4 CAN: Use the same testing code for BXCAN and FDCAN h/w. 2024-03-28 09:32:13 +10:00
2217b80278 CAN: Unify API's between BXCAN and FDCAN. Use Envelope for all read methods instead of a tuple sometimes. 2024-03-28 09:32:13 +10:00
f5daa50a7b BXCAN: Add struct that combines Buffered RX and Buffered TX. 2024-03-28 09:32:13 +10:00
41b7e4a434 BXCAN: Create TxMode in order to support buffered TX. 2024-03-28 09:32:13 +10:00
26c739c2f9 BXCAN: Create RxMode enum and move reader methods into it, laying foundations for different Rx buffering modes. 2024-03-28 09:32:13 +10:00
3bdaad39e8 BXCAN: Register access into new Registers struct. 2024-03-28 09:32:13 +10:00
32065d7719 BXCAN: Cut out more that wasn't required from BXCAN crate. 2024-03-28 09:32:08 +10:00
fcfcfce400 CAN: Move some FDCAN definitions into a module to share with BXCAN. 2024-03-28 09:30:58 +10:00
8f6c07c775 Merge pull request from de-vri-es/bxcan-keep-rtr-flag
embassy_stm32: Preseve the RTR flag in messages.
2024-03-27 22:35:43 +00:00
3133201724 Merge remote-tracking branch 'upstream/main' into i2c-async-transaction 2024-03-27 18:58:59 +01:00
c059062627 embassy_stm32: Preseve the RTR flag in messages. 2024-03-27 16:10:37 +01:00
a678b4850c Merge pull request from adri326/adri326/nodma-embedded-io
Provide embedded_io impls for Uart with and without Dma
2024-03-27 14:47:19 +00:00
289c5edb9b Merge pull request from eZioPan/h5-lse-low-drive
stm32 H5: LSE low drive mode is not functional
2024-03-27 14:34:22 +00:00
e3ef7cd99f Document why embedded_io::Read cannot be implemented for the base Uart 2024-03-27 11:10:16 +01:00
bb5fcce0a0 Use named imports within function to make code easier to read 2024-03-27 10:42:38 +01:00
b52e9a60eb Add missing check for empty buffer in asynchronous read_write() 2024-03-27 10:39:33 +01:00
13636556d9 Mark shared data structure as dead_code for I2C v2 branch 2024-03-27 01:41:13 +01:00
0cfb65abc2 Add transaction stub to I2C v2 2024-03-27 01:36:06 +01:00
54d7d49513 Refactor DMA implementation of I2C v1, clarify flow of code 2024-03-27 01:07:42 +01:00
7e44db099c Move FrameOptions and related function to module itself 2024-03-27 00:35:30 +01:00
b299266cd2 It is not necessary to enable interrupts before registering waker 2024-03-27 00:32:06 +01:00
2e2986c67b It is not necessary to wait for SB and MSL sequentially 2024-03-27 00:32:06 +01:00
c1175bf7d8 It is not necessary to wait for STOP to be fully generated 2024-03-27 00:32:06 +01:00
accec7a840 Implement asynchronous transaction for I2C v1 2024-03-27 00:32:06 +01:00
9c00a40e73 Extract frame options generation into iterator to reuse in async 2024-03-26 22:53:14 +01:00
0885c102d3 Refactor async I2C transfers to use frame options 2024-03-26 22:53:14 +01:00
746ded94b1 Fix minor typos 2024-03-26 22:53:14 +01:00
82046c4691 Added YLab project to "in the wild"
YLab uses Embassy
2024-03-26 22:26:44 +01:00
cf11d28d62 stm32 H5: LSE low drive mode is not functional 2024-03-27 00:55:44 +08:00
1acc34bfaa Remove the need for TxDma to be a DMA channel in the blocking UartTx impl 2024-03-26 17:45:38 +01:00
f3a0bcb15e Merge pull request from adri326/adri326/add-iosv-option
Add a config option to make the VDDIO2 supply line valid
2024-03-26 16:29:45 +00:00
402def86ee Remove ad-hoc fixes for setting the IOSV bit to true 2024-03-26 17:27:02 +01:00
ca998c170f Missing half of the implementation detail comment 2024-03-26 16:33:41 +01:00
64964bd614 Add a config option to make the VDDIO2 supply line valid
On STM32L4[7-A]xx, STM32L5xxx and STM32U5xxx chips, the GPIOG[2..15] pins are only available
once the IOSV bit has been set in PWR->CR2 (U5 chips have the bit in a funkier register).

This is meant to allow the user to have control over this power supply, so the GPIOG pins
are initially insulated, until the user wishes to un-insulate them (or something like that?).
For most applications, though, the VDDIO2 is connected to the VDD line, and this behavior only
gets in the way and causes confusing issues.

This submission adds an option in `embassy_stm32::Config`, called `enable_independent_io_supply`,
which simply enables the IOSV bit. It is only available on chips for which I could find a mention
of IOSV (STM32L4 and STM32L5) or IO2SV (STM32U5).
2024-03-26 16:22:05 +01:00
6b2e15e318 stm32 CORDIC: exclude stm32u5a 2024-03-26 15:06:06 +08:00
cdd1c671e9 Merge pull request from barafael/barafael/minor_clippy_lints_rp
fix minor clippy lints in embassy_rp
2024-03-25 14:31:52 +00:00
e139a4e076 fix: CI 2024-03-25 15:09:41 +01:00
cf789be420 Merge branch 'embassy-rs:main' into barafael/minor_clippy_lints_rp 2024-03-25 14:43:18 +01:00
133a753e49 Merge pull request from cumthugo/bootloader-comment
boot: update comments
2024-03-24 17:43:57 +00:00
a009275875 Merge pull request from CBJamo/sharedbus_setconfig
embassy-embedded-hal: Allow changing Spi/I2cDeviceWithConfig's config at runtime
2024-03-24 11:36:19 +00:00
9bc00e68fa update comments
use 4/5/6 as new firmware for better understanding
2024-03-24 18:25:04 +08:00
8f1bed3d95 Allow changing Spi/I2cDeviceWithConfig's config at runtime 2024-03-23 12:21:13 -04:00
79eabc95aa stm32 CORDIC: add g491re back to cordic test 2024-03-23 09:57:29 +08:00
8fa1d06a6a stm32 CORDIC: use private_bounds for sealed traits. 2024-03-23 09:15:25 +08:00
0abcccee96 stm32 CORDIC: re-design API 2024-03-23 09:15:25 +08:00
83069e7b49 stm32 CORDIC: add example 2024-03-23 09:15:25 +08:00
441aa4c8ce stm32 CORDIC: make HIL run 2024-03-23 09:15:25 +08:00
fac4f9aa2f stm32 CORDIC: typo fix 2024-03-23 09:15:25 +08:00
0d065ab2d6 stm32 CORDIC: add HIL test 2024-03-23 09:15:25 +08:00
c42d9f9eaa stm32 CORDIC: bug fix 2024-03-23 09:15:25 +08:00
641da3602e stm32 CORDIC: error handle 2024-03-23 09:15:25 +08:00
10a9cce855 stm32 CORDIC: DMA for q1.31 and q1.15 2024-03-23 09:15:25 +08:00
2fa04d93ed stm32 CORDIC: DMA for q1.31 2024-03-23 09:15:25 +08:00
c9f759bb21 stm32 CORDIC: ZeroOverhead for q1.31 and q1.15 2024-03-23 09:15:25 +08:00
5d12f59430 stm32 CORDIC: make use of "preload" feature 2024-03-23 09:15:25 +08:00
a1ca9088b4 stm32 CORDIC: ZeroOverhead q1.31 mode 2024-03-23 09:15:25 +08:00
b595d94244 stm32 CORDIC: split into multiple files 2024-03-23 09:15:25 +08:00
cf065d439e stm32 CORDIC: ZeroOverhead q1.31 1 arg 1 res mode 2024-03-23 09:15:25 +08:00
1171e11655 Merge pull request from embassy-rs/stm32-sealed
stm32: use private_bounds for sealed traits.
2024-03-23 01:55:42 +01:00
2fd6f0e718 Merge pull request from embassy-rs/sealed4
use private_bounds for sealed traits.
2024-03-23 01:55:13 +01:00
4aa4ea99c2 use private_bounds for sealed traits. 2024-03-23 01:45:19 +01:00
cb1e4e684e Merge pull request from adamgreig/usb-no-dd-buf
usb: remove device_descriptor buffer, store bytes in UsbDevice.inner instead
2024-03-23 00:39:04 +00:00
2bca875b5f stm32: use private_bounds for sealed traits. 2024-03-23 01:38:51 +01:00
389cbc0a77 stm32/timer: simplify traits, convert from trait methods to struct. 2024-03-23 01:37:28 +01:00
7cf6490fba usb: remove device_descriptor buffer, store bytes in UsbDevice.inner instead 2024-03-23 00:35:15 +00:00
c2aa95016a Merge pull request from de-vri-es/forward-std-feature-to-critical-section
Forward the "std" feature to the critical-section crate in embassy-sync.
2024-03-22 11:34:45 +00:00
a85e9c6e68 Forward the "std" feature to the critical-section crate in embassy-sync.
Otherwise, using embassy-sync in unit tests will result in linker errors
when using the CriticalSectionRawMutex.
2024-03-22 12:29:01 +01:00
3668ace35c Merge pull request from peterkrull/once_lock
Add `OnceLock` sync primitive
2024-03-22 08:40:27 +00:00
7cf5cf4580 Merge pull request from DeepSOIC/regout0
nRF52840/config: add dcdc voltage parameter
2024-03-21 23:01:45 +00:00
10597e3b4d nRF52840/config: add dcdc voltage parameter
address 
2024-03-21 23:56:35 +01:00
ee1aa80e30 Merge pull request from embassy-rs/update-rust
Update stable Rust to 1.77
2024-03-21 14:27:36 +00:00
3ae19bb8f9 Update stable Rust to 1.77 2024-03-21 15:15:51 +01:00
7efe8e0005 Merge branch 'embassy-rs:main' into reset-at-after 2024-03-21 14:17:03 +01:00
29d388042c Merge pull request from jr-oss/stm32_buffered_uart_wake_receive_task_on_time
STM32 BufferedUart: wake receive task for each received byte
2024-03-21 07:52:18 +00:00
08e2ba9d74 STM32 BufferedUart: wake receive task for each received byte
Fixes https://github.com/embassy-rs/embassy/issues/2719
2024-03-21 08:35:41 +01:00
562152c43c Merge pull request from flelchuk/main
usb-logger: avoid data loss at pipe wraparound
2024-03-20 20:24:34 +00:00
53ed4b8b2e usb-logger: avoid data loss at pipe wraparound 2024-03-20 21:15:22 +01:00
c3dedfe3dc Merge pull request from vDorst/stm32_psc_fix
stm32: Fix psc compile error with current stm32-data
2024-03-20 19:49:35 +00:00
92fa49f502 Also fix time_driver.rs 2024-03-20 20:42:03 +01:00
ab7c767c46 Bump stm32-data to latest tag. 2024-03-20 20:31:02 +01:00
fb9d42684b stm32: Fix psc compile error with current stm32-data
Commit cc525f1b25 has changed the definition of the `psc` register.
Update timer/mod.rs to reflect the stm32-data change.
2024-03-20 19:59:17 +01:00
3845288ffb Merge pull request from embassy-rs/update-nightly44
Update nightly Rust.
2024-03-20 15:54:55 +00:00
e5b9b5b3e9 Update Nightly in CI. 2024-03-20 16:39:09 +01:00
eca9aac194 Fix warnings in recent nightly. 2024-03-20 16:39:09 +01:00
6eb539a6a1 Merge pull request from GrantM11235/atpit
Use ATPIT for task macro
2024-03-20 15:12:31 +00:00
3d842dac85 fmt: disable "unused" warnings. 2024-03-20 14:53:19 +01:00
7c2aae88da Merge pull request from AlejandroFNadal/patch-1
Add comment warning for new users about changing pins on Ethernet for different devices + example of change
2024-03-20 13:27:04 +00:00
2587ade63e Rust formatting for comments. 2024-03-20 14:11:04 +01:00
47ebec82b8 Add comment warning for new users about changing pins on Ethernet for different devices
Not all STM32H7 devices share the pins of the example. Added a warning and a specific example for STM32H747XIH
2024-03-20 13:56:15 +01:00
23740abdca Merge pull request from embassy-rs/stm32-opendrain-eh02-input
stm32/gpio: add missing eh02 InputPin for OutputOpenDrain.
2024-03-20 12:55:52 +00:00
a2fd4d751e stm32/gpio: add missing eh02 InputPin for OutputOpenDrain. 2024-03-20 13:49:19 +01:00
56e01d969f Merge pull request from sgoll/i2c-blocking-transaction
stm32/i2c(v1): Implement blocking transactions
2024-03-20 12:40:13 +00:00
5477d57168 Merge pull request from noahbliss/patch-1
Doc update: signaled does not clear signal
2024-03-20 12:30:36 +00:00
b8731ab31f Merge pull request from sgoll/i2c-dev-transaction
Forward transaction() from blocking I2cDevice to underlying bus
2024-03-20 12:30:20 +00:00
cff665f2ec Avoid unnecessary double-reference 2024-03-20 13:08:42 +01:00
d06dbf332b Doc update: signaled does not clear signal
signaled does not clear signal (doc update)
2024-03-20 03:19:01 +00:00
4eb4108952 Fix build for I2C v2 targets 2024-03-20 03:33:15 +01:00
8f19a2b537 Avoid missing stop condition when write/read with empty read buffer 2024-03-20 02:59:30 +01:00
c96062fbcd Implement blocking transaction handling for I2C v1 2024-03-20 02:59:30 +01:00
7c08616c02 Introduce frame options to control start/stop conditions 2024-03-20 02:55:49 +01:00
d65724207d Forward transaction() from blocking I2cDevice to underlying bus 2024-03-20 01:12:04 +01:00
7bf4710f3f Merge pull request from embassy-rs/stm32-usb-clock-check
stm32/usb: assert correct clock on init, set mux in all examples.
2024-03-19 21:18:31 +00:00
4858a53a39 stm32/usb: ensure mux is configured in examples. 2024-03-19 22:10:59 +01:00
d90abb8ac9 stm32/usb: assert usb clock is okay. 2024-03-19 22:10:59 +01:00
daa64bd540 stm32/usb: extract common init code. 2024-03-19 22:10:59 +01:00
530ff9d4d3 stm32/usb: merge usb and usb_otg into single module. 2024-03-19 22:07:16 +01:00
594d330a49 Merge pull request from adamgreig/stm32-sai
STM32: SAI: Fix MCKDIV for SAI v3/v4
2024-03-19 21:38:54 +01:00
5a879b3ed1 STM32: SAI: Fix MCKDIV for SAI v3/v4 2024-03-19 02:17:50 +00:00
255ed29853 fix minor clippy lints in embassy_rp 2024-03-18 23:28:58 +01:00
ea25112f7d Merge pull request from barafael/patch-3
Fix minor typos in embassy_rp/src/lib.rs
2024-03-18 22:05:16 +00:00
5221965a1f Fix minor typos in embassy_rp/src/lib.rs 2024-03-18 23:02:46 +01:00
6d9f87356b Merge pull request from ExplodingWaffle/peri-clock
stm32/rcc: wait for peripheral clock to be active. also, hold the peripheral reset while enabling the clock.
2024-03-18 16:23:28 +00:00
1f9ffbfb18 remove peripheral reads 2024-03-18 00:05:02 +00:00
bd4cb82945 Merge pull request from cschuhen/feature/support_second_h7CAN
FDCAN: Fix offset issue preventing CAN2 and CAN3 from working.
2024-03-16 19:05:29 +00:00
3f5c8784af FDCAN: Fix offset issue preventing CAN2 and CAN3 from working.
Fix for not H7
2024-03-16 19:32:38 +10:00
c580d4c490 Merge pull request from timokroeger/stm32-ucpd
STM32 UCPD CI Test
2024-03-15 18:51:09 +00:00
0f03018434 tests/stm32: run ucpd only on g0. 2024-03-15 19:47:05 +01:00
067e677ae5 [UCPD] Add unit test for stm32g071rb board
One test for changing the CC line pull-up resistor is skipped for now.
2024-03-15 17:49:15 +01:00
21e2499f35 [UCPD] Fix dead-battery disable for G0
Inverted flag got missed in the original PR.
2024-03-15 17:44:27 +01:00
a92a73abe4 Merge pull request from HaoboGu/main
Impl `MultiwriteNorFlash` for `BlockingAsync`
2024-03-15 13:45:10 +00:00
47b9758151 feat: impl MultiwriteNorFlash for BlockingAsync
Signed-off-by: Haobo Gu <haobogu@outlook.com>
2024-03-15 21:38:32 +08:00
963fda2404 Merge pull request from timokroeger/stm32-ucpd
STM32 USB Type-C/USB Power Delivery Interface (UCPD)
2024-03-14 21:21:33 +00:00
7b80de5e3d [UCPD] Enable dead-battery support in example 2024-03-14 22:14:20 +01:00
57ca072dc3 [UCPD] Enable RX PHY only when receiving 2024-03-14 22:05:22 +01:00
62b0410e86 [UCPD] Set CC pins to analog mode
Example: On STM32G431 CC2 has a pull-up (default JTAG signal) which needs to be disabled.
2024-03-14 21:55:05 +01:00
88d1d38be7 [UCPD] RXORDSETEN can only be modified when disabled 2024-03-14 21:55:05 +01:00
b634f8f511 [UCPD] Fix hard reset interrupt disable flags 2024-03-14 21:55:05 +01:00
6e5bb8003a [UCPD] Adjust TX clock divider 2024-03-14 21:55:05 +01:00
e95e95ac7a [UCPD] Take interrupt in constructor and enable it 2024-03-14 21:55:05 +01:00
23e8fd8337 Merge pull request from votrungchi/main
stm32: add usb_hid_keyboard example
2024-03-14 20:39:58 +00:00
9f699e5772 stm32: add usb_hid_keyboard example
Signed-off-by: Vo Trung Chi <votrungchi_108@live.com>
2024-03-14 23:14:43 +07:00
bbcab556c8 Merge pull request from cschuhen/feature/bxcan_use_frame
Use the same Frame struct for BXCAN and FDCAN.
2024-03-14 09:34:40 +00:00
535e4c20e8 Remove unused methods including incorrect #[must_use... 2024-03-14 08:21:45 +10:00
242759a600 Use Result instead of Option for Frame creation. 2024-03-13 17:46:50 +10:00
12a3af5043 Shared frame types.
Remove BXCAN speciffic id and frame modules

Remove SizedClassicData
2024-03-13 17:46:50 +10:00
30cdc6c9c5 [UCPD] Disable dead-battery resistor for all families
Using the code from PR , thank you @ExplodingWaffle
Removes the dead-battery as selectable option because its unclear if
it can be re-enabled. Also there is no use case for it because the same
resistor can be configured with the sink option.
2024-03-12 08:49:27 +01:00
eeb033caf0 [UCPD] Disable RCC clock on drop 2024-03-12 08:14:42 +01:00
89504f5162 [UCPD] Split into CC and PD phy
PD3.0 spec requires concurrent control of CC resistors for collision avoidance.
Needed to introduce some "ref counting" (its just a bool) for drop code.
2024-03-12 08:14:42 +01:00
99854ff840 [UCPD] Fix build for devices with GPDMA
Do not use a flag that is DMA/BDMA only, not required anyway
the transfer should run in the background nevertheless
2024-03-12 08:14:42 +01:00
ff8129a6a6 [UCPD] Implement hard reset transmission 2024-03-12 08:14:42 +01:00
c1efcbba2d [UCPD] Receive hard resets 2024-03-12 08:14:42 +01:00
b7972048a1 [UCPD] Improve example and defmt Format for enums 2024-03-12 08:14:42 +01:00
5e271ff31b [UCPD] Combine RX and TX
`select(rx.receive(), tx.transmit()` had subtle interrupt enable race conditions.
Combine receiver and transmitter into one new `PdPhy` struct to disallow the
problematic pattern.
Scanning through the USB PD 2.0 specification there is no need to have RX and TX
running concurrently (after all the USB PD communication is half-duplex).
2024-03-12 08:14:42 +01:00
36a9918921 [UCPD] Implement PD transmitter 2024-03-12 08:14:42 +01:00
984d5bbc72 [UCPD] Implement PD receiver 2024-03-12 08:14:42 +01:00
4d0e383816 [UCPD] Prepare for PD communication implementation 2024-03-12 08:14:42 +01:00
a3b1222617 [UCPD] Improve Type-C CC handling
* Improved interrupt handling: Clear flags in ISR, check state change in future
* Disable pull-up/pull-down resistors and voltage monitor on drop
* nightly rustfmt
2024-03-12 08:14:42 +01:00
d99fcfd0c2 [UCPD] Configuration Channel (CC) handling 2024-03-12 08:14:42 +01:00
aa1411e2c7 [UCPD] Prepare interrupt handle 2024-03-12 08:14:41 +01:00
8a255b375b [UCPD] Instance and Pin Traits
Skip FRSTX pin for now. Its available twice in the device JSON as
FRSTX1 and FRSTX2 both with the same pins as targets.
I don’t know enough about the FRS (fast role switch) feature to
understand if that is correct and how to handle the pins.
2024-03-12 08:14:41 +01:00
f761f721bc fix ci 2024-03-10 22:51:42 +00:00
2d7ec281e8 stm32/rcc: wait for peripheral clock to be active. also, hold the peripheral reset while enabling the clock. 2024-03-09 18:24:31 +00:00
fda6e3fb8c Resolve rustfmt issue and unused import errors 2024-03-07 15:23:45 -05:00
54751b7a50 Merge branch 'main' into karun/main_octospi_implementation 2024-03-07 15:20:29 -05:00
3b1d87050e Update trait definitions
Make operations generic against valid data widths
2024-03-07 14:41:27 -05:00
e163572bec Add get and set config trait implementations 2024-03-07 14:41:26 -05:00
b86a1f0700 Add constructors
Add transfer configuration
Update command configuration
Add peripheral width consideration
Add drop impl
2024-03-07 14:41:04 -05:00
a0b7067205 Add user enums for transaction configuration 2024-03-07 14:30:53 -05:00
9ed8d01b11 Add transfer config, trait, functional initial configuration and read from memory 2024-03-07 14:30:53 -05:00
f3609f2842 Add initial octopsi module 2024-03-07 14:30:53 -05:00
9905bbe9f7 Update peripheral crate to updated octospi pac 2024-03-07 14:30:53 -05:00
2ab1b2ac9a Update stm-32 build script to include ospi traits 2024-03-07 14:29:37 -05:00
245e7d3bc2 This one is for ci/rustfmt 2024-03-03 15:43:01 +01:00
4bbcc2a7fb Add OnceLock sync primitive 2024-03-03 15:35:52 +01:00
ea89b0c4a0 oops 2024-02-23 18:45:07 -06:00
dd549dad1a Improve hygiene 2024-02-14 16:59:43 -06:00
5a6384333f Fix feature flag in executor tests 2024-02-14 16:14:41 -06:00
84258e1680 wip 2024-02-14 15:57:06 -06:00
8707462ec2 Adjusted documentation and reset_after behaviour. 2023-12-11 16:11:57 +01:00
663fa2addd Introduce reset_{at|after} functions for Ticker. 2023-12-11 13:27:55 +01:00
753 changed files with 42155 additions and 12433 deletions
.github/ci
.vscode
LICENSE-CC-BY-SANOTICE.mdREADME.mdci-nightly.shci.sh
cyw43-pio
cyw43
docs
embassy-boot-nrf
embassy-boot-rp
embassy-boot-stm32
embassy-boot
embassy-embedded-hal
embassy-executor-macros
embassy-executor
embassy-futures/src
embassy-hal-internal
embassy-net-adin1110
embassy-net-driver-channel
embassy-net-enc28j60
embassy-net-esp-hosted
embassy-net-ppp
embassy-net-tuntap/src
embassy-net-wiznet
embassy-net
embassy-nrf
embassy-rp
embassy-stm32-wpan
embassy-stm32
embassy-sync
embassy-time-queue-driver
embassy-time
embassy-usb-dfu
embassy-usb-driver
embassy-usb-logger
embassy-usb-synopsys-otg
embassy-usb
examples
boot
application
nrf
rp
stm32f3
stm32f7
stm32h7
stm32l0
stm32l1
stm32l4
stm32wb-dfu
stm32wl
bootloader
nrf-rtos-trace
nrf51
nrf52810
nrf52840-rtic
nrf52840
nrf5340
nrf9151
nrf9160
rp
std
stm32c0
stm32f0
stm32f1
stm32f2
stm32f3
stm32f334
stm32f4
stm32f469
stm32f7
stm32g0
stm32g4
stm32h5
stm32h7
stm32h735
stm32h7rs
stm32l0
stm32l1
stm32l4
stm32l5
stm32u0
stm32u5
stm32wb
stm32wba
stm32wl
wasm
release
rust-toolchain-nightly.tomlrust-toolchain.toml
tests

17
.github/ci/book.sh vendored Executable file

@ -0,0 +1,17 @@
#!/bin/bash
## on push branch=main
set -euxo pipefail
make -C docs
export KUBECONFIG=/ci/secrets/kubeconfig.yml
POD=$(kubectl -n embassy get po -l app=website -o jsonpath={.items[0].metadata.name})
mkdir -p build
mv docs/book build/book
tar -C build -cf book.tar book
kubectl exec $POD -- mkdir -p /usr/share/nginx/html
kubectl cp book.tar $POD:/usr/share/nginx/html/
kubectl exec $POD -- find /usr/share/nginx/html
kubectl exec $POD -- tar -C /usr/share/nginx/html -xvf /usr/share/nginx/html/book.tar

2
.github/ci/build.sh vendored

@ -7,7 +7,7 @@ set -euo pipefail
export RUSTUP_HOME=/ci/cache/rustup export RUSTUP_HOME=/ci/cache/rustup
export CARGO_HOME=/ci/cache/cargo export CARGO_HOME=/ci/cache/cargo
export CARGO_TARGET_DIR=/ci/cache/target export CARGO_TARGET_DIR=/ci/cache/target
if [ -f /ci/secrets/teleprobe-token.txt ]; then if [ -f /ci/secrets/teleprobe-token.txt ]; then
echo Got teleprobe token! echo Got teleprobe token!
export TELEPROBE_HOST=https://teleprobe.embassy.dev export TELEPROBE_HOST=https://teleprobe.embassy.dev
export TELEPROBE_TOKEN=$(cat /ci/secrets/teleprobe-token.txt) export TELEPROBE_TOKEN=$(cat /ci/secrets/teleprobe-token.txt)

1
.github/ci/doc.sh vendored

@ -38,6 +38,7 @@ docserver-builder -i ./embassy-usb -o webroot/crates/embassy-usb/git.zup
docserver-builder -i ./embassy-usb-dfu -o webroot/crates/embassy-usb-dfu/git.zup docserver-builder -i ./embassy-usb-dfu -o webroot/crates/embassy-usb-dfu/git.zup
docserver-builder -i ./embassy-usb-driver -o webroot/crates/embassy-usb-driver/git.zup docserver-builder -i ./embassy-usb-driver -o webroot/crates/embassy-usb-driver/git.zup
docserver-builder -i ./embassy-usb-logger -o webroot/crates/embassy-usb-logger/git.zup docserver-builder -i ./embassy-usb-logger -o webroot/crates/embassy-usb-logger/git.zup
docserver-builder -i ./embassy-usb-synopsys-otg -o webroot/crates/embassy-usb-synopsys-otg/git.zup
docserver-builder -i ./embassy-net -o webroot/crates/embassy-net/git.zup docserver-builder -i ./embassy-net -o webroot/crates/embassy-net/git.zup
docserver-builder -i ./embassy-net-driver -o webroot/crates/embassy-net-driver/git.zup docserver-builder -i ./embassy-net-driver -o webroot/crates/embassy-net-driver/git.zup

@ -11,3 +11,4 @@ mv rust-toolchain-nightly.toml rust-toolchain.toml
MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test --manifest-path ./embassy-executor/Cargo.toml MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test --manifest-path ./embassy-executor/Cargo.toml
MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test --manifest-path ./embassy-executor/Cargo.toml --features nightly MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test --manifest-path ./embassy-executor/Cargo.toml --features nightly
MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test --manifest-path ./embassy-sync/Cargo.toml

7
.github/ci/test.sh vendored

@ -8,9 +8,10 @@ export RUSTUP_HOME=/ci/cache/rustup
export CARGO_HOME=/ci/cache/cargo export CARGO_HOME=/ci/cache/cargo
export CARGO_TARGET_DIR=/ci/cache/target export CARGO_TARGET_DIR=/ci/cache/target
cargo test --manifest-path ./embassy-sync/Cargo.toml cargo test --manifest-path ./embassy-futures/Cargo.toml
cargo test --manifest-path ./embassy-embedded-hal/Cargo.toml cargo test --manifest-path ./embassy-sync/Cargo.toml
cargo test --manifest-path ./embassy-hal-internal/Cargo.toml cargo test --manifest-path ./embassy-embedded-hal/Cargo.toml
cargo test --manifest-path ./embassy-hal-internal/Cargo.toml
cargo test --manifest-path ./embassy-time/Cargo.toml --features generic-queue,mock-driver cargo test --manifest-path ./embassy-time/Cargo.toml --features generic-queue,mock-driver
cargo test --manifest-path ./embassy-time-driver/Cargo.toml cargo test --manifest-path ./embassy-time-driver/Cargo.toml

12
.vscode/settings.json vendored

@ -9,21 +9,25 @@
"rust-analyzer.check.noDefaultFeatures": true, "rust-analyzer.check.noDefaultFeatures": true,
"rust-analyzer.cargo.noDefaultFeatures": true, "rust-analyzer.cargo.noDefaultFeatures": true,
"rust-analyzer.showUnlinkedFileNotification": false, "rust-analyzer.showUnlinkedFileNotification": false,
// uncomment the target of your chip. // Uncomment the target of your chip.
//"rust-analyzer.cargo.target": "thumbv6m-none-eabi", //"rust-analyzer.cargo.target": "thumbv6m-none-eabi",
//"rust-analyzer.cargo.target": "thumbv7m-none-eabi", //"rust-analyzer.cargo.target": "thumbv7m-none-eabi",
"rust-analyzer.cargo.target": "thumbv7em-none-eabi", "rust-analyzer.cargo.target": "thumbv7em-none-eabi",
//"rust-analyzer.cargo.target": "thumbv7em-none-eabihf",
//"rust-analyzer.cargo.target": "thumbv8m.main-none-eabihf", //"rust-analyzer.cargo.target": "thumbv8m.main-none-eabihf",
"rust-analyzer.cargo.features": [ "rust-analyzer.cargo.features": [
"stm32f103c8", // Comment out these features when working on the examples. Most example crates do not have any cargo features.
"stm32f446re",
"time-driver-any", "time-driver-any",
"unstable-pac", "unstable-pac",
"exti", "exti",
"rt",
], ],
"rust-analyzer.linkedProjects": [ "rust-analyzer.linkedProjects": [
// Uncomment ONE line for the chip you want to work on.
// This makes rust-analyzer work on the example crate and all its dependencies.
"embassy-stm32/Cargo.toml", "embassy-stm32/Cargo.toml",
// To work on the examples, comment the line above and all of the cargo.features lines,
// then uncomment ONE line below to select the chip you want to work on.
// This makes rust-analyzer work on the example crate and all its dependencies.
// "examples/nrf52840-rtic/Cargo.toml", // "examples/nrf52840-rtic/Cargo.toml",
// "examples/nrf5340/Cargo.toml", // "examples/nrf5340/Cargo.toml",
// "examples/nrf-rtos-trace/Cargo.toml", // "examples/nrf-rtos-trace/Cargo.toml",

428
LICENSE-CC-BY-SA Normal file

@ -0,0 +1,428 @@
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.

@ -12,5 +12,5 @@ listed source code repository logs.
This program and the accompanying materials are made available under the terms This program and the accompanying materials are made available under the terms
of the Apache Software License 2.0 which is available at of the Apache Software License 2.0 which is available at
https://www.apache.org/licenses/LICENSE-2.0, or the MIT license which is https://www.apache.org/licenses/LICENSE-2.0, or the MIT license which is
available at https://opensource.org/licenses/MIT available at https://opensource.org/licenses/MIT

@ -2,12 +2,12 @@
Embassy is the next-generation framework for embedded applications. Write safe, correct and energy-efficient embedded code faster, using the Rust programming language, its async facilities, and the Embassy libraries. Embassy is the next-generation framework for embedded applications. Write safe, correct and energy-efficient embedded code faster, using the Rust programming language, its async facilities, and the Embassy libraries.
## <a href="https://embassy.dev/book/dev/index.html">Documentation</a> - <a href="https://docs.embassy.dev/">API reference</a> - <a href="https://embassy.dev/">Website</a> - <a href="https://matrix.to/#/#embassy-rs:matrix.org">Chat</a> ## <a href="https://embassy.dev/book/index.html">Documentation</a> - <a href="https://docs.embassy.dev/">API reference</a> - <a href="https://embassy.dev/">Website</a> - <a href="https://matrix.to/#/#embassy-rs:matrix.org">Chat</a>
## Rust + async ❤️ embedded ## Rust + async ❤️ embedded
The Rust programming language is blazingly fast and memory-efficient, with no runtime, garbage collector or OS. It catches a wide variety of bugs at compile time, thanks to its full memory- and thread-safety, and expressive type system. The Rust programming language is blazingly fast and memory-efficient, with no runtime, garbage collector or OS. It catches a wide variety of bugs at compile time, thanks to its full memory- and thread-safety, and expressive type system.
Rust's <a href="https://rust-lang.github.io/async-book/">async/await</a> allows for unprecedently easy and efficient multitasking in embedded systems. Tasks get transformed at compile time into state machines that get run cooperatively. It requires no dynamic memory allocation, and runs on a single stack, so no per-task stack size tuning is required. It obsoletes the need for a traditional RTOS with kernel context switching, and is <a href="https://tweedegolf.nl/en/blog/65/async-rust-vs-rtos-showdown">faster and smaller than one!</a> Rust's <a href="https://rust-lang.github.io/async-book/">async/await</a> allows for unprecedentedly easy and efficient multitasking in embedded systems. Tasks get transformed at compile time into state machines that get run cooperatively. It requires no dynamic memory allocation, and runs on a single stack, so no per-task stack size tuning is required. It obsoletes the need for a traditional RTOS with kernel context switching, and is <a href="https://tweedegolf.nl/en/blog/65/async-rust-vs-rtos-showdown">faster and smaller than one!</a>
## Batteries included ## Batteries included
@ -18,6 +18,7 @@ Rust's <a href="https://rust-lang.github.io/async-book/">async/await</a> allows
- <a href="https://github.com/esp-rs">esp-rs</a>, for the Espressif Systems ESP32 series of chips. - <a href="https://github.com/esp-rs">esp-rs</a>, for the Espressif Systems ESP32 series of chips.
- Embassy HAL support for Espressif chips is being developed in the [esp-rs/esp-hal](https://github.com/esp-rs/esp-hal) repository. - Embassy HAL support for Espressif chips is being developed in the [esp-rs/esp-hal](https://github.com/esp-rs/esp-hal) repository.
- Async WiFi, Bluetooth and ESP-NOW is being developed in the [esp-rs/esp-wifi](https://github.com/esp-rs/esp-wifi) repository. - Async WiFi, Bluetooth and ESP-NOW is being developed in the [esp-rs/esp-wifi](https://github.com/esp-rs/esp-wifi) repository.
- <a href="https://github.com/ch32-rs/ch32-hal">ch32-hal</a>, for the WCH 32-bit RISC-V(CH32V) series of chips.
- **Time that Just Works** - - **Time that Just Works** -
No more messing with hardware timers. <a href="https://docs.embassy.dev/embassy-time">embassy_time</a> provides Instant, Duration and Timer types that are globally available and never overflow. No more messing with hardware timers. <a href="https://docs.embassy.dev/embassy-time">embassy_time</a> provides Instant, Duration and Timer types that are globally available and never overflow.
@ -89,7 +90,7 @@ async fn main(spawner: Spawner) {
## Examples ## Examples
Examples are found in the `examples/` folder seperated by the chip manufacturer they are designed to run on. For example: Examples are found in the `examples/` folder separated by the chip manufacturer they are designed to run on. For example:
* `examples/nrf52840` run on the `nrf52840-dk` board (PCA10056) but should be easily adaptable to other nRF52 chips and boards. * `examples/nrf52840` run on the `nrf52840-dk` board (PCA10056) but should be easily adaptable to other nRF52 chips and boards.
* `examples/nrf5340` run on the `nrf5340-dk` board (PCA10095). * `examples/nrf5340` run on the `nrf5340-dk` board (PCA10095).
@ -99,12 +100,7 @@ Examples are found in the `examples/` folder seperated by the chip manufacturer
### Running examples ### Running examples
- Install `probe-rs`. - Install `probe-rs` following the instructions at <https://probe.rs>.
```bash
cargo install probe-rs --features cli
```
- Change directory to the sample's base directory. For example: - Change directory to the sample's base directory. For example:
```bash ```bash
@ -130,8 +126,8 @@ For more help getting started, see [Getting Started][1] and [Running the Example
## Developing Embassy with Rust Analyzer based editors ## Developing Embassy with Rust Analyzer based editors
The [Rust Analyzer](https://rust-analyzer.github.io/) is used by [Visual Studio Code](https://code.visualstudio.com/) The [Rust Analyzer](https://rust-analyzer.github.io/) is used by [Visual Studio Code](https://code.visualstudio.com/)
and others. Given the multiple targets that Embassy serves, there is no Cargo workspace file. Instead, the Rust Analyzer and others. Given the multiple targets that Embassy serves, there is no Cargo workspace file. Instead, the Rust Analyzer
must be told of the target project to work with. In the case of Visual Studio Code, must be told of the target project to work with. In the case of Visual Studio Code,
please refer to the `.vscode/settings.json` file's `rust-analyzer.linkedProjects`setting. please refer to the `.vscode/settings.json` file's `rust-analyzer.linkedProjects`setting.
## Minimum supported Rust version (MSRV) ## Minimum supported Rust version (MSRV)

@ -30,4 +30,3 @@ cargo batch \
cargo build --release --manifest-path embassy-executor/Cargo.toml --target avr-unknown-gnu-atmega328 -Z build-std=core,alloc --features nightly,arch-avr,avr-device/atmega328p cargo build --release --manifest-path embassy-executor/Cargo.toml --target avr-unknown-gnu-atmega328 -Z build-std=core,alloc --features nightly,arch-avr,avr-device/atmega328p
cargo build --release --manifest-path embassy-executor/Cargo.toml --target avr-unknown-gnu-atmega328 -Z build-std=core,alloc --features nightly,arch-avr,integrated-timers,avr-device/atmega328p cargo build --release --manifest-path embassy-executor/Cargo.toml --target avr-unknown-gnu-atmega328 -Z build-std=core,alloc --features nightly,arch-avr,integrated-timers,avr-device/atmega328p

53
ci.sh

@ -2,6 +2,14 @@
set -eo pipefail set -eo pipefail
if ! command -v cargo-batch &> /dev/null; then
echo "cargo-batch could not be found. Install it with the following command:"
echo ""
echo " cargo install --git https://github.com/embassy-rs/cargo-batch cargo --bin cargo-batch --locked"
echo ""
exit 1
fi
export RUSTFLAGS=-Dwarnings export RUSTFLAGS=-Dwarnings
export DEFMT_LOG=trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info export DEFMT_LOG=trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info
if [[ -z "${CARGO_TARGET_DIR}" ]]; then if [[ -z "${CARGO_TARGET_DIR}" ]]; then
@ -124,6 +132,11 @@ cargo batch \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h725re,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h725re,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7b3ai,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7b3ai,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7b3ai,defmt,exti,time-driver-tim1,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7r3z8,defmt,exti,time-driver-tim1,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7r7a8,defmt,exti,time-driver-tim1,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7s3a8,defmt,exti,time-driver-tim1,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7s7z8,defmt,exti,time-driver-tim1,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l431cb,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l431cb,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l422cb,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l422cb,defmt,exti,time-driver-any,time \
@ -146,8 +159,15 @@ cargo batch \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f103re,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f103re,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f100c4,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f100c4,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h523cc,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h562ag,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h562ag,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba50ke,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba55ug,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32u5g9nj,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb35ce,defmt,exti,time-driver-any,time \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb35ce,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u031r8,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u073mb,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc,defmt,exti,time-driver-any,time \
--- build --release --manifest-path cyw43/Cargo.toml --target thumbv6m-none-eabi --features ''\ --- build --release --manifest-path cyw43/Cargo.toml --target thumbv6m-none-eabi --features ''\
--- build --release --manifest-path cyw43/Cargo.toml --target thumbv6m-none-eabi --features 'log' \ --- build --release --manifest-path cyw43/Cargo.toml --target thumbv6m-none-eabi --features 'log' \
--- build --release --manifest-path cyw43/Cargo.toml --target thumbv6m-none-eabi --features 'defmt' \ --- build --release --manifest-path cyw43/Cargo.toml --target thumbv6m-none-eabi --features 'defmt' \
@ -157,16 +177,20 @@ cargo batch \
--- build --release --manifest-path cyw43-pio/Cargo.toml --target thumbv6m-none-eabi --features 'overclock' \ --- build --release --manifest-path cyw43-pio/Cargo.toml --target thumbv6m-none-eabi --features 'overclock' \
--- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ --- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
--- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \ --- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \
--- build --release --manifest-path embassy-boot-nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9120-ns \
--- build --release --manifest-path embassy-boot-rp/Cargo.toml --target thumbv6m-none-eabi \ --- build --release --manifest-path embassy-boot-rp/Cargo.toml --target thumbv6m-none-eabi \
--- build --release --manifest-path embassy-boot-stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \ --- build --release --manifest-path embassy-boot-stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \
--- build --release --manifest-path docs/modules/ROOT/examples/basic/Cargo.toml --target thumbv7em-none-eabi \ --- build --release --manifest-path docs/examples/basic/Cargo.toml --target thumbv7em-none-eabi \
--- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml --target thumbv7em-none-eabi \ --- build --release --manifest-path docs/examples/layer-by-layer/blinky-pac/Cargo.toml --target thumbv7em-none-eabi \
--- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml --target thumbv7em-none-eabi \ --- build --release --manifest-path docs/examples/layer-by-layer/blinky-hal/Cargo.toml --target thumbv7em-none-eabi \
--- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml --target thumbv7em-none-eabi \ --- build --release --manifest-path docs/examples/layer-by-layer/blinky-irq/Cargo.toml --target thumbv7em-none-eabi \
--- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml --target thumbv7em-none-eabi \ --- build --release --manifest-path docs/examples/layer-by-layer/blinky-async/Cargo.toml --target thumbv7em-none-eabi \
--- build --release --manifest-path examples/nrf52810/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/nrf52810 \
--- build --release --manifest-path examples/nrf52840/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/nrf52840 \ --- build --release --manifest-path examples/nrf52840/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/nrf52840 \
--- build --release --manifest-path examples/nrf5340/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf5340 \ --- build --release --manifest-path examples/nrf5340/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf5340 \
--- build --release --manifest-path examples/nrf9160/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9160 \ --- build --release --manifest-path examples/nrf9160/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9160 \
--- build --release --manifest-path examples/nrf9151/s/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9151/s \
--- build --release --manifest-path examples/nrf9151/ns/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/nrf9151/ns \
--- build --release --manifest-path examples/nrf51/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/nrf51 \ --- build --release --manifest-path examples/nrf51/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/nrf51 \
--- build --release --manifest-path examples/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/rp \ --- build --release --manifest-path examples/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/rp \
--- build --release --manifest-path examples/stm32f0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32f0 \ --- build --release --manifest-path examples/stm32f0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32f0 \
@ -175,22 +199,27 @@ cargo batch \
--- build --release --manifest-path examples/stm32f3/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f3 \ --- build --release --manifest-path examples/stm32f3/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f3 \
--- build --release --manifest-path examples/stm32f334/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f334 \ --- build --release --manifest-path examples/stm32f334/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f334 \
--- build --release --manifest-path examples/stm32f4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f4 \ --- build --release --manifest-path examples/stm32f4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f4 \
--- build --release --manifest-path examples/stm32f469/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f469 \
--- build --release --manifest-path examples/stm32f7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f7 \ --- build --release --manifest-path examples/stm32f7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32f7 \
--- build --release --manifest-path examples/stm32c0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32c0 \ --- build --release --manifest-path examples/stm32c0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32c0 \
--- build --release --manifest-path examples/stm32g0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32g0 \ --- build --release --manifest-path examples/stm32g0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32g0 \
--- build --release --manifest-path examples/stm32g4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32g4 \ --- build --release --manifest-path examples/stm32g4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32g4 \
--- build --release --manifest-path examples/stm32h5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32h5 \ --- build --release --manifest-path examples/stm32h5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32h5 \
--- build --release --manifest-path examples/stm32h7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32h7 \ --- build --release --manifest-path examples/stm32h7/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32h7 \
--- build --release --manifest-path examples/stm32h735/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32h735 \
--- build --release --manifest-path examples/stm32h7rs/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32h7rs \
--- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32l0 \ --- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32l0 \
--- build --release --manifest-path examples/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/stm32l1 \ --- build --release --manifest-path examples/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/stm32l1 \
--- build --release --manifest-path examples/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32l4 \ --- build --release --manifest-path examples/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32l4 \
--- build --release --manifest-path examples/stm32l5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32l5 \ --- build --release --manifest-path examples/stm32l5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32l5 \
--- build --release --manifest-path examples/stm32u0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32u0 \
--- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \ --- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \
--- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32wb \ --- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32wb \
--- build --release --manifest-path examples/stm32wba/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32wba \ --- build --release --manifest-path examples/stm32wba/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32wba \
--- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32wl \ --- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32wl \
--- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840,skip-include --out-dir out/examples/boot/nrf52840 \ --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840,skip-include --out-dir out/examples/boot/nrf52840 \
--- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns,skip-include --out-dir out/examples/boot/nrf9160 \ --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns,skip-include --out-dir out/examples/boot/nrf9160 \
--- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9120-ns,skip-include --out-dir out/examples/boot/nrf9120 \
--- build --release --manifest-path examples/boot/application/rp/Cargo.toml --target thumbv6m-none-eabi --features skip-include --out-dir out/examples/boot/rp \ --- build --release --manifest-path examples/boot/application/rp/Cargo.toml --target thumbv6m-none-eabi --features skip-include --out-dir out/examples/boot/rp \
--- build --release --manifest-path examples/boot/application/stm32f3/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f3 \ --- build --release --manifest-path examples/boot/application/stm32f3/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f3 \
--- build --release --manifest-path examples/boot/application/stm32f7/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f7 \ --- build --release --manifest-path examples/boot/application/stm32f7/Cargo.toml --target thumbv7em-none-eabi --features skip-include --out-dir out/examples/boot/stm32f7 \
@ -202,6 +231,7 @@ cargo batch \
--- build --release --manifest-path examples/boot/application/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32wb-dfu \ --- build --release --manifest-path examples/boot/application/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32wb-dfu \
--- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
--- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \ --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \
--- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9120-ns \
--- build --release --manifest-path examples/boot/bootloader/rp/Cargo.toml --target thumbv6m-none-eabi \ --- build --release --manifest-path examples/boot/bootloader/rp/Cargo.toml --target thumbv6m-none-eabi \
--- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \ --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \
--- build --release --manifest-path examples/boot/bootloader/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wb55rg \ --- build --release --manifest-path examples/boot/bootloader/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wb55rg \
@ -231,11 +261,17 @@ cargo batch \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303ze --out-dir out/tests/stm32f303ze \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303ze --out-dir out/tests/stm32f303ze \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l496zg --out-dir out/tests/stm32l496zg \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l496zg --out-dir out/tests/stm32l496zg \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wl55jc --out-dir out/tests/stm32wl55jc \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wl55jc --out-dir out/tests/stm32wl55jc \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7s3l8 --out-dir out/tests/stm32h7s3l8 \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --out-dir out/tests/stm32f091rc \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --out-dir out/tests/stm32f091rc \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --out-dir out/tests/stm32h503rb \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --out-dir out/tests/stm32h503rb \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc --out-dir out/tests/stm32u083rc \
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \ --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \
--- build --release --manifest-path tests/nrf52840/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \ --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv6m-none-eabi --features nrf51422 --out-dir out/tests/nrf51422-dk \
--- build --release --manifest-path tests/nrf51422/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/nrf51-dk \ --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52832 --out-dir out/tests/nrf52832-dk \
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52833 --out-dir out/tests/nrf52833-dk \
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52840 --out-dir out/tests/nrf52840-dk \
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features nrf5340 --out-dir out/tests/nrf5340-dk \
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features nrf9160 --out-dir out/tests/nrf9160-dk \
--- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \ --- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \
$BUILD_EXTRA $BUILD_EXTRA
@ -249,6 +285,9 @@ rm out/tests/stm32f207zg/eth
# doesn't work, gives "noise error", no idea why. usart_dma does pass. # doesn't work, gives "noise error", no idea why. usart_dma does pass.
rm out/tests/stm32u5a5zj/usart rm out/tests/stm32u5a5zj/usart
# flaky, perhaps bad wire
rm out/tests/stm32l152re/usart_rx_ringbuffered
if [[ -z "${TELEPROBE_TOKEN-}" ]]; then if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
echo No teleprobe token found, skipping running HIL tests echo No teleprobe token found, skipping running HIL tests
exit exit

@ -16,7 +16,7 @@ overclock = []
[dependencies] [dependencies]
cyw43 = { version = "0.1.0", path = "../cyw43" } cyw43 = { version = "0.1.0", path = "../cyw43" }
embassy-rp = { version = "0.1.0", path = "../embassy-rp" } embassy-rp = { version = "0.2.0", path = "../embassy-rp" }
pio-proc = "0.2" pio-proc = "0.2"
pio = "0.2.1" pio = "0.2.1"
fixed = "1.23.1" fixed = "1.23.1"

@ -17,10 +17,10 @@ log = ["dep:log"]
firmware-logs = [] firmware-logs = []
[dependencies] [dependencies]
embassy-time = { version = "0.3.0", path = "../embassy-time"} embassy-time = { version = "0.3.2", path = "../embassy-time"}
embassy-sync = { version = "0.5.0", path = "../embassy-sync"} embassy-sync = { version = "0.6.0", path = "../embassy-sync"}
embassy-futures = { version = "0.1.0", path = "../embassy-futures"} embassy-futures = { version = "0.1.0", path = "../embassy-futures"}
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel"} embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel"}
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }
log = { version = "0.4.17", optional = true } log = { version = "0.4.17", optional = true }

@ -23,7 +23,7 @@ TODO:
## Running the examples ## Running the examples
- `cargo install probe-rs --features cli` - Install `probe-rs` following the instructions at <https://probe.rs>.
- `cd examples/rp` - `cd examples/rp`
### Example 1: Scan the wifi stations ### Example 1: Scan the wifi stations
- `cargo run --release --bin wifi_scan` - `cargo run --release --bin wifi_scan`

@ -42,9 +42,11 @@ pub enum ScanType {
Passive, Passive,
} }
/// Scan options.
#[derive(Clone)] #[derive(Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct ScanOptions { pub struct ScanOptions {
/// SSID to scan for.
pub ssid: Option<heapless::String<32>>, pub ssid: Option<heapless::String<32>>,
/// If set to `None`, all APs will be returned. If set to `Some`, only APs /// If set to `None`, all APs will be returned. If set to `Some`, only APs
/// with the specified BSSID will be returned. /// with the specified BSSID will be returned.
@ -124,8 +126,7 @@ impl<'a> Control<'a> {
self.set_iovar_u32("apsta", 1).await; self.set_iovar_u32("apsta", 1).await;
// read MAC addr. // read MAC addr.
let mut mac_addr = [0; 6]; let mac_addr = self.address().await;
assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
debug!("mac addr: {:02x}", Bytes(&mac_addr)); debug!("mac addr: {:02x}", Bytes(&mac_addr));
let country = countries::WORLD_WIDE_XX; let country = countries::WORLD_WIDE_XX;
@ -229,8 +230,8 @@ impl<'a> Control<'a> {
self.wait_for_join(i).await self.wait_for_join(i).await
} }
/// Join an protected network with the provided ssid and passphrase. /// Join a protected network with the provided ssid and [`PassphraseInfo`].
pub async fn join_wpa2(&mut self, ssid: &str, passphrase: &str) -> Result<(), Error> { async fn join_wpa2_passphrase_info(&mut self, ssid: &str, passphrase_info: &PassphraseInfo) -> Result<(), Error> {
self.set_iovar_u32("ampdu_ba_wsize", 8).await; self.set_iovar_u32("ampdu_ba_wsize", 8).await;
self.ioctl_set_u32(134, 0, 4).await; // wsec = wpa2 self.ioctl_set_u32(134, 0, 4).await; // wsec = wpa2
@ -240,14 +241,13 @@ impl<'a> Control<'a> {
Timer::after_millis(100).await; Timer::after_millis(100).await;
let mut pfi = PassphraseInfo { self.ioctl(
len: passphrase.len() as _, IoctlType::Set,
flags: 1, IOCTL_CMD_SET_PASSPHRASE,
passphrase: [0; 64], 0,
}; &mut passphrase_info.to_bytes(),
pfi.passphrase[..passphrase.len()].copy_from_slice(passphrase.as_bytes()); )
self.ioctl(IoctlType::Set, IOCTL_CMD_SET_PASSPHRASE, 0, &mut pfi.to_bytes()) .await; // WLC_SET_WSEC_PMK
.await; // WLC_SET_WSEC_PMK
self.ioctl_set_u32(20, 0, 1).await; // set_infra = 1 self.ioctl_set_u32(20, 0, 1).await; // set_infra = 1
self.ioctl_set_u32(22, 0, 0).await; // set_auth = 0 (open) self.ioctl_set_u32(22, 0, 0).await; // set_auth = 0 (open)
@ -262,6 +262,28 @@ impl<'a> Control<'a> {
self.wait_for_join(i).await self.wait_for_join(i).await
} }
/// Join a protected network with the provided ssid and passphrase.
pub async fn join_wpa2(&mut self, ssid: &str, passphrase: &str) -> Result<(), Error> {
let mut pfi = PassphraseInfo {
len: passphrase.len() as _,
flags: 1,
passphrase: [0; 64],
};
pfi.passphrase[..passphrase.len()].copy_from_slice(passphrase.as_bytes());
self.join_wpa2_passphrase_info(ssid, &pfi).await
}
/// Join a protected network with the provided ssid and precomputed PSK.
pub async fn join_wpa2_psk(&mut self, ssid: &str, psk: &[u8; 32]) -> Result<(), Error> {
let mut pfi = PassphraseInfo {
len: psk.len() as _,
flags: 0,
passphrase: [0; 64],
};
pfi.passphrase[..psk.len()].copy_from_slice(psk);
self.join_wpa2_passphrase_info(ssid, &pfi).await
}
async fn wait_for_join(&mut self, i: SsidInfo) -> Result<(), Error> { async fn wait_for_join(&mut self, i: SsidInfo) -> Result<(), Error> {
self.events.mask.enable(&[Event::SET_SSID, Event::AUTH]); self.events.mask.enable(&[Event::SET_SSID, Event::AUTH]);
let mut subscriber = self.events.queue.subscriber().unwrap(); let mut subscriber = self.events.queue.subscriber().unwrap();
@ -373,6 +395,24 @@ impl<'a> Control<'a> {
self.set_iovar_u32x2("bss", 0, 1).await; // bss = BSS_UP self.set_iovar_u32x2("bss", 0, 1).await; // bss = BSS_UP
} }
/// Closes access point.
pub async fn close_ap(&mut self) {
// Stop AP
self.set_iovar_u32x2("bss", 0, 0).await; // bss = BSS_DOWN
// Turn off AP mode
self.ioctl_set_u32(IOCTL_CMD_SET_AP, 0, 0).await;
// Temporarily set wifi down
self.down().await;
// Turn on APSTA mode
self.set_iovar_u32("apsta", 1).await;
// Set wifi up again
self.up().await;
}
/// Add specified address to the list of hardware addresses the device /// Add specified address to the list of hardware addresses the device
/// listens on. The address must be a Group address (I/G bit set). Up /// listens on. The address must be a Group address (I/G bit set). Up
/// to 10 addresses are supported by the firmware. Returns the number of /// to 10 addresses are supported by the firmware. Returns the number of
@ -574,6 +614,13 @@ impl<'a> Control<'a> {
self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await; self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await;
info!("Disassociated") info!("Disassociated")
} }
/// Gets the MAC address of the device
pub async fn address(&mut self) -> [u8; 6] {
let mut mac_addr = [0; 6];
assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
mac_addr
}
} }
/// WiFi network scanner. /// WiFi network scanner.

@ -1,11 +1,12 @@
#![macro_use] #![macro_use]
#![allow(unused_macros)] #![allow(unused)]
use core::fmt::{Debug, Display, LowerHex}; use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))] #[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features."); compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert { macro_rules! assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -17,6 +18,7 @@ macro_rules! assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_eq { macro_rules! assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -28,6 +30,7 @@ macro_rules! assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_ne { macro_rules! assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -39,6 +42,7 @@ macro_rules! assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert { macro_rules! debug_assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -50,6 +54,7 @@ macro_rules! debug_assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_eq { macro_rules! debug_assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -61,6 +66,7 @@ macro_rules! debug_assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_ne { macro_rules! debug_assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -72,6 +78,7 @@ macro_rules! debug_assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! todo { macro_rules! todo {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -83,20 +90,19 @@ macro_rules! todo {
}; };
} }
#[cfg(not(feature = "defmt"))] #[collapse_debuginfo(yes)]
macro_rules! unreachable { macro_rules! unreachable {
($($x:tt)*) => { ($($x:tt)*) => {
::core::unreachable!($($x)*) {
}; #[cfg(not(feature = "defmt"))]
} ::core::unreachable!($($x)*);
#[cfg(feature = "defmt")]
#[cfg(feature = "defmt")] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! panic { macro_rules! panic {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -108,6 +114,7 @@ macro_rules! panic {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! trace { macro_rules! trace {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -121,6 +128,7 @@ macro_rules! trace {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug { macro_rules! debug {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -134,6 +142,7 @@ macro_rules! debug {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! info { macro_rules! info {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -147,6 +156,7 @@ macro_rules! info {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! warn { macro_rules! warn {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -160,6 +170,7 @@ macro_rules! warn {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! error { macro_rules! error {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -174,6 +185,7 @@ macro_rules! error {
} }
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($($x:tt)*) => { ($($x:tt)*) => {
::defmt::unwrap!($($x)*) ::defmt::unwrap!($($x)*)
@ -181,6 +193,7 @@ macro_rules! unwrap {
} }
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($arg:expr) => { ($arg:expr) => {
match $crate::fmt::Try::into_result($arg) { match $crate::fmt::Try::into_result($arg) {
@ -229,7 +242,6 @@ impl<T, E> Try for Result<T, E> {
} }
} }
#[allow(unused)]
pub(crate) struct Bytes<'a>(pub &'a [u8]); pub(crate) struct Bytes<'a>(pub &'a [u8]);
impl<'a> Debug for Bytes<'a> { impl<'a> Debug for Bytes<'a> {

@ -28,7 +28,7 @@ use ioctl::IoctlState;
use crate::bus::Bus; use crate::bus::Bus;
pub use crate::bus::SpiBusCyw43; pub use crate::bus::SpiBusCyw43;
pub use crate::control::{AddMulticastAddressError, Control, Error as ControlError, Scanner}; pub use crate::control::{AddMulticastAddressError, Control, Error as ControlError, ScanOptions, Scanner};
pub use crate::runner::Runner; pub use crate::runner::Runner;
pub use crate::structs::BssInfo; pub use crate::structs::BssInfo;

@ -1,6 +1,5 @@
use embassy_futures::select::{select3, Either3}; use embassy_futures::select::{select3, Either3};
use embassy_net_driver_channel as ch; use embassy_net_driver_channel as ch;
use embassy_sync::pubsub::PubSubBehavior;
use embassy_time::{block_for, Duration, Timer}; use embassy_time::{block_for, Duration, Timer};
use embedded_hal_1::digital::OutputPin; use embedded_hal_1::digital::OutputPin;
@ -438,13 +437,16 @@ where
// publish() is a deadlock risk in the current design as awaiting here prevents ioctls // publish() is a deadlock risk in the current design as awaiting here prevents ioctls
// The `Runner` always yields when accessing the device, so consumers always have a chance to receive the event // The `Runner` always yields when accessing the device, so consumers always have a chance to receive the event
// (if they are actively awaiting the queue) // (if they are actively awaiting the queue)
self.events.queue.publish_immediate(events::Message::new( self.events
Status { .queue
event_type: evt_type, .immediate_publisher()
status, .publish_immediate(events::Message::new(
}, Status {
event_payload, event_type: evt_type,
)); status,
},
event_payload,
));
} }
} }
CHANNEL_TYPE_DATA => { CHANNEL_TYPE_DATA => {

8
docs/Makefile Normal file

@ -0,0 +1,8 @@
all:
asciidoctor -d book -D book/ index.adoc
cp -r images book
clean:
rm -rf book
.PHONY: all clean

@ -1,4 +1,29 @@
# embassy docs # embassy docs
The documentation hosted at [https://embassy.dev/book](https://embassy.dev/book). Building the documentation requires The documentation hosted at [https://embassy.dev/book](https://embassy.dev/book). Building the documentation requires the [asciidoctor](https://asciidoctor.org/) tool, and can built running `make` in this folder:
cloning the [embassy-book](https://github.com/embassy-rs/embassy-book) repository and following the instructions.
```
make
```
Then open the generated file `thebook/index.html`.
## License
The Embassy Docs (this folder) is distributed under the following licenses:
* The code samples and free-standing Cargo projects contained within these docs are licensed under the terms of both the [MIT License] and the [Apache License v2.0].
* The written prose contained within these docs are licensed under the terms of the Creative Commons [CC-BY-SA v4.0] license.
Copies of the licenses used by this project may also be found here:
* [MIT License Hosted]
* [Apache License v2.0 Hosted]
* [CC-BY-SA v4.0 Hosted]
[MIT License]: ./../LICENSE-MIT
[Apache License v2.0]: ./../LICENSE-APACHE
[CC-BY-SA v4.0]: ./../LICENSE-CC-BY-SA
[MIT License Hosted]: https://opensource.org/licenses/MIT
[Apache License v2.0 Hosted]: http://www.apache.org/licenses/LICENSE-2.0
[CC-BY-SA v4.0 Hosted]: https://creativecommons.org/licenses/by-sa/4.0/legalcode

@ -1,5 +0,0 @@
name: ROOT
title: Embassy
version: dev
nav:
- modules/ROOT/nav.adoc

@ -0,0 +1,18 @@
[package]
authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
edition = "2018"
name = "embassy-basic-example"
version = "0.1.0"
license = "MIT OR Apache-2.0"
[dependencies]
embassy-executor = { version = "0.6.0", path = "../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] }
embassy-time = { version = "0.3.2", path = "../../../embassy-time", features = ["defmt"] }
embassy-nrf = { version = "0.2.0", path = "../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
defmt = "0.3"
defmt-rtt = "0.3"
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0"
panic-probe = { version = "0.3", features = ["print-defmt"] }

1
docs/examples/examples Symbolic link

@ -0,0 +1 @@
../../examples

@ -8,8 +8,8 @@ members = [
] ]
[patch.crates-io] [patch.crates-io]
embassy-executor = { path = "../../../../../embassy-executor" } embassy-executor = { path = "../../../embassy-executor" }
embassy-stm32 = { path = "../../../../../embassy-stm32" } embassy-stm32 = { path = "../../../embassy-stm32" }
[profile.release] [profile.release]
codegen-units = 1 codegen-units = 1

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
cortex-m = "0.7" cortex-m = "0.7"
cortex-m-rt = "0.7" cortex-m-rt = "0.7"
embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] } embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"] }
embassy-executor = { version = "0.5.0", features = ["arch-cortex-m", "executor-thread"] } embassy-executor = { version = "0.6.0", features = ["arch-cortex-m", "executor-thread"] }
defmt = "0.3.0" defmt = "0.3.0"
defmt-rtt = "0.3.0" defmt-rtt = "0.3.0"

Before

(image error) Size: 31 KiB

After

(image error) Size: 31 KiB

Before

(image error) Size: 118 KiB

After

(image error) Size: 118 KiB

Before

(image error) Size: 131 KiB

After

(image error) Size: 131 KiB

16
docs/index.adoc Normal file

@ -0,0 +1,16 @@
:description: Embassy Book
:sectanchors:
:doctype: book
:toc:
:toc-placement: left
:toclevels: 2
:imagesdir: images
# Embassy Book
Welcome to the Embassy Book. The Embassy Book is for everyone who wants to use Embassy and understand how Embassy works.
include::pages/overview.adoc[leveloffset = 1]
include::pages/beginners.adoc[leveloffset = 1]
include::pages/system.adoc[leveloffset = 1]
include::pages/faq.adoc[leveloffset = 1]

@ -1,18 +0,0 @@
[package]
authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
edition = "2018"
name = "embassy-basic-example"
version = "0.1.0"
license = "MIT OR Apache-2.0"
[dependencies]
embassy-executor = { version = "0.5.0", path = "../../../../../embassy-executor", features = ["defmt", "integrated-timers", "arch-cortex-m", "executor-thread"] }
embassy-time = { version = "0.3.0", path = "../../../../../embassy-time", features = ["defmt"] }
embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
defmt = "0.3"
defmt-rtt = "0.3"
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0"
panic-probe = { version = "0.3", features = ["print-defmt"] }

@ -1 +0,0 @@
../../../../examples

@ -1,19 +0,0 @@
* xref:getting_started.adoc[Getting started]
** xref:basic_application.adoc[Basic application]
** xref:project_structure.adoc[Project Structure]
** xref:new_project.adoc[Starting a new Embassy project]
** xref:best_practices.adoc[Best Practices]
* xref:runtime.adoc[Executor]
* xref::time_keeping.adoc[Time-keeping]
* xref:sharing_peripherals.adoc[Sharing peripherals]
* xref:hal.adoc[HAL]
** xref:layer_by_layer.adoc[Anatomy of an async HAL]
** xref:nrf.adoc[nRF]
** xref:stm32.adoc[STM32]
* xref:bootloader.adoc[Bootloader]
* xref:examples.adoc[Examples]
* xref:developer.adoc[Developer Docs]
** xref:developer_stm32.adoc[Developer Docs: STM32]
* xref:embassy_in_the_wild.adoc[Embassy in the wild]
* xref:faq.adoc[Frequently Asked Questions]

@ -1,11 +0,0 @@
= Embassy in the wild!
Here are known examples of real-world projects which make use of Embassy. Feel free to link:https://github.com/embassy-rs/embassy/blob/main/docs/modules/ROOT/pages/embassy_in_the_wild.adoc[add more]!
* link:https://github.com/cbruiz/printhor/[Printhor: The highly reliable but not necessarily functional 3D printer firmware]
** Targets some STM32 MCUs
* link:https://github.com/card-io-ecg/card-io-fw[Card/IO firmware] - firmware for an open source ECG device
** Targets the ESP32-S3 or ESP32-C6 MCU
* The link:https://github.com/lora-rs/lora-rs[lora-rs] project includes link:https://github.com/lora-rs/lora-rs/tree/main/examples/stm32l0/src/bin[various standalone examples] for NRF52840, RP2040, STM32L0 and STM32WL
** link:https://github.com/matoushybl/air-force-one[Air force one: A simple air quality monitoring system]
*** Targets nRF52 and uses nrf-softdevice

@ -1,210 +0,0 @@
= Frequently Asked Questions
These are a list of unsorted, commonly asked questions and answers.
Please feel free to add items to link:https://github.com/embassy-rs/embassy/edit/main/docs/modules/ROOT/pages/faq.adoc[this page], especially if someone in the chat answered a question for you!
== How to deploy to RP2040 without a debugging probe.
Install link:https://github.com/JoNil/elf2uf2-rs[elf2uf2-rs] for converting the generated elf binary into a uf2 file.
Configure the runner to use this tool, add this to `.cargo/config.toml`:
[source,toml]
----
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "elf2uf2-rs --deploy --serial --verbose"
----
The command-line parameters `--deploy` will detect your device and upload the binary, `--serial` starts a serial connection. See the documentation for more info.
== Missing main macro
If you see an error like this:
[source,rust]
----
#[embassy_executor::main]
| ^^^^ could not find `main` in `embassy_executor`
----
You are likely missing some features of the `embassy-executor` crate.
For Cortex-M targets, check whether ALL of the following features are enabled in your `Cargo.toml` for the `embassy-executor` crate:
* `arch-cortex-m`
* `executor-thread`
For ESP32, consider using the executors and `#[main]` macro provided by your appropriate link:https://crates.io/crates/esp-hal-common[HAL crate].
== Why is my binary so big?
The first step to managing your binary size is to set up your link:https://doc.rust-lang.org/cargo/reference/profiles.html[profiles].
[source,toml]
----
[profile.release]
lto = true
opt-level = "s"
incremental = false
codegen-units = 1
# note: debug = true is okay - debuginfo isn't flashed to the device!
debug = true
----
All of these flags are elaborated on in the Rust Book page linked above.
=== My binary is still big... filled with `std::fmt` stuff!
This means your code is sufficiently complex that `panic!` invocation's formatting requirements could not be optimized out, despite your usage of `panic-halt` or `panic-reset`.
You can remedy this by adding the following to your `.cargo/config.toml`:
[source,toml]
----
[unstable]
build-std = ["core"]
build-std-features = ["panic_immediate_abort"]
----
This replaces all panics with a `UDF` (undefined) instruction.
Depending on your chipset, this will exhibit different behavior.
Refer to the spec for your chipset, but for `thumbv6m`, it results in a hardfault. Which can be configured like so:
[source,rust]
----
#[exception]
unsafe fn HardFault(_frame: &ExceptionFrame) -> ! {
SCB::sys_reset() // <- you could do something other than reset
}
----
Refer to cortex-m's link:https://docs.rs/cortex-m-rt/latest/cortex_m_rt/attr.exception.html[exception handling] for more info.
== `embassy-time` throws linker errors
If you see linker error like this:
[source,text]
----
= note: rust-lld: error: undefined symbol: _embassy_time_now
>>> referenced by driver.rs:127 (src/driver.rs:127)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::now::hefb1f99d6e069842) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
rust-lld: error: undefined symbol: _embassy_time_allocate_alarm
>>> referenced by driver.rs:134 (src/driver.rs:134)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::allocate_alarm::hf5145b6bd46706b2) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
rust-lld: error: undefined symbol: _embassy_time_set_alarm_callback
>>> referenced by driver.rs:139 (src/driver.rs:139)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::set_alarm_callback::h24f92388d96eafd2) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
rust-lld: error: undefined symbol: _embassy_time_set_alarm
>>> referenced by driver.rs:144 (src/driver.rs:144)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::set_alarm::h530a5b1f444a6d5b) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
----
You probably need to enable a time driver for your HAL (not in `embassy-time`!). For example with `embassy-stm32`, you might need to enable `time-driver-any`:
[source,toml]
----
[dependencies.embassy-stm32]
version = "0.1.0"
features = [
# ...
"time-driver-any", # Add this line!
# ...
]
----
If you are in the early project setup phase and not using anything from the HAL, make sure the HAL is explicitly used to prevent the linker removing it as dead code by adding this line to your source:
[source,rust]
----
use embassy_stm32 as _;
----
== Error: `Only one package in the dependency graph may specify the same links value.`
You have multiple versions of the same crate in your dependency tree. This means that some of your
embassy crates are coming from crates.io, and some from git, each of them pulling in a different set
of dependencies.
To resolve this issue, make sure to only use a single source for all your embassy crates!
To do this, you should patch your dependencies to use git sources using `[patch.crates.io]`
and maybe `[patch.'https://github.com/embassy-rs/embassy.git']`.
Example:
[source,toml]
----
[patch.crates-io]
embassy-time-queue-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
# embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
----
Note that the git revision should match any other embassy patches or git dependencies that you are using!
== How can I optimize the speed of my embassy-stm32 program?
* Make sure RCC is set up to go as fast as possible
* Make sure link:https://docs.rs/cortex-m/latest/cortex_m/peripheral/struct.SCB.html[flash cache] is enabled
* build with `--release`
* Set the following keys for the release profile in your `Cargo.toml`:
** `opt-level = "s"`
** `lto = "fat"`
* Set the following keys in the `[unstable]` section of your `.cargo/config.toml`
** `build-std = ["core"]`
** `build-std-features = ["panic_immediate_abort"]`
* Enable feature `embassy-time/generic-queue`, disable feature `embassy-executor/integrated-timers`
* When using `InterruptExecutor`:
** disable `executor-thread`
** make `main`` spawn everything, then enable link:https://docs.rs/cortex-m/latest/cortex_m/peripheral/struct.SCB.html#method.set_sleeponexit[SCB.SLEEPONEXIT] and `loop { cortex_m::asm::wfi() }`
** *Note:* If you need 2 priority levels, using 2 interrupt executors is better than 1 thread executor + 1 interrupt executor.
== How do I set up the task arenas on stable?
When you aren't using the `nightly` feature of `embassy-executor`, the executor uses a bump allocator, which may require configuration.
Something like this error will occur at **compile time** if the task arena is *too large* for the target's RAM:
[source,plain]
----
rust-lld: error: section '.bss' will not fit in region 'RAM': overflowed by _ bytes
rust-lld: error: section '.uninit' will not fit in region 'RAM': overflowed by _ bytes
----
And this message will appear at **runtime** if the task arena is *too small* for the tasks running:
[source,plain]
----
ERROR panicked at 'embassy-executor: task arena is full. You must increase the arena size, see the documentation for details: https://docs.embassy.dev/embassy-executor/'
----
NOTE: If all tasks are spawned at startup, this panic will occur immediately.
Check out link:https://docs.embassy.dev/embassy-executor/git/cortex-m/index.html#task-arena[Task Arena Documentation] for more details.
== Can I use manual ISRs alongside Embassy?
Yes! This can be useful if you need to respond to an event as fast as possible, and the latency caused by the usual “ISR, wake, return from ISR, context switch to woken task” flow is too much for your application. Simply define a `#[interrupt] fn INTERRUPT_NAME() {}` handler as you would link:https://docs.rust-embedded.org/book/start/interrupts.html[in any other embedded rust project].
== How can I measure resource usage (CPU, RAM, etc.)?
=== For CPU Usage:
There are a couple techniques that have been documented, generally you want to measure how long you are spending in the idle or low priority loop.
We need to document specifically how to do this in embassy, but link:https://blog.japaric.io/cpu-monitor/[this older post] describes the general process.
If you end up doing this, please update this section with more specific examples!
=== For Static Memory Usage
Tools like `cargo size` and `cargo nm` can tell you the size of any globals or other static usage. Specifically you will want to see the size of the `.data` and `.bss` sections, which together make up the total global/static memory usage.
=== For Max Stack Usage
Check out link:https://github.com/Dirbaio/cargo-call-stack/[`cargo-call-stack`] for statically calculating worst-case stack usage. There are some caveats and inaccuracies possible with this, but this is a good way to get the general idea. See link:https://github.com/dirbaio/cargo-call-stack#known-limitations[the README] for more details.

@ -1,10 +1,10 @@
= A basic Embassy application = A basic Embassy application
So you've got one of the xref:examples.adoc[examples] running, but what now? Let's go through a simple Embassy application for the nRF52 DK to understand it better. So you've got one of the examples running, but what now? Let's go through a simple Embassy application for the nRF52 DK to understand it better.
== Main == Main
The full example can be found link:https://github.com/embassy-rs/embassy/tree/master/docs/modules/ROOT/examples/basic[here]. The full example can be found link:https://github.com/embassy-rs/embassy/tree/main/docs/examples/basic[here].
NOTE: If youre using VS Code and rust-analyzer to view and edit the examples, you may need to make some changes to `.vscode/settings.json` to tell it which project were working on. Follow the instructions commented in that file to get rust-analyzer working correctly. NOTE: If youre using VS Code and rust-analyzer to view and edit the examples, you may need to make some changes to `.vscode/settings.json` to tell it which project were working on. Follow the instructions commented in that file to get rust-analyzer working correctly.
@ -14,7 +14,7 @@ The first thing youll notice are two attributes at the top of the file. These
[source,rust] [source,rust]
---- ----
include::example$basic/src/main.rs[lines="1..2"] include::../examples/basic/src/main.rs[lines="1..2"]
---- ----
=== Dealing with errors === Dealing with errors
@ -23,7 +23,7 @@ Then, what follows are some declarations on how to deal with panics and faults.
[source,rust] [source,rust]
---- ----
include::example$basic/src/main.rs[lines="8"] include::../examples/basic/src/main.rs[lines="8"]
---- ----
=== Task declaration === Task declaration
@ -32,7 +32,7 @@ After a bit of import declaration, the tasks run by the application should be de
[source,rust] [source,rust]
---- ----
include::example$basic/src/main.rs[lines="10..18"] include::../examples/basic/src/main.rs[lines="10..18"]
---- ----
An embassy task must be declared `async`, and may NOT take generic arguments. In this case, we are handed the LED that should be blinked and the interval of the blinking. An embassy task must be declared `async`, and may NOT take generic arguments. In this case, we are handed the LED that should be blinked and the interval of the blinking.
@ -47,7 +47,7 @@ We then initialize the HAL with a default config, which gives us a `Peripherals`
[source,rust] [source,rust]
---- ----
include::example$basic/src/main.rs[lines="20..-1"] include::../examples/basic/src/main.rs[lines="20..-1"]
---- ----
What happens when the `blinker` task has been spawned and main returns? Well, the main entry point is actually just like any other task, except that you can only have one and it takes some specific type arguments. The magic lies within the `#[embassy_executor::main]` macro. The macro does the following: What happens when the `blinker` task has been spawned and main returns? Well, the main entry point is actually just like any other task, except that you can only have one and it takes some specific type arguments. The magic lies within the `#[embassy_executor::main]` macro. The macro does the following:
@ -64,7 +64,7 @@ The project definition needs to contain the embassy dependencies:
[source,toml] [source,toml]
---- ----
include::example$basic/Cargo.toml[lines="9..11"] include::../examples/basic/Cargo.toml[lines="9..11"]
---- ----
Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well). Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well).

11
docs/pages/beginners.adoc Normal file

@ -0,0 +1,11 @@
= For beginners
The articles in this section are primarily aimed at users new to Embassy,
showing how to get started, how to structure your project and other best practices.
include::getting_started.adoc[leveloffset = 2]
include::basic_application.adoc[leveloffset = 2]
include::project_structure.adoc[leveloffset = 2]
include::new_project.adoc[leveloffset = 2]
include::best_practices.adoc[leveloffset = 2]
include::layer_by_layer.adoc[leveloffset = 2]

@ -0,0 +1,22 @@
= Embassy in the wild!
Here are known examples of real-world projects which make use of Embassy. Feel free to link:https://github.com/embassy-rs/embassy/blob/main/docs/pages/embassy_in_the_wild.adoc[add more]!
* link:https://github.com/haobogu/rmk/[RMK: A feature-rich Rust keyboard firmware]
** RMK has built-in layer support, wireless(BLE) support, real-time key editing support using vial, and more!
** Targets STM32, RP2040, nRF52 and ESP32 MCUs
* link:https://github.com/cbruiz/printhor/[Printhor: The highly reliable but not necessarily functional 3D printer firmware]
** Targets some STM32 MCUs
* link:https://github.com/card-io-ecg/card-io-fw[Card/IO firmware] - firmware for an open source ECG device
** Targets the ESP32-S3 or ESP32-C6 MCU
* The link:https://github.com/lora-rs/lora-rs[lora-rs] project includes link:https://github.com/lora-rs/lora-rs/tree/main/examples/stm32l0/src/bin[various standalone examples] for NRF52840, RP2040, STM32L0 and STM32WL
* link:https://github.com/matoushybl/air-force-one[Air force one: A simple air quality monitoring system]
** Targets nRF52 and uses nrf-softdevice
* link:https://github.com/schmettow/ylab-edge-go[YLab Edge Go] and link:https://github.com/schmettow/ylab-edge-pro[YLab Edge Pro] projects develop
firmware (RP2040, STM32) for capturing physiological data in behavioural science research. Included so far are:
** biopotentials (analog ports)
** motion capture (6-axis accelerometers)
** air quality (CO2, Temp, Humidity)
** comes with an app for capturing and visualizing data [link:https://github.com/schmettow/ystudio-zero[Ystudio]]

@ -7,5 +7,5 @@ Main loop example
[source,rust] [source,rust]
---- ----
include::example$examples/std/src/bin/tick.rs[] include::../examples/examples/std/src/bin/tick.rs[]
---- ----

364
docs/pages/faq.adoc Normal file

@ -0,0 +1,364 @@
= Frequently Asked Questions
These are a list of unsorted, commonly asked questions and answers.
Please feel free to add items to link:https://github.com/embassy-rs/embassy/edit/main/docs/pages/faq.adoc[this page], especially if someone in the chat answered a question for you!
== How to deploy to RP2040 without a debugging probe.
Install link:https://github.com/JoNil/elf2uf2-rs[elf2uf2-rs] for converting the generated elf binary into a uf2 file.
Configure the runner to use this tool, add this to `.cargo/config.toml`:
[source,toml]
----
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "elf2uf2-rs --deploy --serial --verbose"
----
The command-line parameters `--deploy` will detect your device and upload the binary, `--serial` starts a serial connection. See the documentation for more info.
== Missing main macro
If you see an error like this:
[source,rust]
----
#[embassy_executor::main]
| ^^^^ could not find `main` in `embassy_executor`
----
You are likely missing some features of the `embassy-executor` crate.
For Cortex-M targets, check whether ALL of the following features are enabled in your `Cargo.toml` for the `embassy-executor` crate:
* `arch-cortex-m`
* `executor-thread`
For ESP32, consider using the executors and `#[main]` macro provided by your appropriate link:https://crates.io/crates/esp-hal-common[HAL crate].
== Why is my binary so big?
The first step to managing your binary size is to set up your link:https://doc.rust-lang.org/cargo/reference/profiles.html[profiles].
[source,toml]
----
[profile.release]
lto = true
opt-level = "s"
incremental = false
codegen-units = 1
# note: debug = true is okay - debuginfo isn't flashed to the device!
debug = true
----
All of these flags are elaborated on in the Rust Book page linked above.
=== My binary is still big... filled with `std::fmt` stuff!
This means your code is sufficiently complex that `panic!` invocation's formatting requirements could not be optimized out, despite your usage of `panic-halt` or `panic-reset`.
You can remedy this by adding the following to your `.cargo/config.toml`:
[source,toml]
----
[unstable]
build-std = ["core"]
build-std-features = ["panic_immediate_abort"]
----
This replaces all panics with a `UDF` (undefined) instruction.
Depending on your chipset, this will exhibit different behavior.
Refer to the spec for your chipset, but for `thumbv6m`, it results in a hardfault. Which can be configured like so:
[source,rust]
----
#[exception]
unsafe fn HardFault(_frame: &ExceptionFrame) -> ! {
SCB::sys_reset() // <- you could do something other than reset
}
----
Refer to cortex-m's link:https://docs.rs/cortex-m-rt/latest/cortex_m_rt/attr.exception.html[exception handling] for more info.
== `embassy-time` throws linker errors
If you see linker error like this:
[source,text]
----
= note: rust-lld: error: undefined symbol: _embassy_time_now
>>> referenced by driver.rs:127 (src/driver.rs:127)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::now::hefb1f99d6e069842) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
rust-lld: error: undefined symbol: _embassy_time_allocate_alarm
>>> referenced by driver.rs:134 (src/driver.rs:134)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::allocate_alarm::hf5145b6bd46706b2) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
rust-lld: error: undefined symbol: _embassy_time_set_alarm_callback
>>> referenced by driver.rs:139 (src/driver.rs:139)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::set_alarm_callback::h24f92388d96eafd2) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
rust-lld: error: undefined symbol: _embassy_time_set_alarm
>>> referenced by driver.rs:144 (src/driver.rs:144)
>>> embassy_time-846f66f1620ad42c.embassy_time.4f6a638abb75dd4c-cgu.0.rcgu.o:(embassy_time::driver::set_alarm::h530a5b1f444a6d5b) in archive Devel/Embedded/pogodyna/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-846f66f1620ad42c.rlib
----
You probably need to enable a time driver for your HAL (not in `embassy-time`!). For example with `embassy-stm32`, you might need to enable `time-driver-any`:
[source,toml]
----
[dependencies.embassy-stm32]
version = "0.1.0"
features = [
# ...
"time-driver-any", # Add this line!
# ...
]
----
If you are in the early project setup phase and not using anything from the HAL, make sure the HAL is explicitly used to prevent the linker removing it as dead code by adding this line to your source:
[source,rust]
----
use embassy_stm32 as _;
----
== Error: `Only one package in the dependency graph may specify the same links value.`
You have multiple versions of the same crate in your dependency tree. This means that some of your
embassy crates are coming from crates.io, and some from git, each of them pulling in a different set
of dependencies.
To resolve this issue, make sure to only use a single source for all your embassy crates!
To do this, you should patch your dependencies to use git sources using `[patch.crates.io]`
and maybe `[patch.'https://github.com/embassy-rs/embassy.git']`.
Example:
[source,toml]
----
[patch.crates-io]
embassy-time-queue-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
# embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "e5fdd35" }
----
Note that the git revision should match any other embassy patches or git dependencies that you are using!
== How can I optimize the speed of my embassy-stm32 program?
* Make sure RCC is set up to go as fast as possible
* Make sure link:https://docs.rs/cortex-m/latest/cortex_m/peripheral/struct.SCB.html[flash cache] is enabled
* build with `--release`
* Set the following keys for the release profile in your `Cargo.toml`:
** `opt-level = "s"`
** `lto = "fat"`
* Set the following keys in the `[unstable]` section of your `.cargo/config.toml`
** `build-std = ["core"]`
** `build-std-features = ["panic_immediate_abort"]`
* Enable feature `embassy-time/generic-queue`, disable feature `embassy-executor/integrated-timers`
* When using `InterruptExecutor`:
** disable `executor-thread`
** make `main`` spawn everything, then enable link:https://docs.rs/cortex-m/latest/cortex_m/peripheral/struct.SCB.html#method.set_sleeponexit[SCB.SLEEPONEXIT] and `loop { cortex_m::asm::wfi() }`
** *Note:* If you need 2 priority levels, using 2 interrupt executors is better than 1 thread executor + 1 interrupt executor.
== How do I set up the task arenas on stable?
When you aren't using the `nightly` feature of `embassy-executor`, the executor uses a bump allocator, which may require configuration.
Something like this error will occur at **compile time** if the task arena is *too large* for the target's RAM:
[source,plain]
----
rust-lld: error: section '.bss' will not fit in region 'RAM': overflowed by _ bytes
rust-lld: error: section '.uninit' will not fit in region 'RAM': overflowed by _ bytes
----
And this message will appear at **runtime** if the task arena is *too small* for the tasks running:
[source,plain]
----
ERROR panicked at 'embassy-executor: task arena is full. You must increase the arena size, see the documentation for details: https://docs.embassy.dev/embassy-executor/'
----
NOTE: If all tasks are spawned at startup, this panic will occur immediately.
Check out link:https://docs.embassy.dev/embassy-executor/git/cortex-m/index.html#task-arena[Task Arena Documentation] for more details.
== Can I use manual ISRs alongside Embassy?
Yes! This can be useful if you need to respond to an event as fast as possible, and the latency caused by the usual “ISR, wake, return from ISR, context switch to woken task” flow is too much for your application. Simply define a `#[interrupt] fn INTERRUPT_NAME() {}` handler as you would link:https://docs.rust-embedded.org/book/start/interrupts.html[in any other embedded rust project].
== How can I measure resource usage (CPU, RAM, etc.)?
=== For CPU Usage:
There are a couple techniques that have been documented, generally you want to measure how long you are spending in the idle or low priority loop.
We need to document specifically how to do this in embassy, but link:https://blog.japaric.io/cpu-monitor/[this older post] describes the general process.
If you end up doing this, please update this section with more specific examples!
=== For Static Memory Usage
Tools like `cargo size` and `cargo nm` can tell you the size of any globals or other static usage. Specifically you will want to see the size of the `.data` and `.bss` sections, which together make up the total global/static memory usage.
=== For Max Stack Usage
Check out link:https://github.com/Dirbaio/cargo-call-stack/[`cargo-call-stack`] for statically calculating worst-case stack usage. There are some caveats and inaccuracies possible with this, but this is a good way to get the general idea. See link:https://github.com/dirbaio/cargo-call-stack#known-limitations[the README] for more details.
== The memory definition for my STM chip seems wrong, how do I define a `memory.x` file?
It could happen that your project compiles, flashes but fails to run. The following situation can be true for your setup:
The `memory.x` is generated automatically when enabling the `memory-x` feature on the `embassy-stm32` crate in the `Cargo.toml` file.
This, in turn, uses `stm32-metapac` to generate the `memory.x` file for you. Unfortunately, more often than not this memory definition is not correct.
You can override this by adding your own `memory.x` file. Such a file could look like this:
```
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
}
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
```
Please refer to the STM32 documentation for the specific values suitable for your board and setup. The STM32 Cube examples often contain a linker script `.ld` file.
Look for the `MEMORY` section and try to determine the FLASH and RAM sizes and section start.
If you find a case where the memory.x is wrong, please report it on [this Github issue](https://github.com/embassy-rs/stm32-data/issues/301) so other users are not caught by surprise.
== The USB examples are not working on my board, is there anything else I need to configure?
If you are trying out the USB examples and your device doesn not connect, the most common issues are listed below.
=== Incorrect RCC config
Check your board and crystal/oscillator, in particular make sure that `HSE` is set to the correct value, e.g. `8_000_000` Hertz if your board does indeed run on a 8 MHz oscillator.
=== VBUS detection on STM32 platform
The USB specification requires that all USB devices monitor the bus for detection of plugging/unplugging actions. The devices must pull-up the D+ or D- lane as soon as the host supplies VBUS.
See the docs, for example at link:https://docs.embassy.dev/embassy-stm32/git/stm32f401vc/usb/struct.Config.html[`usb/struct.Config.html`] for information on how to enable/disable `vbus_detection`.
When the device is powered only from the USB bus that simultaneously serves as the data connection, this is optional. (If there's no power in VBUS the device would be off anyway, so it's safe to always assume there's power in VBUS, i.e. the USB cable is always plugged in). If your device doesn't have the required connections in place to allow VBUS sensing (see below), then this option needs to be set to `false` to work.
When the device is powered from another power source and therefore can stay powered through USB cable plug/unplug events, then this must be implemented and `vbus_detection` MUST be set to `true`.
If your board is powered from the USB and you are unsure whether it supports `vbus_detection`, consult the schematics of your board to see if VBUS is connected to PA9 for USB Full Speed or PB13 for USB High Speed, vice versa, possibly with a voltage divider. When designing your own hardware, see ST application note AN4879 (in particular section 2.6) and the reference manual of your specific chip for more details.
== Known issues (details and/or mitigations)
These are issues that are commonly reported. Help wanted fixing them, or improving the UX when possible!
=== STM32H5 and STM32H7 power issues
STM32 chips with built-in power management (SMPS and LDO) settings often cause user problems when the configuration does not match how the board was designed.
Settings from the examples, or even from other working boards, may not work on YOUR board, because they are wired differently.
Additionally, some PWR settings require a full device reboot (and enough time to discharge any power capacitors!), making this hard to troubleshoot. Also, some
"wrong" power settings will ALMOST work, meaning it will sometimes work on some boots, or for a while, but crash unexpectedly.
There is not a fix for this yet, as it is board/hardware dependant. See link:https://github.com/embassy-rs/embassy/issues/2806[this tracking issue] for more details
=== STM32 BDMA only working out of some RAM regions
The STM32 BDMA controller included in some STM32H7 chips has to be configured to use only certain regions of RAM,
otherwise the transfer will fail.
If you see errors that look like this:
[source,plain]
----
DMA: error on BDMA@1234ABCD channel 4
----
You need to set up your linker script to define a special region for this area and copy data to that region before using with BDMA.
General steps:
1. Find out which memory region BDMA has access to. You can get this information from the bus matrix and the memory mapping table in the STM32 datasheet.
2. Add the memory region to `memory.x`, you can modify the generated one from https://github.com/embassy-rs/stm32-data-generated/tree/main/data/chips.
3. You might need to modify `build.rs` to make cargo pick up the modified `memory.x`.
4. In your code, access the defined memory region using `#[link_section = ".xxx"]`
5. Copy data to that region before using BDMA.
See link:https://github.com/embassy-rs/embassy/blob/main/examples/stm32h7/src/bin/spi_bdma.rs[SMT32H7 SPI BDMA example] for more details.
== How do I switch to the `main` branch?
Sometimes to test new changes or fixes, you'll want to switch your project to using a version from GitHub.
You can add a section to your `Cargo.toml` file like this, you'll need to patch ALL embassy crates to the same revision:
Using `patch` will replace all direct AND indirect dependencies.
See the link:https://embassy.dev/book/#_starting_a_new_project[new project docs] for more details on this approach.
[source,toml]
----
[patch.crates-io]
# make sure to get the latest git rev from github, you can see the latest one here:
# https://github.com/embassy-rs/embassy/commits/main/
embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" }
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" }
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" }
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" }
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" }
embassy-usb = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" }
embassy-usb-driver = { git = "https://github.com/embassy-rs/embassy", rev = "4cade64ebd34bf93458f17cfe85c5f710d0ff13c" }
----
== How do I add support for a new microcontroller to embassy?
This is particularly for cortex-m, and potentially risc-v, where there is already support for basics like interrupt handling, or even already embassy-executor support for your architecture.
This is a *much harder path* than just using Embassy on an already supported chip. If you are a beginner, consider using embassy on an existing, well supported chip for a while, before you decide to write drivers from scratch. It's also worth reading the existing source of supported Embassy HALs, to get a feel for how drivers are implemented for various chips. You should already be comfortable reading and writing unsafe code, and understanding the responsibilities of writing safe abstractions for users of your HAL.
This is not the only possible approach, but if you are looking for where to start, this is a reasonable way to tackle the task:
1. First, drop by the Matrix room or search around to see if someone has already started writing drivers, either in Embassy or otherwise in Rust. You might not have to start from scratch!
2. Make sure the target is supported in probe-rs, it likely is, and if not, there is likely a cmsis-pack you can use to add support so that flashing and debugging is possible. You will definitely appreciate being able to debug with SWD or JTAG when writing drivers!
3. See if there is an SVD (or SVDs, if it's a family) available, if it is, run it through chiptool to create a PAC for low level register access. If not, there are other ways (like scraping the PDF datasheets or existing C header files), but these are more work than starting from the SVD file to define peripheral memory locations necessary for writing drivers.
4. Either make a fork of embassy repo, and add your target there, or make a repo that just contains the PAC and an empty HAL. It doesn't necessarily have to live in the embassy repo at first.
5. Get a hello world binary working on your chip, either with minimal HAL or just PAC access, use delays and blink a light or send some raw data on some interface, make sure it works and you can flash, debug with defmt + RTT, write a proper linker script, etc.
6. Get basic timer operations and timer interrupts working, upgrade your blinking application to use hardware timers and interrupts, and ensure they are accurate (with a logic analyzer or oscilloscope, if possible).
7. Implement the embassy-time driver API with your timer and timer interrupt code, so that you can use embassy-time operations in your drivers and applications.
8. Then start implementing whatever peripherals you need, like GPIOs, UART, SPI, I2C, etc. This is the largest part of the work, and will likely continue for a while! Don't feel like you need 100% coverage of all peripherals at first, this is likely to be an ongoing process over time.
9. Start implementing the embedded-hal, embedded-io, and embedded-hal-async traits on top of your HAL drivers, once you start having more features completed. This will allow users to use standard external device drivers (e.g. sensors, actuators, displays, etc.) with your HAL.
10. Discuss upstreaming the PAC/HAL for embassy support, or make sure your drivers are added to the awesome-embedded-rust list so that people can find it.
== Multiple Tasks, or one task with multiple futures?
Some examples end like this in main:
[source,rust]
----
// Run everything concurrently.
// If we had made everything `'static` above instead, we could do this using separate tasks instead.
join(usb_fut, join(echo_fut, log_fut)).await;
----
There are two main ways to handle concurrency in Embassy:
1. Spawn multiple tasks, e.g. with `#[embassy_executor::task]`
2. Manage multiple futures inside ONE task using `join()` or `select()` (as shown above)
In general, either of these approaches will work. The main differences of these approaches are:
When using **separate tasks**, each task needs its own RAM allocation, so there's a little overhead for each task, so one task that does three things will likely be a little bit smaller than three tasks that do one thing (not a lot, probably a couple dozen bytes). In contrast, with **multiple futures in one task**, you don't need multiple task allocations, and it will generally be easier to share data, or use borrowed resources, inside of a single task.
An example showcasing some methods for sharing things between tasks link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here].
But when it comes to "waking" tasks, for example when a data transfer is complete or a button is pressed, it's faster to wake a dedicated task, because that task does not need to check which future is actually ready. `join` and `select` must check ALL of the futures they are managing to see which one (or which ones) are ready to do more work. This is because all Rust executors (like Embassy or Tokio) only have the ability to wake tasks, not specific futures. This means you will use slightly less CPU time juggling futures when using dedicated tasks.
Practically, there's not a LOT of difference either way - so go with what makes it easier for you and your code first, but there will be some details that are slightly different in each case.
== splitting peripherals resources between tasks
There are two ways to split resources between tasks, either manually assigned or by a convenient macro. See link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/assign_resources.rs[this example]

@ -131,13 +131,16 @@ If youre using a raspberry pi pico-w, make sure youre running `+cargo run
If youre using an rp2040 debug probe (e.g. the pico probe) and are having issues after running `probe-rs info`, unplug and reconnect the probe, letting it power cycle. Running `probe-rs info` is link:https://github.com/probe-rs/probe-rs/issues/1849[known to put the pico probe into an unusable state]. If youre using an rp2040 debug probe (e.g. the pico probe) and are having issues after running `probe-rs info`, unplug and reconnect the probe, letting it power cycle. Running `probe-rs info` is link:https://github.com/probe-rs/probe-rs/issues/1849[known to put the pico probe into an unusable state].
If youre still having problems, check the link:https://embassy.dev/book/dev/faq.html[FAQ], or ask for help in the link:https://matrix.to/#/#embassy-rs:matrix.org[Embassy Chat Room]. :embassy-dev-faq-link-with-hash: https://embassy.dev/book/#_frequently_asked_questions
:embassy-matrix-channel: https://matrix.to/#/#embassy-rs:matrix.org
If youre still having problems, check the {embassy-dev-faq-link-with-hash}[FAQ], or ask for help in the {embassy-matrix-channel}[Embassy Chat Room].
== What's next? == What's next?
Congratulations, you have your first Embassy application running! Here are some suggestions for where to go from here: Congratulations, you have your first Embassy application running! Here are some suggestions for where to go from here:
* Read more about the xref:runtime.adoc[executor]. * Read more about the xref:_embassy_executor[executor].
* Read more about the xref:hal.adoc[HAL]. * Read more about the xref:_hardware_abstraction_layer_hal[HAL].
* Start xref:basic_application.adoc[writing your application]. * Start xref:_a_basic_embassy_application[writing your application].
* Learn how to xref:new_project.adoc[start a new embassy project by adapting an example]. * Learn how to xref:_starting_a_new_project[start a new embassy project by adapting an example].

@ -10,3 +10,5 @@ These HALs implement async/await functionality for most peripherals while also i
async traits in `embedded-hal` and `embedded-hal-async`. You can also use these HALs with another executor. async traits in `embedded-hal` and `embedded-hal-async`. You can also use these HALs with another executor.
For the ESP32 series, there is an link:https://github.com/esp-rs/esp-hal[esp-hal] which you can use. For the ESP32 series, there is an link:https://github.com/esp-rs/esp-hal[esp-hal] which you can use.
For the WCH 32-bit RISC-V series, there is an link:https://github.com/ch32-rs/ch32-hal[ch32-hal], which you can use.

@ -16,7 +16,7 @@ The blinky app using PAC is shown below:
[source,rust] [source,rust]
---- ----
include::example$layer-by-layer/blinky-pac/src/main.rs[] include::../examples/layer-by-layer/blinky-pac/src/main.rs[]
---- ----
As you can see, a lot of code is needed to enable the peripheral clocks and to configure the input pins and the output pins of the application. As you can see, a lot of code is needed to enable the peripheral clocks and to configure the input pins and the output pins of the application.
@ -35,7 +35,7 @@ The HAL example is shown below:
[source,rust] [source,rust]
---- ----
include::example$layer-by-layer/blinky-hal/src/main.rs[] include::../examples/layer-by-layer/blinky-hal/src/main.rs[]
---- ----
As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` types hide all the details of accessing the GPIO registers and allow you to use a much simpler API for querying the state of the button and toggling the LED output. As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` types hide all the details of accessing the GPIO registers and allow you to use a much simpler API for querying the state of the button and toggling the LED output.
@ -52,7 +52,7 @@ Given Embassy focus on async Rust (which we'll come back to after this example),
[source,rust] [source,rust]
---- ----
include::example$layer-by-layer/blinky-irq/src/main.rs[lines="1..57"] include::../examples/layer-by-layer/blinky-irq/src/main.rs[lines="1..57"]
---- ----
The simple application is now more complex again, primarily because of the need to keep the button and LED states in the global scope where it is accessible by the main application loop, as well as the interrupt handler. The simple application is now more complex again, primarily because of the need to keep the button and LED states in the global scope where it is accessible by the main application loop, as well as the interrupt handler.
@ -63,11 +63,11 @@ Luckily, there is an elegant solution to this problem when using Embassy.
== Async version == Async version
It's time to use the Embassy capabilities to its fullest. At the core, Embassy has an async excecutor, or a runtime for async tasks if you will. The executor polls a set of tasks (defined at compile time), and whenever a task `blocks`, the executor will run another task, or put the microcontroller to sleep. It's time to use the Embassy capabilities to its fullest. At the core, Embassy has an async executor, or a runtime for async tasks if you will. The executor polls a set of tasks (defined at compile time), and whenever a task `blocks`, the executor will run another task, or put the microcontroller to sleep.
[source,rust] [source,rust]
---- ----
include::example$layer-by-layer/blinky-async/src/main.rs[] include::../examples/layer-by-layer/blinky-async/src/main.rs[]
---- ----
The async version looks very similar to the HAL version, apart from a few minor details: The async version looks very similar to the HAL version, apart from a few minor details:
@ -76,7 +76,7 @@ The async version looks very similar to the HAL version, apart from a few minor
* The peripheral initialization is done by the main macro, and is handed to the main task. * The peripheral initialization is done by the main macro, and is handed to the main task.
* Before checking the button state, the application is awaiting a transition in the pin state (low -> high or high -> low). * Before checking the button state, the application is awaiting a transition in the pin state (low -> high or high -> low).
When `button.await_for_any_edge().await` is called, the executor will pause the main task and put the microcontroller in sleep mode, unless there are other tasks that can run. Internally, the Embassy HAL has configured the interrupt handler for the button (in `ExtiButton`), so that whenever an interrupt is raised, the task awaiting the button will be woken up. When `button.await_for_any_edge().await` is called, the executor will pause the main task and put the microcontroller in sleep mode, unless there are other tasks that can run. Internally, the Embassy HAL has configured the interrupt handler for the button (in `ExtiInput`), so that whenever an interrupt is raised, the task awaiting the button will be woken up.
The minimal overhead of the executor and the ability to run multiple tasks "concurrently" combined with the enormous simplification of the application, makes `async` a great fit for embedded. The minimal overhead of the executor and the ability to run multiple tasks "concurrently" combined with the enormous simplification of the application, makes `async` a great fit for embedded.

@ -1,17 +1,18 @@
= Starting a new Embassy project = Starting a new project
Once youve successfully xref:getting_started.adoc[run some example projects], the next step is to make a standalone Embassy project. Once youve successfully xref:#_getting_started[run some example projects], the next step is to make a standalone Embassy project.
There are some tools for generating Embassy projects: (WIP) == Tools for generating Embassy projects
==== CLI === CLI
- link:https://github.com/adinack/cargo-embassy[cargo-embassy] (STM32 and NRF) - link:https://github.com/adinack/cargo-embassy[cargo-embassy] (STM32 and NRF)
==== cargo-generate === cargo-generate
- link:https://github.com/lulf/embassy-template[embassy-template] (STM32, NRF, and RP) - link:https://github.com/lulf/embassy-template[embassy-template] (STM32, NRF, and RP)
- link:https://github.com/bentwire/embassy-rp2040-template[embassy-rp2040-template] (RP) - link:https://github.com/bentwire/embassy-rp2040-template[embassy-rp2040-template] (RP)
But if you want to start from scratch:
== Starting a project from scratch
As an example, lets create a new embassy project from scratch for a STM32G474. The same instructions are applicable for any supported chip with some minor changes. As an example, lets create a new embassy project from scratch for a STM32G474. The same instructions are applicable for any supported chip with some minor changes.
@ -35,7 +36,7 @@ stm32g474-example
Looking in link:https://github.com/embassy-rs/embassy/tree/main/examples[the Embassy examples], we can see theres a `stm32g4` folder. Find `src/blinky.rs` and copy its contents into our `src/main.rs`. Looking in link:https://github.com/embassy-rs/embassy/tree/main/examples[the Embassy examples], we can see theres a `stm32g4` folder. Find `src/blinky.rs` and copy its contents into our `src/main.rs`.
== .cargo/config.toml === The .cargo/config.toml
Currently, wed need to provide cargo with a target triple every time we run `cargo build` or `cargo run`. Lets spare ourselves that work by copying `.cargo/config.toml` from `examples/stm32g4` into our project. Currently, wed need to provide cargo with a target triple every time we run `cargo build` or `cargo run`. Lets spare ourselves that work by copying `.cargo/config.toml` from `examples/stm32g4` into our project.
@ -66,7 +67,7 @@ and copying `STM32G474RETx` into `.cargo/config.toml` as so:
runner = "probe-rs run --chip STM32G474RETx" runner = "probe-rs run --chip STM32G474RETx"
---- ----
== Cargo.toml === Cargo.toml
Now that cargo knows what target to compile for (and probe-rs knows what chip to run it on), were ready to add some dependencies. Now that cargo knows what target to compile for (and probe-rs knows what chip to run it on), were ready to add some dependencies.
@ -117,7 +118,7 @@ Finally, copy the `[profile.release]` section from the example `Cargo.toml` into
debug = 2 debug = 2
---- ----
== rust-toolchain.toml === rust-toolchain.toml
Before we can build our project, we need to add an additional file to tell cargo to use the nightly toolchain. Copy the `rust-toolchain.toml` from the embassy repo to ours, and trim the list of targets down to only the target triple relevent for our project — in this case, `thumbv7em-none-eabi`: Before we can build our project, we need to add an additional file to tell cargo to use the nightly toolchain. Copy the `rust-toolchain.toml` from the embassy repo to ours, and trim the list of targets down to only the target triple relevent for our project — in this case, `thumbv7em-none-eabi`:
@ -142,7 +143,7 @@ components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ]
targets = ["thumbv7em-none-eabi"] targets = ["thumbv7em-none-eabi"]
---- ----
== build.rs === build.rs
In order to produce a working binary for our target, cargo requires a custom build script. Copy `build.rs` from the example to our project: In order to produce a working binary for our target, cargo requires a custom build script. Copy `build.rs` from the example to our project:
@ -158,7 +159,7 @@ stm32g474-example
└── main.rs └── main.rs
---- ----
== Building and running === Building and running
At this point, were finally ready to build and run our project! Connect your board via a debug probe and run: At this point, were finally ready to build and run our project! Connect your board via a debug probe and run:

@ -1,6 +1,6 @@
= Embassy nRF HAL = Embassy nRF HAL
The link:https://github.com/embassy-rs/embassy/tree/master/embassy-nrf[Embassy nRF HAL] is based on the PACs (Peripheral Access Crate) from link:https://github.com/nrf-rs/[nrf-rs]. The link:https://github.com/embassy-rs/embassy/tree/main/embassy-nrf[Embassy nRF HAL] is based on the PACs (Peripheral Access Crate) from link:https://github.com/nrf-rs/[nrf-rs].
== Timer driver == Timer driver

@ -1,4 +1,4 @@
= Embassy = Introduction
Embassy is a project to make async/await a first-class option for embedded development. Embassy is a project to make async/await a first-class option for embedded development.
@ -30,6 +30,7 @@ The Embassy project maintains HALs for select hardware, but you can still use HA
* link:https://docs.embassy.dev/embassy-nrf/[embassy-nrf], for the Nordic Semiconductor nRF52, nRF53, nRF91 series. * link:https://docs.embassy.dev/embassy-nrf/[embassy-nrf], for the Nordic Semiconductor nRF52, nRF53, nRF91 series.
* link:https://docs.embassy.dev/embassy-rp/[embassy-rp], for the Raspberry Pi RP2040 microcontroller. * link:https://docs.embassy.dev/embassy-rp/[embassy-rp], for the Raspberry Pi RP2040 microcontroller.
* link:https://github.com/esp-rs[esp-rs], for the Espressif Systems ESP32 series of chips. * link:https://github.com/esp-rs[esp-rs], for the Espressif Systems ESP32 series of chips.
* link:https://github.com/ch32-rs/ch32-hal[ch32-hal], for the WCH 32-bit RISC-V(CH32V) series of chips.
NOTE: A common question is if one can use the Embassy HALs standalone. Yes, it is possible! There are no dependency on the executor within the HALs. You can even use them without async, NOTE: A common question is if one can use the Embassy HALs standalone. Yes, it is possible! There are no dependency on the executor within the HALs. You can even use them without async,
as they implement both the link:https://github.com/rust-embedded/embedded-hal[Embedded HAL] blocking and async traits. as they implement both the link:https://github.com/rust-embedded/embedded-hal[Embedded HAL] blocking and async traits.
@ -47,7 +48,7 @@ link:https://github.com/lora-rs/lora-rs[lora-rs] supports LoRa networking on a w
link:https://docs.embassy.dev/embassy-usb/[embassy-usb] implements a device-side USB stack. Implementations for common classes such as USB serial (CDC ACM) and USB HID are available, and a rich builder API allows building your own. link:https://docs.embassy.dev/embassy-usb/[embassy-usb] implements a device-side USB stack. Implementations for common classes such as USB serial (CDC ACM) and USB HID are available, and a rich builder API allows building your own.
=== Bootloader and DFU === Bootloader and DFU
link:https://github.com/embassy-rs/embassy/tree/master/embassy-boot[embassy-boot] is a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks. link:https://github.com/embassy-rs/embassy/tree/main/embassy-boot[embassy-boot] is a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks.
== What is DMA? == What is DMA?
@ -55,6 +56,20 @@ For most I/O in embedded devices, the peripheral doesn't directly support the tr
The Direct Memory Access controller (DMA) is a controller that is present in MCUs that Embassy supports, including stm32 and nrf. The DMA allows the MCU to set up a transfer, either send or receive, and then wait for the transfer to complete. With DMA, once started, no MCU intervention is required until the transfer is complete, meaning that the MCU can perform other computation, or set up other I/O while the transfer is in progress. For high I/O rates, DMA can cut the time that the MCU spends handling I/O by over half. However, because DMA is more complex to set-up, it is less widely used in the embedded community. Embassy aims to change that by making DMA the first choice rather than the last. Using Embassy, there's no additional tuning required once I/O rates increase because your application is already set-up to handle them. The Direct Memory Access controller (DMA) is a controller that is present in MCUs that Embassy supports, including stm32 and nrf. The DMA allows the MCU to set up a transfer, either send or receive, and then wait for the transfer to complete. With DMA, once started, no MCU intervention is required until the transfer is complete, meaning that the MCU can perform other computation, or set up other I/O while the transfer is in progress. For high I/O rates, DMA can cut the time that the MCU spends handling I/O by over half. However, because DMA is more complex to set-up, it is less widely used in the embedded community. Embassy aims to change that by making DMA the first choice rather than the last. Using Embassy, there's no additional tuning required once I/O rates increase because your application is already set-up to handle them.
== Examples
Embassy provides examples for all HALs supported. You can find them in the `examples/` folder.
Main loop example
[source,rust]
----
include::../examples/examples/std/src/bin/tick.rs[]
----
include::embassy_in_the_wild.adoc[leveloffset = 2]
== Resources == Resources
For more reading material on async Rust and Embassy: For more reading material on async Rust and Embassy:

@ -18,6 +18,7 @@ my-project
|- rust-toolchain.toml |- rust-toolchain.toml
---- ----
[discrete]
== .cargo/config.toml == .cargo/config.toml
This directory/file describes what platform you're on, and configures link:https://github.com/probe-rs/probe-rs[probe-rs] to deploy to your device. This directory/file describes what platform you're on, and configures link:https://github.com/probe-rs/probe-rs[probe-rs] to deploy to your device.
@ -36,21 +37,27 @@ target = "thumbv6m-none-eabi" # <-change for your platform
DEFMT_LOG = "trace" # <- can change to info, warn, or error DEFMT_LOG = "trace" # <- can change to info, warn, or error
---- ----
[discrete]
== build.rs == build.rs
This is the build script for your project. It links defmt (what is link:https://defmt.ferrous-systems.com[defmt]?) and the `memory.x` file if needed. This file is pretty specific for each chipset, just copy and paste from the corresponding link:https://github.com/embassy-rs/embassy/tree/main/examples[example]. This is the build script for your project. It links defmt (what is link:https://defmt.ferrous-systems.com[defmt]?) and the `memory.x` file if needed. This file is pretty specific for each chipset, just copy and paste from the corresponding link:https://github.com/embassy-rs/embassy/tree/main/examples[example].
[discrete]
== Cargo.toml == Cargo.toml
This is your manifest file, where you can configure all of the embassy components to use the features you need. This is your manifest file, where you can configure all of the embassy components to use the features you need.
==== Features [discrete]
===== Time === Features
[discrete]
==== Time
- tick-hz-x: Configures the tick rate of `embassy-time`. Higher tick rate means higher precision, and higher CPU wakes. - tick-hz-x: Configures the tick rate of `embassy-time`. Higher tick rate means higher precision, and higher CPU wakes.
- defmt-timestamp-uptime: defmt log entries will display the uptime in seconds. - defmt-timestamp-uptime: defmt log entries will display the uptime in seconds.
...more to come ...more to come
[discrete]
== memory.x == memory.x
This file outlines the flash/ram usage of your program. It is especially useful when using link:https://github.com/embassy-rs/nrf-softdevice[nrf-softdevice] on an nRF5x. This file outlines the flash/ram usage of your program. It is especially useful when using link:https://github.com/embassy-rs/nrf-softdevice[nrf-softdevice] on an nRF5x.
@ -68,6 +75,7 @@ MEMORY
} }
---- ----
[discrete]
== rust-toolchain.toml == rust-toolchain.toml
This file configures the rust version and configuration to use. This file configures the rust version and configuration to use.

@ -8,6 +8,7 @@ The following examples shows different ways to use the on-board LED on a Raspber
Using mutual exclusion is the simplest way to share a peripheral. Using mutual exclusion is the simplest way to share a peripheral.
TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
[,rust] [,rust]
---- ----
use defmt::*; use defmt::*;
@ -77,6 +78,7 @@ To indicate that the pin will be set to an Output. The `AnyPin` could have been
A channel is another way to ensure exclusive access to a resource. Using a channel is great in the cases where the access can happen at a later point in time, allowing you to enqueue operations and do other things. A channel is another way to ensure exclusive access to a resource. Using a channel is great in the cases where the access can happen at a later point in time, allowing you to enqueue operations and do other things.
TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
[,rust] [,rust]
---- ----
use defmt::*; use defmt::*;
@ -123,4 +125,10 @@ async fn toggle_led(control: Sender<'static, ThreadModeRawMutex, LedState, 64>,
---- ----
This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure This example replaces the Mutex with a Channel, and uses another task (the main loop) to drive the LED. The advantage of this approach is that only a single task references the peripheral, separating concerns. However, using a Mutex has a lower overhead and might be necessary if you need to ensure
that the operation is ecompleted before continuing to do other work in your task. that the operation is completed before continuing to do other work in your task.
An example showcasing more methods for sharing link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/sharing.rs[can be found here].
== Sharing an I2C or SPI bus between multiple devices
An example of how to deal with multiple devices sharing a common I2C or SPI bus link:https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/shared_bus.rs[can be found here].

@ -1,6 +1,6 @@
= Embassy STM32 HAL = Embassy STM32 HAL
The link:https://github.com/embassy-rs/embassy/tree/master/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project. The link:https://github.com/embassy-rs/embassy/tree/main/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project.
== The infinite variant problem == The infinite variant problem

13
docs/pages/system.adoc Normal file

@ -0,0 +1,13 @@
= System description
This section describes different parts of Embassy in more detail.
include::runtime.adoc[leveloffset = 2]
include::bootloader.adoc[leveloffset = 2]
include::time_keeping.adoc[leveloffset = 2]
include::hal.adoc[leveloffset = 2]
include::nrf.adoc[leveloffset = 2]
include::stm32.adoc[leveloffset = 2]
include::sharing_peripherals.adoc[leveloffset = 2]
include::developer.adoc[leveloffset = 2]
include::developer_stm32.adoc[leveloffset = 2]

@ -16,6 +16,7 @@ The `embassy::time::Timer` type provides two timing methods.
An example of a delay is provided as follows: An example of a delay is provided as follows:
TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
[,rust] [,rust]
---- ----
use embassy::executor::{task, Executor}; use embassy::executor::{task, Executor};
@ -40,6 +41,7 @@ that expect a generic delay implementation to be provided.
An example of how this can be used: An example of how this can be used:
TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
[,rust] [,rust]
---- ----
use embassy::executor::{task, Executor}; use embassy::executor::{task, Executor};

@ -1,7 +1,7 @@
[package] [package]
edition = "2021" edition = "2021"
name = "embassy-boot-nrf" name = "embassy-boot-nrf"
version = "0.2.0" version = "0.3.0"
description = "Bootloader lib for nRF chips" description = "Bootloader lib for nRF chips"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/embassy-rs/embassy" repository = "https://github.com/embassy-rs/embassy"
@ -22,10 +22,11 @@ target = "thumbv7em-none-eabi"
[dependencies] [dependencies]
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }
log = { version = "0.4.17", optional = true }
embassy-sync = { version = "0.5.0", path = "../embassy-sync" } embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
embassy-nrf = { version = "0.1.0", path = "../embassy-nrf", default-features = false } embassy-nrf = { version = "0.2.0", path = "../embassy-nrf", default-features = false }
embassy-boot = { version = "0.2.0", path = "../embassy-boot" } embassy-boot = { version = "0.3.0", path = "../embassy-boot" }
cortex-m = { version = "0.7.6" } cortex-m = { version = "0.7.6" }
cortex-m-rt = { version = "0.7" } cortex-m-rt = { version = "0.7" }
embedded-storage = "0.3.1" embedded-storage = "0.3.1"

@ -2,7 +2,7 @@
An [Embassy](https://embassy.dev) project. An [Embassy](https://embassy.dev) project.
An adaptation of `embassy-boot` for nRF. An adaptation of `embassy-boot` for nRF.
## Features ## Features

@ -1,11 +1,12 @@
#![macro_use] #![macro_use]
#![allow(unused_macros)] #![allow(unused)]
use core::fmt::{Debug, Display, LowerHex}; use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))] #[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features."); compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert { macro_rules! assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -17,6 +18,7 @@ macro_rules! assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_eq { macro_rules! assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -28,6 +30,7 @@ macro_rules! assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_ne { macro_rules! assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -39,6 +42,7 @@ macro_rules! assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert { macro_rules! debug_assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -50,6 +54,7 @@ macro_rules! debug_assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_eq { macro_rules! debug_assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -61,6 +66,7 @@ macro_rules! debug_assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_ne { macro_rules! debug_assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -72,6 +78,7 @@ macro_rules! debug_assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! todo { macro_rules! todo {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -83,20 +90,19 @@ macro_rules! todo {
}; };
} }
#[cfg(not(feature = "defmt"))] #[collapse_debuginfo(yes)]
macro_rules! unreachable { macro_rules! unreachable {
($($x:tt)*) => { ($($x:tt)*) => {
::core::unreachable!($($x)*) {
}; #[cfg(not(feature = "defmt"))]
} ::core::unreachable!($($x)*);
#[cfg(feature = "defmt")]
#[cfg(feature = "defmt")] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! panic { macro_rules! panic {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -108,6 +114,7 @@ macro_rules! panic {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! trace { macro_rules! trace {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -121,6 +128,7 @@ macro_rules! trace {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug { macro_rules! debug {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -134,6 +142,7 @@ macro_rules! debug {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! info { macro_rules! info {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -147,6 +156,7 @@ macro_rules! info {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! warn { macro_rules! warn {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -160,6 +170,7 @@ macro_rules! warn {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! error { macro_rules! error {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -174,6 +185,7 @@ macro_rules! error {
} }
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($($x:tt)*) => { ($($x:tt)*) => {
::defmt::unwrap!($($x)*) ::defmt::unwrap!($($x)*)
@ -181,6 +193,7 @@ macro_rules! unwrap {
} }
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($arg:expr) => { ($arg:expr) => {
match $crate::fmt::Try::into_result($arg) { match $crate::fmt::Try::into_result($arg) {
@ -229,7 +242,6 @@ impl<T, E> Try for Result<T, E> {
} }
} }
#[allow(unused)]
pub(crate) struct Bytes<'a>(pub &'a [u8]); pub(crate) struct Bytes<'a>(pub &'a [u8]);
impl<'a> Debug for Bytes<'a> { impl<'a> Debug for Bytes<'a> {

@ -20,7 +20,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>( pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
config: BootLoaderConfig<ACTIVE, DFU, STATE>, config: BootLoaderConfig<ACTIVE, DFU, STATE>,
) -> Self { ) -> Self {
Self::try_prepare::<ACTIVE, DFU, STATE>(config).expect("Boot prepare error") if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE>(config) {
loader
} else {
// Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
// properly
panic!("Boot prepare error")
}
} }
/// Inspect the bootloader state and perform actions required before booting, such as swapping firmware /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware

@ -1,7 +1,7 @@
[package] [package]
edition = "2021" edition = "2021"
name = "embassy-boot-rp" name = "embassy-boot-rp"
version = "0.2.0" version = "0.3.0"
description = "Bootloader lib for RP2040 chips" description = "Bootloader lib for RP2040 chips"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/embassy-rs/embassy" repository = "https://github.com/embassy-rs/embassy"
@ -21,13 +21,12 @@ target = "thumbv6m-none-eabi"
[dependencies] [dependencies]
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }
defmt-rtt = { version = "0.4", optional = true }
log = { version = "0.4", optional = true } log = { version = "0.4", optional = true }
embassy-sync = { version = "0.5.0", path = "../embassy-sync" } embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
embassy-rp = { version = "0.1.0", path = "../embassy-rp", default-features = false } embassy-rp = { version = "0.2.0", path = "../embassy-rp", default-features = false }
embassy-boot = { version = "0.2.0", path = "../embassy-boot" } embassy-boot = { version = "0.3.0", path = "../embassy-boot" }
embassy-time = { version = "0.3.0", path = "../embassy-time" } embassy-time = { version = "0.3.2", path = "../embassy-time" }
cortex-m = { version = "0.7.6" } cortex-m = { version = "0.7.6" }
cortex-m-rt = { version = "0.7" } cortex-m-rt = { version = "0.7" }
@ -46,7 +45,6 @@ log = [
"embassy-boot/log", "embassy-boot/log",
"embassy-rp/log", "embassy-rp/log",
] ]
debug = ["defmt-rtt"]
[profile.dev] [profile.dev]
debug = 2 debug = 2

@ -5,4 +5,5 @@ fn main() {
if target.starts_with("thumbv6m-") { if target.starts_with("thumbv6m-") {
println!("cargo:rustc-cfg=armv6m"); println!("cargo:rustc-cfg=armv6m");
} }
println!("cargo:rustc-check-cfg=cfg(armv6m)");
} }

@ -1,11 +1,12 @@
#![macro_use] #![macro_use]
#![allow(unused_macros)] #![allow(unused)]
use core::fmt::{Debug, Display, LowerHex}; use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))] #[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features."); compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert { macro_rules! assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -17,6 +18,7 @@ macro_rules! assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_eq { macro_rules! assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -28,6 +30,7 @@ macro_rules! assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_ne { macro_rules! assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -39,6 +42,7 @@ macro_rules! assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert { macro_rules! debug_assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -50,6 +54,7 @@ macro_rules! debug_assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_eq { macro_rules! debug_assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -61,6 +66,7 @@ macro_rules! debug_assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_ne { macro_rules! debug_assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -72,6 +78,7 @@ macro_rules! debug_assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! todo { macro_rules! todo {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -83,20 +90,19 @@ macro_rules! todo {
}; };
} }
#[cfg(not(feature = "defmt"))] #[collapse_debuginfo(yes)]
macro_rules! unreachable { macro_rules! unreachable {
($($x:tt)*) => { ($($x:tt)*) => {
::core::unreachable!($($x)*) {
}; #[cfg(not(feature = "defmt"))]
} ::core::unreachable!($($x)*);
#[cfg(feature = "defmt")]
#[cfg(feature = "defmt")] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! panic { macro_rules! panic {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -108,6 +114,7 @@ macro_rules! panic {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! trace { macro_rules! trace {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -121,6 +128,7 @@ macro_rules! trace {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug { macro_rules! debug {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -134,6 +142,7 @@ macro_rules! debug {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! info { macro_rules! info {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -147,6 +156,7 @@ macro_rules! info {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! warn { macro_rules! warn {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -160,6 +170,7 @@ macro_rules! warn {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! error { macro_rules! error {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -174,6 +185,7 @@ macro_rules! error {
} }
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($($x:tt)*) => { ($($x:tt)*) => {
::defmt::unwrap!($($x)*) ::defmt::unwrap!($($x)*)
@ -181,6 +193,7 @@ macro_rules! unwrap {
} }
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($arg:expr) => { ($arg:expr) => {
match $crate::fmt::Try::into_result($arg) { match $crate::fmt::Try::into_result($arg) {
@ -229,7 +242,6 @@ impl<T, E> Try for Result<T, E> {
} }
} }
#[allow(unused)]
pub(crate) struct Bytes<'a>(pub &'a [u8]); pub(crate) struct Bytes<'a>(pub &'a [u8]);
impl<'a> Debug for Bytes<'a> { impl<'a> Debug for Bytes<'a> {

@ -21,7 +21,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>( pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
config: BootLoaderConfig<ACTIVE, DFU, STATE>, config: BootLoaderConfig<ACTIVE, DFU, STATE>,
) -> Self { ) -> Self {
Self::try_prepare::<ACTIVE, DFU, STATE>(config).expect("Boot prepare error") if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE>(config) {
loader
} else {
// Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
// properly
panic!("Boot prepare error")
}
} }
/// Inspect the bootloader state and perform actions required before booting, such as swapping firmware /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware

@ -13,7 +13,7 @@ categories = [
] ]
[package.metadata.embassy_docs] [package.metadata.embassy_docs]
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot-stm32/src/" src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-stm32-v$VERSION/embassy-boot-stm32/src/"
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-boot-stm32/src/" src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-boot-stm32/src/"
features = ["embassy-stm32/stm32f429zi"] features = ["embassy-stm32/stm32f429zi"]
target = "thumbv7em-none-eabi" target = "thumbv7em-none-eabi"
@ -22,12 +22,11 @@ target = "thumbv7em-none-eabi"
[dependencies] [dependencies]
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }
defmt-rtt = { version = "0.4", optional = true }
log = { version = "0.4", optional = true } log = { version = "0.4", optional = true }
embassy-sync = { version = "0.5.0", path = "../embassy-sync" } embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false } embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false }
embassy-boot = { version = "0.2.0", path = "../embassy-boot" } embassy-boot = { version = "0.3.0", path = "../embassy-boot" }
cortex-m = { version = "0.7.6" } cortex-m = { version = "0.7.6" }
cortex-m-rt = { version = "0.7" } cortex-m-rt = { version = "0.7" }
embedded-storage = "0.3.1" embedded-storage = "0.3.1"
@ -37,7 +36,6 @@ cfg-if = "1.0.0"
[features] [features]
defmt = ["dep:defmt", "embassy-boot/defmt", "embassy-stm32/defmt"] defmt = ["dep:defmt", "embassy-boot/defmt", "embassy-stm32/defmt"]
log = ["dep:log", "embassy-boot/log", "embassy-stm32/log"] log = ["dep:log", "embassy-boot/log", "embassy-stm32/log"]
debug = ["defmt-rtt"]
[profile.dev] [profile.dev]
debug = 2 debug = 2

@ -5,4 +5,5 @@ fn main() {
if target.starts_with("thumbv6m-") { if target.starts_with("thumbv6m-") {
println!("cargo:rustc-cfg=armv6m"); println!("cargo:rustc-cfg=armv6m");
} }
println!("cargo:rustc-check-cfg=cfg(armv6m)");
} }

@ -1,11 +1,12 @@
#![macro_use] #![macro_use]
#![allow(unused_macros)] #![allow(unused)]
use core::fmt::{Debug, Display, LowerHex}; use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))] #[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features."); compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert { macro_rules! assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -17,6 +18,7 @@ macro_rules! assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_eq { macro_rules! assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -28,6 +30,7 @@ macro_rules! assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_ne { macro_rules! assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -39,6 +42,7 @@ macro_rules! assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert { macro_rules! debug_assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -50,6 +54,7 @@ macro_rules! debug_assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_eq { macro_rules! debug_assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -61,6 +66,7 @@ macro_rules! debug_assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_ne { macro_rules! debug_assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -72,6 +78,7 @@ macro_rules! debug_assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! todo { macro_rules! todo {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -83,20 +90,19 @@ macro_rules! todo {
}; };
} }
#[cfg(not(feature = "defmt"))] #[collapse_debuginfo(yes)]
macro_rules! unreachable { macro_rules! unreachable {
($($x:tt)*) => { ($($x:tt)*) => {
::core::unreachable!($($x)*) {
}; #[cfg(not(feature = "defmt"))]
} ::core::unreachable!($($x)*);
#[cfg(feature = "defmt")]
#[cfg(feature = "defmt")] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! panic { macro_rules! panic {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -108,6 +114,7 @@ macro_rules! panic {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! trace { macro_rules! trace {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -121,6 +128,7 @@ macro_rules! trace {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug { macro_rules! debug {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -134,6 +142,7 @@ macro_rules! debug {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! info { macro_rules! info {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -147,6 +156,7 @@ macro_rules! info {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! warn { macro_rules! warn {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -160,6 +170,7 @@ macro_rules! warn {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! error { macro_rules! error {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -174,6 +185,7 @@ macro_rules! error {
} }
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($($x:tt)*) => { ($($x:tt)*) => {
::defmt::unwrap!($($x)*) ::defmt::unwrap!($($x)*)
@ -181,6 +193,7 @@ macro_rules! unwrap {
} }
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($arg:expr) => { ($arg:expr) => {
match $crate::fmt::Try::into_result($arg) { match $crate::fmt::Try::into_result($arg) {
@ -229,7 +242,6 @@ impl<T, E> Try for Result<T, E> {
} }
} }
#[allow(unused)]
pub(crate) struct Bytes<'a>(pub &'a [u8]); pub(crate) struct Bytes<'a>(pub &'a [u8]);
impl<'a> Debug for Bytes<'a> { impl<'a> Debug for Bytes<'a> {

@ -20,7 +20,13 @@ impl BootLoader {
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash, const BUFFER_SIZE: usize>( pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash, const BUFFER_SIZE: usize>(
config: BootLoaderConfig<ACTIVE, DFU, STATE>, config: BootLoaderConfig<ACTIVE, DFU, STATE>,
) -> Self { ) -> Self {
Self::try_prepare::<ACTIVE, DFU, STATE, BUFFER_SIZE>(config).expect("Boot prepare error") if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE, BUFFER_SIZE>(config) {
loader
} else {
// Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
// properly
panic!("Boot prepare error")
}
} }
/// Inspect the bootloader state and perform actions required before booting, such as swapping firmware /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware

@ -1,7 +1,7 @@
[package] [package]
edition = "2021" edition = "2021"
name = "embassy-boot" name = "embassy-boot"
version = "0.2.0" version = "0.3.0"
description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks." description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks."
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/embassy-rs/embassy" repository = "https://github.com/embassy-rs/embassy"
@ -28,8 +28,8 @@ defmt = { version = "0.3", optional = true }
digest = "0.10" digest = "0.10"
log = { version = "0.4", optional = true } log = { version = "0.4", optional = true }
ed25519-dalek = { version = "2", default_features = false, features = ["digest"], optional = true } ed25519-dalek = { version = "2", default_features = false, features = ["digest"], optional = true }
embassy-embedded-hal = { version = "0.1.0", path = "../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.2.0", path = "../embassy-embedded-hal" }
embassy-sync = { version = "0.5.0", path = "../embassy-sync" } embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
embedded-storage = "0.3.1" embedded-storage = "0.3.1"
embedded-storage-async = { version = "0.4.1" } embedded-storage-async = { version = "0.4.1" }
salty = { version = "0.3", optional = true } salty = { version = "0.3", optional = true }

@ -15,7 +15,7 @@ The bootloader divides the storage into 4 main partitions, configurable when cre
* BOOTLOADER - Where the bootloader is placed. The bootloader itself consumes about 8kB of flash, but if you need to debug it and have space available, increasing this to 24kB will allow you to run the bootloader with probe-rs. * BOOTLOADER - Where the bootloader is placed. The bootloader itself consumes about 8kB of flash, but if you need to debug it and have space available, increasing this to 24kB will allow you to run the bootloader with probe-rs.
* ACTIVE - Where the main application is placed. The bootloader will attempt to load the application at the start of this partition. The minimum size required for this partition is the size of your application. * ACTIVE - Where the main application is placed. The bootloader will attempt to load the application at the start of this partition. The minimum size required for this partition is the size of your application.
* DFU - Where the application-to-be-swapped is placed. This partition is written to by the application. This partition must be at least 1 page bigger than the ACTIVE partition. * DFU - Where the application-to-be-swapped is placed. This partition is written to by the application. This partition must be at least 1 page bigger than the ACTIVE partition.
* BOOTLOADER STATE - Where the bootloader stores the current state describing if the active and dfu partitions need to be swapped. * BOOTLOADER STATE - Where the bootloader stores the current state describing if the active and dfu partitions need to be swapped.
For any partition, the following preconditions are required: For any partition, the following preconditions are required:
@ -24,7 +24,7 @@ For any partition, the following preconditions are required:
The linker scripts for the application and bootloader look similar, but the FLASH region must point to the BOOTLOADER partition for the bootloader, and the ACTIVE partition for the application. The linker scripts for the application and bootloader look similar, but the FLASH region must point to the BOOTLOADER partition for the bootloader, and the ACTIVE partition for the application.
For more details on the bootloader, see [the documentation](https://embassy.dev/book/dev/bootloader.html). For more details on the bootloader, see [the documentation](https://embassy.dev/book/#_bootloader).
## Hardware support ## Hardware support

@ -183,29 +183,29 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S
/// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 | /// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 |
/// |-----------|------------|--------|--------|--------|--------| /// |-----------|------------|--------|--------|--------|--------|
/// | Active | 0 | 1 | 2 | 3 | - | /// | Active | 0 | 1 | 2 | 3 | - |
/// | DFU | 0 | 3 | 2 | 1 | X | /// | DFU | 0 | 4 | 5 | 6 | X |
/// ///
/// The algorithm starts by copying 'backwards', and after the first step, the layout is /// The algorithm starts by copying 'backwards', and after the first step, the layout is
/// as follows: /// as follows:
/// ///
/// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 | /// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 |
/// |-----------|------------|--------|--------|--------|--------| /// |-----------|------------|--------|--------|--------|--------|
/// | Active | 1 | 1 | 2 | 1 | - | /// | Active | 1 | 1 | 2 | 6 | - |
/// | DFU | 1 | 3 | 2 | 1 | 3 | /// | DFU | 1 | 4 | 5 | 6 | 3 |
/// ///
/// The next iteration performs the same steps /// The next iteration performs the same steps
/// ///
/// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 | /// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 |
/// |-----------|------------|--------|--------|--------|--------| /// |-----------|------------|--------|--------|--------|--------|
/// | Active | 2 | 1 | 2 | 1 | - | /// | Active | 2 | 1 | 5 | 6 | - |
/// | DFU | 2 | 3 | 2 | 2 | 3 | /// | DFU | 2 | 4 | 5 | 2 | 3 |
/// ///
/// And again until we're done /// And again until we're done
/// ///
/// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 | /// | Partition | Swap Index | Page 0 | Page 1 | Page 3 | Page 4 |
/// |-----------|------------|--------|--------|--------|--------| /// |-----------|------------|--------|--------|--------|--------|
/// | Active | 3 | 3 | 2 | 1 | - | /// | Active | 3 | 4 | 5 | 6 | - |
/// | DFU | 3 | 3 | 1 | 2 | 3 | /// | DFU | 3 | 4 | 1 | 2 | 3 |
/// ///
/// ## REVERTING /// ## REVERTING
/// ///
@ -220,27 +220,30 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S
/// ///
/// | Partition | Revert Index | Page 0 | Page 1 | Page 3 | Page 4 | /// | Partition | Revert Index | Page 0 | Page 1 | Page 3 | Page 4 |
/// |-----------|--------------|--------|--------|--------|--------| /// |-----------|--------------|--------|--------|--------|--------|
/// | Active | 3 | 1 | 2 | 1 | - | /// | Active | 3 | 1 | 5 | 6 | - |
/// | DFU | 3 | 3 | 1 | 2 | 3 | /// | DFU | 3 | 4 | 1 | 2 | 3 |
/// ///
/// ///
/// | Partition | Revert Index | Page 0 | Page 1 | Page 3 | Page 4 | /// | Partition | Revert Index | Page 0 | Page 1 | Page 3 | Page 4 |
/// |-----------|--------------|--------|--------|--------|--------| /// |-----------|--------------|--------|--------|--------|--------|
/// | Active | 3 | 1 | 2 | 1 | - | /// | Active | 3 | 1 | 2 | 6 | - |
/// | DFU | 3 | 3 | 2 | 2 | 3 | /// | DFU | 3 | 4 | 5 | 2 | 3 |
/// ///
/// | Partition | Revert Index | Page 0 | Page 1 | Page 3 | Page 4 | /// | Partition | Revert Index | Page 0 | Page 1 | Page 3 | Page 4 |
/// |-----------|--------------|--------|--------|--------|--------| /// |-----------|--------------|--------|--------|--------|--------|
/// | Active | 3 | 1 | 2 | 3 | - | /// | Active | 3 | 1 | 2 | 3 | - |
/// | DFU | 3 | 3 | 2 | 1 | 3 | /// | DFU | 3 | 4 | 5 | 6 | 3 |
/// ///
pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> { pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> {
const {
core::assert!(Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32 == 0);
core::assert!(Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32 == 0);
core::assert!(Self::PAGE_SIZE % DFU::WRITE_SIZE as u32 == 0);
core::assert!(Self::PAGE_SIZE % DFU::ERASE_SIZE as u32 == 0);
}
// Ensure we have enough progress pages to store copy progress // Ensure we have enough progress pages to store copy progress
assert_eq!(0, Self::PAGE_SIZE % aligned_buf.len() as u32); assert_eq!(0, Self::PAGE_SIZE % aligned_buf.len() as u32);
assert_eq!(0, Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32);
assert_eq!(0, Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32);
assert_eq!(0, Self::PAGE_SIZE % DFU::WRITE_SIZE as u32);
assert_eq!(0, Self::PAGE_SIZE % DFU::ERASE_SIZE as u32);
assert!(aligned_buf.len() >= STATE::WRITE_SIZE); assert!(aligned_buf.len() >= STATE::WRITE_SIZE);
assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE); assert_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE);
assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE); assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE);

@ -1,11 +1,12 @@
#![macro_use] #![macro_use]
#![allow(unused_macros)] #![allow(unused)]
use core::fmt::{Debug, Display, LowerHex}; use core::fmt::{Debug, Display, LowerHex};
#[cfg(all(feature = "defmt", feature = "log"))] #[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features."); compile_error!("You may not enable both `defmt` and `log` features.");
#[collapse_debuginfo(yes)]
macro_rules! assert { macro_rules! assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -17,6 +18,7 @@ macro_rules! assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_eq { macro_rules! assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -28,6 +30,7 @@ macro_rules! assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! assert_ne { macro_rules! assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -39,6 +42,7 @@ macro_rules! assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert { macro_rules! debug_assert {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -50,6 +54,7 @@ macro_rules! debug_assert {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_eq { macro_rules! debug_assert_eq {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -61,6 +66,7 @@ macro_rules! debug_assert_eq {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug_assert_ne { macro_rules! debug_assert_ne {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -72,6 +78,7 @@ macro_rules! debug_assert_ne {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! todo { macro_rules! todo {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -83,20 +90,19 @@ macro_rules! todo {
}; };
} }
#[cfg(not(feature = "defmt"))] #[collapse_debuginfo(yes)]
macro_rules! unreachable { macro_rules! unreachable {
($($x:tt)*) => { ($($x:tt)*) => {
::core::unreachable!($($x)*) {
}; #[cfg(not(feature = "defmt"))]
} ::core::unreachable!($($x)*);
#[cfg(feature = "defmt")]
#[cfg(feature = "defmt")] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! panic { macro_rules! panic {
($($x:tt)*) => { ($($x:tt)*) => {
{ {
@ -108,6 +114,7 @@ macro_rules! panic {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! trace { macro_rules! trace {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -121,6 +128,7 @@ macro_rules! trace {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! debug { macro_rules! debug {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -134,6 +142,7 @@ macro_rules! debug {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! info { macro_rules! info {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -147,6 +156,7 @@ macro_rules! info {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! warn { macro_rules! warn {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -160,6 +170,7 @@ macro_rules! warn {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! error { macro_rules! error {
($s:literal $(, $x:expr)* $(,)?) => { ($s:literal $(, $x:expr)* $(,)?) => {
{ {
@ -174,6 +185,7 @@ macro_rules! error {
} }
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($($x:tt)*) => { ($($x:tt)*) => {
::defmt::unwrap!($($x)*) ::defmt::unwrap!($($x)*)
@ -181,6 +193,7 @@ macro_rules! unwrap {
} }
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)]
macro_rules! unwrap { macro_rules! unwrap {
($arg:expr) => { ($arg:expr) => {
match $crate::fmt::Try::into_result($arg) { match $crate::fmt::Try::into_result($arg) {
@ -229,7 +242,6 @@ impl<T, E> Try for Result<T, E> {
} }
} }
#[allow(unused)]
pub(crate) struct Bytes<'a>(pub &'a [u8]); pub(crate) struct Bytes<'a>(pub &'a [u8]);
impl<'a> Debug for Bytes<'a> { impl<'a> Debug for Bytes<'a> {

@ -43,7 +43,7 @@ where
} }
fn create_partition<T: NorFlash>(mutex: &Mutex<NoopRawMutex, T>) -> Partition<NoopRawMutex, T> { fn create_partition<T: NorFlash>(mutex: &Mutex<NoopRawMutex, T>) -> Partition<NoopRawMutex, T> {
Partition::new(mutex, 0, mutex.try_lock().unwrap().capacity() as u32) Partition::new(mutex, 0, unwrap!(mutex.try_lock()).capacity() as u32)
} }
} }

@ -0,0 +1,21 @@
# Changelog for embassy-embedded-hal
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.2.0 - 2024-08-05
- Add Clone derive to flash Partition in embassy-embedded-hal
- Add support for all word sizes to async shared spi
- Add Copy and 'static constraint to Word type in SPI structs
- Improve flexibility by introducing SPI word size as a generic parameter
- Allow changing Spi/I2cDeviceWithConfig's config at runtime
- Impl `MultiwriteNorFlash` for `BlockingAsync`
## 0.1.0 - 2024-01-10
- First release

@ -1,6 +1,6 @@
[package] [package]
name = "embassy-embedded-hal" name = "embassy-embedded-hal"
version = "0.1.0" version = "0.2.0"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Collection of utilities to use `embedded-hal` and `embedded-storage` traits with Embassy." description = "Collection of utilities to use `embedded-hal` and `embedded-storage` traits with Embassy."
@ -28,8 +28,8 @@ default = ["time"]
[dependencies] [dependencies]
embassy-futures = { version = "0.1.0", path = "../embassy-futures" } embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
embassy-sync = { version = "0.5.0", path = "../embassy-sync" } embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
embassy-time = { version = "0.3.0", path = "../embassy-time", optional = true } embassy-time = { version = "0.3.2", path = "../embassy-time", optional = true }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
"unproven", "unproven",
] } ] }

@ -104,8 +104,10 @@ where
} }
/// NOR flash wrapper /// NOR flash wrapper
use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; use embedded_storage::nor_flash::{ErrorType, MultiwriteNorFlash, NorFlash, ReadNorFlash};
use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; use embedded_storage_async::nor_flash::{
MultiwriteNorFlash as AsyncMultiwriteNorFlash, NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash,
};
impl<T> ErrorType for BlockingAsync<T> impl<T> ErrorType for BlockingAsync<T>
where where
@ -143,3 +145,5 @@ where
self.wrapped.capacity() self.wrapped.capacity()
} }
} }
impl<T> AsyncMultiwriteNorFlash for BlockingAsync<T> where T: MultiwriteNorFlash {}

@ -18,6 +18,16 @@ pub struct Partition<'a, M: RawMutex, T: NorFlash> {
size: u32, size: u32,
} }
impl<'a, M: RawMutex, T: NorFlash> Clone for Partition<'a, M, T> {
fn clone(&self) -> Self {
Self {
flash: self.flash,
offset: self.offset,
size: self.size,
}
}
}
impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> { impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> {
/// Create a new partition /// Create a new partition
pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self { pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self {

@ -19,6 +19,16 @@ pub struct BlockingPartition<'a, M: RawMutex, T: NorFlash> {
size: u32, size: u32,
} }
impl<'a, M: RawMutex, T: NorFlash> Clone for BlockingPartition<'a, M, T> {
fn clone(&self) -> Self {
Self {
flash: self.flash,
offset: self.offset,
size: self.size,
}
}
}
impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> { impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> {
/// Create a new partition /// Create a new partition
pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self { pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self {

@ -106,6 +106,11 @@ impl<'a, M: RawMutex, BUS: SetConfig> I2cDeviceWithConfig<'a, M, BUS> {
pub fn new(bus: &'a Mutex<M, BUS>, config: BUS::Config) -> Self { pub fn new(bus: &'a Mutex<M, BUS>, config: BUS::Config) -> Self {
Self { bus, config } Self { bus, config }
} }
/// Change the device's config at runtime
pub fn set_config(&mut self, config: BUS::Config) {
self.config = config;
}
} }
impl<'a, M, BUS> i2c::ErrorType for I2cDeviceWithConfig<'a, M, BUS> impl<'a, M, BUS> i2c::ErrorType for I2cDeviceWithConfig<'a, M, BUS>

@ -55,13 +55,14 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS> impl<M, BUS, CS, Word> spi::SpiDevice<Word> for SpiDevice<'_, M, BUS, CS>
where where
M: RawMutex, M: RawMutex,
BUS: spi::SpiBus, BUS: spi::SpiBus<Word>,
CS: OutputPin, CS: OutputPin,
Word: Copy + 'static,
{ {
async fn transaction(&mut self, operations: &mut [spi::Operation<'_, u8>]) -> Result<(), Self::Error> { async fn transaction(&mut self, operations: &mut [spi::Operation<'_, Word>]) -> Result<(), Self::Error> {
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) { if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
return Err(SpiDeviceError::DelayNotSupported); return Err(SpiDeviceError::DelayNotSupported);
} }
@ -122,6 +123,11 @@ impl<'a, M: RawMutex, BUS: SetConfig, CS> SpiDeviceWithConfig<'a, M, BUS, CS> {
pub fn new(bus: &'a Mutex<M, BUS>, cs: CS, config: BUS::Config) -> Self { pub fn new(bus: &'a Mutex<M, BUS>, cs: CS, config: BUS::Config) -> Self {
Self { bus, cs, config } Self { bus, cs, config }
} }
/// Change the device's config at runtime
pub fn set_config(&mut self, config: BUS::Config) {
self.config = config;
}
} }
impl<'a, M, BUS, CS> spi::ErrorType for SpiDeviceWithConfig<'a, M, BUS, CS> impl<'a, M, BUS, CS> spi::ErrorType for SpiDeviceWithConfig<'a, M, BUS, CS>
@ -133,13 +139,14 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> impl<M, BUS, CS, Word> spi::SpiDevice<Word> for SpiDeviceWithConfig<'_, M, BUS, CS>
where where
M: RawMutex, M: RawMutex,
BUS: spi::SpiBus + SetConfig, BUS: spi::SpiBus<Word> + SetConfig,
CS: OutputPin, CS: OutputPin,
Word: Copy + 'static,
{ {
async fn transaction(&mut self, operations: &mut [spi::Operation<'_, u8>]) -> Result<(), Self::Error> { async fn transaction(&mut self, operations: &mut [spi::Operation<'_, Word>]) -> Result<(), Self::Error> {
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) { if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
return Err(SpiDeviceError::DelayNotSupported); return Err(SpiDeviceError::DelayNotSupported);
} }

@ -67,9 +67,11 @@ where
} }
fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> { fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
let _ = address; self.bus.lock(|bus| {
let _ = operations; bus.borrow_mut()
todo!() .transaction(address, operations)
.map_err(I2cDeviceError::I2c)
})
} }
} }
@ -130,6 +132,11 @@ impl<'a, M: RawMutex, BUS: SetConfig> I2cDeviceWithConfig<'a, M, BUS> {
pub fn new(bus: &'a Mutex<M, RefCell<BUS>>, config: BUS::Config) -> Self { pub fn new(bus: &'a Mutex<M, RefCell<BUS>>, config: BUS::Config) -> Self {
Self { bus, config } Self { bus, config }
} }
/// Change the device's config at runtime
pub fn set_config(&mut self, config: BUS::Config) {
self.config = config;
}
} }
impl<'a, M, BUS> ErrorType for I2cDeviceWithConfig<'a, M, BUS> impl<'a, M, BUS> ErrorType for I2cDeviceWithConfig<'a, M, BUS>
@ -171,8 +178,10 @@ where
} }
fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> { fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
let _ = address; self.bus.lock(|bus| {
let _ = operations; let mut bus = bus.borrow_mut();
todo!() bus.set_config(&self.config).map_err(|_| I2cDeviceError::Config)?;
bus.transaction(address, operations).map_err(I2cDeviceError::I2c)
})
} }
} }

@ -48,13 +48,14 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDevice<'_, M, BUS, CS> impl<BUS, M, CS, Word> embedded_hal_1::spi::SpiDevice<Word> for SpiDevice<'_, M, BUS, CS>
where where
M: RawMutex, M: RawMutex,
BUS: SpiBus, BUS: SpiBus<Word>,
CS: OutputPin, CS: OutputPin,
Word: Copy + 'static,
{ {
fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> { fn transaction(&mut self, operations: &mut [embedded_hal_1::spi::Operation<'_, Word>]) -> Result<(), Self::Error> {
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) { if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
return Err(SpiDeviceError::DelayNotSupported); return Err(SpiDeviceError::DelayNotSupported);
} }
@ -90,47 +91,6 @@ where
} }
} }
impl<'d, M, BUS, CS, BusErr, CsErr> embedded_hal_02::blocking::spi::Transfer<u8> for SpiDevice<'_, M, BUS, CS>
where
M: RawMutex,
BUS: embedded_hal_02::blocking::spi::Transfer<u8, Error = BusErr>,
CS: OutputPin<Error = CsErr>,
{
type Error = SpiDeviceError<BusErr, CsErr>;
fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> {
self.bus.lock(|bus| {
let mut bus = bus.borrow_mut();
self.cs.set_low().map_err(SpiDeviceError::Cs)?;
let op_res = bus.transfer(words);
let cs_res = self.cs.set_high();
let op_res = op_res.map_err(SpiDeviceError::Spi)?;
cs_res.map_err(SpiDeviceError::Cs)?;
Ok(op_res)
})
}
}
impl<'d, M, BUS, CS, BusErr, CsErr> embedded_hal_02::blocking::spi::Write<u8> for SpiDevice<'_, M, BUS, CS>
where
M: RawMutex,
BUS: embedded_hal_02::blocking::spi::Write<u8, Error = BusErr>,
CS: OutputPin<Error = CsErr>,
{
type Error = SpiDeviceError<BusErr, CsErr>;
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
self.bus.lock(|bus| {
let mut bus = bus.borrow_mut();
self.cs.set_low().map_err(SpiDeviceError::Cs)?;
let op_res = bus.write(words);
let cs_res = self.cs.set_high();
let op_res = op_res.map_err(SpiDeviceError::Spi)?;
cs_res.map_err(SpiDeviceError::Cs)?;
Ok(op_res)
})
}
}
/// SPI device on a shared bus, with its own configuration. /// SPI device on a shared bus, with its own configuration.
/// ///
/// This is like [`SpiDevice`], with an additional bus configuration that's applied /// This is like [`SpiDevice`], with an additional bus configuration that's applied
@ -147,6 +107,11 @@ impl<'a, M: RawMutex, BUS: SetConfig, CS> SpiDeviceWithConfig<'a, M, BUS, CS> {
pub fn new(bus: &'a Mutex<M, RefCell<BUS>>, cs: CS, config: BUS::Config) -> Self { pub fn new(bus: &'a Mutex<M, RefCell<BUS>>, cs: CS, config: BUS::Config) -> Self {
Self { bus, cs, config } Self { bus, cs, config }
} }
/// Change the device's config at runtime
pub fn set_config(&mut self, config: BUS::Config) {
self.config = config;
}
} }
impl<'a, M, BUS, CS> spi::ErrorType for SpiDeviceWithConfig<'a, M, BUS, CS> impl<'a, M, BUS, CS> spi::ErrorType for SpiDeviceWithConfig<'a, M, BUS, CS>
@ -158,13 +123,14 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> impl<BUS, M, CS, Word> embedded_hal_1::spi::SpiDevice<Word> for SpiDeviceWithConfig<'_, M, BUS, CS>
where where
M: RawMutex, M: RawMutex,
BUS: SpiBus + SetConfig, BUS: SpiBus<Word> + SetConfig,
CS: OutputPin, CS: OutputPin,
Word: Copy + 'static,
{ {
fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> { fn transaction(&mut self, operations: &mut [embedded_hal_1::spi::Operation<'_, Word>]) -> Result<(), Self::Error> {
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) { if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
return Err(SpiDeviceError::DelayNotSupported); return Err(SpiDeviceError::DelayNotSupported);
} }

@ -1,6 +1,6 @@
[package] [package]
name = "embassy-executor-macros" name = "embassy-executor-macros"
version = "0.4.1" version = "0.5.0"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "macros for creating the entry point and tasks for embassy-executor" description = "macros for creating the entry point and tasks for embassy-executor"

@ -70,7 +70,7 @@ pub fn wasm() -> TokenStream {
let executor = ::std::boxed::Box::leak(::std::boxed::Box::new(::embassy_executor::Executor::new())); let executor = ::std::boxed::Box::leak(::std::boxed::Box::new(::embassy_executor::Executor::new()));
executor.start(|spawner| { executor.start(|spawner| {
spawner.spawn(__embassy_main(spawner)).unwrap(); spawner.must_spawn(__embassy_main(spawner));
}); });
Ok(()) Ok(())

@ -93,10 +93,21 @@ pub fn run(args: &[NestedMeta], f: syn::ItemFn) -> Result<TokenStream, TokenStre
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
let mut task_outer: ItemFn = parse_quote! { let mut task_outer: ItemFn = parse_quote! {
#visibility fn #task_ident(#fargs) -> ::embassy_executor::SpawnToken<impl Sized> { #visibility fn #task_ident(#fargs) -> ::embassy_executor::SpawnToken<impl Sized> {
type Fut = impl ::core::future::Future + 'static; trait _EmbassyInternalTaskTrait {
type Fut: ::core::future::Future + 'static;
fn construct(#fargs) -> Self::Fut;
}
impl _EmbassyInternalTaskTrait for () {
type Fut = impl core::future::Future + 'static;
fn construct(#fargs) -> Self::Fut {
#task_inner_ident(#(#full_args,)*)
}
}
const POOL_SIZE: usize = #pool_size; const POOL_SIZE: usize = #pool_size;
static POOL: ::embassy_executor::raw::TaskPool<Fut, POOL_SIZE> = ::embassy_executor::raw::TaskPool::new(); static POOL: ::embassy_executor::raw::TaskPool<<() as _EmbassyInternalTaskTrait>::Fut, POOL_SIZE> = ::embassy_executor::raw::TaskPool::new();
unsafe { POOL._spawn_async_fn(move || #task_inner_ident(#(#full_args,)*)) } unsafe { POOL._spawn_async_fn(move || <() as _EmbassyInternalTaskTrait>::construct(#(#full_args,)*)) }
} }
}; };
#[cfg(not(feature = "nightly"))] #[cfg(not(feature = "nightly"))]

@ -7,7 +7,6 @@ use std::thread;
use proc_macro2::TokenStream; use proc_macro2::TokenStream;
use quote::{quote, ToTokens}; use quote::{quote, ToTokens};
use syn;
/// A type to collect errors together and format them. /// A type to collect errors together and format them.
/// ///

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
## 0.6.0 - 2024-08-05
- Add collapse_debuginfo to fmt.rs macros.
- initial support for avr
- use nightly waker_getters APIs
## 0.5.0 - 2024-01-11 ## 0.5.0 - 2024-01-11
- Updated to `embassy-time-driver 0.1`, `embassy-time-queue-driver 0.1`, compatible with `embassy-time v0.3` and higher. - Updated to `embassy-time-driver 0.1`, `embassy-time-queue-driver 0.1`, compatible with `embassy-time v0.3` and higher.

Some files were not shown because too many files have changed in this diff Show More