diff options
36 files changed, 242 insertions, 51 deletions
diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 411b7589f..b4e225e64 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml | |||
| @@ -29,7 +29,7 @@ jobs: | |||
| 29 | concurrency: doc-${{ matrix.crates }} | 29 | concurrency: doc-${{ matrix.crates }} |
| 30 | 30 | ||
| 31 | steps: | 31 | steps: |
| 32 | - uses: actions/checkout@v2 | 32 | - uses: actions/checkout@v3 |
| 33 | with: | 33 | with: |
| 34 | submodules: true | 34 | submodules: true |
| 35 | - name: Install Rust targets | 35 | - name: Install Rust targets |
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 79354fe70..47dc8fd7a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml | |||
| @@ -22,11 +22,11 @@ jobs: | |||
| 22 | id-token: write | 22 | id-token: write |
| 23 | contents: read | 23 | contents: read |
| 24 | steps: | 24 | steps: |
| 25 | - uses: actions/checkout@v2 | 25 | - uses: actions/checkout@v3 |
| 26 | with: | 26 | with: |
| 27 | submodules: true | 27 | submodules: true |
| 28 | - name: Cache multiple paths | 28 | - name: Cache multiple paths |
| 29 | uses: actions/cache@v2 | 29 | uses: actions/cache@v3 |
| 30 | with: | 30 | with: |
| 31 | path: | | 31 | path: | |
| 32 | ~/.cargo/bin/ | 32 | ~/.cargo/bin/ |
| @@ -44,11 +44,11 @@ jobs: | |||
| 44 | build-stable: | 44 | build-stable: |
| 45 | runs-on: ubuntu-latest | 45 | runs-on: ubuntu-latest |
| 46 | steps: | 46 | steps: |
| 47 | - uses: actions/checkout@v2 | 47 | - uses: actions/checkout@v3 |
| 48 | with: | 48 | with: |
| 49 | submodules: true | 49 | submodules: true |
| 50 | - name: Cache multiple paths | 50 | - name: Cache multiple paths |
| 51 | uses: actions/cache@v2 | 51 | uses: actions/cache@v3 |
| 52 | with: | 52 | with: |
| 53 | path: | | 53 | path: | |
| 54 | ~/.cargo/bin/ | 54 | ~/.cargo/bin/ |
| @@ -67,7 +67,7 @@ jobs: | |||
| 67 | test: | 67 | test: |
| 68 | runs-on: ubuntu-latest | 68 | runs-on: ubuntu-latest |
| 69 | steps: | 69 | steps: |
| 70 | - uses: actions/checkout@v2 | 70 | - uses: actions/checkout@v3 |
| 71 | 71 | ||
| 72 | - name: Test boot | 72 | - name: Test boot |
| 73 | working-directory: ./embassy-boot/boot | 73 | working-directory: ./embassy-boot/boot |
diff --git a/docs/modules/ROOT/pages/getting_started.adoc b/docs/modules/ROOT/pages/getting_started.adoc index 9015d7845..881e449b6 100644 --- a/docs/modules/ROOT/pages/getting_started.adoc +++ b/docs/modules/ROOT/pages/getting_started.adoc | |||
| @@ -49,7 +49,7 @@ cd examples/nrf52840 | |||
| 49 | cargo run --bin blinky --release | 49 | cargo run --bin blinky --release |
| 50 | ---- | 50 | ---- |
| 51 | 51 | ||
| 52 | == Whats next? | 52 | == What's next? |
| 53 | 53 | ||
| 54 | Congratulations, you have your first Embassy application running! Here are some alternatives on where to go from here: | 54 | Congratulations, you have your first Embassy application running! Here are some alternatives on where to go from here: |
| 55 | 55 | ||
diff --git a/embassy-hal-common/src/atomic_ring_buffer.rs b/embassy-hal-common/src/atomic_ring_buffer.rs index afd3ce1de..0eb39cb33 100644 --- a/embassy-hal-common/src/atomic_ring_buffer.rs +++ b/embassy-hal-common/src/atomic_ring_buffer.rs | |||
| @@ -133,7 +133,7 @@ impl<'a> Writer<'a> { | |||
| 133 | 133 | ||
| 134 | /// Push one data byte. | 134 | /// Push one data byte. |
| 135 | /// | 135 | /// |
| 136 | /// Returns true if pushed succesfully. | 136 | /// Returns true if pushed successfully. |
| 137 | pub fn push_one(&mut self, val: u8) -> bool { | 137 | pub fn push_one(&mut self, val: u8) -> bool { |
| 138 | let n = self.push(|f| match f { | 138 | let n = self.push(|f| match f { |
| 139 | [] => 0, | 139 | [] => 0, |
| @@ -265,7 +265,7 @@ impl<'a> Reader<'a> { | |||
| 265 | 265 | ||
| 266 | /// Pop one data byte. | 266 | /// Pop one data byte. |
| 267 | /// | 267 | /// |
| 268 | /// Returns true if popped succesfully. | 268 | /// Returns true if popped successfully. |
| 269 | pub fn pop_one(&mut self) -> Option<u8> { | 269 | pub fn pop_one(&mut self) -> Option<u8> { |
| 270 | let mut res = None; | 270 | let mut res = None; |
| 271 | self.pop(|f| match f { | 271 | self.pop(|f| match f { |
diff --git a/embassy-nrf/src/nvmc.rs b/embassy-nrf/src/nvmc.rs index 6f48853d5..91a5a272f 100644 --- a/embassy-nrf/src/nvmc.rs +++ b/embassy-nrf/src/nvmc.rs | |||
| @@ -24,7 +24,7 @@ pub const FLASH_SIZE: usize = crate::chip::FLASH_SIZE; | |||
| 24 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] | 24 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
| 25 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 25 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 26 | pub enum Error { | 26 | pub enum Error { |
| 27 | /// Opration using a location not in flash. | 27 | /// Operation using a location not in flash. |
| 28 | OutOfBounds, | 28 | OutOfBounds, |
| 29 | /// Unaligned operation or using unaligned buffers. | 29 | /// Unaligned operation or using unaligned buffers. |
| 30 | Unaligned, | 30 | Unaligned, |
diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 9ae569609..cab36884f 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs | |||
| @@ -336,7 +336,7 @@ impl<'d, T: Instance> Twim<'d, T> { | |||
| 336 | return Poll::Ready(()); | 336 | return Poll::Ready(()); |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | // stop if an error occured | 339 | // stop if an error occurred |
| 340 | if r.events_error.read().bits() != 0 { | 340 | if r.events_error.read().bits() != 0 { |
| 341 | r.events_error.reset(); | 341 | r.events_error.reset(); |
| 342 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 342 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
diff --git a/embassy-nrf/src/twis.rs b/embassy-nrf/src/twis.rs index bfa30b044..f68a9940a 100644 --- a/embassy-nrf/src/twis.rs +++ b/embassy-nrf/src/twis.rs | |||
| @@ -320,7 +320,7 @@ impl<'d, T: Instance> Twis<'d, T> { | |||
| 320 | fn blocking_listen_wait_end(&mut self, status: Status) -> Result<Command, Error> { | 320 | fn blocking_listen_wait_end(&mut self, status: Status) -> Result<Command, Error> { |
| 321 | let r = T::regs(); | 321 | let r = T::regs(); |
| 322 | loop { | 322 | loop { |
| 323 | // stop if an error occured | 323 | // stop if an error occurred |
| 324 | if r.events_error.read().bits() != 0 { | 324 | if r.events_error.read().bits() != 0 { |
| 325 | r.events_error.reset(); | 325 | r.events_error.reset(); |
| 326 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 326 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
| @@ -346,7 +346,7 @@ impl<'d, T: Instance> Twis<'d, T> { | |||
| 346 | fn blocking_wait(&mut self) -> Result<usize, Error> { | 346 | fn blocking_wait(&mut self) -> Result<usize, Error> { |
| 347 | let r = T::regs(); | 347 | let r = T::regs(); |
| 348 | loop { | 348 | loop { |
| 349 | // stop if an error occured | 349 | // stop if an error occurred |
| 350 | if r.events_error.read().bits() != 0 { | 350 | if r.events_error.read().bits() != 0 { |
| 351 | r.events_error.reset(); | 351 | r.events_error.reset(); |
| 352 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 352 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
| @@ -372,7 +372,7 @@ impl<'d, T: Instance> Twis<'d, T> { | |||
| 372 | let r = T::regs(); | 372 | let r = T::regs(); |
| 373 | let deadline = Instant::now() + timeout; | 373 | let deadline = Instant::now() + timeout; |
| 374 | loop { | 374 | loop { |
| 375 | // stop if an error occured | 375 | // stop if an error occurred |
| 376 | if r.events_error.read().bits() != 0 { | 376 | if r.events_error.read().bits() != 0 { |
| 377 | r.events_error.reset(); | 377 | r.events_error.reset(); |
| 378 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 378 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
| @@ -432,7 +432,7 @@ impl<'d, T: Instance> Twis<'d, T> { | |||
| 432 | let r = T::regs(); | 432 | let r = T::regs(); |
| 433 | let deadline = Instant::now() + timeout; | 433 | let deadline = Instant::now() + timeout; |
| 434 | loop { | 434 | loop { |
| 435 | // stop if an error occured | 435 | // stop if an error occurred |
| 436 | if r.events_error.read().bits() != 0 { | 436 | if r.events_error.read().bits() != 0 { |
| 437 | r.events_error.reset(); | 437 | r.events_error.reset(); |
| 438 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 438 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
| @@ -465,7 +465,7 @@ impl<'d, T: Instance> Twis<'d, T> { | |||
| 465 | 465 | ||
| 466 | s.waker.register(cx.waker()); | 466 | s.waker.register(cx.waker()); |
| 467 | 467 | ||
| 468 | // stop if an error occured | 468 | // stop if an error occurred |
| 469 | if r.events_error.read().bits() != 0 { | 469 | if r.events_error.read().bits() != 0 { |
| 470 | r.events_error.reset(); | 470 | r.events_error.reset(); |
| 471 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 471 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
| @@ -495,7 +495,7 @@ impl<'d, T: Instance> Twis<'d, T> { | |||
| 495 | 495 | ||
| 496 | s.waker.register(cx.waker()); | 496 | s.waker.register(cx.waker()); |
| 497 | 497 | ||
| 498 | // stop if an error occured | 498 | // stop if an error occurred |
| 499 | if r.events_error.read().bits() != 0 { | 499 | if r.events_error.read().bits() != 0 { |
| 500 | r.events_error.reset(); | 500 | r.events_error.reset(); |
| 501 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 501 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
| @@ -522,7 +522,7 @@ impl<'d, T: Instance> Twis<'d, T> { | |||
| 522 | 522 | ||
| 523 | s.waker.register(cx.waker()); | 523 | s.waker.register(cx.waker()); |
| 524 | 524 | ||
| 525 | // stop if an error occured | 525 | // stop if an error occurred |
| 526 | if r.events_error.read().bits() != 0 { | 526 | if r.events_error.read().bits() != 0 { |
| 527 | r.events_error.reset(); | 527 | r.events_error.reset(); |
| 528 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); | 528 | r.tasks_stop.write(|w| unsafe { w.bits(1) }); |
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index a2eb6c581..e395a994f 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml | |||
| @@ -30,6 +30,15 @@ rom-func-cache = [] | |||
| 30 | intrinsics = [] | 30 | intrinsics = [] |
| 31 | rom-v2-intrinsics = [] | 31 | rom-v2-intrinsics = [] |
| 32 | 32 | ||
| 33 | # boot2 flash chip support. if none of these is enabled we'll default to w25q080 (used on the pico) | ||
| 34 | boot2-at25sf128a = [] | ||
| 35 | boot2-gd25q64cs = [] | ||
| 36 | boot2-generic-03h = [] | ||
| 37 | boot2-is25lp080 = [] | ||
| 38 | boot2-ram-memcpy = [] | ||
| 39 | boot2-w25q080 = [] | ||
| 40 | boot2-w25x10cl = [] | ||
| 41 | |||
| 33 | # Enable nightly-only features | 42 | # Enable nightly-only features |
| 34 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] | 43 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] |
| 35 | 44 | ||
| @@ -71,3 +80,4 @@ embedded-hal-nb = { version = "=1.0.0-alpha.2", optional = true} | |||
| 71 | paste = "1.0" | 80 | paste = "1.0" |
| 72 | pio-proc = {version= "0.2" } | 81 | pio-proc = {version= "0.2" } |
| 73 | pio = {version= "0.2.1" } | 82 | pio = {version= "0.2.1" } |
| 83 | rp2040-boot2 = "0.3" | ||
diff --git a/embassy-rp/src/boot2.bin b/embassy-rp/src/boot2.bin deleted file mode 100644 index fdc1fc756..000000000 --- a/embassy-rp/src/boot2.bin +++ /dev/null | |||
| Binary files differ | |||
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs index 6ab05ff0b..51c7af913 100644 --- a/embassy-rp/src/flash.rs +++ b/embassy-rp/src/flash.rs | |||
| @@ -25,7 +25,7 @@ pub const ERASE_SIZE: usize = 4096; | |||
| 25 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] | 25 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
| 26 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 26 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 27 | pub enum Error { | 27 | pub enum Error { |
| 28 | /// Opration using a location not in flash. | 28 | /// Operation using a location not in flash. |
| 29 | OutOfBounds, | 29 | OutOfBounds, |
| 30 | /// Unaligned operation or using unaligned buffers. | 30 | /// Unaligned operation or using unaligned buffers. |
| 31 | Unaligned, | 31 | Unaligned, |
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index cd5364393..d5dc94406 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs | |||
| @@ -551,7 +551,7 @@ impl<'d, T: Instance + 'd, M: Mode> I2c<'d, T, M> { | |||
| 551 | 551 | ||
| 552 | if abort_reason.is_err() || (send_stop && last) { | 552 | if abort_reason.is_err() || (send_stop && last) { |
| 553 | // If the transaction was aborted or if it completed | 553 | // If the transaction was aborted or if it completed |
| 554 | // successfully wait until the STOP condition has occured. | 554 | // successfully wait until the STOP condition has occurred. |
| 555 | 555 | ||
| 556 | while !p.ic_raw_intr_stat().read().stop_det() {} | 556 | while !p.ic_raw_intr_stat().read().stop_det() {} |
| 557 | 557 | ||
diff --git a/embassy-rp/src/interrupt.rs b/embassy-rp/src/interrupt.rs index f21a5433b..989f5dc2d 100644 --- a/embassy-rp/src/interrupt.rs +++ b/embassy-rp/src/interrupt.rs | |||
| @@ -34,3 +34,9 @@ declare!(ADC_IRQ_FIFO); | |||
| 34 | declare!(I2C0_IRQ); | 34 | declare!(I2C0_IRQ); |
| 35 | declare!(I2C1_IRQ); | 35 | declare!(I2C1_IRQ); |
| 36 | declare!(RTC_IRQ); | 36 | declare!(RTC_IRQ); |
| 37 | declare!(SWI_IRQ_0); | ||
| 38 | declare!(SWI_IRQ_1); | ||
| 39 | declare!(SWI_IRQ_2); | ||
| 40 | declare!(SWI_IRQ_3); | ||
| 41 | declare!(SWI_IRQ_4); | ||
| 42 | declare!(SWI_IRQ_5); | ||
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index 118ce5237..980ebe7f4 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs | |||
| @@ -131,9 +131,32 @@ embassy_hal_common::peripherals! { | |||
| 131 | WATCHDOG, | 131 | WATCHDOG, |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | #[link_section = ".boot2"] | 134 | macro_rules! select_bootloader { |
| 135 | #[used] | 135 | ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => { |
| 136 | static BOOT2: [u8; 256] = *include_bytes!("boot2.bin"); | 136 | $( |
| 137 | #[cfg(feature = $feature)] | ||
| 138 | #[link_section = ".boot2"] | ||
| 139 | #[used] | ||
| 140 | static BOOT2: [u8; 256] = rp2040_boot2::$loader; | ||
| 141 | )* | ||
| 142 | |||
| 143 | #[cfg(not(any( $( feature = $feature),* )))] | ||
| 144 | #[link_section = ".boot2"] | ||
| 145 | #[used] | ||
| 146 | static BOOT2: [u8; 256] = rp2040_boot2::$default; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | select_bootloader! { | ||
| 151 | "boot2-at25sf128a" => BOOT_LOADER_AT25SF128A, | ||
| 152 | "boot2-gd25q64cs" => BOOT_LOADER_GD25Q64CS, | ||
| 153 | "boot2-generic-03h" => BOOT_LOADER_GENERIC_03H, | ||
| 154 | "boot2-is25lp080" => BOOT_LOADER_IS25LP080, | ||
| 155 | "boot2-ram-memcpy" => BOOT_LOADER_RAM_MEMCPY, | ||
| 156 | "boot2-w25q080" => BOOT_LOADER_W25Q080, | ||
| 157 | "boot2-w25x10cl" => BOOT_LOADER_W25X10CL, | ||
| 158 | default => BOOT_LOADER_W25Q080 | ||
| 159 | } | ||
| 137 | 160 | ||
| 138 | pub mod config { | 161 | pub mod config { |
| 139 | use crate::clocks::ClockConfig; | 162 | use crate::clocks::ClockConfig; |
diff --git a/embassy-rp/src/uart/buffered.rs b/embassy-rp/src/uart/buffered.rs index 59fec8f1b..9d3de1bd8 100644 --- a/embassy-rp/src/uart/buffered.rs +++ b/embassy-rp/src/uart/buffered.rs | |||
| @@ -544,7 +544,7 @@ pub(crate) unsafe fn on_interrupt<T: Instance>(_: *mut ()) { | |||
| 544 | s.rx_waker.wake(); | 544 | s.rx_waker.wake(); |
| 545 | } | 545 | } |
| 546 | // Disable any further RX interrupts when the buffer becomes full or | 546 | // Disable any further RX interrupts when the buffer becomes full or |
| 547 | // errors have occured. this lets us buffer additional errors in the | 547 | // errors have occurred. This lets us buffer additional errors in the |
| 548 | // fifo without needing more error storage locations, and most applications | 548 | // fifo without needing more error storage locations, and most applications |
| 549 | // will want to do a full reset of their uart state anyway once an error | 549 | // will want to do a full reset of their uart state anyway once an error |
| 550 | // has happened. | 550 | // has happened. |
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs index 4084c158a..a0ee6b4ce 100644 --- a/embassy-rp/src/uart/mod.rs +++ b/embassy-rp/src/uart/mod.rs | |||
| @@ -231,7 +231,7 @@ impl<'d, T: Instance> UartTx<'d, T, Async> { | |||
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | impl<'d, T: Instance, M: Mode> UartRx<'d, T, M> { | 233 | impl<'d, T: Instance, M: Mode> UartRx<'d, T, M> { |
| 234 | /// Create a new DMA-enabled UART which can only recieve data | 234 | /// Create a new DMA-enabled UART which can only receive data |
| 235 | pub fn new( | 235 | pub fn new( |
| 236 | _uart: impl Peripheral<P = T> + 'd, | 236 | _uart: impl Peripheral<P = T> + 'd, |
| 237 | rx: impl Peripheral<P = impl RxPin<T>> + 'd, | 237 | rx: impl Peripheral<P = impl RxPin<T>> + 'd, |
| @@ -690,7 +690,7 @@ impl<'d, T: Instance, M: Mode> Uart<'d, T, M> { | |||
| 690 | self.tx.send_break(bits).await | 690 | self.tx.send_break(bits).await |
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | /// Split the Uart into a transmitter and receiver, which is particuarly | 693 | /// Split the Uart into a transmitter and receiver, which is particularly |
| 694 | /// useful when having two tasks correlating to transmitting and receiving. | 694 | /// useful when having two tasks correlating to transmitting and receiving. |
| 695 | pub fn split(self) -> (UartTx<'d, T, M>, UartRx<'d, T, M>) { | 695 | pub fn split(self) -> (UartTx<'d, T, M>, UartRx<'d, T, M>) { |
| 696 | (self.tx, self.rx) | 696 | (self.tx, self.rx) |
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index 8e84570a4..d45c90dd8 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs | |||
| @@ -250,7 +250,7 @@ impl RtcDriver { | |||
| 250 | // Call after clearing alarm, so the callback can set another alarm. | 250 | // Call after clearing alarm, so the callback can set another alarm. |
| 251 | 251 | ||
| 252 | // safety: | 252 | // safety: |
| 253 | // - we can ignore the possiblity of `f` being unset (null) because of the safety contract of `allocate_alarm`. | 253 | // - we can ignore the possibility of `f` being unset (null) because of the safety contract of `allocate_alarm`. |
| 254 | // - other than that we only store valid function pointers into alarm.callback | 254 | // - other than that we only store valid function pointers into alarm.callback |
| 255 | let f: fn(*mut ()) = unsafe { mem::transmute(alarm.callback.get()) }; | 255 | let f: fn(*mut ()) = unsafe { mem::transmute(alarm.callback.get()) }; |
| 256 | f(alarm.ctx.get()); | 256 | f(alarm.ctx.get()); |
diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs index dbce668c2..e946762af 100644 --- a/embassy-stm32/src/usart/mod.rs +++ b/embassy-stm32/src/usart/mod.rs | |||
| @@ -112,7 +112,7 @@ pub struct UartRx<'d, T: BasicInstance, RxDma = NoDma> { | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | impl<'d, T: BasicInstance, TxDma> UartTx<'d, T, TxDma> { | 114 | impl<'d, T: BasicInstance, TxDma> UartTx<'d, T, TxDma> { |
| 115 | /// usefull if you only want Uart Tx. It saves 1 pin and consumes a little less power | 115 | /// Useful if you only want Uart Tx. It saves 1 pin and consumes a little less power. |
| 116 | pub fn new( | 116 | pub fn new( |
| 117 | peri: impl Peripheral<P = T> + 'd, | 117 | peri: impl Peripheral<P = T> + 'd, |
| 118 | tx: impl Peripheral<P = impl TxPin<T>> + 'd, | 118 | tx: impl Peripheral<P = impl TxPin<T>> + 'd, |
| @@ -210,7 +210,7 @@ impl<'d, T: BasicInstance, TxDma> UartTx<'d, T, TxDma> { | |||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | impl<'d, T: BasicInstance, RxDma> UartRx<'d, T, RxDma> { | 212 | impl<'d, T: BasicInstance, RxDma> UartRx<'d, T, RxDma> { |
| 213 | /// usefull if you only want Uart Rx. It saves 1 pin and consumes a little less power | 213 | /// Useful if you only want Uart Rx. It saves 1 pin and consumes a little less power. |
| 214 | pub fn new( | 214 | pub fn new( |
| 215 | peri: impl Peripheral<P = T> + 'd, | 215 | peri: impl Peripheral<P = T> + 'd, |
| 216 | irq: impl Peripheral<P = T::Interrupt> + 'd, | 216 | irq: impl Peripheral<P = T::Interrupt> + 'd, |
| @@ -757,7 +757,7 @@ impl<'d, T: BasicInstance, TxDma, RxDma> Uart<'d, T, TxDma, RxDma> { | |||
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | /// Split the Uart into a transmitter and receiver, which is | 759 | /// Split the Uart into a transmitter and receiver, which is |
| 760 | /// particuarly useful when having two tasks correlating to | 760 | /// particularly useful when having two tasks correlating to |
| 761 | /// transmitting and receiving. | 761 | /// transmitting and receiving. |
| 762 | pub fn split(self) -> (UartTx<'d, T, TxDma>, UartRx<'d, T, RxDma>) { | 762 | pub fn split(self) -> (UartTx<'d, T, TxDma>, UartRx<'d, T, RxDma>) { |
| 763 | (self.tx, self.rx) | 763 | (self.tx, self.rx) |
diff --git a/embassy-usb-driver/src/lib.rs b/embassy-usb-driver/src/lib.rs index e8f71a2dc..2c05f94f7 100644 --- a/embassy-usb-driver/src/lib.rs +++ b/embassy-usb-driver/src/lib.rs | |||
| @@ -97,7 +97,7 @@ impl EndpointAddress { | |||
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /// Infomation for an endpoint. | 100 | /// Information for an endpoint. |
| 101 | #[derive(Copy, Clone, Eq, PartialEq, Debug)] | 101 | #[derive(Copy, Clone, Eq, PartialEq, Debug)] |
| 102 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 102 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 103 | pub struct EndpointInfo { | 103 | pub struct EndpointInfo { |
diff --git a/embassy-usb/src/class/cdc_ncm/mod.rs b/embassy-usb/src/class/cdc_ncm/mod.rs index 262499ccb..d5556dd0b 100644 --- a/embassy-usb/src/class/cdc_ncm/mod.rs +++ b/embassy-usb/src/class/cdc_ncm/mod.rs | |||
| @@ -370,7 +370,7 @@ pub struct Sender<'d, D: Driver<'d>> { | |||
| 370 | impl<'d, D: Driver<'d>> Sender<'d, D> { | 370 | impl<'d, D: Driver<'d>> Sender<'d, D> { |
| 371 | /// Write a packet. | 371 | /// Write a packet. |
| 372 | /// | 372 | /// |
| 373 | /// This waits until the packet is succesfully stored in the CDC-NCM endpoint buffers. | 373 | /// This waits until the packet is successfully stored in the CDC-NCM endpoint buffers. |
| 374 | pub async fn write_packet(&mut self, data: &[u8]) -> Result<(), EndpointError> { | 374 | pub async fn write_packet(&mut self, data: &[u8]) -> Result<(), EndpointError> { |
| 375 | let seq = self.seq; | 375 | let seq = self.seq; |
| 376 | self.seq = self.seq.wrapping_add(1); | 376 | self.seq = self.seq.wrapping_add(1); |
| @@ -436,7 +436,7 @@ pub struct Receiver<'d, D: Driver<'d>> { | |||
| 436 | impl<'d, D: Driver<'d>> Receiver<'d, D> { | 436 | impl<'d, D: Driver<'d>> Receiver<'d, D> { |
| 437 | /// Write a network packet. | 437 | /// Write a network packet. |
| 438 | /// | 438 | /// |
| 439 | /// This waits until a packet is succesfully received from the endpoint buffers. | 439 | /// This waits until a packet is successfully received from the endpoint buffers. |
| 440 | pub async fn read_packet(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError> { | 440 | pub async fn read_packet(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError> { |
| 441 | // Retry loop | 441 | // Retry loop |
| 442 | loop { | 442 | loop { |
diff --git a/embassy-usb/src/class/hid.rs b/embassy-usb/src/class/hid.rs index 03e4c1dbb..889d66ec5 100644 --- a/embassy-usb/src/class/hid.rs +++ b/embassy-usb/src/class/hid.rs | |||
| @@ -165,7 +165,7 @@ impl<'d, D: Driver<'d>, const READ_N: usize, const WRITE_N: usize> HidReaderWrit | |||
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /// Splits into seperate readers/writers for input and output reports. | 168 | /// Splits into separate readers/writers for input and output reports. |
| 169 | pub fn split(self) -> (HidReader<'d, D, READ_N>, HidWriter<'d, D, WRITE_N>) { | 169 | pub fn split(self) -> (HidReader<'d, D, READ_N>, HidWriter<'d, D, WRITE_N>) { |
| 170 | (self.reader, self.writer) | 170 | (self.reader, self.writer) |
| 171 | } | 171 | } |
diff --git a/embassy-usb/src/msos.rs b/embassy-usb/src/msos.rs index 218d9931a..187b2ff8e 100644 --- a/embassy-usb/src/msos.rs +++ b/embassy-usb/src/msos.rs | |||
| @@ -186,7 +186,7 @@ impl<'d> MsOsDescriptorWriter<'d> { | |||
| 186 | capability_type::PLATFORM, | 186 | capability_type::PLATFORM, |
| 187 | &[ | 187 | &[ |
| 188 | 0, // reserved | 188 | 0, // reserved |
| 189 | // platform capability UUID, Microsoft OS 2.0 platform compabitility | 189 | // platform capability UUID, Microsoft OS 2.0 platform compatibility |
| 190 | 0xdf, | 190 | 0xdf, |
| 191 | 0x60, | 191 | 0x60, |
| 192 | 0xdd, | 192 | 0xdd, |
diff --git a/examples/nrf52840/src/bin/pubsub.rs b/examples/nrf52840/src/bin/pubsub.rs index 688e6d075..cca60ebc9 100644 --- a/examples/nrf52840/src/bin/pubsub.rs +++ b/examples/nrf52840/src/bin/pubsub.rs | |||
| @@ -74,9 +74,9 @@ async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Messa | |||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | /// A logger task that awaits the messages, but also does some other work. | 76 | /// A logger task that awaits the messages, but also does some other work. |
| 77 | /// Because of this, depeding on how the messages were published, the subscriber might miss some messages | 77 | /// Because of this, depending on how the messages were published, the subscriber might miss some messages. |
| 78 | /// | 78 | /// |
| 79 | /// This takes the dynamic `DynSubscriber`. This is not as performant as the generic version, but let's you ignore some of the generics | 79 | /// This takes the dynamic `DynSubscriber`. This is not as performant as the generic version, but let's you ignore some of the generics. |
| 80 | #[embassy_executor::task] | 80 | #[embassy_executor::task] |
| 81 | async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { | 81 | async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { |
| 82 | loop { | 82 | loop { |
diff --git a/examples/nrf52840/src/bin/usb_serial.rs b/examples/nrf52840/src/bin/usb_serial.rs index 9727a4f57..dc95cde84 100644 --- a/examples/nrf52840/src/bin/usb_serial.rs +++ b/examples/nrf52840/src/bin/usb_serial.rs | |||
| @@ -40,7 +40,7 @@ async fn main(_spawner: Spawner) { | |||
| 40 | config.max_power = 100; | 40 | config.max_power = 100; |
| 41 | config.max_packet_size_0 = 64; | 41 | config.max_packet_size_0 = 64; |
| 42 | 42 | ||
| 43 | // Required for windows compatiblity. | 43 | // Required for windows compatibility. |
| 44 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 44 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 45 | config.device_class = 0xEF; | 45 | config.device_class = 0xEF; |
| 46 | config.device_sub_class = 0x02; | 46 | config.device_sub_class = 0x02; |
diff --git a/examples/nrf52840/src/bin/usb_serial_multitask.rs b/examples/nrf52840/src/bin/usb_serial_multitask.rs index 6da2c2a2f..ac22d9499 100644 --- a/examples/nrf52840/src/bin/usb_serial_multitask.rs +++ b/examples/nrf52840/src/bin/usb_serial_multitask.rs | |||
| @@ -66,7 +66,7 @@ async fn main(spawner: Spawner) { | |||
| 66 | config.max_power = 100; | 66 | config.max_power = 100; |
| 67 | config.max_packet_size_0 = 64; | 67 | config.max_packet_size_0 = 64; |
| 68 | 68 | ||
| 69 | // Required for windows compatiblity. | 69 | // Required for windows compatibility. |
| 70 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 70 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 71 | config.device_class = 0xEF; | 71 | config.device_class = 0xEF; |
| 72 | config.device_sub_class = 0x02; | 72 | config.device_sub_class = 0x02; |
diff --git a/examples/nrf52840/src/bin/usb_serial_winusb.rs b/examples/nrf52840/src/bin/usb_serial_winusb.rs index 6e4f71a48..1d39d3841 100644 --- a/examples/nrf52840/src/bin/usb_serial_winusb.rs +++ b/examples/nrf52840/src/bin/usb_serial_winusb.rs | |||
| @@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) { | |||
| 45 | config.max_power = 100; | 45 | config.max_power = 100; |
| 46 | config.max_packet_size_0 = 64; | 46 | config.max_packet_size_0 = 64; |
| 47 | 47 | ||
| 48 | // Required for windows compatiblity. | 48 | // Required for windows compatibility. |
| 49 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 49 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 50 | config.device_class = 0xEF; | 50 | config.device_class = 0xEF; |
| 51 | config.device_sub_class = 0x02; | 51 | config.device_sub_class = 0x02; |
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index d2829df99..ffeb69f15 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal", features = ["defmt"] } | 9 | embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal", features = ["defmt"] } |
| 10 | embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } | 11 | embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } |
| 12 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["nightly", "unstable-traits", "defmt", "defmt-timestamp-uptime"] } | 12 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["nightly", "unstable-traits", "defmt", "defmt-timestamp-uptime"] } |
| 13 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } | 13 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } |
| 14 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
diff --git a/examples/rp/src/bin/multiprio.rs b/examples/rp/src/bin/multiprio.rs new file mode 100644 index 000000000..2f79ba49e --- /dev/null +++ b/examples/rp/src/bin/multiprio.rs | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | //! This example showcases how to create multiple Executor instances to run tasks at | ||
| 2 | //! different priority levels. | ||
| 3 | //! | ||
| 4 | //! Low priority executor runs in thread mode (not interrupt), and uses `sev` for signaling | ||
| 5 | //! there's work in the queue, and `wfe` for waiting for work. | ||
| 6 | //! | ||
| 7 | //! Medium and high priority executors run in two interrupts with different priorities. | ||
| 8 | //! Signaling work is done by pending the interrupt. No "waiting" needs to be done explicitly, since | ||
| 9 | //! when there's work the interrupt will trigger and run the executor. | ||
| 10 | //! | ||
| 11 | //! Sample output below. Note that high priority ticks can interrupt everything else, and | ||
| 12 | //! medium priority computations can interrupt low priority computations, making them to appear | ||
| 13 | //! to take significantly longer time. | ||
| 14 | //! | ||
| 15 | //! ```not_rust | ||
| 16 | //! [med] Starting long computation | ||
| 17 | //! [med] done in 992 ms | ||
| 18 | //! [high] tick! | ||
| 19 | //! [low] Starting long computation | ||
| 20 | //! [med] Starting long computation | ||
| 21 | //! [high] tick! | ||
| 22 | //! [high] tick! | ||
| 23 | //! [med] done in 993 ms | ||
| 24 | //! [med] Starting long computation | ||
| 25 | //! [high] tick! | ||
| 26 | //! [high] tick! | ||
| 27 | //! [med] done in 993 ms | ||
| 28 | //! [low] done in 3972 ms | ||
| 29 | //! [med] Starting long computation | ||
| 30 | //! [high] tick! | ||
| 31 | //! [high] tick! | ||
| 32 | //! [med] done in 993 ms | ||
| 33 | //! ``` | ||
| 34 | //! | ||
| 35 | //! For comparison, try changing the code so all 3 tasks get spawned on the low priority executor. | ||
| 36 | //! You will get an output like the following. Note that no computation is ever interrupted. | ||
| 37 | //! | ||
| 38 | //! ```not_rust | ||
| 39 | //! [high] tick! | ||
| 40 | //! [med] Starting long computation | ||
| 41 | //! [med] done in 496 ms | ||
| 42 | //! [low] Starting long computation | ||
| 43 | //! [low] done in 992 ms | ||
| 44 | //! [med] Starting long computation | ||
| 45 | //! [med] done in 496 ms | ||
| 46 | //! [high] tick! | ||
| 47 | //! [low] Starting long computation | ||
| 48 | //! [low] done in 992 ms | ||
| 49 | //! [high] tick! | ||
| 50 | //! [med] Starting long computation | ||
| 51 | //! [med] done in 496 ms | ||
| 52 | //! [high] tick! | ||
| 53 | //! ``` | ||
| 54 | //! | ||
| 55 | |||
| 56 | #![no_std] | ||
| 57 | #![no_main] | ||
| 58 | #![feature(type_alias_impl_trait)] | ||
| 59 | |||
| 60 | use core::mem; | ||
| 61 | |||
| 62 | use cortex_m::peripheral::NVIC; | ||
| 63 | use cortex_m_rt::entry; | ||
| 64 | use defmt::{info, unwrap}; | ||
| 65 | use embassy_rp::executor::{Executor, InterruptExecutor}; | ||
| 66 | use embassy_rp::interrupt; | ||
| 67 | use embassy_rp::pac::Interrupt; | ||
| 68 | use embassy_time::{Duration, Instant, Timer, TICK_HZ}; | ||
| 69 | use static_cell::StaticCell; | ||
| 70 | use {defmt_rtt as _, panic_probe as _}; | ||
| 71 | |||
| 72 | #[embassy_executor::task] | ||
| 73 | async fn run_high() { | ||
| 74 | loop { | ||
| 75 | info!(" [high] tick!"); | ||
| 76 | Timer::after(Duration::from_ticks(673740)).await; | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | #[embassy_executor::task] | ||
| 81 | async fn run_med() { | ||
| 82 | loop { | ||
| 83 | let start = Instant::now(); | ||
| 84 | info!(" [med] Starting long computation"); | ||
| 85 | |||
| 86 | // Spin-wait to simulate a long CPU computation | ||
| 87 | cortex_m::asm::delay(125_000_000); // ~1 second | ||
| 88 | |||
| 89 | let end = Instant::now(); | ||
| 90 | let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; | ||
| 91 | info!(" [med] done in {} ms", ms); | ||
| 92 | |||
| 93 | Timer::after(Duration::from_ticks(53421)).await; | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | #[embassy_executor::task] | ||
| 98 | async fn run_low() { | ||
| 99 | loop { | ||
| 100 | let start = Instant::now(); | ||
| 101 | info!("[low] Starting long computation"); | ||
| 102 | |||
| 103 | // Spin-wait to simulate a long CPU computation | ||
| 104 | cortex_m::asm::delay(250_000_000); // ~2 seconds | ||
| 105 | |||
| 106 | let end = Instant::now(); | ||
| 107 | let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; | ||
| 108 | info!("[low] done in {} ms", ms); | ||
| 109 | |||
| 110 | Timer::after(Duration::from_ticks(82983)).await; | ||
| 111 | } | ||
| 112 | } | ||
| 113 | |||
| 114 | static EXECUTOR_HIGH: InterruptExecutor = InterruptExecutor::new(); | ||
| 115 | static EXECUTOR_MED: InterruptExecutor = InterruptExecutor::new(); | ||
| 116 | static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new(); | ||
| 117 | |||
| 118 | #[interrupt] | ||
| 119 | unsafe fn SWI_IRQ_1() { | ||
| 120 | EXECUTOR_HIGH.on_interrupt() | ||
| 121 | } | ||
| 122 | |||
| 123 | #[interrupt] | ||
| 124 | unsafe fn SWI_IRQ_0() { | ||
| 125 | EXECUTOR_MED.on_interrupt() | ||
| 126 | } | ||
| 127 | |||
| 128 | #[entry] | ||
| 129 | fn main() -> ! { | ||
| 130 | info!("Hello World!"); | ||
| 131 | |||
| 132 | let _p = embassy_rp::init(Default::default()); | ||
| 133 | let mut nvic: NVIC = unsafe { mem::transmute(()) }; | ||
| 134 | |||
| 135 | // High-priority executor: SWI_IRQ_1, priority level 2 | ||
| 136 | unsafe { nvic.set_priority(Interrupt::SWI_IRQ_1, 2 << 6) }; | ||
| 137 | info!("bla: {}", NVIC::get_priority(Interrupt::SWI_IRQ_1)); | ||
| 138 | let spawner = EXECUTOR_HIGH.start(Interrupt::SWI_IRQ_1); | ||
| 139 | unwrap!(spawner.spawn(run_high())); | ||
| 140 | |||
| 141 | // Medium-priority executor: SWI_IRQ_0, priority level 3 | ||
| 142 | unsafe { nvic.set_priority(Interrupt::SWI_IRQ_0, 3 << 6) }; | ||
| 143 | info!("bla: {}", NVIC::get_priority(Interrupt::SWI_IRQ_0)); | ||
| 144 | let spawner = EXECUTOR_MED.start(Interrupt::SWI_IRQ_0); | ||
| 145 | unwrap!(spawner.spawn(run_med())); | ||
| 146 | |||
| 147 | // Low priority executor: runs in thread mode, using WFE/SEV | ||
| 148 | let executor = EXECUTOR_LOW.init(Executor::new()); | ||
| 149 | executor.run(|spawner| { | ||
| 150 | unwrap!(spawner.spawn(run_low())); | ||
| 151 | }); | ||
| 152 | } | ||
diff --git a/examples/rp/src/bin/usb_serial.rs b/examples/rp/src/bin/usb_serial.rs index a991082ee..8160a1875 100644 --- a/examples/rp/src/bin/usb_serial.rs +++ b/examples/rp/src/bin/usb_serial.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | config.max_power = 100; | 30 | config.max_power = 100; |
| 31 | config.max_packet_size_0 = 64; | 31 | config.max_packet_size_0 = 64; |
| 32 | 32 | ||
| 33 | // Required for windows compatiblity. | 33 | // Required for windows compatibility. |
| 34 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 34 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 35 | config.device_class = 0xEF; | 35 | config.device_class = 0xEF; |
| 36 | config.device_sub_class = 0x02; | 36 | config.device_sub_class = 0x02; |
diff --git a/examples/stm32f0/src/bin/button_controlled_blink.rs b/examples/stm32f0/src/bin/button_controlled_blink.rs index e1f223433..f362c53f5 100644 --- a/examples/stm32f0/src/bin/button_controlled_blink.rs +++ b/examples/stm32f0/src/bin/button_controlled_blink.rs | |||
| @@ -17,8 +17,8 @@ static BLINK_MS: AtomicU32 = AtomicU32::new(0); | |||
| 17 | 17 | ||
| 18 | #[embassy_executor::task] | 18 | #[embassy_executor::task] |
| 19 | async fn led_task(led: AnyPin) { | 19 | async fn led_task(led: AnyPin) { |
| 20 | // Configure the LED pin as a push pull ouput and obtain handler. | 20 | // Configure the LED pin as a push pull output and obtain handler. |
| 21 | // On the Nucleo F091RC theres an on-board LED connected to pin PA5. | 21 | // On the Nucleo F091RC there's an on-board LED connected to pin PA5. |
| 22 | let mut led = Output::new(led, Level::Low, Speed::Low); | 22 | let mut led = Output::new(led, Level::Low, Speed::Low); |
| 23 | 23 | ||
| 24 | loop { | 24 | loop { |
diff --git a/examples/stm32f4/src/bin/usb_serial.rs b/examples/stm32f4/src/bin/usb_serial.rs index baabc1a2d..d2b1dca43 100644 --- a/examples/stm32f4/src/bin/usb_serial.rs +++ b/examples/stm32f4/src/bin/usb_serial.rs | |||
| @@ -34,7 +34,7 @@ async fn main(_spawner: Spawner) { | |||
| 34 | config.product = Some("USB-serial example"); | 34 | config.product = Some("USB-serial example"); |
| 35 | config.serial_number = Some("12345678"); | 35 | config.serial_number = Some("12345678"); |
| 36 | 36 | ||
| 37 | // Required for windows compatiblity. | 37 | // Required for windows compatibility. |
| 38 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 38 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 39 | config.device_class = 0xEF; | 39 | config.device_class = 0xEF; |
| 40 | config.device_sub_class = 0x02; | 40 | config.device_sub_class = 0x02; |
diff --git a/examples/stm32f7/src/bin/usb_serial.rs b/examples/stm32f7/src/bin/usb_serial.rs index 5fd9d2ec9..dca90d9cb 100644 --- a/examples/stm32f7/src/bin/usb_serial.rs +++ b/examples/stm32f7/src/bin/usb_serial.rs | |||
| @@ -35,7 +35,7 @@ async fn main(_spawner: Spawner) { | |||
| 35 | config.product = Some("USB-serial example"); | 35 | config.product = Some("USB-serial example"); |
| 36 | config.serial_number = Some("12345678"); | 36 | config.serial_number = Some("12345678"); |
| 37 | 37 | ||
| 38 | // Required for windows compatiblity. | 38 | // Required for windows compatibility. |
| 39 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 39 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 40 | config.device_class = 0xEF; | 40 | config.device_class = 0xEF; |
| 41 | config.device_sub_class = 0x02; | 41 | config.device_sub_class = 0x02; |
diff --git a/examples/stm32h5/src/bin/usb_serial.rs b/examples/stm32h5/src/bin/usb_serial.rs index 6af269c1d..4f987cbd1 100644 --- a/examples/stm32h5/src/bin/usb_serial.rs +++ b/examples/stm32h5/src/bin/usb_serial.rs | |||
| @@ -57,7 +57,7 @@ async fn main(_spawner: Spawner) { | |||
| 57 | config.product = Some("USB-serial example"); | 57 | config.product = Some("USB-serial example"); |
| 58 | config.serial_number = Some("12345678"); | 58 | config.serial_number = Some("12345678"); |
| 59 | 59 | ||
| 60 | // Required for windows compatiblity. | 60 | // Required for windows compatibility. |
| 61 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 61 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 62 | config.device_class = 0xEF; | 62 | config.device_class = 0xEF; |
| 63 | config.device_sub_class = 0x02; | 63 | config.device_sub_class = 0x02; |
diff --git a/examples/stm32h7/src/bin/usb_serial.rs b/examples/stm32h7/src/bin/usb_serial.rs index 9ef520ae2..475af116d 100644 --- a/examples/stm32h7/src/bin/usb_serial.rs +++ b/examples/stm32h7/src/bin/usb_serial.rs | |||
| @@ -34,7 +34,7 @@ async fn main(_spawner: Spawner) { | |||
| 34 | config.product = Some("USB-serial example"); | 34 | config.product = Some("USB-serial example"); |
| 35 | config.serial_number = Some("12345678"); | 35 | config.serial_number = Some("12345678"); |
| 36 | 36 | ||
| 37 | // Required for windows compatiblity. | 37 | // Required for windows compatibility. |
| 38 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 38 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 39 | config.device_class = 0xEF; | 39 | config.device_class = 0xEF; |
| 40 | config.device_sub_class = 0x02; | 40 | config.device_sub_class = 0x02; |
diff --git a/examples/stm32l4/src/bin/usb_serial.rs b/examples/stm32l4/src/bin/usb_serial.rs index 663f60d52..bdb290e63 100644 --- a/examples/stm32l4/src/bin/usb_serial.rs +++ b/examples/stm32l4/src/bin/usb_serial.rs | |||
| @@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) { | |||
| 36 | config.product = Some("USB-serial example"); | 36 | config.product = Some("USB-serial example"); |
| 37 | config.serial_number = Some("12345678"); | 37 | config.serial_number = Some("12345678"); |
| 38 | 38 | ||
| 39 | // Required for windows compatiblity. | 39 | // Required for windows compatibility. |
| 40 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 40 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 41 | config.device_class = 0xEF; | 41 | config.device_class = 0xEF; |
| 42 | config.device_sub_class = 0x02; | 42 | config.device_sub_class = 0x02; |
diff --git a/examples/stm32u5/src/bin/usb_serial.rs b/examples/stm32u5/src/bin/usb_serial.rs index 8cd3bf2f4..4882cd2e0 100644 --- a/examples/stm32u5/src/bin/usb_serial.rs +++ b/examples/stm32u5/src/bin/usb_serial.rs | |||
| @@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) { | |||
| 36 | config.product = Some("USB-serial example"); | 36 | config.product = Some("USB-serial example"); |
| 37 | config.serial_number = Some("12345678"); | 37 | config.serial_number = Some("12345678"); |
| 38 | 38 | ||
| 39 | // Required for windows compatiblity. | 39 | // Required for windows compatibility. |
| 40 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | 40 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help |
| 41 | config.device_class = 0xEF; | 41 | config.device_class = 0xEF; |
| 42 | config.device_sub_class = 0x02; | 42 | config.device_sub_class = 0x02; |
diff --git a/examples/stm32wl/src/bin/uart_async.rs b/examples/stm32wl/src/bin/uart_async.rs index f12fec4c8..ac8766af6 100644 --- a/examples/stm32wl/src/bin/uart_async.rs +++ b/examples/stm32wl/src/bin/uart_async.rs | |||
| @@ -48,7 +48,7 @@ async fn main(_spawner: Spawner) { | |||
| 48 | //Write suc. | 48 | //Write suc. |
| 49 | } | 49 | } |
| 50 | Err(..) => { | 50 | Err(..) => { |
| 51 | //Wasnt able to write | 51 | //Wasn't able to write |
| 52 | } | 52 | } |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
