Formatting

This commit is contained in:
Rasmus Melchior Jacobsen 2023-05-30 14:05:38 +02:00
parent 36e00caf4d
commit b527cc98af
4 changed files with 7 additions and 12 deletions

View File

@ -2,15 +2,16 @@
#![no_main] #![no_main]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use core::cell::RefCell;
use defmt_rtt as _; use defmt_rtt as _;
use embassy_boot_rp::*; use embassy_boot_rp::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_rp::flash::Flash; use embassy_rp::flash::Flash;
use embassy_rp::gpio::{Level, Output}; use embassy_rp::gpio::{Level, Output};
use embassy_rp::watchdog::Watchdog; use embassy_rp::watchdog::Watchdog;
use embassy_time::{Duration, Timer};
use embassy_sync::blocking_mutex::Mutex; use embassy_sync::blocking_mutex::Mutex;
use core::cell::RefCell; use embassy_time::{Duration, Timer};
use embedded_storage::nor_flash::NorFlash; use embedded_storage::nor_flash::NorFlash;
#[cfg(feature = "panic-probe")] #[cfg(feature = "panic-probe")]
use panic_probe as _; use panic_probe as _;
@ -49,9 +50,7 @@ async fn main(_s: Spawner) {
for chunk in APP_B.chunks(4096) { for chunk in APP_B.chunks(4096) {
buf.0[..chunk.len()].copy_from_slice(chunk); buf.0[..chunk.len()].copy_from_slice(chunk);
defmt::info!("writing block at offset {}", offset); defmt::info!("writing block at offset {}", offset);
writer writer.write(offset, &buf.0[..]).unwrap();
.write(offset, &buf.0[..])
.unwrap();
offset += chunk.len() as u32; offset += chunk.len() as u32;
} }
watchdog.feed(); watchdog.feed();

View File

@ -5,12 +5,12 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::{AlignedBuffer, FirmwareUpdater, FirmwareUpdaterConfig}; use embassy_boot_stm32::{AlignedBuffer, FirmwareUpdater, FirmwareUpdaterConfig};
use embassy_sync::mutex::Mutex;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::{Flash, WRITE_SIZE}; use embassy_stm32::flash::{Flash, WRITE_SIZE};
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_sync::mutex::Mutex;
use panic_reset as _; use panic_reset as _;
static APP_B: &[u8] = include_bytes!("../../b.bin"); static APP_B: &[u8] = include_bytes!("../../b.bin");

View File

@ -33,9 +33,7 @@ async fn main(_spawner: Spawner) {
let mut buf = AlignedBuffer([0; 4096]); let mut buf = AlignedBuffer([0; 4096]);
for chunk in APP_B.chunks(4096) { for chunk in APP_B.chunks(4096) {
buf.as_mut()[..chunk.len()].copy_from_slice(chunk); buf.as_mut()[..chunk.len()].copy_from_slice(chunk);
writer writer.write(offset, buf.as_ref()).unwrap();
.write(offset, buf.as_ref())
.unwrap();
offset += chunk.len(); offset += chunk.len();
} }
let mut magic = AlignedBuffer([0; WRITE_SIZE]); let mut magic = AlignedBuffer([0; WRITE_SIZE]);

View File

@ -33,9 +33,7 @@ async fn main(_spawner: Spawner) {
let mut buf = AlignedBuffer([0; 4096]); let mut buf = AlignedBuffer([0; 4096]);
for chunk in APP_B.chunks(4096) { for chunk in APP_B.chunks(4096) {
buf.as_mut()[..chunk.len()].copy_from_slice(chunk); buf.as_mut()[..chunk.len()].copy_from_slice(chunk);
writer writer.write(offset, buf.as_ref()).unwrap();
.write(offset, buf.as_ref())
.unwrap();
offset += chunk.len(); offset += chunk.len();
} }
let mut magic = AlignedBuffer([0; WRITE_SIZE]); let mut magic = AlignedBuffer([0; WRITE_SIZE]);