Compare commits

...

521 commits

Author SHA1 Message Date
da9ce32909
feat(hid): allow specifying in & out packet size separately 2024-10-12 16:21:33 +02:00
Ulf Lilleengen
d091b3f0a4
Merge pull request #3225 from embassy-rs/prepare-nrf-release
Prepare some crate releases
2024-08-05 07:05:57 +00:00
Ulf Lilleengen
886580179f update dates 2024-08-05 08:58:56 +02:00
Ulf Lilleengen
187093e147 Prepare to release embassy-boot-rp 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
f605302791 Prepare to release embassy-rp 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
ec9a07d143 Prepare to release embassy-boot-nrf 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
1588fbc256 Prepare to release embassy-boot 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
37d7b0cd06 prepare release embassy-executor 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
61bda59d83 Prepare to release embassy-usb 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
ffb55754c8 Prepare release embassy-net-driver-channel 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
2f3b3335e1 Prepare for embassy-nrf release 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
44282b18fa Prepare embassy-time release 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
fb0ab1e42a Prepare release of embassy-hal-internal 2024-08-05 08:56:29 +02:00
Ulf Lilleengen
5767c003cc Prepare release of embassy-embedded-hal 0.2.0 2024-08-05 08:56:29 +02:00
Dario Nieuwenhuis
e173b973ae
Merge pull request #3227 from barafael/patch-1
Fix possible typo in embassy-rp README.md
2024-08-04 18:49:16 +00:00
Rafael Bachmann
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
Dario Nieuwenhuis
03b8e36532
Merge pull request #3226 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
Dario Nieuwenhuis
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
Dario Nieuwenhuis
a2ea2630f6
Merge pull request #3224 from towynlin/adin1110-readme
Fix broken link to OPEN Alliance spec for ADIN1110
2024-08-02 15:49:23 +00:00
Zachary Crockett
4e905bfcba
Fix broken link to OPEN Alliance spec for ADIN1110 2024-08-02 08:39:37 -07:00
Ulf Lilleengen
f2c29ba9d8
Merge pull request #3174 from JomerDev/add-count-to-read_to_break
RP2040: Add read_to_break_with_count
2024-08-02 13:50:32 +00:00
Dario Nieuwenhuis
2b031756c6
Merge pull request #3222 from bobrippling/fix/bootloader-overflow
Fix bootloader-rp's bootloader memory region overflow
2024-07-31 17:20:44 +00:00
Rob Pilling
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
Ulf Lilleengen
32adddff9c
Merge pull request #3221 from wllenyj/lazy-lock
embassy-sync: fix the data of LazyLock never drop
2024-07-31 16:28:06 +00:00
Ulf Lilleengen
91f135e25b
Merge pull request #3161 from diondokter/hsem
Add function to get the active HSEM interrupt
2024-07-31 14:34:11 +00:00
wanglei
05562b92af embassy-sync: more unit-test for LazyLock
Signed-off-by: wanglei <wllenyj@gmail.com>
2024-07-31 10:32:44 +08:00
wanglei
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
Dario Nieuwenhuis
e89ff7d129
Merge pull request #3219 from mirkomartn/bound-dns-servers
embassy-net: dns: bound the dns_servers slice
2024-07-29 21:36:35 +00:00
Gasper Stukelj
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
Ulf Lilleengen
7d3c852613
Merge pull request #3215 from samueltardieu/lazy-lock
embassy-sync: add LazyLock
2024-07-29 12:01:17 +00:00
Samuel Tardieu
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
Dario Nieuwenhuis
4e5a646f8b
Merge pull request #3217 from samueltardieu/f1-flash-bsy
embassy-stm32: wait for BSY flag to clear before flashing
2024-07-27 19:35:25 +00:00
Samuel Tardieu
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
Dario Nieuwenhuis
b88dc137e7
Merge pull request #3211 from busslina/original-mirror-main-fixing-missing-reexport
Fixing missing re-export
2024-07-25 18:07:20 +00:00
Vicente
29d79d3af2 Added doc comment to a public enum variant 2024-07-25 20:01:19 +02:00
Vicente
da5ecd29f1 Formmating 2024-07-25 19:55:54 +02:00
Vicente
6eb447eb58 Adding pub struct docs
cyw43::ScanOptions
2024-07-25 19:45:52 +02:00
Vicente
3efbd60a90 Fixing missing re-export
cyw::control::ScanOptions
2024-07-25 19:24:37 +02:00
Dario Nieuwenhuis
8c4f044ae7
Merge pull request #3207 from diondokter/fix-opamp-lifetimes
Add extra lifetime to opamp-using structs
2024-07-25 15:14:10 +00:00
Dario Nieuwenhuis
43b878708d
Merge pull request #3209 from embassy-rs/rust180
Update to Rust 1.80, make check-cfg unconditional.
2024-07-25 14:09:24 +00:00
Dion Dokter
4a8abe8028 Relax lifetimes again 2024-07-25 16:01:27 +02:00
Dario Nieuwenhuis
2d678d6956 Update to Rust 1.80, make check-cfg unconditional. 2024-07-25 15:53:00 +02:00
Dario Nieuwenhuis
8b4bb625be
Merge pull request #3206 from embassy-rs/rp-timer-test
tests/rp: add timer test.
2024-07-25 10:25:05 +00:00
Dion Dokter
6ef9e564ca Add extra lifetime to opamp-using structs 2024-07-25 12:22:55 +02:00
Dario Nieuwenhuis
1598dd55e4 tests/rp: add timer test. 2024-07-25 12:22:49 +02:00
Dario Nieuwenhuis
2436335f9b ci: add instructions to install cargo-batch if not installed. 2024-07-24 17:17:04 +02:00
Dario Nieuwenhuis
2537fc6f4f
Merge pull request #3188 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
James Munns
ea4c2ca95d
Merge pull request #3200 from Dygear/main
Documentation Link Fixes
2024-07-22 11:48:12 +00:00
Mark Tomlin
4811c14cc8 Updated cargo toml section links. 2024-07-22 07:26:55 -04:00
Mark Tomlin
dc6639fa4d Updated github branch from master to main. 2024-07-22 06:59:13 -04:00
Jomer.Dev
7c1ecae53f Add read_to_break_with_count 2024-07-19 16:01:20 +02:00
David Haig
e7270e00f6 Added set_cmd_block for dma memory compatibility 2024-07-19 02:03:53 +01:00
James Munns
2766993099
Merge pull request #3159 from kalkyl/shared-bus
Add example for shared I2C and SPI buses
2024-07-18 15:11:54 +00:00
Dario Nieuwenhuis
5e625f274a
Merge pull request #3185 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
Dario Nieuwenhuis
024097d833
Merge pull request #3163 from michelrandahl/f303-tsc-example
add TSC examples
2024-07-18 12:10:02 +00:00
Dario Nieuwenhuis
c83d940005
Merge pull request #3171 from nerwalt/nrf9151
nrf9151 support
2024-07-18 12:07:15 +00:00
Dario Nieuwenhuis
f32b711e4a
Merge pull request #3186 from MathiasKoch/embassy-net/socket-timeout
(embassy-net): Allow setting socket timeout for embedded-nal TcpClient
2024-07-18 11:49:59 +00:00
Dario Nieuwenhuis
14de5e5a3c
Merge pull request #3191 from mirkomartn/fix-doc
embassy-net: fix minor typo in doc
2024-07-18 11:49:38 +00:00
Dario Nieuwenhuis
2e4374df1b
Merge pull request #3189 from kalkyl/fmc-a13
stm32: Add 13bit address sdram constructors
2024-07-18 11:38:19 +00:00
Gasper Stukelj
dc84b4f45a embassy-net: fix minor typo in doc 2024-07-18 13:37:47 +02:00
Dario Nieuwenhuis
94b2143463
Merge pull request #3195 from MathiasKoch/chore/flash-partition-clone
chore(embassy-embedded-hal): Add Clone impl to flash Partition
2024-07-18 11:36:47 +00:00
Dario Nieuwenhuis
5236df97c6
Merge pull request #3193 from taaki2311/main
Reduced the definition for 'unreachable!' to a single macro rule
2024-07-18 11:36:15 +00:00
Mathias
ccc2ddab66 Hand-roll Clone impl instead of derive 2024-07-18 12:14:56 +02:00
Mathias
20bf995c3b Add Clone derive to flash Partition in embassy-embedded-hal 2024-07-18 11:15:18 +02:00
taaki2311
255864f46c
Merge branch 'embassy-rs:main' into main 2024-07-17 17:07:01 -04:00
Tarun Singh
a716a3f006 Reduced define for 'unreachable!' to a single macro rule 2024-07-17 17:05:52 -04:00
kalkyl
a4ca71bc23 stm32: Add 13bit address sdram constructors 2024-07-17 18:16:56 +02:00
David Haig
32019ed9b7 Allow cmd buffer to be passed in for dma memory 2024-07-17 17:12:37 +01:00
Mathias
4c34132337 Correctly handle modifying LCR register after uart enable 2024-07-17 12:23:59 +02:00
Mathias
d1207706c0 Fix example after swapping bufferedUart rx and tx in split fn 2024-07-17 12:07:58 +02:00
Mathias
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
Mathias
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
Dario Nieuwenhuis
e54c753537
Merge pull request #3182 from embassy-rs/nightly-update-more
Update nightly, fix error with rp inline asm.
2024-07-16 14:48:00 +00:00
Dario Nieuwenhuis
a0f8948c1c Update nightly, fix error with rp inline asm. 2024-07-16 16:40:54 +02:00
Dario Nieuwenhuis
e1e99879a6
Merge pull request #3181 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
JuliDi
d78ce3c6ab
bump more udbd-hid usages to 0.8.1 2024-07-16 12:38:16 +02:00
JuliDi
2571e0416f
bump usbd-hid from 0.7.0 to 0.8.1 2024-07-16 12:26:51 +02:00
nerwalt
2e1b5ef58b Fixing 9151 s and ns ci example builds 2024-07-15 13:46:55 -06:00
nerwalt
238cc004f0 saddc regression fix 2024-07-15 13:41:32 -06:00
nerwalt
0dd0e593c2 cargo fmt examples 2024-07-15 13:35:21 -06:00
nerwalt
0567ad5e74 cargo fmt 2024-07-15 13:30:16 -06:00
nerwalt
8a6cb98e45 Adding _nrf91 feature
Combining _nrf9160 and _nrf9120 in many places to reduce cfgs
2024-07-15 13:21:30 -06:00
nerwalt
4340d74e19 Adding 9120 to ci.sh 2024-07-15 12:02:12 -06:00
nerwalt
2c3de1eeec Merge branch 'main' into nrf9151 2024-07-15 11:33:53 -06:00
nerwalt
a978234cc5 Connecting GPIOTE interrupts 2024-07-15 10:12:22 -06:00
nerwalt
042d234f11 Putting never used/constucted items behind feature flag 2024-07-15 09:23:58 -06:00
nerwalt
639acdd2a3 Using published nrf9120-pac 2024-07-15 09:23:16 -06:00
James Munns
4472e08bca
Merge pull request #3179 from 1-rafael-1/impl-ReadReady-for-buffered-uart
Impl read ready for buffered uart
2024-07-14 17:14:37 +00:00
rafael
d9ea5cb015 stm after cargo fix 2024-07-14 17:56:56 +02:00
rafael
f5ebdebd96 nrf after cargo check 2024-07-14 17:34:50 +02:00
rafael
c7f775dc20 stm 2024-07-14 16:42:54 +02:00
rafael
08f1454527 nrf 2024-07-14 16:35:05 +02:00
Dario Nieuwenhuis
f5e3f31df7
Merge pull request #3176 from wyager/main
Change const asserts to `core::assert` to avoid invoking `defmt::assert`
2024-07-14 06:54:48 +00:00
William Yager
a5c0d1b79f Change const asserts to core::assert to avoid invoking defmt::assert 2024-07-13 15:55:24 -04:00
nerwalt
eefaf1b02e Merge branch 'main' into nrf9151 2024-07-12 14:05:39 -06:00
Dario Nieuwenhuis
3937c53fd8
Merge pull request #3170 from neuschaefer/dev
Minor fixes
2024-07-12 15:52:22 +00:00
J. Neuschäfer
de1dc272e0 net-adin1110: Fix typo in comment 2024-07-12 02:06:13 +02:00
J. Neuschäfer
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
nerwalt
38d8abef26 Merge branch 'main' into nrf9151 2024-07-11 06:58:05 -06:00
James Munns
ed3da1721a
Merge pull request #3165 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
rafael
d8821dd7d7 rustfmt 2024-07-10 22:56:12 +02:00
rafael
68b3fbe348 implement read_ready method in BufferedUart 2024-07-10 22:54:48 +02:00
michel
10a1a27cc3 add async TSC example for STM32L073 2024-07-10 20:59:18 +02:00
michel
52f40b9c9d add blocking TSC examples 2024-07-10 13:26:18 +02:00
Dion Dokter
4972dbd91b Add function to get the active HSEM interrupt 2024-07-09 11:49:16 +02:00
James Munns
6636a5835b
Merge pull request #3160 from 1-rafael-1/add-rp-sample-distribute-resources
add assign_resources rp example
2024-07-08 21:29:25 +00:00
rafael
2f62376a15 add faq 2024-07-08 23:27:42 +02:00
kalkyl
af9c7379f9 Add link to example in book 2024-07-08 22:53:50 +02:00
rafael
52c43f0249 rustfmt 2024-07-08 22:26:32 +02:00
rafael
91e6aa3166 rustfmt 2024-07-08 22:20:23 +02:00
rafael
376f65e1d3 add assign_resources example 2024-07-08 22:07:38 +02:00
kalkyl
03f3a3389d Add example for shared I2C and SPI buses 2024-07-08 21:48:19 +02:00
James Munns
d8bd5907ca
Merge pull request #3157 from kalkyl/sharing
Add example for sharing things between tasks
2024-07-08 15:19:48 +00:00
kalkyl
028ca55f9c Add more docs and cross-links 2024-07-08 17:16:35 +02:00
kalkyl
87f6634349 Add example for sharing things between tasks 2024-07-08 13:58:36 +02:00
James Munns
462daeeb49
Merge pull request #3154 from Dicklessgreat/main
Fix BDMA example for soundness
2024-07-07 16:54:37 +00:00
Dickless
3408e1ddbf Fixed to reserve as much space as it uses. 2024-07-07 04:39:39 +09:00
Dickless
e2aa5ef376 Merge branch 'main' of https://github.com/Dicklessgreat/embassy into main 2024-07-06 17:46:53 +09:00
Dickless
b90eef293b [#2905 #2904] Replaced static raw array with GroundedArrayCell 2024-07-06 17:36:22 +09:00
Henrik Alsér
f91244bae6
Merge pull request #3152 from Dicklessgreat/main
add SAI example
2024-07-04 18:32:51 +00:00
Dickless
4f649caa81 cargo +nightly fmt 2024-07-05 03:29:25 +09:00
Dickless
49546abfec rustfmt 2024-07-05 03:17:04 +09:00
Dickless
4ecdf31f9b add SAI example 2024-07-05 02:33:30 +09:00
Ulf Lilleengen
e2f9a48457
Merge pull request #3148 from andresv/stm32-adc-blocking_read
stm32 adc: introduce blocking_read
2024-07-03 12:45:58 +00:00
Andres Vahter
f851081e09 stm32 adc: introduce blocking_read 2024-07-03 15:20:31 +03:00
Dario Nieuwenhuis
ac5b7edb05
Merge pull request #3144 from Stupremee/better-clock-messages
Better panic message when peripheral clock is not enabled
2024-07-03 09:30:24 +00:00
Ulf Lilleengen
914d7c7919
Merge pull request #3128 from andresv/stm32-adc-dma-v3
STM32 ADC v3 and V4 DMA support
2024-07-03 08:13:26 +00:00
Andres Vahter
09cfa28a21 stm32g0: add adc_dma example 2024-07-03 10:59:20 +03:00
Ulf Lilleengen
8c54df1042
Merge pull request #3145 from embassy-rs/nrf-radio-fixes
fix cancellation hanging on event never occuring
2024-07-03 07:45:14 +00:00
Ulf Lilleengen
ef78e3283b
Merge pull request #3143 from andresv/stm32-ringbuffered-adc-docs
stm32 ringbuffered adc docs
2024-07-03 07:33:10 +00:00
Ulf Lilleengen
b6f76b5ab2
Merge pull request #3110 from liarokapisv/adc_v4_averaging
stm32 - Adc v4 - Add averaging support.
2024-07-03 07:22:34 +00:00
Ulf Lilleengen
3e70601fc7
Merge pull request #3124 from Adancurusul/dev
Add adc oversampling support
2024-07-03 07:22:03 +00:00
Ulf Lilleengen
b07570fce5 remove unused logging 2024-07-03 09:04:47 +02:00
Ulf Lilleengen
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
Justus K
9e4e536769
Better panic message when peripheral clock is not enabled 2024-07-03 08:32:00 +02:00
Ulf Lilleengen
5223923bd2
Merge pull request #3111 from Eekle/feature/async_tsc
Add async API to TSC
2024-07-02 18:51:50 +00:00
Eekle
d3f8905e93 Use crate level PeriMode 2024-07-02 20:46:05 +02:00
Dario Nieuwenhuis
14435d095f
Merge pull request #3142 from embassy-rs/compile-time-asserts
make some embassy-boot asserts const
2024-07-02 17:33:34 +00:00
Dario Nieuwenhuis
5137ebab56
Merge pull request #3132 from oro-os/wiznet-version-check
wiznet: add version check to initialization sequence
2024-07-02 16:58:00 +00:00
Andres Vahter
d4ff7616f9 stm32 ringbuffered adc docs improvements 2024-07-02 17:35:15 +03:00
Andres Vahter
a4e62314af stm32: adc v3: fix for newest pac 2024-07-02 17:15:22 +03:00
Andres Vahter
c120efad5b stm32 adc read_async: add asserts for buf len 2024-07-02 17:07:18 +03:00
Andres Vahter
5e2fd8623a stm32 adc v3 read_async 2024-07-02 17:07:18 +03:00
Alexandros Liarokapis
70061e74b2 add async dma read example 2024-07-02 17:07:18 +03:00
Alexandros Liarokapis
02b096915f add asynchrous sequence read support to adc v4 2024-07-02 17:07:18 +03:00
Dario Nieuwenhuis
9bdb697cd9
Merge pull request #3138 from andresv/update-stm32-metapac
update stm32-metapac
2024-07-02 14:01:02 +00:00
Andres Vahter
dd69efe708 stm32 ringbuffered adc: add buf size assert 2024-07-02 16:56:19 +03:00
Andres Vahter
b88e1a5d71 stm32 ringbuffered adc docs 2024-07-02 16:53:49 +03:00
Ulf Lilleengen
8f52ee469e make some embassy-boot asserts const 2024-07-02 12:37:36 +02:00
Andres Vahter
1f30ad595b stm32 ringbuffered adc: fix for metapac changes 2024-07-02 09:21:27 +03:00
Andres Vahter
8cbb64226b update stm32-metapac 2024-07-02 09:15:01 +03:00
Dario Nieuwenhuis
6f21d5e478
Merge pull request #3116 from sethkrie/adc-v2-ringbuf
ring buffered adc v2
2024-07-02 01:05:49 +00:00
Dario Nieuwenhuis
d6e4086a15
Merge pull request #3089 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
Dario Nieuwenhuis
c0cd851fb9
Merge pull request #3093 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
Dario Nieuwenhuis
f3fdeb26a4
Merge pull request #3127 from shufps/feat/dds-example
Feat/dds example
2024-07-01 23:50:35 +00:00
Dario Nieuwenhuis
3d8cec3b47
Merge pull request #3141 from trepidacious/ready_ready_and_write_ready_fix
Update `ReadReady` and `WriteReady` implementations
2024-07-01 23:21:10 +00:00
Dario Nieuwenhuis
976e9f7fba
Merge pull request #3104 from birdistheword96/main
Fix: Ensure I2C bus is free before master-write operation
2024-07-01 23:18:55 +00:00
Dario Nieuwenhuis
00babd2ec4
Merge pull request #3126 from ninjasource/stm32-ltdc
Add support for the stm32 LTDC display peripheral
2024-07-01 23:18:15 +00:00
trepidacious
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
Dario Nieuwenhuis
92eb6011d6
Merge pull request #3139 from igiona/AllowDrivingStrengthInPwm
feat(pwm): allow specifying OutputDrive for PWM channels
2024-07-01 17:51:53 +00:00
Giona Imperatori
f418006508 fixup! feat(pwm): allow specifying OutputDrive for PWM channels 2024-07-01 18:06:14 +02:00
nerwalt
98263ac220 Merge branch 'main' into nrf9151 2024-07-01 10:03:24 -06:00
nerwalt
e9bbfb349c Clean up 2024-07-01 10:02:03 -06:00
Giona Imperatori
7884babb9d feat(pwm): allow specifying OutputDrive for PWM channels 2024-07-01 17:33:24 +02:00
seth
27652798c7 fix typo, add spaces after // 2024-07-01 06:44:47 -07:00
Ulf Lilleengen
3c6bf3a31a
Merge pull request #3137 from embassy-rs/nrf-egu-irq
expose enabling and disabling irq for triggers
2024-07-01 12:08:44 +00:00
Ulf Lilleengen
0b8a8e54dc expose enabling and disabling irq for triggers 2024-07-01 10:26:45 +02:00
Ulf Lilleengen
2a38787a83
Merge pull request #3130 from kkrolczyk/kk/i2c-addr-flexibility
rp/i2c: add address flexibility and example
2024-07-01 06:38:33 +00:00
Josh Junon
c4b88b5781
wiznet: add version check to initialization sequence 2024-06-30 23:56:17 +02:00
Dario Nieuwenhuis
e0c0a618bd
Merge pull request #3136 from trepidacious/read_ready_smoltcp_fix
Add check for closed connection to `read_ready()`
2024-06-30 21:05:52 +00:00
trepidacious
c3be54f96b Add check for closed connection to read_ready() 2024-06-30 17:47:04 +01:00
Eekle
67f5b8d974 Update example 2024-06-30 11:06:32 +02:00
Eekle
1d1fc9afea Add async and blocking variants 2024-06-30 11:03:29 +02:00
Dario Nieuwenhuis
bd0243d12f
Merge pull request #3131 from dflemstr/less-implicit-panics
Less implicit panics
2024-06-28 23:41:02 +00:00
David Flemström
662e97f7b5 Panic on index-out-of-bounds when releasing RCC node 2024-06-29 01:37:35 +02:00
David Flemström
114dda2fd1 Avoid accidental copy of static var before creating mut ref 2024-06-29 01:34:07 +02:00
David Flemström
2f750a82bf Swat some other occurrences of .unwrap() that pull in panicing infra 2024-06-28 22:52:21 +02:00
David Flemström
73d937dc33 Remove implicit bounds checking from rcc module 2024-06-28 22:52:10 +02:00
David Flemström
cbc67469d3 Route sources of panics to the crate's fmt macros 2024-06-28 22:52:03 +02:00
Krzysztof Królczyk
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
David Haig
6edf7b4688 Applied formatting 2024-06-28 18:17:17 +01:00
David Haig
79f00e54cc Moved ltdc example to its own crate 2024-06-28 18:11:34 +01:00
nerwalt
317e065517 Adding uart example to 9151-ns
Updated README
2024-06-28 08:59:22 -06:00
David Haig
1123e3fd41 Get dsi_bsp example to compile again 2024-06-28 15:12:17 +01:00
nerwalt
5e1a6a9753 Adding support for 9120 2024-06-28 07:11:50 -06:00
shufps
2462a22140 format 2024-06-28 14:52:21 +02:00
shufps
b2a0eb3cb4 added comment 2024-06-28 14:43:39 +02:00
shufps
ece6203a99 added DDS example 2024-06-28 14:42:19 +02:00
David Haig
47c7bb2bb5 Updated metapac dependency to latest for LTDC support 2024-06-28 11:35:38 +01:00
nerwalt
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
David Haig
0e84bd8a91 Add support for the stm32 ltdc display peripheral 2024-06-27 20:13:20 +01:00
Dario Nieuwenhuis
26e660722c
Merge pull request #3125 from neuschaefer/input
docs: Fix mention of ExtiInput
2024-06-27 14:51:56 +00:00
J. Neuschäfer
e3b495908c docs: Fix mention of ExtiInput
The struct is called ExtiInput, not ExtiButton.
2024-06-27 16:48:48 +02:00
Chen Yuheng
a0799bf270 Add adc oversampling support 2024-06-27 17:04:26 +08:00
Dario Nieuwenhuis
a2acb3e3dc
Merge pull request #3121 from embassy-rs/nrftests
nRF uart fixes, better tests.
2024-06-25 22:02:12 +00:00
Dario Nieuwenhuis
9a21f70c9f tests/nrf: add non-buffered uart tests. 2024-06-25 23:57:19 +02:00
Dario Nieuwenhuis
b870e7f257 tests/nrf: generalize buffereduart tests for all chips. 2024-06-25 23:56:59 +02:00
Dario Nieuwenhuis
1ce9418bca nrf/buffered_uart: take into account EASYDMA_SIZE. fixes nrf52832 2024-06-25 23:55:07 +02:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
e4c4036a46
Merge pull request #3120 from embassy-rs/nrftests
tests/nrf: unify, add nrf52832, nrf52833, nrf5340, nrf9160
2024-06-25 20:50:08 +00:00
Dario Nieuwenhuis
292dbcc991 nrf/gpiote: fix port1 on nrf5340 2024-06-25 22:29:07 +02:00
Dario Nieuwenhuis
cab17434d5 tests/nrf: unify, add nrf52832, nrf52833, nrf5340, nrf9160 2024-06-25 22:29:07 +02:00
Dario Nieuwenhuis
3ae2f140f9
Merge pull request #3119 from diondokter/rp-boot2-none
RP: Shut up missed warning boot2-none
2024-06-25 15:48:11 +00:00
Dion Dokter
5dbc531671 RP: Shut up missed warning boot2-none 2024-06-25 16:54:34 +02:00
Dario Nieuwenhuis
bce7c73a3a
Merge pull request #3118 from diondokter/rp-boot2-none
RP: add option to provide your own boot2
2024-06-25 12:58:56 +00:00
Dion Dokter
957be1980d Fix syntax error? 2024-06-25 14:43:30 +02:00
Dion Dokter
92343551aa RP: add option to provide your own boot2 2024-06-25 14:31:15 +02:00
James Munns
89cd0e7cca
Merge pull request #3117 from 9names/rp-example-fixes
RP network example fixes
2024-06-25 11:09:37 +00:00
9names
080b5869da Fix rngcore imports in examples 2024-06-25 21:07:09 +10:00
9names
1456900281 Replace joke seed with best RNG available 2024-06-25 20:47:27 +10:00
9names
7b9215c8b9 Use published version of reqwless 2024-06-25 20:33:55 +10:00
James Munns
dfdbcb400c
Merge pull request #3115 from 1-rafael-1/add-http-request-example-to-rp
Add http request example to rp
2024-06-25 09:35:36 +00:00
seth
6926e9e071 CI 2024-06-24 23:15:00 -07:00
seth
7056783fa2 second adc added to example + API todos completed 2024-06-24 17:53:59 -07:00
seth
27b83fdbcf fmt 2024-06-24 17:15:16 -07:00
seth
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
rafael
b927c22ac0 rustfmt 2024-06-24 22:12:18 +02:00
rafael
6dae3c02c0 comment the comments 2024-06-24 22:08:59 +02:00
rafael
d05817f89d rustfmt again 2024-06-24 21:33:42 +02:00
rafael
67e7532b4a rustfmt 2024-06-24 21:16:56 +02:00
rafael
32e9867b4e need to bring down binary size or flashing will corrupt the device 2024-06-24 20:51:31 +02:00
Ulf Lilleengen
ab3cc7226a
Merge pull request #3113 from tshakah/patch-1
Fix typo in README
2024-06-24 10:14:07 +00:00
Eli Hastings
b7dd04e3b1
Fix typo in README 2024-06-24 10:59:43 +01:00
rafael
b05217b356 add wifi_webrequest example 2024-06-23 23:04:47 +02:00
Eekle
7eb605d116 fmt 2024-06-23 16:55:36 +02:00
Eekle
2655426cd8 Add async wait to TSC 2024-06-23 16:43:12 +02:00
Alexandros Liarokapis
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
Alexandros Liarokapis
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 #1441.
2024-06-23 11:43:50 +03:00
Henrik Alsér
cfe8561550
Merge pull request #3044 from kalkyl/adc-multi
rp: Add multichannel ADC
2024-06-22 21:05:17 +00:00
kalkyl
0888183666 Change pin in HIL test 2024-06-22 23:02:38 +02:00
kalkyl
e3891b09dc Add comment about internal api 2024-06-22 16:39:23 +02:00
Ulf Lilleengen
95d0cae897
Merge pull request #3079 from aurelj/with_timeout
implement with_timeout()/with_deadline() method style call on Future
2024-06-22 14:14:35 +00:00
Ulf Lilleengen
8b0c883443
Merge pull request #3095 from Adancurusul/g0_development
Add PWM examples for stm32g0
2024-06-22 14:11:50 +00:00
Ulf Lilleengen
f6bd4a3f37
Merge pull request #3100 from romainreignier/feature/stm32wb_doc_fix
examples: stm32wb: remove comment about memory.x file
2024-06-22 14:10:32 +00:00
Jamie Bird
18ba56534b Fix Formatting Issues 2024-06-21 15:29:02 +01:00
Jamie Bird
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
Dario Nieuwenhuis
d5badb94d2
Merge pull request #3101 from ROMemories/patch-1
docs(gpio): fix a typo regarding GPIO speed
2024-06-20 22:28:58 +00:00
ROMemories
4b0615957f
docs(gpio): fix a typo regarding GPIO speed 2024-06-20 12:09:30 +00:00
Romain Reignier
c65ee20cdd examples: stm32wb: remove comment about memory.x file
File removed in commit c19967dcf2
2024-06-20 14:06:44 +02:00
Chen Yuheng
a3c6626f40 Update pwm_complementary.rs 2024-06-19 11:04:40 +08:00
Chen Yuheng
0579d248ef Add PWM examples for stm32g0 2024-06-19 10:57:18 +08:00
Dario Nieuwenhuis
b0172bb582
Merge pull request #3092 from tarfu/patch-1
Update rust-toolchain-nightly.toml to compile with changes to fmt.rs
2024-06-18 14:56:20 +00:00
Tobias Breitwieser
bd6fad6b61
Update rust-toolchain-nightly.toml to compile with changes to fmt.rs 2024-06-18 16:42:22 +02:00
Dario Nieuwenhuis
a0231ed74c
Merge pull request #3091 from embassy-rs/nrf-egu-peri
add HAL and example for using nRF EGU peripheral
2024-06-18 11:25:51 +00:00
Ulf Lilleengen
91476eea12 cargo fmt 2024-06-18 13:22:38 +02:00
Ulf Lilleengen
a44ee963ef add HAL and example for using nRF EGU peripheral 2024-06-18 13:13:33 +02:00
Dario Nieuwenhuis
94af383809
Merge pull request #3090 from Adancurusul/add_G0_examples
Add examples for stm32g0
2024-06-18 11:09:25 +00:00
Chen Yuheng
bbe8d3d38a Add stm32g0 examples 2024-06-18 17:01:37 +08:00
Dario Nieuwenhuis
3c414e99cb
Merge pull request #3087 from ProfFan/patch-2
Update Cargo.toml to latest `stm32-metapac`
2024-06-17 18:24:04 +00:00
Fan Jiang
478cbc6a41
Update Cargo.toml to latest stm32-metapac 2024-06-17 14:09:53 -04:00
Dario Nieuwenhuis
86c48dde41
Merge pull request #3085 from embassy-rs/collapse
Add collapse_debuginfo to fmt.rs macros.
2024-06-16 23:47:47 +00:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
1e268a4d3d
Merge pull request #3084 from sjoerdsimons/ucpd-missing-packets
Improve stm32 ucpd packet reception
2024-06-16 19:57:14 +00:00
Dario Nieuwenhuis
633c15c2d8
Merge pull request #3031 from honzasp/pin-af
stm32/gpio: refactor AfType
2024-06-16 19:36:06 +00:00
Jan Špaček
94007ce6e0 stm32/gpio: refactor AfType 2024-06-16 21:11:55 +02:00
Sjoerd Simons
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
Sjoerd Simons
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
Dario Nieuwenhuis
1a2c8cecde
Merge pull request #3082 from markszente/dsihost-format-derive
Add Format derive to DSI HOST Error
2024-06-15 21:06:23 +00:00
Ulf Lilleengen
9daa233b61
Merge pull request #3083 from 1-rafael-1/fix---binary-format-in-rp-examples
--binary-format bin in rp examples
2024-06-15 17:44:05 +00:00
rafael
8b903e8873 --binary-format bin in rp examples 2024-06-15 14:39:41 +02:00
Mark Szente
3cf94958c6 Add Format derive 2024-06-15 14:21:15 +02:00
Ulf Lilleengen
c818125c22
Merge pull request #3081 from 1-rafael-1/typo-in-rp-examples
typo: was missing "bin"
2024-06-15 08:20:45 +00:00
rafael
a8581e242b typo: was missing "bin" 2024-06-14 21:43:12 +02:00
Dario Nieuwenhuis
6bbb870bfa
Merge pull request #3080 from Eekle/main
Update stm32 to latest generated data
2024-06-14 17:19:34 +00:00
Eekle
b64b555bbf
Update stm32 to latest generated data 2024-06-14 18:58:01 +02:00
Aurélien Jacobs
8ec2e193e2 implement with_timeout()/with_deadline() method style call on Future 2024-06-14 17:46:32 +02:00
Dario Nieuwenhuis
74739997bd
Merge pull request #3073 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
rafael
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
Dario Nieuwenhuis
e6a1fde3ac
Merge pull request #3072 from embassy-rs/rust1-79
Update to Rust 1.79
2024-06-13 18:57:44 +00:00
Dario Nieuwenhuis
7ad76f5f60 Use raw slices .len() method instead of unsafe hacks.
Stabilized in 1.79.
2024-06-13 20:41:08 +02:00
Dario Nieuwenhuis
4d9115b3fb Update stable to Rust 1.79. 2024-06-13 20:40:04 +02:00
Dario Nieuwenhuis
68c8238812
Merge pull request #3071 from nautd/add-tsc-example
Add example for touch sensitive controller
2024-06-13 18:01:06 +00:00
Karun
54fa33cbae Add example for touch sensitive controller 2024-06-13 13:46:10 -04:00
Dario Nieuwenhuis
8d79679bb2
Merge pull request #3069 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
Dario Nieuwenhuis
e80ca5fc67
Merge pull request #3059 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
Dario Nieuwenhuis
3d8c028864
Merge pull request #3067 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
Dario Nieuwenhuis
72029ca0c6 stm32: update stm32-metapac, fixes memory.x for many families. 2024-06-12 21:39:39 +02:00
Daniel Philipp
8b0cfde9a6
Clarified comments about the cortex_m::asm::delay functionality in al… (#3064)
* 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
James Munns
dbe21730cd
Merge pull request #3066 from mikkelens/patch-1
Add missing word "pin" in rp pwm documentation
2024-06-12 13:05:26 +00:00
Mikkel
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
Dario Nieuwenhuis
5154de3b7e
Merge pull request #3063 from aurelj/dns_qtype_either
dns: properly handle AddrType::Either in get_host_by_name()
2024-06-11 18:53:14 +00:00
Aurélien Jacobs
7f3805437c dns: properly handle AddrType::Either in get_host_by_name() 2024-06-11 11:39:07 +02:00
Dario Nieuwenhuis
ad7d739ddc
Merge pull request #3062 from kkrolczyk/kk/bootloader-typos
fix docu typos, linker addr example
2024-06-10 20:48:41 +00:00
Krzysztof Królczyk
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
Krzysztof Królczyk
268430bd9f
stm32/docs: correct typos, links
Signed-off-by: Krzysztof Królczyk <Krzysztof.Krolczyk@o2.pl>
2024-06-10 11:25:43 +02:00
Dario Nieuwenhuis
3e2b015dc4
Merge pull request #3054 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
Dario Nieuwenhuis
e5495b51b4
Merge pull request #3057 from dvdsk/docs-net-size
Document w5500 State and add w5500 example for stmf4
2024-06-07 23:00:56 +00:00
dvdsk
ab31a02e17
cargo fmt 2024-06-08 00:30:52 +02:00
dvdsk
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
dvdsk
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
dvdsk
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
Ulf Lilleengen
4a4b8c9b8d
Merge pull request #3052 from jvatic/main
embassy-sync: remove T: Send for Signal<M, T>
2024-06-06 06:47:39 +00:00
Jesse Stuart
3e85fb4f52 embassy-sync: remove T: Send for Signal<M, T> 2024-06-05 20:22:48 -04:00
Dario Nieuwenhuis
72a5523c64
Merge pull request #3050 from ant32/queue
add send_queue and recv_queue to embassy-net
2024-06-05 22:02:02 +00:00
Philip Reimer
673d11f49f add send_queue and recv_queue 2024-06-05 15:28:18 -06:00
Ulf Lilleengen
044b5c8921
Merge pull request #3040 from embassy-rs/embassy-time-0.3.1
prepare for embassy-time 0.3.1 release
2024-06-05 13:36:24 +00:00
Dario Nieuwenhuis
5af0fe8a58
Merge pull request #3042 from GustavToft/fix_main
Adding function to close soft AP.
2024-06-05 12:06:30 +00:00
kalkyl
bf36bec9bb rp: Add multichannel ADC 2024-06-05 09:42:08 +02:00
Gustav Toft
3610799618 Added docs. 2024-06-05 08:33:55 +02:00
Gustav Toft
a516dbd5e2 CYW43: Add function to close existing soft AP 2024-06-05 08:14:35 +02:00
Gustav Toft
319e18b399 Merge branch 'main' of https://github.com/embassy-rs/embassy into fix_main 2024-06-05 08:11:50 +02:00
Ulf Lilleengen
4ebd8af96f add convenience script to bump dependency version 2024-06-04 09:19:07 +02:00
Ulf Lilleengen
30918c355b prepare for embassy-time 0.3.1 release 2024-06-04 09:02:41 +02:00
Ulf Lilleengen
5f9bc6def7
Merge pull request #3037 from kalkyl/zerocopy
rp: Add zerocopy channel example
2024-06-04 06:37:45 +00:00
kalkyl
f9d8c68fc8 Add description 2024-06-04 01:20:19 +02:00
kalkyl
874d5f7c65 core atomic 2024-06-04 00:53:51 +02:00
kalkyl
03d8f99aa5 rp: Add zerocopy channel example 2024-06-04 00:38:51 +02:00
Dario Nieuwenhuis
9856d21693
Merge pull request #3006 from honzasp/harmonize-new
stm32: Make initialization of I2C and USART consistent with SPI
2024-06-03 21:26:43 +00:00
Jan Špaček
f3703ff6bf stm32/usart: set refcount even if initialization failed 2024-06-03 20:12:33 +02:00
Dario Nieuwenhuis
039d8ed671
Merge pull request #3036 from embassy-rs/fix-book-refs
fix broken links to embassy book
2024-06-03 12:12:18 +02:00
Ulf Lilleengen
d2045be9f3 fix broken links to embassy book 2024-06-03 08:45:05 +02:00
Dario Nieuwenhuis
ecd7888ba9
Merge pull request #3035 from embassy-rs/spi-nosck-fix
stm32/spi: fix blocking_write on nosck spi.
2024-06-02 23:03:53 +00:00
Dario Nieuwenhuis
348c87fc2f stm32/spi: fix blocking_write on nosck spi.
Fixes #2902.
2024-06-03 00:57:53 +02:00
Dario Nieuwenhuis
7b590334e6
Merge pull request #3033 from cschuhen/feature/fdcan_no_generics2
Remove generic argument from FDCAN CanBuilder.
2024-06-02 19:25:44 +00:00
Corey Schuhen
900b104860 Remove generic argument from CanBuilder. 2024-06-02 21:47:14 +10:00
Dario Nieuwenhuis
5f8f867eae
Merge pull request #3032 from cschuhen/feature/bxcan_no_generics2
Remove more BXCAN generics.
2024-06-02 10:33:14 +00:00
Corey Schuhen
58ef2594e5 Fix F7 example. 2024-06-02 20:16:57 +10:00
Corey Schuhen
367a22cc0e Remove more BXCAN generics. 2024-06-02 20:11:56 +10:00
Jan Špaček
664e4a5c03 stm32/usart: move init code to function that's not generic in T 2024-06-01 19:46:39 +02:00
Jan Špaček
44e4a2c9e9 stm32/buffered-usart: use new_pin! and disconnect pins on drop 2024-06-01 19:46:39 +02:00
Jan Špaček
ade27b7f21 stm32/usart: disconnect pins of RingBufferedUartRx on drop 2024-06-01 19:46:39 +02:00
Jan Špaček
41711195e3 stm32/i2c: use new_pin! macro 2024-06-01 19:46:39 +02:00
Jan Špaček
ca3c15658d stm32/spi: move init code to function that's not generic in T 2024-06-01 19:46:39 +02:00
Dario Nieuwenhuis
e61136fa4a
Merge pull request #3028 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
Dario Nieuwenhuis
8a1658ab0e stm32/spi: test zero-length transfers in more cases. 2024-05-31 22:58:53 +02:00
Dario Nieuwenhuis
339dd85968 stm32/spi: restrict txonly_nosck to SPIv1, it hangs in other versions. 2024-05-31 22:58:53 +02:00
Dario Nieuwenhuis
7baa14371b
Merge pull request #3027 from embassy-rs/check-cfg-fix
Fix all check-cfg errors, fix stm32 spi rxonly.
2024-05-31 21:59:06 +02:00
Dario Nieuwenhuis
f594ddceec stm32/spi: add blocking rxonly test. 2024-05-31 21:54:42 +02:00
Dario Nieuwenhuis
da197b6016 stm32/spi: fix spiv1 rxonly hanging. 2024-05-31 21:54:42 +02:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
ba940017ee
Merge pull request #3014 from brunob45/pwm_input
Add PWM Input for STM32
2024-05-31 18:09:27 +00:00
Dario Nieuwenhuis
4452a06e76
Merge pull request #3025 from andresovela/timestamp-uptime-features
embassy-time: add timestamp features
2024-05-31 17:43:55 +00:00
Dario Nieuwenhuis
441ca8f64d
Merge pull request #3005 from honzasp/check-cfg
Emit cargo:rustc-check-cfg instructions from build.rs
2024-05-31 17:32:29 +00:00
Jan Špaček
bfb380e8ca Copy build_common.rs into each crate, to make cargo publish happy 2024-05-31 08:07:51 +02:00
Bruno Bousquet
7d86919257 rust fmt really does not want blank space there 2024-05-30 17:54:49 -04:00
Bruno Bousquet
83b5797b8d fix fmt (again) 2024-05-30 17:53:38 -04:00
Bruno Bousquet
713d84f778 fix fmt 2024-05-30 17:51:48 -04:00
Bruno Bousquet
4d307b5a77 undo changes in input_capture 2024-05-30 17:49:20 -04:00
Bruno Bousquet
84707af5d7 create functions in inner to handle register modification 2024-05-30 17:43:53 -04:00
Andres O. Vela
6eaa259342 embassy-time: add timestamp features 2024-05-30 22:16:56 +02:00
Jan Špaček
368893c9cb Emit cargo:rustc-check-cfg instructions from build.rs 2024-05-30 18:28:29 +02:00
Dario Nieuwenhuis
694ac3a515
Merge pull request #2992 from liarokapisv/i2s-spi_v3
Add spi v3 & Full-duplex support to the I2S driver.
2024-05-30 12:31:59 +00:00
Dario Nieuwenhuis
d21e9caa80
Merge pull request #3021 from mat-kie/follower-opamp
Make OpAmp usable in follower configuration for internal DAC channel
2024-05-30 12:23:53 +00:00
Dario Nieuwenhuis
b378ec4558
Merge pull request #3020 from cschuhen/feature/bxcan_no_generics
Remove generics for BXCAN.
2024-05-30 12:16:17 +00:00
Corey Schuhen
b4a2f7fb70 Use phantom for lifetime holder instead of not used pointer to pointer. 2024-05-30 22:10:46 +10:00
Mattis Kieffer
28f5f0baba add dac buffer function 2024-05-30 14:07:47 +02:00
Corey Schuhen
7fd79857c3 Fix example. 2024-05-30 22:00:02 +10:00
Dario Nieuwenhuis
39c5a6c3f7
Merge pull request #3002 from honzasp/rcc-info
stm32/rcc: replace generated enable/disable code with runtime info
2024-05-30 11:50:40 +00:00
Corey Schuhen
245c895d09 Remove generics for BXCAN. 2024-05-30 21:39:11 +10:00
Dario Nieuwenhuis
7bc71a8262
Merge pull request #3019 from embassy-rs/rtc-lowpower-mod
stm32/rtc: move lowpower stuff to a separate mod.
2024-05-30 11:34:46 +00:00
Dario Nieuwenhuis
2c691baadd stm32/rtc: move lowpower stuff to a separate mod. 2024-05-30 13:26:14 +02:00
Dario Nieuwenhuis
62f4b4ee1e
Merge pull request #3018 from embassy-rs/nopacpointer
stm32: remove pointer-to-pointer-to-registers.
2024-05-30 11:17:51 +00:00
Dario Nieuwenhuis
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
Dario Nieuwenhuis
7532a06f67
Merge pull request #3007 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
Dario Nieuwenhuis
e9cb9badf7
Merge pull request #3012 from cschuhen/feature/fdcan_no_generics
Remove generic argument for STM32 FDCAN.
2024-05-30 10:42:53 +00:00
Gustav Toft
d3c3670a96 Merge branch 'main' of https://github.com/embassy-rs/embassy into fix_main 2024-05-30 09:56:09 +02:00
Dario Nieuwenhuis
50210e8cdc
Merge pull request #3017 from lucasgranberg/main
add set_as_analog to stm32 gpio Flex
2024-05-29 14:22:44 +00:00
Bruno Bousquet
a87b333034 fix fmt 2024-05-29 10:02:54 -04:00
Bruno Bousquet
292c1dd0b8 rename get_width_ticks and add info!() in examples 2024-05-29 09:59:00 -04:00
Bruno Bousquet
a23fa8dcb2
Apply suggestions from code review
Co-authored-by: Romain Reignier <romainreignier@users.noreply.github.com>
2024-05-29 09:14:05 -04:00
Lucas Granberg
b282edcc6e add set_as_analog to stm32 gpio Flex 2024-05-29 14:56:29 +03:00
Ulf Lilleengen
56235c97bc
Merge pull request #3016 from embassy-rs/embassy-sync-release
Prepare for embassy-sync 0.6.0 release
2024-05-29 10:40:02 +00:00
Ulf Lilleengen
52965ae96a remove duplicate entry 2024-05-29 12:38:33 +02:00
Ulf Lilleengen
d040dfaff9 add missing entries to changelog 2024-05-29 12:21:41 +02:00
Ulf Lilleengen
cf0d227cca Prepare for embassy-sync 0.6.0 release 2024-05-29 12:09:55 +02:00
Corey Schuhen
35feb1bf23 Remove generic argument for STM32 FDCAN. 2024-05-29 20:07:17 +10:00
Ulf Lilleengen
53dedd2ff5
Merge pull request #3015 from valleyflowerbear/main
Fix watchdog CTRL register getting overwritten
2024-05-29 07:39:06 +00:00
Nick
9031ce7fa7 rp: fix watchdog CTRL register getting overwritten 2024-05-29 06:30:41 +01:00
Bruno Bousquet
7f4803ddaf fix fmt again 2024-05-29 00:55:49 -04:00
Bruno Bousquet
66122aa60f Merge branch 'pwm_input_f103' into pwm_input 2024-05-29 00:53:09 -04:00
Bruno Bousquet
61f1f80e90 fix fmt 2024-05-29 00:52:55 -04:00
Bruno Bousquet
69badfb845 remove dev files 2024-05-29 00:37:50 -04:00
Bruno Bousquet
50039b17a7 fix F103 example 2024-05-29 00:33:35 -04:00
Bruno Bousquet
521332bdd1 pwm_input is working on F446 2024-05-29 00:28:26 -04:00
Bruno Bousquet
a6c419d096 add f103 example for input_capture 2024-05-28 23:12:08 -04:00
Bruno Bousquet
f1d5f4ca21 undo minor changes 2024-05-28 22:43:23 -04:00
Bruno Bousquet
a52841041d use timer LL 2024-05-28 22:38:08 -04:00
Bruno Bousquet
7c1e1ee288 example is working now 2024-05-28 22:30:10 -04:00
Bruno Bousquet
41b9a12574 compile pwm_input example 2024-05-28 20:36:23 -04:00
Bruno Bousquet
642465a7da add stm32f446 files 2024-05-28 20:20:15 -04:00
Alexandros Liarokapis
4f76f6b9df add spi_dma rx-only test 2024-05-28 16:08:36 +03:00
Dario Nieuwenhuis
000b022ae2
Merge pull request #2988 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
Alexandros Liarokapis
4d1fbcd9cd address review comments 2024-05-28 13:38:27 +03:00
Alexandros Liarokapis
46fc15783d add spi_v4 and spi_v5 support but block i2scfg rx-only configuration 2024-05-28 12:50:24 +03:00
Dario Nieuwenhuis
34bc439f17
Merge pull request #3011 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
Priit Laes
4d431b3080 docs: faq: Fix link to bdma example and improve wording. 2024-05-28 11:27:21 +03:00
Alexandros Liarokapis
9a6ed79ad1 remove rx-only support for new spi versions with missing I2SCFGR register 2024-05-27 20:51:50 +03:00
Alexandros Liarokapis
1d05015a1c broaden tsize read support to other spi versions 2024-05-27 20:47:24 +03:00
Alexandros Liarokapis
76fbec74da fix spi panic on read due to i2s configuration conversion check 2024-05-27 20:43:24 +03:00
Dario Nieuwenhuis
8d7c3f7de1
Merge pull request #3008 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
Aurélien Jacobs
ec6cfc1f21 stm32: ensure the core runs on HSI clock while setting up rcc 2024-05-27 17:31:29 +02:00
Alexandros Liarokapis
25cc5241b1 Add i2s support for spi_v3. 2024-05-27 18:06:20 +03:00
Alexandros Liarokapis
f9324201b1 add proper rxonly support for spi_v3 and force tx dma stream requirement on others 2024-05-27 17:49:47 +03:00
Maarten de Vries
807e573994 embassy_stm32: allow scheduling lower priority frames in bxcan driver 2024-05-27 16:10:08 +02:00
Maarten de Vries
854ae5da8f embassy_stm32: implement optional FIFO scheduling for outgoing frames 2024-05-27 16:10:08 +02:00
Dario Nieuwenhuis
8b9e2efec2
Merge pull request #3001 from embassy-rs/rp-spinlock-fix
rp: fix spinlocks staying locked after reset.
2024-05-26 22:18:40 +00:00
Dario Nieuwenhuis
d18a919ab9 rp: wait until read matches for PSM accesses. 2024-05-27 00:14:44 +02:00
Ulf Lilleengen
ec185b2fd2
Merge pull request #3004 from embassy-rs/jamesmunns-patch-1
FAQ: One vs Many tasks
2024-05-25 18:22:31 +00:00
James Munns
ad45725a24
Update docs/pages/faq.adoc 2024-05-25 19:33:13 +02:00
James Munns
9c32c43cf8
FAQ: One vs Many tasks
Copy and paste from chat
2024-05-25 19:32:02 +02:00
Jan Špaček
081afca3f0 stm32/rcc: replace generated enable/disable code with runtime info 2024-05-25 18:44:55 +02:00
Dario Nieuwenhuis
33bdc9e85f rp: fix spinlocks staying locked after reset.
Fixes #1736
2024-05-24 20:04:14 +02:00
Ulf Lilleengen
01c1cb2764
Merge pull request #3000 from embassy-rs/fix-book-link
fix link to embassy book
2024-05-24 15:34:01 +00:00
Ulf Lilleengen
8e89e6a313 fix link to embassy book 2024-05-24 17:31:14 +02:00
Dario Nieuwenhuis
a5763b4df4
Merge pull request #2943 from joelsa/add-miso-pullup
Add miso pullup to spi configuration
2024-05-24 15:01:18 +00:00
Joël Schulz-Andres
ac76a713e1 Remove wrong modulo 2024-05-24 16:54:04 +02:00
Dario Nieuwenhuis
891ec5fa5d
Merge pull request #2996 from joelsa/fix-gpiov1
gpiov1: Do not call set_speed for AFType::Input
2024-05-24 13:12:37 +00:00
Dario Nieuwenhuis
b48cf5357c
Merge pull request #2998 from joelsa/add-nrf52810-example
Add nrf52810 example
2024-05-24 13:12:13 +00:00
Joël Schulz-Andres
92988a3939 Correct chip in comment 2024-05-24 14:22:30 +02:00
Joël Schulz-Andres
e1d2ba07a7 Formatting 2024-05-24 14:15:10 +02:00
Joël Schulz-Andres
c4b3488f7f Add body to match statement 2024-05-24 14:12:01 +02:00
Joël Schulz-Andres
fab434ae84 Use match instead of if 2024-05-24 14:09:29 +02:00
Joël Schulz-Andres
06234e7839 Add example to CI 2024-05-24 14:04:44 +02:00
Joël Schulz-Andres
201b5c6ec1 Add NRF52810 example 2024-05-24 14:03:27 +02:00
Joël Schulz-Andres
32a75cb764 Fix naming 2024-05-24 13:53:19 +02:00
Joël Schulz-Andres
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
Joël Schulz-Ansres
5cba97821f Naming: Change pullup to pull 2024-05-24 01:05:56 +02:00
Joël Schulz-Ansres
f285a545be Change bool to Pull 2024-05-23 23:52:59 +02:00
Dario Nieuwenhuis
8226904b34
Merge pull request #2836 from honzasp/usart-nogeneric
stm32/usart: Remove BasicInstance generic
2024-05-23 17:04:52 +00:00
Dario Nieuwenhuis
85cfacd3cf
Merge pull request #2990 from jamesmunns/james/license-book
Explicitly license the book prose CC-BY-SA
2024-05-23 16:09:49 +00:00
Jan Špaček
183f2f6913 stm32/usart: remove instance generic params 2024-05-23 16:32:15 +02:00
Joel Schulz-Andres
0a5820e3ed
Merge branch 'embassy-rs:main' into add-miso-pullup 2024-05-23 15:34:16 +02:00
Dario Nieuwenhuis
ded1f9d335
Merge pull request #2989 from MabezDev/ringbuf-reconfigure
stm32 ringbuffered usart: don't teardown during reconfigure
2024-05-23 10:10:57 +00:00
Dario Nieuwenhuis
e5c579d9fb
Merge pull request #2985 from rumcake-rs/stm32-adc-anyadcchannel
stm32/adc: add AnyAdcChannel type
2024-05-23 10:09:45 +00:00
James Munns
495a29ad6e Explicitly license the book prose CC-BY-SA
This matches the Rust Embedded books
2024-05-23 09:57:10 +02:00
Univa
4e9206efb8 remove InternalChannel and AdcPin 2024-05-22 19:00:48 -04:00
Joël Schulz-Ansres
27e8ef6e7e Remove Speed::Input in order to move it into separate PR 2024-05-22 23:49:48 +02:00
Joël Schulz-Ansres
89017d338f Cargo format 2024-05-22 23:45:26 +02:00
Joël Schulz-Ansres
2f7bba4668 Use ODR register for Pull::Up or Down 2024-05-22 23:44:34 +02:00
Scott Mabin
94e559eba7 Don't teardown during reconfigure 2024-05-22 22:28:03 +01:00
Ulf Lilleengen
4e2296e344
Merge pull request #2987 from sourcebox/sync-additions
embassy-sync: Add clear function to all channels
2024-05-22 13:01:16 +00:00
Oliver Rockstedt
bbeba7f014 embassy-sync: Add clear function to all channels 2024-05-22 14:54:09 +02:00
Dario Nieuwenhuis
1d4cd85f71
Merge pull request #2984 from sourcebox/sync-additions
embassy-sync: fixed some documentation typos
2024-05-22 13:03:30 +02:00
Univa
41e11d86b9 make AdcChannel required for InternalChannel 2024-05-21 19:08:01 -04:00
Univa
ddbb6c8c31 add back InternalChannel and implement it where its missing 2024-05-21 19:03:14 -04:00
Oliver Rockstedt
aee9d5902a embassy-sync: fixed some documentation typos 2024-05-22 00:54:52 +02:00
Dario Nieuwenhuis
68e784ccd6
Merge pull request #2983 from reneherrero/main
Added a CAN example for the stm32l4
2024-05-21 22:34:13 +00:00
Dario Nieuwenhuis
608c953fc8
Merge pull request #2982 from embassy-rs/qspi-nodma
stm32/qspi: remove DMA generic param.
2024-05-21 22:27:15 +00:00
Dario Nieuwenhuis
e7161aa085 stm32/qspi: remove DMA generic param. 2024-05-22 00:23:42 +02:00
René Herrero
2f2869f195 Merge branch 'main' of github.com:reneherrero/embassy 2024-05-21 17:20:18 -05:00
René Herrero
ec32159576 added CAN example 2024-05-21 17:14:31 -05:00
Dario Nieuwenhuis
6fa608f516
Merge pull request #2941 from nautd/kkoppul2/update_ospi
Remove OSPI generic DMA
2024-05-21 22:09:44 +00:00
Dario Nieuwenhuis
7a26cc3764
Merge pull request #2786 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
Dario Nieuwenhuis
5ecc9b805d
Merge pull request #2829 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
Dario Nieuwenhuis
9a4c4fe2c7
Merge pull request #2781 from ismet55555/pwm-change
Remove Generics from `embassy-rp` `Pwm` struct
2024-05-21 21:48:21 +00:00
Dario Nieuwenhuis
ba7ef3c919
Merge pull request #2981 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
Dario Nieuwenhuis
3b01023636 Remove "cargo install probe-rs", point users to probe.rs instead.
Fixes #2965
2024-05-21 23:45:01 +02:00
Dario Nieuwenhuis
e55f31bdc6 rp/pwm: rename channel->slice in args, misc fix. 2024-05-21 23:41:45 +02:00
Ismet Handzic
24032d0853 Remove generics from embassy-rp 2024-05-21 23:35:06 +02:00
Dario Nieuwenhuis
ae49e58993
Merge pull request #2777 from taunusflieger/feature/HSEM
HSEM support for embassy-stm32
2024-05-21 21:34:50 +00:00
Dario Nieuwenhuis
4b5026e197
Merge pull request #2895 from qwerty19106/fix_uart_half_fifo_flush
Fix uart::flush with FIFO at Half-Duplex mode
2024-05-21 21:26:04 +00:00
Dario Nieuwenhuis
afd61ed610 stm32/hsem: misc fixes. 2024-05-21 23:22:47 +02:00
Michael Zill
7d350fb4c8 HSEM support for embassy-stm32 2024-05-21 23:08:44 +02:00
Dario Nieuwenhuis
c7c5723f8b
Merge pull request #2980 from sourcebox/sync-additions
embassy-sync: fixed some clippy warnings
2024-05-21 21:08:40 +00:00
Oliver Rockstedt
73e523ab14 embassy-sync: fixed some clippy warnings 2024-05-21 22:59:39 +02:00
Dario Nieuwenhuis
2d8ec70f71
Merge pull request #2853 from nautd/kkoppul2/tsc
TSC implementation
2024-05-21 20:55:41 +00:00
Dario Nieuwenhuis
e85242af2c
Merge pull request #2976 from joelsa/add-dsihost-example
Add dsihost example
2024-05-21 20:46:17 +00:00
Dario Nieuwenhuis
a636bace98
Merge pull request #2974 from embassy-rs/spi-nogenerics
stm32/i2c: remove peripheral generic param.
2024-05-21 20:46:03 +00:00
Joël Schulz-Ansres
4e42eaef7c Add dsi example 2024-05-21 22:44:40 +02:00
Dario Nieuwenhuis
2da2e57b38
Merge pull request #2979 from mattico/xcvrdly
usb: add transceiver delay option
2024-05-21 20:41:29 +00:00
Matt Ickstadt
9d6746e650 usb: add transceiver delay option 2024-05-21 14:42:37 -05:00
Ulf Lilleengen
bb82a1bd60
Merge pull request #2975 from embassy-rs/update-book-script-perm
update script permission
2024-05-21 08:24:27 +00:00
Ulf Lilleengen
cab46a7a8c update script permission 2024-05-21 10:21:45 +02:00
Ulf Lilleengen
cd27439fca
Merge pull request #2958 from embassy-rs/embassy-book-refactor
Embassy book refactor
2024-05-21 08:11:34 +00:00
Ulf Lilleengen
bb9c687a39 update crate paths 2024-05-21 10:05:21 +02:00
Ulf Lilleengen
06218f9536 fix internal refs 2024-05-21 10:05:21 +02:00
Ulf Lilleengen
38946114d8 update links 2024-05-21 10:05:21 +02:00
Ulf Lilleengen
d90e35980f update example path 2024-05-21 10:05:21 +02:00
Ulf Lilleengen
797f5c1e5e add book ci script 2024-05-21 10:05:21 +02:00
Ulf Lilleengen
2991099daa move images and add makefile 2024-05-21 10:05:21 +02:00
Ulf Lilleengen
739e5861c2 convert from antora to asciidoctor 2024-05-21 10:05:21 +02:00
Univa
7cdbae2a5d add AnyAdcChannel 2024-05-20 21:29:20 -04:00
Dario Nieuwenhuis
45a12fd41f stm32/i2c: remove peripheral generic param. 2024-05-21 01:25:49 +02:00
Dario Nieuwenhuis
6a508b3210 stm32: use funcs for info/state, const for ENABLE_BIT. 2024-05-21 01:24:10 +02:00
Dario Nieuwenhuis
51d5530925
Merge pull request #2835 from embassy-rs/spi-nogenerics
stm32/spi: remove peripheral generic param.
2024-05-20 21:48:48 +00:00
Dario Nieuwenhuis
2b09f9efd7 stm32/spi: check that the RCC enable bit is disabled on drop. 2024-05-20 23:43:10 +02:00
Dario Nieuwenhuis
ca2eef5387 stm32/spi: remove peripheral generic param. 2024-05-20 23:43:10 +02:00
Dario Nieuwenhuis
eeb6ffce4c stm32/rcc: add ClockEnableBit struct. 2024-05-20 23:37:20 +02:00
Ulf Lilleengen
8e7361f4ca
Merge pull request #2969 from diondokter/pubsub-cleanup
Pubsub cleanup
2024-05-20 18:30:19 +00:00
Ulf Lilleengen
c74acae7c0
Merge pull request #2972 from cacharle/patch-1
Fix typo in sharing_peripherals.adoc
2024-05-20 18:29:54 +00:00
Charles Cabergs
98b06d7646
Fix typo in sharing_peripherals.adoc 2024-05-20 20:28:13 +02:00
Dario Nieuwenhuis
5bc1e1793d
Merge pull request #2971 from mattico/usb-ep-send
embassy-usb-synopsys-otg: impl Sync for EpState
2024-05-20 17:30:04 +00:00
Matt Ickstadt
5a8ac21f6b embassy-usb-synopsys-otg: impl Sync for EpState
This restores the Send/Sync impls for EpState, which were incidentally
removed in #2881. 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
Matt Ickstadt
a4350e0398 vscode: improve docs in settings.json 2024-05-20 11:33:13 -05:00
Dion Dokter
5cffaf323b Add little migration sentence to changelog 2024-05-20 15:52:32 +02:00
Dario Nieuwenhuis
daaaf50298
Merge pull request #2967 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
Dion Dokter
f3008597aa Fix cyw43 2024-05-20 15:49:11 +02:00
Dion Dokter
07f2240a19 Add to changelog 2024-05-20 15:38:28 +02:00
Dion Dokter
a76082b104 Expose new length functions in the subs and pubs 2024-05-20 15:34:03 +02:00
Dan Groshev
b843f2546f
Add a CHANGELOG to embassy-usb-logger and bump its version 2024-05-20 14:25:32 +01:00
Dion Dokter
2a4a714060 Make behaviour trait sealed 2024-05-20 15:18:10 +02:00
Dario Nieuwenhuis
b33ef0d7dd
Merge pull request #2966 from embassy-rs/jamesmunns-patch-1
embassy-usb - update 0.2 changelog
2024-05-20 13:29:42 +02:00
James Munns
aa7fcec009
embassy-usb - update 0.2 changelog 2024-05-20 13:27:54 +02:00
Dario Nieuwenhuis
3a24e6b465
Merge pull request #2897 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
Joël Schulz-Ansres
cc6998be30 Cargo format 2024-05-15 14:12:44 +02:00
Joël Schulz-Ansres
db56c4fe6f Add miso pullup to spi configuration, add input as field for speed 2024-05-15 12:54:30 +02:00
Karun
3e399a9690 update to remove dma generics 2024-05-14 12:45:07 -04:00
Karun
07c2f169f5 Add versioning for group checks 2024-05-03 19:47:42 -04:00
Karun
a91f686544 Check group configuration validity 2024-05-03 19:45:26 -04:00
Karun
8e92e8718d Add example documentation 2024-05-03 19:45:26 -04:00
Karun
0f8b3b8c65 Functional touch sensing 2024-05-02 17:19:08 -04:00
Karun
3cd6232d43 update num groups definition 2024-05-02 17:19:08 -04:00
Karun
4bf2178de7 remove remaining warnings 2024-05-02 17:17:39 -04:00
Karun
253f6c42ee Address versioning and format issues raised by CI 2024-05-02 17:17:39 -04:00
Karun
fd69247d70 hyperspecific constructor 2024-05-02 17:17:39 -04:00
Karun
af357d2ad0 Prevent invalid config sets 2024-05-02 17:17:39 -04:00
Karun
87d2c66ef4 Add io pin masking 2024-05-02 17:17:39 -04:00
Karun
0b606b57f1 Add crate documentation 2024-05-02 17:17:39 -04:00
Karun
bcd923a4b0 fix create build pin traits 2024-05-02 17:17:39 -04:00
Karun
bef76ee057 initial set of io changes 2024-05-02 17:17:38 -04:00
Karun
0febc24de7 Initial fill out of driver without IO considerations 2024-05-02 17:17:38 -04:00
Роман Кривенков
d5f0bceb7c Clear Receiver enable flag before write in Half-Duplex mode 2024-05-02 15:59:42 +04:00
Andelf
5568cb89c3 Add ch32-hal to HAL list 2024-05-01 08:15:22 +08:00
Aurélien Jacobs
10ee1c1ae8 stm32: ensure the core runs on HSI clock while setting up rcc 2024-04-16 23:36:47 +02:00
Gustav Toft
ab36329dce Merge branch 'main' of https://github.com/embassy-rs/embassy 2024-04-10 09:20:46 +02:00
Andelf
803b76df86 Fix crash caused by using higher MSI on STM32WL 2024-04-08 01:23:49 +08:00
533 changed files with 18252 additions and 4807 deletions

17
.github/ci/book.sh vendored Executable file
View 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

View file

@ -9,12 +9,14 @@
"rust-analyzer.check.noDefaultFeatures": true,
"rust-analyzer.cargo.noDefaultFeatures": true,
"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": "thumbv7m-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.features": [
// Comment out these features when working on the examples. Most example crates do not have any cargo features.
"stm32f446re",
"time-driver-any",
"unstable-pac",
@ -22,9 +24,10 @@
"rt",
],
"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",
// 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/nrf5340/Cargo.toml",
// "examples/nrf-rtos-trace/Cargo.toml",

428
LICENSE-CC-BY-SA Normal file
View 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.

View file

@ -2,7 +2,7 @@
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
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.
@ -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.
- 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.
- <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** -
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.
@ -99,12 +100,7 @@ Examples are found in the `examples/` folder separated by the chip manufacturer
### Running examples
- Install `probe-rs`.
```bash
cargo install probe-rs --features cli
```
- Install `probe-rs` following the instructions at <https://probe.rs>.
- Change directory to the sample's base directory. For example:
```bash

View file

@ -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,integrated-timers,avr-device/atmega328p

34
ci.sh
View file

@ -2,6 +2,14 @@
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 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
@ -169,16 +177,20 @@ cargo batch \
--- 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 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-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/modules/ROOT/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/modules/ROOT/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/basic/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/examples/layer-by-layer/blinky-hal/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/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/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/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/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 \
@ -187,12 +199,14 @@ cargo batch \
--- 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/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/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/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/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/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/stm32l1 \
@ -205,6 +219,7 @@ cargo batch \
--- 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 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/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 \
@ -216,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/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/nrf9120-ns \
--- 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/stm32wb-dfu/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wb55rg \
@ -250,8 +266,12 @@ cargo batch \
--- 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/nrf52840/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-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 thumbv6m-none-eabi --features nrf51422 --out-dir out/tests/nrf51422-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_EXTRA

View file

@ -16,7 +16,7 @@ overclock = []
[dependencies]
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 = "0.2.1"
fixed = "1.23.1"

View file

@ -17,10 +17,10 @@ log = ["dep:log"]
firmware-logs = []
[dependencies]
embassy-time = { version = "0.3.0", path = "../embassy-time"}
embassy-sync = { version = "0.5.0", path = "../embassy-sync"}
embassy-time = { version = "0.3.2", path = "../embassy-time"}
embassy-sync = { version = "0.6.0", path = "../embassy-sync"}
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 }
log = { version = "0.4.17", optional = true }

View file

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

View file

@ -42,9 +42,11 @@ pub enum ScanType {
Passive,
}
/// Scan options.
#[derive(Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct ScanOptions {
/// SSID to scan for.
pub ssid: Option<heapless::String<32>>,
/// If set to `None`, all APs will be returned. If set to `Some`, only APs
/// with the specified BSSID will be returned.
@ -393,6 +395,24 @@ impl<'a> Control<'a> {
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
/// 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

View file

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

View file

@ -28,7 +28,7 @@ use ioctl::IoctlState;
use crate::bus::Bus;
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::structs::BssInfo;

View file

@ -1,6 +1,5 @@
use embassy_futures::select::{select3, Either3};
use embassy_net_driver_channel as ch;
use embassy_sync::pubsub::PubSubBehavior;
use embassy_time::{block_for, Duration, Timer};
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
// 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)
self.events.queue.publish_immediate(events::Message::new(
Status {
event_type: evt_type,
status,
},
event_payload,
));
self.events
.queue
.immediate_publisher()
.publish_immediate(events::Message::new(
Status {
event_type: evt_type,
status,
},
event_payload,
));
}
}
CHANNEL_TYPE_DATA => {

8
docs/Makefile Normal file
View file

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

View file

@ -1,4 +1,29 @@
# embassy docs
The documentation hosted at [https://embassy.dev/book](https://embassy.dev/book). Building the documentation requires
cloning the [embassy-book](https://github.com/embassy-rs/embassy-book) repository and following the instructions.
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:
```
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

View file

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

View file

@ -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
View file

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

View file

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

View file

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
cortex-m = "0.7"
cortex-m-rt = "0.7"
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-rtt = "0.3.0"

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View file

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

16
docs/index.adoc Normal file
View 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]

View file

@ -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"] }

View file

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

View file

@ -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]

View file

@ -1,10 +1,10 @@
= 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
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.
@ -14,7 +14,7 @@ The first thing youll notice are two attributes at the top of the file. These
[source,rust]
----
include::example$basic/src/main.rs[lines="1..2"]
include::../examples/basic/src/main.rs[lines="1..2"]
----
=== Dealing with errors
@ -23,7 +23,7 @@ Then, what follows are some declarations on how to deal with panics and faults.
[source,rust]
----
include::example$basic/src/main.rs[lines="8"]
include::../examples/basic/src/main.rs[lines="8"]
----
=== Task declaration
@ -32,7 +32,7 @@ After a bit of import declaration, the tasks run by the application should be de
[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.
@ -47,7 +47,7 @@ We then initialize the HAL with a default config, which gives us a `Peripherals`
[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:
@ -64,7 +64,7 @@ The project definition needs to contain the embassy dependencies:
[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).

11
docs/pages/beginners.adoc Normal file
View 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]

View file

@ -1,6 +1,6 @@
= 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]!
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!
@ -10,8 +10,8 @@ Here are known examples of real-world projects which make use of Embassy. Feel f
* 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/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:

View file

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

View file

@ -2,7 +2,7 @@
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!
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.
@ -267,10 +267,10 @@ Additionally, some PWR settings require a full device reboot (and enough time to
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 work out of some RAM regions
=== STM32 BDMA only working out of some RAM regions
The STM32 BDMA controller included in some chips (TODO: list which ones) has a limitation in that it only works out of certain regions of RAM (TODO: list which ones), otherwise the transfer
will fail.
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:
@ -279,7 +279,7 @@ If you see errors that look like this:
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.
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:
@ -289,7 +289,7 @@ General steps:
4. In your code, access the defined memory region using `#[link_section = ".xxx"]`
5. Copy data to that region before using BDMA.
See link:/examples/stm32h7/src/bin/spi_bdma.rs[this example] for more details.
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?
@ -299,7 +299,7 @@ You can add a section to your `Cargo.toml` file like this, you'll need to patch
Using `patch` will replace all direct AND indirect dependencies.
See the link:https://embassy.dev/book/dev/new_project.html#_cargo_toml[new project docs] for more details on this approach.
See the link:https://embassy.dev/book/#_starting_a_new_project[new project docs] for more details on this approach.
[source,toml]
----
@ -333,3 +333,32 @@ This is not the only possible approach, but if you are looking for where to star
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]

View file

@ -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 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?
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:hal.adoc[HAL].
* Start xref:basic_application.adoc[writing your application].
* Learn how to xref:new_project.adoc[start a new embassy project by adapting an example].
* Read more about the xref:_embassy_executor[executor].
* Read more about the xref:_hardware_abstraction_layer_hal[HAL].
* Start xref:_a_basic_embassy_application[writing your application].
* Learn how to xref:_starting_a_new_project[start a new embassy project by adapting an example].

View file

@ -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.
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.

View file

@ -16,7 +16,7 @@ The blinky app using PAC is shown below:
[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.
@ -35,7 +35,7 @@ The HAL example is shown below:
[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.
@ -52,7 +52,7 @@ Given Embassy focus on async Rust (which we'll come back to after this example),
[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.
@ -67,7 +67,7 @@ It's time to use the Embassy capabilities to its fullest. At the core, Embassy h
[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:
@ -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.
* 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.

View file

@ -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)
==== cargo-generate
=== cargo-generate
- 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)
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.
@ -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`.
== .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.
@ -66,7 +67,7 @@ and copying `STM32G474RETx` into `.cargo/config.toml` as so:
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.
@ -117,7 +118,7 @@ Finally, copy the `[profile.release]` section from the example `Cargo.toml` into
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`:
@ -142,7 +143,7 @@ components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ]
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:
@ -158,7 +159,7 @@ stm32g474-example
└── 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:

View file

@ -1,6 +1,6 @@
= 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

View file

@ -1,4 +1,4 @@
= Embassy
= Introduction
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-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/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,
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.
=== 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?
@ -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.
== 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
For more reading material on async Rust and Embassy:

View file

@ -18,6 +18,7 @@ my-project
|- rust-toolchain.toml
----
[discrete]
== .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.
@ -36,21 +37,27 @@ target = "thumbv6m-none-eabi" # <-change for your platform
DEFMT_LOG = "trace" # <- can change to info, warn, or error
----
[discrete]
== 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].
[discrete]
== Cargo.toml
This is your manifest file, where you can configure all of the embassy components to use the features you need.
==== Features
===== Time
[discrete]
=== Features
[discrete]
==== Time
- 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.
...more to come
[discrete]
== 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.
@ -68,6 +75,7 @@ MEMORY
}
----
[discrete]
== rust-toolchain.toml
This file configures the rust version and configuration to use.

View file

@ -8,7 +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.
TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here].
TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
[,rust]
----
use defmt::*;
@ -78,7 +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.
TIP: Dependencies needed to run this example link:/book/dev/basic_application.html#_the_cargo_toml[can be found here].
TIP: Dependencies needed to run this example link:#_the_cargo_toml[can be found here].
[,rust]
----
use defmt::*;
@ -125,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
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].

View file

@ -1,6 +1,6 @@
= 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

13
docs/pages/system.adoc Normal file
View 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]

View file

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

View file

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

View file

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

View file

@ -20,7 +20,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
config: BootLoaderConfig<ACTIVE, DFU, STATE>,
) -> 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

View file

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

View file

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

View file

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

View file

@ -21,7 +21,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
config: BootLoaderConfig<ACTIVE, DFU, STATE>,
) -> 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

View file

@ -13,7 +13,7 @@ categories = [
]
[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/"
features = ["embassy-stm32/stm32f429zi"]
target = "thumbv7em-none-eabi"
@ -22,12 +22,11 @@ target = "thumbv7em-none-eabi"
[dependencies]
defmt = { version = "0.3", optional = true }
defmt-rtt = { 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-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-rt = { version = "0.7" }
embedded-storage = "0.3.1"
@ -37,7 +36,6 @@ cfg-if = "1.0.0"
[features]
defmt = ["dep:defmt", "embassy-boot/defmt", "embassy-stm32/defmt"]
log = ["dep:log", "embassy-boot/log", "embassy-stm32/log"]
debug = ["defmt-rtt"]
[profile.dev]
debug = 2

View file

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

View file

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

View file

@ -20,7 +20,13 @@ impl BootLoader {
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash, const BUFFER_SIZE: usize>(
config: BootLoaderConfig<ACTIVE, DFU, STATE>,
) -> 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

View file

@ -1,7 +1,7 @@
[package]
edition = "2021"
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."
license = "MIT OR Apache-2.0"
repository = "https://github.com/embassy-rs/embassy"
@ -28,8 +28,8 @@ defmt = { version = "0.3", optional = true }
digest = "0.10"
log = { version = "0.4", 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-sync = { version = "0.5.0", path = "../embassy-sync" }
embassy-embedded-hal = { version = "0.2.0", path = "../embassy-embedded-hal" }
embassy-sync = { version = "0.6.0", path = "../embassy-sync" }
embedded-storage = "0.3.1"
embedded-storage-async = { version = "0.4.1" }
salty = { version = "0.3", optional = true }

View file

@ -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.
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

View file

@ -235,12 +235,15 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S
/// | DFU | 3 | 4 | 5 | 6 | 3 |
///
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
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_eq!(0, aligned_buf.len() % ACTIVE::WRITE_SIZE);
assert_eq!(0, aligned_buf.len() % DFU::WRITE_SIZE);

View file

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

View file

@ -43,7 +43,7 @@ where
}
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)
}
}

View file

@ -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

View file

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

View file

@ -18,6 +18,16 @@ pub struct Partition<'a, M: RawMutex, T: NorFlash> {
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> {
/// Create a new partition
pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self {

View file

@ -19,6 +19,16 @@ pub struct BlockingPartition<'a, M: RawMutex, T: NorFlash> {
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> {
/// Create a new partition
pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self {

View file

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

View file

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

View file

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 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
- Updated to `embassy-time-driver 0.1`, `embassy-time-queue-driver 0.1`, compatible with `embassy-time v0.3` and higher.

View file

@ -1,6 +1,6 @@
[package]
name = "embassy-executor"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "async/await executor designed for embedded usage"
@ -33,7 +33,7 @@ defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
rtos-trace = { version = "0.1.2", optional = true }
embassy-executor-macros = { version = "0.4.0", path = "../embassy-executor-macros" }
embassy-executor-macros = { version = "0.5.0", path = "../embassy-executor-macros" }
embassy-time-driver = { version = "0.1.0", path = "../embassy-time-driver", optional = true }
embassy-time-queue-driver = { version = "0.1.0", path = "../embassy-time-queue-driver", optional = true }
critical-section = "1.1"

View file

@ -3,6 +3,9 @@ use std::fmt::Write;
use std::path::PathBuf;
use std::{env, fs};
#[path = "./build_common.rs"]
mod common;
static CONFIGS: &[(&str, usize)] = &[
// BEGIN AUTOGENERATED CONFIG FEATURES
// Generated by gen_config.py. DO NOT EDIT.
@ -91,30 +94,6 @@ fn main() {
let out_file = out_dir.join("config.rs").to_string_lossy().to_string();
fs::write(out_file, data).unwrap();
// cortex-m targets
let target = env::var("TARGET").unwrap();
if target.starts_with("thumbv6m-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv6m");
} else if target.starts_with("thumbv7m-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv7m");
} else if target.starts_with("thumbv7em-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv7m");
println!("cargo:rustc-cfg=armv7em"); // (not currently used)
} else if target.starts_with("thumbv8m.base") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv8m");
println!("cargo:rustc-cfg=armv8m_base");
} else if target.starts_with("thumbv8m.main") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv8m");
println!("cargo:rustc-cfg=armv8m_main");
}
if target.ends_with("-eabihf") {
println!("cargo:rustc-cfg=has_fpu");
}
let mut rustc_cfgs = common::CfgSet::new();
common::set_target_cfgs(&mut rustc_cfgs);
}

View file

@ -0,0 +1,94 @@
// NOTE: this file is copy-pasted between several Embassy crates, because there is no
// straightforward way to share this code:
// - it cannot be placed into the root of the repo and linked from each build.rs using `#[path =
// "../build_common.rs"]`, because `cargo publish` requires that all files published with a crate
// reside in the crate's directory,
// - it cannot be symlinked from `embassy-xxx/build_common.rs` to `../build_common.rs`, because
// symlinks don't work on Windows.
use std::collections::HashSet;
use std::env;
/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring
/// them (`cargo:rust-check-cfg=cfg(X)`).
#[derive(Debug)]
pub struct CfgSet {
enabled: HashSet<String>,
declared: HashSet<String>,
}
impl CfgSet {
pub fn new() -> Self {
Self {
enabled: HashSet::new(),
declared: HashSet::new(),
}
}
/// Enable a config, which can then be used in `#[cfg(...)]` for conditional compilation.
///
/// All configs that can potentially be enabled should be unconditionally declared using
/// [`Self::declare()`].
pub fn enable(&mut self, cfg: impl AsRef<str>) {
if self.enabled.insert(cfg.as_ref().to_owned()) {
println!("cargo:rustc-cfg={}", cfg.as_ref());
}
}
pub fn enable_all(&mut self, cfgs: &[impl AsRef<str>]) {
for cfg in cfgs.iter() {
self.enable(cfg.as_ref());
}
}
/// Declare a valid config for conditional compilation, without enabling it.
///
/// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid.
pub fn declare(&mut self, cfg: impl AsRef<str>) {
if self.declared.insert(cfg.as_ref().to_owned()) {
println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref());
}
}
pub fn declare_all(&mut self, cfgs: &[impl AsRef<str>]) {
for cfg in cfgs.iter() {
self.declare(cfg.as_ref());
}
}
pub fn set(&mut self, cfg: impl Into<String>, enable: bool) {
let cfg = cfg.into();
if enable {
self.enable(cfg.clone());
}
self.declare(cfg);
}
}
/// Sets configs that describe the target platform.
pub fn set_target_cfgs(cfgs: &mut CfgSet) {
let target = env::var("TARGET").unwrap();
if target.starts_with("thumbv6m-") {
cfgs.enable_all(&["cortex_m", "armv6m"]);
} else if target.starts_with("thumbv7m-") {
cfgs.enable_all(&["cortex_m", "armv7m"]);
} else if target.starts_with("thumbv7em-") {
cfgs.enable_all(&["cortex_m", "armv7m", "armv7em"]);
} else if target.starts_with("thumbv8m.base") {
cfgs.enable_all(&["cortex_m", "armv8m", "armv8m_base"]);
} else if target.starts_with("thumbv8m.main") {
cfgs.enable_all(&["cortex_m", "armv8m", "armv8m_main"]);
}
cfgs.declare_all(&[
"cortex_m",
"armv6m",
"armv7m",
"armv7em",
"armv8m",
"armv8m_base",
"armv8m_main",
]);
cfgs.set("has_fpu", target.ends_with("-eabihf"));
}

View file

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

View file

@ -1,4 +1,5 @@
#![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)]
#![cfg_attr(feature = "nightly", feature(waker_getters))]
#![allow(clippy::new_without_default)]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]

View file

@ -1,4 +1,3 @@
use core::mem;
use core::task::{RawWaker, RawWakerVTable, Waker};
use super::{wake_task, TaskHeader, TaskRef};
@ -33,20 +32,32 @@ pub(crate) unsafe fn from_task(p: TaskRef) -> Waker {
///
/// Panics if the waker is not created by the Embassy executor.
pub fn task_from_waker(waker: &Waker) -> TaskRef {
// safety: OK because WakerHack has the same layout as Waker.
// This is not really guaranteed because the structs are `repr(Rust)`, it is
// indeed the case in the current implementation.
// TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992
let hack: &WakerHack = unsafe { mem::transmute(waker) };
if hack.vtable != &VTABLE {
let (vtable, data) = {
#[cfg(not(feature = "nightly"))]
{
struct WakerHack {
data: *const (),
vtable: &'static RawWakerVTable,
}
// safety: OK because WakerHack has the same layout as Waker.
// This is not really guaranteed because the structs are `repr(Rust)`, it is
// indeed the case in the current implementation.
// TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992
let hack: &WakerHack = unsafe { core::mem::transmute(waker) };
(hack.vtable, hack.data)
}
#[cfg(feature = "nightly")]
{
let raw_waker = waker.as_raw();
(raw_waker.vtable(), raw_waker.data())
}
};
if vtable != &VTABLE {
panic!("Found waker not created by the Embassy executor. `embassy_time::Timer` only works with the Embassy executor.")
}
// safety: our wakers are always created with `TaskRef::as_ptr`
unsafe { TaskRef::from_ptr(hack.data as *const TaskHeader) }
}
struct WakerHack {
data: *const (),
vtable: &'static RawWakerVTable,
unsafe { TaskRef::from_ptr(data as *const TaskHeader) }
}

View file

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

View file

@ -1,6 +1,6 @@
[package]
name = "embassy-hal-internal"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Internal implementation details for Embassy HALs. DO NOT USE DIRECTLY."

View file

@ -1,29 +1,7 @@
use std::env;
#[path = "./build_common.rs"]
mod common;
fn main() {
let target = env::var("TARGET").unwrap();
if target.starts_with("thumbv6m-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv6m");
} else if target.starts_with("thumbv7m-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv7m");
} else if target.starts_with("thumbv7em-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv7m");
println!("cargo:rustc-cfg=armv7em"); // (not currently used)
} else if target.starts_with("thumbv8m.base") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv8m");
println!("cargo:rustc-cfg=armv8m_base");
} else if target.starts_with("thumbv8m.main") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv8m");
println!("cargo:rustc-cfg=armv8m_main");
}
if target.ends_with("-eabihf") {
println!("cargo:rustc-cfg=has_fpu");
}
let mut cfgs = common::CfgSet::new();
common::set_target_cfgs(&mut cfgs);
}

View file

@ -0,0 +1,94 @@
// NOTE: this file is copy-pasted between several Embassy crates, because there is no
// straightforward way to share this code:
// - it cannot be placed into the root of the repo and linked from each build.rs using `#[path =
// "../build_common.rs"]`, because `cargo publish` requires that all files published with a crate
// reside in the crate's directory,
// - it cannot be symlinked from `embassy-xxx/build_common.rs` to `../build_common.rs`, because
// symlinks don't work on Windows.
use std::collections::HashSet;
use std::env;
/// Helper for emitting cargo instruction for enabling configs (`cargo:rustc-cfg=X`) and declaring
/// them (`cargo:rust-check-cfg=cfg(X)`).
#[derive(Debug)]
pub struct CfgSet {
enabled: HashSet<String>,
declared: HashSet<String>,
}
impl CfgSet {
pub fn new() -> Self {
Self {
enabled: HashSet::new(),
declared: HashSet::new(),
}
}
/// Enable a config, which can then be used in `#[cfg(...)]` for conditional compilation.
///
/// All configs that can potentially be enabled should be unconditionally declared using
/// [`Self::declare()`].
pub fn enable(&mut self, cfg: impl AsRef<str>) {
if self.enabled.insert(cfg.as_ref().to_owned()) {
println!("cargo:rustc-cfg={}", cfg.as_ref());
}
}
pub fn enable_all(&mut self, cfgs: &[impl AsRef<str>]) {
for cfg in cfgs.iter() {
self.enable(cfg.as_ref());
}
}
/// Declare a valid config for conditional compilation, without enabling it.
///
/// This enables rustc to check that the configs in `#[cfg(...)]` attributes are valid.
pub fn declare(&mut self, cfg: impl AsRef<str>) {
if self.declared.insert(cfg.as_ref().to_owned()) {
println!("cargo:rustc-check-cfg=cfg({})", cfg.as_ref());
}
}
pub fn declare_all(&mut self, cfgs: &[impl AsRef<str>]) {
for cfg in cfgs.iter() {
self.declare(cfg.as_ref());
}
}
pub fn set(&mut self, cfg: impl Into<String>, enable: bool) {
let cfg = cfg.into();
if enable {
self.enable(cfg.clone());
}
self.declare(cfg);
}
}
/// Sets configs that describe the target platform.
pub fn set_target_cfgs(cfgs: &mut CfgSet) {
let target = env::var("TARGET").unwrap();
if target.starts_with("thumbv6m-") {
cfgs.enable_all(&["cortex_m", "armv6m"]);
} else if target.starts_with("thumbv7m-") {
cfgs.enable_all(&["cortex_m", "armv7m"]);
} else if target.starts_with("thumbv7em-") {
cfgs.enable_all(&["cortex_m", "armv7m", "armv7em"]);
} else if target.starts_with("thumbv8m.base") {
cfgs.enable_all(&["cortex_m", "armv8m", "armv8m_base"]);
} else if target.starts_with("thumbv8m.main") {
cfgs.enable_all(&["cortex_m", "armv8m", "armv8m_main"]);
}
cfgs.declare_all(&[
"cortex_m",
"armv6m",
"armv7m",
"armv7em",
"armv8m",
"armv8m_base",
"armv8m_main",
]);
cfgs.set("has_fpu", target.ends_with("-eabihf"));
}

View file

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

View file

@ -16,8 +16,8 @@ log = { version = "0.4", default-features = false, optional = true }
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = { version = "1.0" }
embedded-hal-bus = { version = "0.1", features = ["async"] }
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" }
embassy-time = { version = "0.3.0", path = "../embassy-time" }
embassy-net-driver-channel = { version = "0.3.0", path = "../embassy-net-driver-channel" }
embassy-time = { version = "0.3.2", path = "../embassy-time" }
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
bitfield = "0.14.0"
@ -29,7 +29,6 @@ critical-section = { version = "1.1.2", features = ["std"] }
futures-test = "0.3.28"
[features]
default = [ ]
defmt = [ "dep:defmt", "embedded-hal-1/defmt-03" ]
log = ["dep:log"]

View file

@ -21,7 +21,7 @@ APL can be used in [`intrinsic safety applications/explosion hazardous areas`](h
## Supported SPI modes
`ADIN1110` supports two SPI modes. `Generic` and [`OPEN Alliance 10BASE-T1x MAC-PHY serial interface`](https://opensig.org/download/document/OPEN_Alliance_10BASET1x_MAC-PHY_Serial_Interface_V1.1.pdf)
`ADIN1110` supports two SPI modes. `Generic` and [`OPEN Alliance 10BASE-T1x MAC-PHY serial interface`](https://opensig.org/wp-content/uploads/2023/12/OPEN_Alliance_10BASET1x_MAC-PHY_Serial_Interface_V1.1.pdf)
Both modes support with and without additional CRC.
Currently only `Generic` SPI with or without CRC is supported.

View file

@ -16,7 +16,7 @@ const CRC8X_TABLE: [u8; 256] = [
0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3,
];
/// Calculate the crc of a pease of data.
/// Calculate the crc of a piece of data.
pub fn crc8(data: &[u8]) -> u8 {
data.iter().fold(0, |crc, &byte| CRC8X_TABLE[usize::from(byte ^ crc)])
}

View file

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

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