From 8730a013c395cf0bf4c2fa8eeb7f138288103039 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 6 Oct 2025 22:56:31 +0200 Subject: Rustfmt for edition 2024. --- cyw43-pio/src/lib.rs | 4 +-- cyw43/src/bluetooth.rs | 2 +- cyw43/src/bus.rs | 6 +--- cyw43/src/control.rs | 2 +- cyw43/src/ioctl.rs | 2 +- cyw43/src/runner.rs | 6 ++-- embassy-boot-nrf/src/lib.rs | 2 +- embassy-boot-rp/src/lib.rs | 4 +-- embassy-boot/src/boot_loader.rs | 4 +-- embassy-boot/src/firmware_updater/asynch.rs | 2 +- embassy-boot/src/firmware_updater/blocking.rs | 4 +-- embassy-boot/src/lib.rs | 14 ++++++---- embassy-boot/src/test_flash/blocking.rs | 2 +- .../src/flash/partition/blocking.rs | 2 +- embassy-embedded-hal/src/shared_bus/asynch/i2c.rs | 2 +- embassy-embedded-hal/src/shared_bus/asynch/spi.rs | 2 +- .../src/shared_bus/blocking/i2c.rs | 4 +-- .../src/shared_bus/blocking/spi.rs | 4 +-- embassy-executor-macros/src/macros/main.rs | 2 +- embassy-executor-macros/src/macros/task.rs | 8 ++++-- embassy-executor-macros/src/util.rs | 2 +- embassy-executor/src/arch/avr.rs | 2 +- embassy-executor/src/arch/cortex_ar.rs | 2 +- embassy-executor/src/arch/cortex_m.rs | 2 +- embassy-executor/src/arch/riscv32.rs | 2 +- embassy-executor/src/arch/spin.rs | 2 +- embassy-executor/src/arch/std.rs | 2 +- embassy-executor/src/arch/wasm.rs | 2 +- embassy-executor/src/metadata.rs | 2 +- embassy-executor/src/raw/run_queue.rs | 4 +-- embassy-executor/src/raw/state_atomics_arm.rs | 2 +- embassy-executor/src/raw/state_critical_section.rs | 2 +- embassy-executor/src/raw/trace.rs | 6 +--- embassy-executor/src/raw/waker.rs | 6 ++-- embassy-executor/src/raw/waker_turbo.rs | 2 +- embassy-executor/src/spawner.rs | 12 ++++++-- embassy-executor/tests/test.rs | 4 +-- embassy-hal-internal/src/interrupt.rs | 2 +- embassy-imxrt/src/clocks.rs | 2 +- embassy-imxrt/src/crc.rs | 4 +-- embassy-imxrt/src/dma.rs | 6 ++-- embassy-imxrt/src/flexcomm/mod.rs | 18 ++++++++---- embassy-imxrt/src/flexcomm/uart.rs | 4 +-- embassy-imxrt/src/gpio.rs | 2 +- embassy-imxrt/src/iopctl.rs | 2 +- embassy-imxrt/src/lib.rs | 2 +- embassy-imxrt/src/rng.rs | 4 +-- embassy-imxrt/src/time_driver.rs | 4 +-- embassy-mspm0/src/adc.rs | 6 ++-- embassy-mspm0/src/dma.rs | 8 +++--- embassy-mspm0/src/gpio.rs | 2 +- embassy-mspm0/src/i2c.rs | 4 +-- embassy-mspm0/src/lib.rs | 2 +- embassy-mspm0/src/time_driver.rs | 2 +- embassy-mspm0/src/uart/buffered.rs | 4 +-- embassy-mspm0/src/uart/mod.rs | 13 ++++----- embassy-mspm0/src/wwdt.rs | 4 +-- embassy-net-adin1110/src/crc8.rs | 2 +- embassy-net-adin1110/src/lib.rs | 4 +-- embassy-net-driver-channel/src/lib.rs | 2 +- embassy-net-esp-hosted/src/control.rs | 3 +- embassy-net-esp-hosted/src/ioctl.rs | 2 +- embassy-net-esp-hosted/src/lib.rs | 2 +- embassy-net-nrf91/src/lib.rs | 11 +++----- embassy-net-ppp/src/lib.rs | 2 +- embassy-net-wiznet/src/chip/mod.rs | 2 +- embassy-net-wiznet/src/lib.rs | 2 +- embassy-net/src/icmp.rs | 2 +- embassy-net/src/lib.rs | 2 +- embassy-net/src/raw.rs | 2 +- embassy-net/src/tcp.rs | 4 +-- embassy-net/src/udp.rs | 2 +- embassy-nrf/src/buffered_uarte.rs | 12 ++++---- embassy-nrf/src/egu.rs | 2 +- embassy-nrf/src/embassy_net_802154_driver.rs | 4 +-- embassy-nrf/src/gpio.rs | 4 +-- embassy-nrf/src/gpiote.rs | 4 +-- embassy-nrf/src/i2s.rs | 4 +-- embassy-nrf/src/lib.rs | 2 +- embassy-nrf/src/nfct.rs | 6 ++-- embassy-nrf/src/nvmc.rs | 2 +- embassy-nrf/src/pdm.rs | 4 +-- embassy-nrf/src/ppi/dppi.rs | 2 +- embassy-nrf/src/ppi/mod.rs | 4 +-- embassy-nrf/src/ppi/ppi.rs | 2 +- embassy-nrf/src/pwm.rs | 4 +-- embassy-nrf/src/qspi.rs | 2 +- embassy-nrf/src/radio/ieee802154.rs | 4 +-- embassy-nrf/src/rramc.rs | 2 +- embassy-nrf/src/saadc.rs | 4 +-- embassy-nrf/src/spim.rs | 6 ++-- embassy-nrf/src/spis.rs | 6 ++-- embassy-nrf/src/temp.rs | 2 +- embassy-nrf/src/time_driver.rs | 4 +-- embassy-nrf/src/twim.rs | 2 +- embassy-nrf/src/twis.rs | 4 +-- embassy-nrf/src/uarte.rs | 4 +-- embassy-nrf/src/usb/mod.rs | 10 ++----- embassy-nrf/src/usb/vbus_detect.rs | 2 +- embassy-nrf/src/util.rs | 6 +--- embassy-nrf/src/wdt.rs | 2 +- embassy-nxp/src/dma/lpc55.rs | 6 ++-- embassy-nxp/src/gpio/lpc55.rs | 4 +-- embassy-nxp/src/gpio/rt1xxx.rs | 4 +-- embassy-nxp/src/lib.rs | 2 +- embassy-nxp/src/pint.rs | 4 +-- embassy-nxp/src/time_driver/rtc.rs | 4 +-- embassy-nxp/src/usart/lpc55.rs | 6 ++-- embassy-rp/src/adc.rs | 8 +++--- embassy-rp/src/bootsel.rs | 2 +- embassy-rp/src/clocks.rs | 4 +-- embassy-rp/src/dma.rs | 4 +-- embassy-rp/src/flash.rs | 4 +-- embassy-rp/src/float/cmp.rs | 12 ++------ embassy-rp/src/float/functions.rs | 12 ++------ embassy-rp/src/gpio.rs | 6 ++-- embassy-rp/src/i2c_slave.rs | 4 +-- embassy-rp/src/multicore.rs | 4 +-- embassy-rp/src/pio/mod.rs | 14 ++++------ embassy-rp/src/pio_programs/hd44780.rs | 2 +- embassy-rp/src/pio_programs/i2s.rs | 2 +- embassy-rp/src/pio_programs/onewire.rs | 8 ++---- embassy-rp/src/pio_programs/pwm.rs | 2 +- embassy-rp/src/pio_programs/rotary_encoder.rs | 2 +- embassy-rp/src/pio_programs/stepper.rs | 2 +- embassy-rp/src/pio_programs/uart.rs | 2 +- embassy-rp/src/pio_programs/ws2812.rs | 2 +- embassy-rp/src/psram.rs | 2 +- embassy-rp/src/pwm.rs | 4 +-- embassy-rp/src/rtc/mod.rs | 2 +- embassy-rp/src/time_driver.rs | 2 +- embassy-rp/src/uart/mod.rs | 16 +++-------- embassy-rp/src/usb.rs | 16 +++-------- embassy-rp/src/watchdog.rs | 2 +- embassy-stm32-wpan/src/cmd.rs | 2 +- embassy-stm32-wpan/src/consts.rs | 2 +- embassy-stm32-wpan/src/lhci.rs | 4 +-- embassy-stm32-wpan/src/lib.rs | 4 +-- embassy-stm32-wpan/src/mac/driver.rs | 2 +- embassy-stm32-wpan/src/mac/runner.rs | 2 +- embassy-stm32-wpan/src/sub/ble.rs | 4 +-- embassy-stm32-wpan/src/sub/mm.rs | 4 +-- embassy-stm32-wpan/src/sub/sys.rs | 12 +++----- embassy-stm32-wpan/src/tables.rs | 2 +- embassy-stm32/build.rs | 8 ++++-- embassy-stm32/src/adc/adc4.rs | 9 ++++-- embassy-stm32/src/adc/c0.rs | 9 ++++-- embassy-stm32/src/adc/f1.rs | 2 +- embassy-stm32/src/adc/f3.rs | 2 +- embassy-stm32/src/adc/f3_v1_1.rs | 2 +- embassy-stm32/src/adc/g4.rs | 9 ++++-- embassy-stm32/src/adc/mod.rs | 2 +- embassy-stm32/src/adc/ringbuffered_v2.rs | 4 +-- embassy-stm32/src/adc/v1.rs | 8 ++---- embassy-stm32/src/adc/v2.rs | 2 +- embassy-stm32/src/adc/v3.rs | 4 +-- embassy-stm32/src/adc/v4.rs | 9 ++++-- embassy-stm32/src/can/bxcan/mod.rs | 12 ++++---- embassy-stm32/src/can/fd/config.rs | 2 +- embassy-stm32/src/can/fdcan.rs | 12 ++++---- embassy-stm32/src/can/util.rs | 2 +- embassy-stm32/src/crc/v1.rs | 2 +- embassy-stm32/src/crc/v2v3.rs | 4 +-- embassy-stm32/src/cryp/mod.rs | 10 +++++-- embassy-stm32/src/dac/mod.rs | 2 +- embassy-stm32/src/dcmi.rs | 2 +- embassy-stm32/src/dma/dma_bdma.rs | 4 +-- embassy-stm32/src/dma/gpdma/mod.rs | 2 +- embassy-stm32/src/dma/gpdma/ringbuffered.rs | 4 +-- embassy-stm32/src/dma/mod.rs | 2 +- .../src/dma/ringbuffer/tests/prop_test/mod.rs | 2 +- embassy-stm32/src/dsihost.rs | 2 +- embassy-stm32/src/dts/mod.rs | 2 +- embassy-stm32/src/eth/v1/mod.rs | 8 ++++-- embassy-stm32/src/eth/v1/rx_desc.rs | 2 +- embassy-stm32/src/eth/v1/tx_desc.rs | 2 +- embassy-stm32/src/eth/v2/descriptors.rs | 2 +- embassy-stm32/src/eth/v2/mod.rs | 6 ++-- embassy-stm32/src/exti.rs | 6 ++-- embassy-stm32/src/flash/asynch.rs | 8 +++--- embassy-stm32/src/flash/common.rs | 8 +++--- embassy-stm32/src/flash/eeprom.rs | 2 +- embassy-stm32/src/flash/f0.rs | 2 +- embassy-stm32/src/flash/f1f3.rs | 2 +- embassy-stm32/src/flash/f2.rs | 4 +-- embassy-stm32/src/flash/f4.rs | 24 ++++++++++------ embassy-stm32/src/flash/f7.rs | 12 +++++--- embassy-stm32/src/flash/g.rs | 18 ++++++++---- embassy-stm32/src/flash/h5.rs | 2 +- embassy-stm32/src/flash/h50.rs | 2 +- embassy-stm32/src/flash/h7.rs | 4 +-- embassy-stm32/src/flash/l.rs | 18 ++++++++---- embassy-stm32/src/flash/u0.rs | 2 +- embassy-stm32/src/flash/u5.rs | 2 +- embassy-stm32/src/fmc.rs | 2 +- embassy-stm32/src/gpio.rs | 2 +- embassy-stm32/src/hash/mod.rs | 8 ++---- embassy-stm32/src/hsem/mod.rs | 4 +-- embassy-stm32/src/hspi/mod.rs | 2 +- embassy-stm32/src/i2c/mod.rs | 4 +-- embassy-stm32/src/i2c/v1.rs | 8 ++---- embassy-stm32/src/i2c/v2.rs | 2 +- embassy-stm32/src/i2s.rs | 4 +-- embassy-stm32/src/ipcc.rs | 2 +- embassy-stm32/src/low_power.rs | 4 +-- embassy-stm32/src/lptim/pwm.rs | 6 ++-- embassy-stm32/src/ltdc.rs | 2 +- embassy-stm32/src/opamp.rs | 2 +- embassy-stm32/src/ospi/mod.rs | 6 ++-- embassy-stm32/src/qspi/mod.rs | 2 +- embassy-stm32/src/rcc/bd.rs | 4 +-- embassy-stm32/src/rcc/f247.rs | 4 +-- embassy-stm32/src/rcc/h.rs | 5 +++- embassy-stm32/src/rcc/l.rs | 8 +++--- embassy-stm32/src/rcc/mco.rs | 4 +-- embassy-stm32/src/rcc/mod.rs | 2 +- embassy-stm32/src/rcc/u5.rs | 9 ++++-- embassy-stm32/src/rcc/wba.rs | 9 ++++-- embassy-stm32/src/rng.rs | 2 +- embassy-stm32/src/rtc/low_power.rs | 2 +- embassy-stm32/src/rtc/mod.rs | 8 +++--- embassy-stm32/src/rtc/v3.rs | 2 +- embassy-stm32/src/sai/mod.rs | 6 ++-- embassy-stm32/src/sdmmc/mod.rs | 6 ++-- embassy-stm32/src/spdifrx/mod.rs | 2 +- embassy-stm32/src/spi/mod.rs | 8 +++--- embassy-stm32/src/time_driver.rs | 6 ++-- embassy-stm32/src/timer/complementary_pwm.rs | 6 ++-- embassy-stm32/src/timer/input_capture.rs | 2 +- embassy-stm32/src/timer/one_pulse.rs | 2 +- embassy-stm32/src/timer/pwm_input.rs | 2 +- embassy-stm32/src/timer/qei.rs | 2 +- embassy-stm32/src/timer/simple_pwm.rs | 2 +- embassy-stm32/src/tsc/acquisition_banks.rs | 4 +-- embassy-stm32/src/tsc/pin_groups.rs | 4 +-- embassy-stm32/src/ucpd.rs | 4 +-- embassy-stm32/src/usart/buffered.rs | 6 ++-- embassy-stm32/src/usart/mod.rs | 8 +++--- embassy-stm32/src/usart/ringbuffered.rs | 8 +++--- embassy-stm32/src/usb/otg.rs | 10 +++---- embassy-stm32/src/usb/usb.rs | 4 +-- embassy-stm32/src/vrefbuf/mod.rs | 3 +- embassy-stm32/src/wdg/mod.rs | 2 +- embassy-stm32/src/xspi/mod.rs | 6 ++-- embassy-sync/src/channel.rs | 30 +++++++++++--------- embassy-sync/src/mutex.rs | 4 +-- embassy-sync/src/once_lock.rs | 2 +- embassy-sync/src/pipe.rs | 2 +- embassy-sync/src/priority_channel.rs | 32 ++++++++++++---------- embassy-sync/src/pubsub/mod.rs | 2 +- embassy-sync/src/ring_buffer.rs | 6 +--- embassy-sync/src/rwlock.rs | 4 +-- embassy-sync/src/semaphore.rs | 4 +-- embassy-sync/src/signal.rs | 4 +-- embassy-sync/src/waitqueue/atomic_waker.rs | 2 +- embassy-sync/src/watch.rs | 4 +-- embassy-sync/src/zerocopy_channel.rs | 10 ++----- embassy-time-queue-utils/src/queue_generic.rs | 2 +- embassy-time/src/duration.rs | 8 +----- embassy-time/src/lib.rs | 10 ++----- embassy-time/src/timer.rs | 4 +-- embassy-usb-dfu/src/application.rs | 4 +-- embassy-usb-dfu/src/dfu.rs | 4 +-- embassy-usb-synopsys-otg/src/lib.rs | 16 +++-------- embassy-usb/src/builder.rs | 9 ++++-- embassy-usb/src/class/cdc_acm.rs | 2 +- embassy-usb/src/class/cdc_ncm/embassy_net.rs | 2 +- embassy-usb/src/class/cdc_ncm/mod.rs | 2 +- embassy-usb/src/class/cmsis_dap_v2.rs | 2 +- embassy-usb/src/class/midi.rs | 2 +- embassy-usb/src/class/uac1/speaker.rs | 4 +-- embassy-usb/src/descriptor.rs | 2 +- embassy-usb/src/lib.rs | 2 +- embassy-usb/src/msos.rs | 2 +- examples/boot/application/stm32wb-dfu/src/main.rs | 4 +-- examples/boot/application/stm32wba-dfu/src/main.rs | 4 +-- examples/boot/application/stm32wl/src/bin/a.rs | 2 +- examples/boot/application/stm32wl/src/bin/b.rs | 2 +- .../boot/bootloader/stm32-dual-bank/src/main.rs | 2 +- examples/boot/bootloader/stm32/src/main.rs | 2 +- examples/boot/bootloader/stm32wb-dfu/src/main.rs | 6 ++-- examples/boot/bootloader/stm32wba-dfu/src/main.rs | 8 +++--- examples/mimxrt6/src/bin/button.rs | 2 +- examples/mspm0c1104/src/bin/blinky.rs | 2 +- examples/mspm0c1104/src/bin/button.rs | 2 +- examples/mspm0g3507/src/bin/adc.rs | 2 +- examples/mspm0g3507/src/bin/blinky.rs | 2 +- examples/mspm0g3507/src/bin/button.rs | 2 +- examples/mspm0g3519/src/bin/blinky.rs | 2 +- examples/mspm0g3519/src/bin/button.rs | 2 +- examples/mspm0l1306/src/bin/adc.rs | 2 +- examples/mspm0l1306/src/bin/blinky.rs | 2 +- examples/mspm0l1306/src/bin/button.rs | 2 +- examples/mspm0l2228/src/bin/blinky.rs | 2 +- examples/mspm0l2228/src/bin/button.rs | 2 +- examples/nrf52840-edf/src/bin/basic.rs | 2 +- examples/nrf52840-rtic/src/bin/blinky.rs | 2 +- .../nrf52840/src/bin/channel_sender_receiver.rs | 2 +- examples/nrf52840/src/bin/ethernet_enc28j60.rs | 2 +- examples/nrf52840/src/bin/i2s_effect.rs | 8 ++---- examples/nrf52840/src/bin/i2s_monitor.rs | 2 +- examples/nrf52840/src/bin/i2s_waveform.rs | 8 ++---- examples/nrf52840/src/bin/raw_spawn.rs | 2 +- examples/nrf52840/src/bin/rtc.rs | 2 +- examples/nrf52840/src/bin/usb_ethernet.rs | 4 +-- examples/nrf52840/src/bin/usb_hid_keyboard.rs | 8 ++++-- examples/nrf52840/src/bin/usb_hid_mouse.rs | 2 +- examples/nrf52840/src/bin/usb_serial.rs | 2 +- examples/nrf52840/src/bin/usb_serial_multitask.rs | 2 +- examples/nrf52840/src/bin/usb_serial_winusb.rs | 2 +- examples/nrf52840/src/bin/wifi_esp_hosted.rs | 2 +- examples/nrf9160/src/bin/modem_tcp_client.rs | 4 +-- examples/rp/src/bin/assign_resources.rs | 2 +- examples/rp/src/bin/debounce.rs | 2 +- examples/rp/src/bin/ethernet_w5500_icmp_ping.rs | 4 +-- examples/rp/src/bin/ethernet_w55rp20_tcp_server.rs | 2 +- examples/rp/src/bin/interrupt.rs | 2 +- examples/rp/src/bin/multicore.rs | 2 +- examples/rp/src/bin/multiprio.rs | 2 +- examples/rp/src/bin/orchestrate_tasks.rs | 4 +-- examples/rp/src/bin/overclock.rs | 2 +- examples/rp/src/bin/overclock_manual.rs | 2 +- examples/rp/src/bin/pio_async.rs | 2 +- examples/rp/src/bin/pio_stepper.rs | 2 +- examples/rp/src/bin/pwm.rs | 4 +-- examples/rp/src/bin/rtc_alarm.rs | 2 +- examples/rp/src/bin/spi_display.rs | 12 +++----- examples/rp/src/bin/spi_gc9a01.rs | 4 +-- examples/rp/src/bin/uart_r503.rs | 2 +- examples/rp/src/bin/usb_ethernet.rs | 2 +- examples/rp/src/bin/usb_serial.rs | 2 +- examples/rp/src/bin/wifi_ap_tcp_server.rs | 2 +- examples/rp/src/bin/wifi_blinky.rs | 2 +- examples/rp/src/bin/wifi_scan.rs | 2 +- examples/rp/src/bin/wifi_tcp_server.rs | 2 +- examples/rp/src/bin/wifi_webrequest.rs | 2 +- examples/rp/src/bin/zerocopy.rs | 2 +- examples/rp235x/src/bin/assign_resources.rs | 2 +- examples/rp235x/src/bin/debounce.rs | 2 +- .../rp235x/src/bin/ethernet_w5500_icmp_ping.rs | 4 +-- examples/rp235x/src/bin/interrupt.rs | 2 +- examples/rp235x/src/bin/multicore.rs | 2 +- .../rp235x/src/bin/multicore_stack_overflow.rs | 2 +- examples/rp235x/src/bin/multiprio.rs | 2 +- examples/rp235x/src/bin/overclock.rs | 2 +- examples/rp235x/src/bin/pio_async.rs | 2 +- examples/rp235x/src/bin/pio_i2s_rx.rs | 2 +- examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs | 2 +- examples/rp235x/src/bin/pio_stepper.rs | 2 +- examples/rp235x/src/bin/pwm.rs | 4 +-- .../rp235x/src/bin/pwm_tb6612fng_motor_driver.rs | 2 +- examples/rp235x/src/bin/spi_display.rs | 12 +++----- examples/rp235x/src/bin/uart_r503.rs | 2 +- examples/rp235x/src/bin/zerocopy.rs | 2 +- examples/stm32c0/src/bin/rtc.rs | 2 +- .../stm32f0/src/bin/button_controlled_blink.rs | 2 +- examples/stm32f1/src/bin/can.rs | 6 ++-- examples/stm32f1/src/bin/input_capture.rs | 2 +- examples/stm32f1/src/bin/pwm_input.rs | 2 +- examples/stm32f1/src/bin/usb_serial.rs | 4 +-- examples/stm32f2/src/bin/pll.rs | 2 +- examples/stm32f3/src/bin/button_events.rs | 2 +- examples/stm32f3/src/bin/usb_serial.rs | 4 +-- examples/stm32f334/src/bin/adc.rs | 2 +- examples/stm32f334/src/bin/opamp.rs | 2 +- examples/stm32f334/src/bin/pwm.rs | 2 +- examples/stm32f4/src/bin/adc_dma.rs | 2 +- examples/stm32f4/src/bin/eth.rs | 2 +- examples/stm32f4/src/bin/eth_compliance_test.rs | 2 +- examples/stm32f4/src/bin/eth_w5500.rs | 2 +- examples/stm32f4/src/bin/flash_async.rs | 2 +- examples/stm32f4/src/bin/input_capture.rs | 2 +- examples/stm32f4/src/bin/pwm_complementary.rs | 2 +- examples/stm32f4/src/bin/pwm_input.rs | 2 +- examples/stm32f4/src/bin/rtc.rs | 2 +- examples/stm32f4/src/bin/sdmmc.rs | 4 +-- examples/stm32f4/src/bin/usb_ethernet.rs | 4 +-- examples/stm32f4/src/bin/usb_hid_keyboard.rs | 2 +- examples/stm32f4/src/bin/usb_hid_mouse.rs | 4 +-- examples/stm32f4/src/bin/usb_raw.rs | 2 +- examples/stm32f4/src/bin/usb_serial.rs | 4 +-- examples/stm32f4/src/bin/usb_uac_speaker.rs | 4 +-- examples/stm32f4/src/bin/ws2812_pwm.rs | 2 +- examples/stm32f469/src/bin/dsi_bsp.rs | 6 ++-- examples/stm32f7/src/bin/can.rs | 2 +- examples/stm32f7/src/bin/cryp.rs | 4 +-- examples/stm32f7/src/bin/eth.rs | 2 +- examples/stm32f7/src/bin/hash.rs | 2 +- examples/stm32f7/src/bin/qspi.rs | 2 +- examples/stm32f7/src/bin/sdmmc.rs | 4 +-- examples/stm32f7/src/bin/usb_serial.rs | 4 +-- examples/stm32g0/src/bin/hf_timer.rs | 4 +-- examples/stm32g0/src/bin/input_capture.rs | 4 +-- examples/stm32g0/src/bin/pwm_complementary.rs | 2 +- examples/stm32g0/src/bin/pwm_input.rs | 2 +- examples/stm32g0/src/bin/rtc.rs | 2 +- examples/stm32g0/src/bin/usb_serial.rs | 4 +-- examples/stm32g4/src/bin/adc.rs | 2 +- examples/stm32g4/src/bin/adc_differential.rs | 2 +- examples/stm32g4/src/bin/adc_dma.rs | 2 +- examples/stm32g4/src/bin/adc_oversampling.rs | 2 +- examples/stm32g4/src/bin/can.rs | 2 +- examples/stm32g4/src/bin/usb_c_pd.rs | 6 ++-- examples/stm32g4/src/bin/usb_serial.rs | 4 +-- examples/stm32h5/src/bin/adc.rs | 2 +- examples/stm32h5/src/bin/can.rs | 2 +- examples/stm32h5/src/bin/dts.rs | 2 +- examples/stm32h5/src/bin/eth.rs | 2 +- examples/stm32h5/src/bin/sai.rs | 2 +- examples/stm32h5/src/bin/usb_c_pd.rs | 6 ++-- examples/stm32h5/src/bin/usb_serial.rs | 4 +-- examples/stm32h5/src/bin/usb_uac_speaker.rs | 4 +-- examples/stm32h7/src/bin/adc.rs | 2 +- examples/stm32h7/src/bin/adc_dma.rs | 2 +- examples/stm32h7/src/bin/camera.rs | 2 +- examples/stm32h7/src/bin/can.rs | 2 +- examples/stm32h7/src/bin/dac.rs | 2 +- examples/stm32h7/src/bin/dac_dma.rs | 2 +- examples/stm32h7/src/bin/eth.rs | 2 +- examples/stm32h7/src/bin/eth_client.rs | 4 +-- examples/stm32h7/src/bin/eth_client_mii.rs | 4 +-- examples/stm32h7/src/bin/fmc.rs | 2 +- examples/stm32h7/src/bin/i2c_shared.rs | 2 +- examples/stm32h7/src/bin/low_level_timer_api.rs | 2 +- examples/stm32h7/src/bin/pwm.rs | 2 +- examples/stm32h7/src/bin/rng.rs | 2 +- examples/stm32h7/src/bin/rtc.rs | 2 +- examples/stm32h7/src/bin/sdmmc.rs | 2 +- examples/stm32h7/src/bin/spi.rs | 2 +- examples/stm32h7/src/bin/spi_bdma.rs | 2 +- examples/stm32h7/src/bin/spi_dma.rs | 2 +- examples/stm32h7/src/bin/usb_serial.rs | 4 +-- examples/stm32h723/src/bin/spdifrx.rs | 4 +-- examples/stm32h735/src/bin/ltdc.rs | 4 +-- examples/stm32h742/src/bin/qspi.rs | 2 +- examples/stm32h755cm4/src/bin/blinky.rs | 2 +- examples/stm32h755cm4/src/bin/intercore.rs | 2 +- examples/stm32h755cm7/src/bin/blinky.rs | 2 +- examples/stm32h7b0/src/bin/ospi_memory_mapped.rs | 2 +- examples/stm32h7rs/src/bin/blinky.rs | 2 +- examples/stm32h7rs/src/bin/can.rs | 2 +- examples/stm32h7rs/src/bin/eth.rs | 2 +- examples/stm32h7rs/src/bin/rng.rs | 2 +- examples/stm32h7rs/src/bin/rtc.rs | 2 +- examples/stm32h7rs/src/bin/usb_serial.rs | 4 +-- examples/stm32h7rs/src/bin/xspi_memory_mapped.rs | 2 +- examples/stm32l0/src/bin/button_exti.rs | 2 +- examples/stm32l0/src/bin/dds.rs | 2 +- examples/stm32l0/src/bin/eeprom.rs | 2 +- examples/stm32l0/src/bin/raw_spawn.rs | 2 +- examples/stm32l0/src/bin/usb_serial.rs | 2 +- examples/stm32l1/src/bin/eeprom.rs | 2 +- examples/stm32l1/src/bin/usb_serial.rs | 2 +- examples/stm32l4/src/bin/adc.rs | 2 +- examples/stm32l4/src/bin/can.rs | 2 +- examples/stm32l4/src/bin/dac_dma.rs | 2 +- examples/stm32l4/src/bin/rng.rs | 2 +- examples/stm32l4/src/bin/rtc.rs | 2 +- .../stm32l4/src/bin/spe_adin1110_http_server.rs | 10 ++++--- examples/stm32l4/src/bin/usb_serial.rs | 4 +-- examples/stm32l5/src/bin/rng.rs | 2 +- examples/stm32l5/src/bin/usb_ethernet.rs | 4 +-- examples/stm32l5/src/bin/usb_hid_mouse.rs | 4 +-- examples/stm32l5/src/bin/usb_serial.rs | 4 +-- examples/stm32u0/src/bin/adc.rs | 2 +- examples/stm32u0/src/bin/rng.rs | 2 +- examples/stm32u0/src/bin/rtc.rs | 2 +- examples/stm32u0/src/bin/usb_serial.rs | 4 +-- examples/stm32u5/src/bin/adc.rs | 2 +- examples/stm32u5/src/bin/ltdc.rs | 6 ++-- examples/stm32u5/src/bin/usb_hs_serial.rs | 4 +-- examples/stm32u5/src/bin/usb_serial.rs | 4 +-- examples/stm32wb/src/bin/eddystone_beacon.rs | 4 +-- examples/stm32wb/src/bin/gatt_server.rs | 2 +- examples/stm32wb/src/bin/mac_ffd.rs | 2 +- examples/stm32wb/src/bin/mac_ffd_net.rs | 2 +- examples/stm32wb/src/bin/mac_rfd.rs | 2 +- examples/stm32wb/src/bin/tl_mbox_mac.rs | 2 +- examples/stm32wba/src/bin/adc.rs | 2 +- examples/stm32wba/src/bin/pwm.rs | 2 +- examples/stm32wba6/src/bin/adc.rs | 2 +- examples/stm32wba6/src/bin/pwm.rs | 2 +- examples/stm32wba6/src/bin/usb_hs_serial.rs | 4 +-- examples/stm32wl/src/bin/adc.rs | 2 +- examples/stm32wl/src/bin/blinky.rs | 2 +- examples/stm32wl/src/bin/button.rs | 2 +- examples/stm32wl/src/bin/button_exti.rs | 2 +- examples/stm32wl/src/bin/flash.rs | 2 +- examples/stm32wl/src/bin/random.rs | 2 +- examples/stm32wl/src/bin/uart_async.rs | 2 +- tests/mspm0/src/bin/dma.rs | 2 +- tests/perf-client/src/lib.rs | 2 +- tests/rp/src/bin/cyw43-perf.rs | 2 +- tests/rp/src/bin/gpio_multicore.rs | 4 +-- tests/rp/src/bin/multicore.rs | 2 +- tests/rp/src/bin/overclock.rs | 2 +- tests/rp/src/bin/pio_multi_load.rs | 4 ++- tests/rp/src/bin/rtc.rs | 2 +- tests/rp/src/bin/spinlock_mutex_multicore.rs | 2 +- tests/stm32/src/bin/afio.rs | 2 +- tests/stm32/src/bin/cryp.rs | 2 +- tests/stm32/src/bin/fdcan.rs | 2 +- tests/stm32/src/bin/stop.rs | 4 +-- tests/stm32/src/bin/ucpd.rs | 2 +- tests/stm32/src/bin/usart.rs | 2 +- tests/stm32/src/bin/wpan_ble.rs | 4 +-- tests/stm32/src/bin/wpan_mac.rs | 2 +- tests/stm32/src/common.rs | 2 +- tests/utils/src/bin/saturate_serial.rs | 2 +- 509 files changed, 943 insertions(+), 967 deletions(-) diff --git a/cyw43-pio/src/lib.rs b/cyw43-pio/src/lib.rs index b0be19358..41ac6816d 100644 --- a/cyw43-pio/src/lib.rs +++ b/cyw43-pio/src/lib.rs @@ -6,13 +6,13 @@ use core::slice; use cyw43::SpiBusCyw43; +use embassy_rp::Peri; use embassy_rp::dma::Channel; use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate}; use embassy_rp::pio::program::pio_asm; use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; -use embassy_rp::Peri; -use fixed::types::extra::U8; use fixed::FixedU32; +use fixed::types::extra::U8; /// SPI comms driven by PIO. pub struct PioSpi<'d, PIO: Instance, const SM: usize, DMA: Channel> { diff --git a/cyw43/src/bluetooth.rs b/cyw43/src/bluetooth.rs index d176c4b09..332b7048d 100644 --- a/cyw43/src/bluetooth.rs +++ b/cyw43/src/bluetooth.rs @@ -15,7 +15,7 @@ use crate::bus::Bus; pub use crate::bus::SpiBusCyw43; use crate::consts::*; use crate::util::round_up; -use crate::{util, CHIP}; +use crate::{CHIP, util}; pub(crate) struct BtState { rx: [BtPacketBuf; 4], diff --git a/cyw43/src/bus.rs b/cyw43/src/bus.rs index 8a53484d5..aa2b66a40 100644 --- a/cyw43/src/bus.rs +++ b/cyw43/src/bus.rs @@ -340,11 +340,7 @@ where self.status = self.spi.cmd_read(cmd, &mut buf[..len]).await; // if we read from the backplane, the result is in the second word, after the response delay - if func == FUNC_BACKPLANE { - buf[1] - } else { - buf[0] - } + if func == FUNC_BACKPLANE { buf[1] } else { buf[0] } } async fn writen(&mut self, func: u32, addr: u32, val: u32, len: u32) { diff --git a/cyw43/src/control.rs b/cyw43/src/control.rs index fd0d4d532..49e3faee4 100644 --- a/cyw43/src/control.rs +++ b/cyw43/src/control.rs @@ -10,7 +10,7 @@ use crate::events::{Event, EventSubscriber, Events}; use crate::fmt::Bytes; use crate::ioctl::{IoctlState, IoctlType}; use crate::structs::*; -use crate::{countries, events, PowerManagementMode}; +use crate::{PowerManagementMode, countries, events}; /// Control errors. #[derive(Debug)] diff --git a/cyw43/src/ioctl.rs b/cyw43/src/ioctl.rs index 35135e296..deccc945d 100644 --- a/cyw43/src/ioctl.rs +++ b/cyw43/src/ioctl.rs @@ -1,5 +1,5 @@ use core::cell::{Cell, RefCell}; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::task::{Poll, Waker}; use embassy_sync::waitqueue::WakerRegistration; diff --git a/cyw43/src/runner.rs b/cyw43/src/runner.rs index 77910b281..7c38be24a 100644 --- a/cyw43/src/runner.rs +++ b/cyw43/src/runner.rs @@ -1,6 +1,6 @@ -use embassy_futures::select::{select4, Either4}; +use embassy_futures::select::{Either4, select4}; use embassy_net_driver_channel as ch; -use embassy_time::{block_for, Duration, Timer}; +use embassy_time::{Duration, Timer, block_for}; use embedded_hal_1::digital::OutputPin; use crate::bus::Bus; @@ -12,7 +12,7 @@ use crate::ioctl::{IoctlState, IoctlType, PendingIoctl}; use crate::nvram::NVRAM; use crate::structs::*; use crate::util::slice8_mut; -use crate::{events, Core, CHIP, MTU}; +use crate::{CHIP, Core, MTU, events}; #[cfg(feature = "firmware-logs")] struct LogState { diff --git a/embassy-boot-nrf/src/lib.rs b/embassy-boot-nrf/src/lib.rs index 3b3434e2c..b4c3c1151 100644 --- a/embassy-boot-nrf/src/lib.rs +++ b/embassy-boot-nrf/src/lib.rs @@ -9,7 +9,7 @@ pub use embassy_boot::{ FirmwareUpdater, FirmwareUpdaterConfig, }; use embassy_nrf::nvmc::PAGE_SIZE; -use embassy_nrf::{wdt, Peri}; +use embassy_nrf::{Peri, wdt}; use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; /// A bootloader for nRF devices. diff --git a/embassy-boot-rp/src/lib.rs b/embassy-boot-rp/src/lib.rs index dd049851a..d090aee49 100644 --- a/embassy-boot-rp/src/lib.rs +++ b/embassy-boot-rp/src/lib.rs @@ -8,10 +8,10 @@ pub use embassy_boot::{ AlignedBuffer, BlockingFirmwareState, BlockingFirmwareUpdater, BootError, BootLoaderConfig, FirmwareState, FirmwareUpdater, FirmwareUpdaterConfig, State, }; -use embassy_rp::flash::{Blocking, Flash, ERASE_SIZE}; +use embassy_rp::Peri; +use embassy_rp::flash::{Blocking, ERASE_SIZE, Flash}; use embassy_rp::peripherals::{FLASH, WATCHDOG}; use embassy_rp::watchdog::Watchdog; -use embassy_rp::Peri; use embassy_time::Duration; use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; diff --git a/embassy-boot/src/boot_loader.rs b/embassy-boot/src/boot_loader.rs index 8d97882ea..c38940d6e 100644 --- a/embassy-boot/src/boot_loader.rs +++ b/embassy-boot/src/boot_loader.rs @@ -1,11 +1,11 @@ use core::cell::RefCell; use embassy_embedded_hal::flash::partition::BlockingPartition; -use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embedded_storage::nor_flash::{NorFlash, NorFlashError, NorFlashErrorKind}; -use crate::{State, DFU_DETACH_MAGIC, REVERT_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; +use crate::{DFU_DETACH_MAGIC, REVERT_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC, State}; /// Errors returned by bootloader #[derive(PartialEq, Eq, Debug)] diff --git a/embassy-boot/src/firmware_updater/asynch.rs b/embassy-boot/src/firmware_updater/asynch.rs index fd02fa526..26d4d39bd 100644 --- a/embassy-boot/src/firmware_updater/asynch.rs +++ b/embassy-boot/src/firmware_updater/asynch.rs @@ -6,7 +6,7 @@ use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embedded_storage_async::nor_flash::NorFlash; use super::FirmwareUpdaterConfig; -use crate::{FirmwareUpdaterError, State, BOOT_MAGIC, DFU_DETACH_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; +use crate::{BOOT_MAGIC, DFU_DETACH_MAGIC, FirmwareUpdaterError, STATE_ERASE_VALUE, SWAP_MAGIC, State}; /// FirmwareUpdater is an application API for interacting with the BootLoader without the ability to /// 'mess up' the internal bootloader state diff --git a/embassy-boot/src/firmware_updater/blocking.rs b/embassy-boot/src/firmware_updater/blocking.rs index 44550e795..5554025fc 100644 --- a/embassy-boot/src/firmware_updater/blocking.rs +++ b/embassy-boot/src/firmware_updater/blocking.rs @@ -6,7 +6,7 @@ use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embedded_storage::nor_flash::NorFlash; use super::FirmwareUpdaterConfig; -use crate::{FirmwareUpdaterError, State, BOOT_MAGIC, DFU_DETACH_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; +use crate::{BOOT_MAGIC, DFU_DETACH_MAGIC, FirmwareUpdaterError, STATE_ERASE_VALUE, SWAP_MAGIC, State}; /// Blocking FirmwareUpdater is an application API for interacting with the BootLoader without the ability to /// 'mess up' the internal bootloader state @@ -399,8 +399,8 @@ mod tests { use core::cell::RefCell; use embassy_embedded_hal::flash::partition::BlockingPartition; - use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::Mutex; + use embassy_sync::blocking_mutex::raw::NoopRawMutex; use sha1::{Digest, Sha1}; use super::*; diff --git a/embassy-boot/src/lib.rs b/embassy-boot/src/lib.rs index 4d7ebfc4f..7dc811f66 100644 --- a/embassy-boot/src/lib.rs +++ b/embassy-boot/src/lib.rs @@ -342,11 +342,13 @@ mod tests { &mut aligned, ); - assert!(block_on(updater.verify_and_mark_updated( - &public_key.to_bytes(), - &signature.to_bytes(), - firmware_len as u32, - )) - .is_ok()); + assert!( + block_on(updater.verify_and_mark_updated( + &public_key.to_bytes(), + &signature.to_bytes(), + firmware_len as u32, + )) + .is_ok() + ); } } diff --git a/embassy-boot/src/test_flash/blocking.rs b/embassy-boot/src/test_flash/blocking.rs index 5ec476c65..7334346fd 100644 --- a/embassy-boot/src/test_flash/blocking.rs +++ b/embassy-boot/src/test_flash/blocking.rs @@ -1,8 +1,8 @@ use core::cell::RefCell; use embassy_embedded_hal::flash::partition::BlockingPartition; -use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embedded_storage::nor_flash::NorFlash; use crate::BootLoaderConfig; diff --git a/embassy-embedded-hal/src/flash/partition/blocking.rs b/embassy-embedded-hal/src/flash/partition/blocking.rs index cb30290a8..bd9329e2d 100644 --- a/embassy-embedded-hal/src/flash/partition/blocking.rs +++ b/embassy-embedded-hal/src/flash/partition/blocking.rs @@ -1,7 +1,7 @@ use core::cell::RefCell; -use embassy_sync::blocking_mutex::raw::RawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::RawMutex; use embedded_storage::nor_flash::{ErrorType, MultiwriteNorFlash, NorFlash, ReadNorFlash}; use super::Error; diff --git a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs index 48246270e..9c7d3ee71 100644 --- a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs @@ -26,8 +26,8 @@ use embassy_sync::blocking_mutex::raw::RawMutex; use embassy_sync::mutex::Mutex; use embedded_hal_async::i2c; -use crate::shared_bus::I2cDeviceError; use crate::SetConfig; +use crate::shared_bus::I2cDeviceError; /// I2C device on a shared bus. pub struct I2cDevice<'a, M: RawMutex, BUS> { diff --git a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs index 0faefbc1e..869a78164 100644 --- a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs @@ -32,8 +32,8 @@ use embedded_hal_1::digital::OutputPin; use embedded_hal_1::spi::Operation; use embedded_hal_async::spi; -use crate::shared_bus::SpiDeviceError; use crate::SetConfig; +use crate::shared_bus::SpiDeviceError; /// SPI device on a shared bus. pub struct SpiDevice<'a, M: RawMutex, BUS, CS> { diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs index dc634a209..49b50f8c1 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs @@ -17,12 +17,12 @@ use core::cell::RefCell; -use embassy_sync::blocking_mutex::raw::RawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::RawMutex; use embedded_hal_1::i2c::{ErrorType, I2c, Operation}; -use crate::shared_bus::I2cDeviceError; use crate::SetConfig; +use crate::shared_bus::I2cDeviceError; /// I2C device on a shared bus. pub struct I2cDevice<'a, M: RawMutex, BUS> { diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs index ffe2aa1c6..48fe2f4c4 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs @@ -19,13 +19,13 @@ use core::cell::RefCell; -use embassy_sync::blocking_mutex::raw::RawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::RawMutex; use embedded_hal_1::digital::OutputPin; use embedded_hal_1::spi::{self, Operation, SpiBus}; -use crate::shared_bus::SpiDeviceError; use crate::SetConfig; +use crate::shared_bus::SpiDeviceError; /// SPI device on a shared bus. pub struct SpiDevice<'a, M: RawMutex, BUS, CS> { diff --git a/embassy-executor-macros/src/macros/main.rs b/embassy-executor-macros/src/macros/main.rs index 3d52ebfe1..c259c003f 100644 --- a/embassy-executor-macros/src/macros/main.rs +++ b/embassy-executor-macros/src/macros/main.rs @@ -1,7 +1,7 @@ use std::str::FromStr; -use darling::export::NestedMeta; use darling::FromMeta; +use darling::export::NestedMeta; use proc_macro2::TokenStream; use quote::quote; use syn::{ReturnType, Type}; diff --git a/embassy-executor-macros/src/macros/task.rs b/embassy-executor-macros/src/macros/task.rs index 755948882..8ce8d6726 100644 --- a/embassy-executor-macros/src/macros/task.rs +++ b/embassy-executor-macros/src/macros/task.rs @@ -1,7 +1,7 @@ use std::str::FromStr; -use darling::export::NestedMeta; use darling::FromMeta; +use darling::export::NestedMeta; use proc_macro2::{Span, TokenStream}; use quote::{format_ident, quote}; use syn::visit::{self, Visit}; @@ -287,7 +287,11 @@ fn check_arg_ty(errors: &mut TokenStream, ty: &Type) { } fn visit_type_impl_trait(&mut self, i: &'ast syn::TypeImplTrait) { - error(self.errors, i, "`impl Trait` is not allowed in task arguments. It is syntax sugar for generics, and tasks can't be generic."); + error( + self.errors, + i, + "`impl Trait` is not allowed in task arguments. It is syntax sugar for generics, and tasks can't be generic.", + ); } } diff --git a/embassy-executor-macros/src/util.rs b/embassy-executor-macros/src/util.rs index ebd032a62..5a13f2121 100644 --- a/embassy-executor-macros/src/util.rs +++ b/embassy-executor-macros/src/util.rs @@ -3,7 +3,7 @@ use std::fmt::Display; use proc_macro2::{TokenStream, TokenTree}; use quote::{ToTokens, TokenStreamExt}; use syn::parse::{Parse, ParseStream}; -use syn::{braced, bracketed, token, AttrStyle, Attribute, Signature, Token, Visibility}; +use syn::{AttrStyle, Attribute, Signature, Token, Visibility, braced, bracketed, token}; pub fn token_stream_with_error(mut tokens: TokenStream, error: syn::Error) -> TokenStream { tokens.extend(error.into_compile_error()); diff --git a/embassy-executor/src/arch/avr.rs b/embassy-executor/src/arch/avr.rs index 4a19c523a..a841afe15 100644 --- a/embassy-executor/src/arch/avr.rs +++ b/embassy-executor/src/arch/avr.rs @@ -10,7 +10,7 @@ mod thread { pub use embassy_executor_macros::main_avr as main; use portable_atomic::{AtomicBool, Ordering}; - use crate::{raw, Spawner}; + use crate::{Spawner, raw}; static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); diff --git a/embassy-executor/src/arch/cortex_ar.rs b/embassy-executor/src/arch/cortex_ar.rs index 36d45944a..a9be3d323 100644 --- a/embassy-executor/src/arch/cortex_ar.rs +++ b/embassy-executor/src/arch/cortex_ar.rs @@ -26,7 +26,7 @@ mod thread { use cortex_ar::asm::wfe; pub use embassy_executor_macros::main_cortex_ar as main; - use crate::{raw, Spawner}; + use crate::{Spawner, raw}; /// Thread mode executor, using WFE/SEV. /// diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs index 9f1081e93..1ce96d1d5 100644 --- a/embassy-executor/src/arch/cortex_m.rs +++ b/embassy-executor/src/arch/cortex_m.rs @@ -53,7 +53,7 @@ mod thread { pub use embassy_executor_macros::main_cortex_m as main; - use crate::{raw, Spawner}; + use crate::{Spawner, raw}; /// Thread mode executor, using WFE/SEV. /// diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs index 13b93cf02..c70c1344a 100644 --- a/embassy-executor/src/arch/riscv32.rs +++ b/embassy-executor/src/arch/riscv32.rs @@ -10,7 +10,7 @@ mod thread { pub use embassy_executor_macros::main_riscv as main; - use crate::{raw, Spawner}; + use crate::{Spawner, raw}; /// global atomic used to keep track of whether there is work to do since sev() is not available on RISCV static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); diff --git a/embassy-executor/src/arch/spin.rs b/embassy-executor/src/arch/spin.rs index 40cb56a09..49f3356a6 100644 --- a/embassy-executor/src/arch/spin.rs +++ b/embassy-executor/src/arch/spin.rs @@ -9,7 +9,7 @@ mod thread { pub use embassy_executor_macros::main_spin as main; - use crate::{raw, Spawner}; + use crate::{Spawner, raw}; #[unsafe(export_name = "__pender")] fn __pender(_context: *mut ()) {} diff --git a/embassy-executor/src/arch/std.rs b/embassy-executor/src/arch/std.rs index cdb9f7642..c62ab723b 100644 --- a/embassy-executor/src/arch/std.rs +++ b/embassy-executor/src/arch/std.rs @@ -10,7 +10,7 @@ mod thread { pub use embassy_executor_macros::main_std as main; - use crate::{raw, Spawner}; + use crate::{Spawner, raw}; #[unsafe(export_name = "__pender")] fn __pender(context: *mut ()) { diff --git a/embassy-executor/src/arch/wasm.rs b/embassy-executor/src/arch/wasm.rs index 6b36f8a5b..d2ff2fe51 100644 --- a/embassy-executor/src/arch/wasm.rs +++ b/embassy-executor/src/arch/wasm.rs @@ -13,7 +13,7 @@ mod thread { use wasm_bindgen::prelude::*; use crate::raw::util::UninitCell; - use crate::{raw, Spawner}; + use crate::{Spawner, raw}; #[unsafe(export_name = "__pender")] fn __pender(context: *mut ()) { diff --git a/embassy-executor/src/metadata.rs b/embassy-executor/src/metadata.rs index bc0df0f83..76504ab0b 100644 --- a/embassy-executor/src/metadata.rs +++ b/embassy-executor/src/metadata.rs @@ -1,6 +1,6 @@ #[cfg(feature = "metadata-name")] use core::cell::Cell; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; #[cfg(feature = "scheduler-priority")] use core::sync::atomic::{AtomicU8, Ordering}; use core::task::Poll; diff --git a/embassy-executor/src/raw/run_queue.rs b/embassy-executor/src/raw/run_queue.rs index b8b052310..6f2abdbd0 100644 --- a/embassy-executor/src/raw/run_queue.rs +++ b/embassy-executor/src/raw/run_queue.rs @@ -1,9 +1,9 @@ -use core::ptr::{addr_of_mut, NonNull}; +use core::ptr::{NonNull, addr_of_mut}; -use cordyceps::sorted_list::Links; use cordyceps::Linked; #[cfg(any(feature = "scheduler-priority", feature = "scheduler-deadline"))] use cordyceps::SortedList; +use cordyceps::sorted_list::Links; #[cfg(target_has_atomic = "ptr")] type TransferStack = cordyceps::TransferStack; diff --git a/embassy-executor/src/raw/state_atomics_arm.rs b/embassy-executor/src/raw/state_atomics_arm.rs index b743dcc2c..f68de955f 100644 --- a/embassy-executor/src/raw/state_atomics_arm.rs +++ b/embassy-executor/src/raw/state_atomics_arm.rs @@ -1,4 +1,4 @@ -use core::sync::atomic::{compiler_fence, AtomicBool, AtomicU32, Ordering}; +use core::sync::atomic::{AtomicBool, AtomicU32, Ordering, compiler_fence}; #[derive(Clone, Copy)] pub(crate) struct Token(()); diff --git a/embassy-executor/src/raw/state_critical_section.rs b/embassy-executor/src/raw/state_critical_section.rs index b69a6ac66..8d7ef2892 100644 --- a/embassy-executor/src/raw/state_critical_section.rs +++ b/embassy-executor/src/raw/state_critical_section.rs @@ -1,7 +1,7 @@ use core::cell::Cell; -pub(crate) use critical_section::{with as locked, CriticalSection as Token}; use critical_section::{CriticalSection, Mutex}; +pub(crate) use critical_section::{CriticalSection as Token, with as locked}; #[cfg(target_arch = "avr")] type StateBits = u8; diff --git a/embassy-executor/src/raw/trace.rs b/embassy-executor/src/raw/trace.rs index b3086948c..74519b927 100644 --- a/embassy-executor/src/raw/trace.rs +++ b/embassy-executor/src/raw/trace.rs @@ -368,11 +368,7 @@ impl rtos_trace::RtosTraceOSCallbacks for crate::raw::SyncExecutor { } fn time() -> u64 { const fn gcd(a: u64, b: u64) -> u64 { - if b == 0 { - a - } else { - gcd(b, a % b) - } + if b == 0 { a } else { gcd(b, a % b) } } const GCD_1M: u64 = gcd(embassy_time_driver::TICK_HZ, 1_000_000); diff --git a/embassy-executor/src/raw/waker.rs b/embassy-executor/src/raw/waker.rs index d0d7b003d..2706f0fdf 100644 --- a/embassy-executor/src/raw/waker.rs +++ b/embassy-executor/src/raw/waker.rs @@ -1,6 +1,6 @@ use core::task::{RawWaker, RawWakerVTable, Waker}; -use super::{wake_task, TaskHeader, TaskRef}; +use super::{TaskHeader, TaskRef, wake_task}; static VTABLE: RawWakerVTable = RawWakerVTable::new(clone, wake, wake, drop); @@ -35,7 +35,9 @@ pub fn task_from_waker(waker: &Waker) -> TaskRef { // make sure to compare vtable addresses. Doing `==` on the references // will compare the contents, which is slower. if waker.vtable() as *const _ != &VTABLE as *const _ { - panic!("Found waker not created by the Embassy executor. `embassy_time::Timer` only works with the Embassy executor.") + 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(waker.data() as *const TaskHeader) } diff --git a/embassy-executor/src/raw/waker_turbo.rs b/embassy-executor/src/raw/waker_turbo.rs index 9d0ad35ec..919bcc61a 100644 --- a/embassy-executor/src/raw/waker_turbo.rs +++ b/embassy-executor/src/raw/waker_turbo.rs @@ -1,7 +1,7 @@ use core::ptr::NonNull; use core::task::Waker; -use super::{wake_task, TaskHeader, TaskRef}; +use super::{TaskHeader, TaskRef, wake_task}; pub(crate) unsafe fn from_task(p: TaskRef) -> Waker { Waker::from_turbo_ptr(NonNull::new_unchecked(p.as_ptr() as _)) diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs index 83d896b76..b73a1e7c6 100644 --- a/embassy-executor/src/spawner.rs +++ b/embassy-executor/src/spawner.rs @@ -1,4 +1,4 @@ -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::mem; use core::sync::atomic::Ordering; @@ -75,7 +75,10 @@ impl core::fmt::Debug for SpawnError { impl core::fmt::Display for SpawnError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { - SpawnError::Busy => write!(f, "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."), + SpawnError::Busy => write!( + f, + "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task." + ), } } } @@ -84,7 +87,10 @@ impl core::fmt::Display for SpawnError { impl defmt::Format for SpawnError { fn format(&self, f: defmt::Formatter) { match self { - SpawnError::Busy => defmt::write!(f, "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."), + SpawnError::Busy => defmt::write!( + f, + "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task." + ), } } } diff --git a/embassy-executor/tests/test.rs b/embassy-executor/tests/test.rs index 6c4783dc1..a99976168 100644 --- a/embassy-executor/tests/test.rs +++ b/embassy-executor/tests/test.rs @@ -2,12 +2,12 @@ #![cfg_attr(feature = "nightly", feature(never_type))] use std::boxed::Box; -use std::future::{poll_fn, Future}; +use std::future::{Future, poll_fn}; use std::sync::{Arc, Mutex}; use std::task::Poll; use embassy_executor::raw::Executor; -use embassy_executor::{task, Spawner}; +use embassy_executor::{Spawner, task}; #[unsafe(export_name = "__pender")] fn __pender(context: *mut ()) { diff --git a/embassy-hal-internal/src/interrupt.rs b/embassy-hal-internal/src/interrupt.rs index 5e64dce9d..ce6057e2d 100644 --- a/embassy-hal-internal/src/interrupt.rs +++ b/embassy-hal-internal/src/interrupt.rs @@ -1,6 +1,6 @@ //! Interrupt handling for cortex-m devices. use core::mem; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use cortex_m::interrupt::InterruptNumber; use cortex_m::peripheral::NVIC; diff --git a/embassy-imxrt/src/clocks.rs b/embassy-imxrt/src/clocks.rs index 39c3e6238..22df2686f 100644 --- a/embassy-imxrt/src/clocks.rs +++ b/embassy-imxrt/src/clocks.rs @@ -1,5 +1,5 @@ //! Clock configuration for the `RT6xx` -use core::sync::atomic::{AtomicU32, AtomicU8, Ordering}; +use core::sync::atomic::{AtomicU8, AtomicU32, Ordering}; use paste::paste; diff --git a/embassy-imxrt/src/crc.rs b/embassy-imxrt/src/crc.rs index 24d6ba5bd..d6f0419d0 100644 --- a/embassy-imxrt/src/crc.rs +++ b/embassy-imxrt/src/crc.rs @@ -2,9 +2,9 @@ use core::marker::PhantomData; -use crate::clocks::{enable_and_reset, SysconPeripheral}; +use crate::clocks::{SysconPeripheral, enable_and_reset}; pub use crate::pac::crc_engine::mode::CrcPolynomial as Polynomial; -use crate::{peripherals, Peri, PeripheralType}; +use crate::{Peri, PeripheralType, peripherals}; /// CRC driver. pub struct Crc<'d> { diff --git a/embassy-imxrt/src/dma.rs b/embassy-imxrt/src/dma.rs index e141447f3..e71a27e0e 100644 --- a/embassy-imxrt/src/dma.rs +++ b/embassy-imxrt/src/dma.rs @@ -2,10 +2,10 @@ use core::future::Future; use core::pin::Pin; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::{Context, Poll}; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use pac::dma0::channel::cfg::Periphreqen; use pac::dma0::channel::xfercfg::{Dstinc, Srcinc, Width}; @@ -14,7 +14,7 @@ use crate::clocks::enable_and_reset; use crate::interrupt::InterruptExt; use crate::peripherals::DMA0; use crate::sealed::Sealed; -use crate::{interrupt, pac, peripherals, BitIter}; +use crate::{BitIter, interrupt, pac, peripherals}; #[cfg(feature = "rt")] #[interrupt] diff --git a/embassy-imxrt/src/flexcomm/mod.rs b/embassy-imxrt/src/flexcomm/mod.rs index 4473c9a77..27794042b 100644 --- a/embassy-imxrt/src/flexcomm/mod.rs +++ b/embassy-imxrt/src/flexcomm/mod.rs @@ -4,11 +4,11 @@ pub mod uart; use paste::paste; -use crate::clocks::{enable_and_reset, SysconPeripheral}; +use crate::clocks::{SysconPeripheral, enable_and_reset}; use crate::peripherals::{ - FLEXCOMM0, FLEXCOMM1, FLEXCOMM14, FLEXCOMM15, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, + FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM14, FLEXCOMM15, }; -use crate::{pac, PeripheralType}; +use crate::{PeripheralType, pac}; /// clock selection option #[derive(Copy, Clone, Debug)] @@ -223,9 +223,15 @@ macro_rules! into_mode { } } -into_mode!(usart, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7); -into_mode!(spi, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM14); -into_mode!(i2c, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM15); +into_mode!( + usart, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7 +); +into_mode!( + spi, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM14 +); +into_mode!( + i2c, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM15 +); into_mode!( i2s_transmit, diff --git a/embassy-imxrt/src/flexcomm/uart.rs b/embassy-imxrt/src/flexcomm/uart.rs index 230b30d43..2b759ba84 100644 --- a/embassy-imxrt/src/flexcomm/uart.rs +++ b/embassy-imxrt/src/flexcomm/uart.rs @@ -2,10 +2,10 @@ use core::future::poll_fn; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, AtomicU8, Ordering}; +use core::sync::atomic::{AtomicU8, Ordering, compiler_fence}; use core::task::Poll; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_hal_internal::drop::OnDrop; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; diff --git a/embassy-imxrt/src/gpio.rs b/embassy-imxrt/src/gpio.rs index e62fde8b1..4a0608e76 100644 --- a/embassy-imxrt/src/gpio.rs +++ b/embassy-imxrt/src/gpio.rs @@ -13,7 +13,7 @@ use crate::clocks::enable_and_reset; use crate::iopctl::IopctlPin; pub use crate::iopctl::{AnyPin, DriveMode, DriveStrength, Function, Inverter, Pull, SlewRate}; use crate::sealed::Sealed; -use crate::{interrupt, peripherals, BitIter, Peri, PeripheralType}; +use crate::{BitIter, Peri, PeripheralType, interrupt, peripherals}; // This should be unique per IMXRT package const PORT_COUNT: usize = 8; diff --git a/embassy-imxrt/src/iopctl.rs b/embassy-imxrt/src/iopctl.rs index a3b8b14d6..805bf2f1b 100644 --- a/embassy-imxrt/src/iopctl.rs +++ b/embassy-imxrt/src/iopctl.rs @@ -2,7 +2,7 @@ //! //! Also known as IO Pin Configuration (IOCON) -use crate::pac::{iopctl, Iopctl}; +use crate::pac::{Iopctl, iopctl}; // A generic pin of any type. // diff --git a/embassy-imxrt/src/lib.rs b/embassy-imxrt/src/lib.rs index 00ac9af29..643dd0c8a 100644 --- a/embassy-imxrt/src/lib.rs +++ b/embassy-imxrt/src/lib.rs @@ -40,7 +40,7 @@ pub use chip::interrupts::*; pub use chip::pac; #[cfg(not(feature = "unstable-pac"))] pub(crate) use chip::pac; -pub use chip::{peripherals, Peripherals}; +pub use chip::{Peripherals, peripherals}; pub use embassy_hal_internal::{Peri, PeripheralType}; #[cfg(feature = "rt")] diff --git a/embassy-imxrt/src/rng.rs b/embassy-imxrt/src/rng.rs index 75f243df9..094418e41 100644 --- a/embassy-imxrt/src/rng.rs +++ b/embassy-imxrt/src/rng.rs @@ -7,9 +7,9 @@ use core::task::Poll; use embassy_futures::block_on; use embassy_sync::waitqueue::AtomicWaker; -use crate::clocks::{enable_and_reset, SysconPeripheral}; +use crate::clocks::{SysconPeripheral, enable_and_reset}; use crate::interrupt::typelevel::Interrupt; -use crate::{interrupt, peripherals, Peri, PeripheralType}; +use crate::{Peri, PeripheralType, interrupt, peripherals}; static RNG_WAKER: AtomicWaker = AtomicWaker::new(); diff --git a/embassy-imxrt/src/time_driver.rs b/embassy-imxrt/src/time_driver.rs index f127609c8..fbd935b70 100644 --- a/embassy-imxrt/src/time_driver.rs +++ b/embassy-imxrt/src/time_driver.rs @@ -1,11 +1,11 @@ //! Time Driver. use core::cell::{Cell, RefCell}; #[cfg(feature = "time-driver-rtc")] -use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; +use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; use critical_section::CriticalSection; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_time_driver::Driver; use embassy_time_queue_utils::Queue; diff --git a/embassy-mspm0/src/adc.rs b/embassy-mspm0/src/adc.rs index 5b93e9a6e..948801679 100644 --- a/embassy-mspm0/src/adc.rs +++ b/embassy-mspm0/src/adc.rs @@ -4,13 +4,13 @@ use core::future::poll_fn; use core::marker::PhantomData; use core::task::Poll; -use embassy_hal_internal::{impl_peripheral, PeripheralType}; +use embassy_hal_internal::{PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use crate::interrupt::{Interrupt, InterruptExt}; use crate::mode::{Async, Blocking, Mode}; -use crate::pac::adc::{vals, Adc as Regs}; -use crate::{interrupt, Peri}; +use crate::pac::adc::{Adc as Regs, vals}; +use crate::{Peri, interrupt}; /// Interrupt handler. pub struct InterruptHandler { diff --git a/embassy-mspm0/src/dma.rs b/embassy-mspm0/src/dma.rs index 66b79709c..58b087761 100644 --- a/embassy-mspm0/src/dma.rs +++ b/embassy-mspm0/src/dma.rs @@ -5,18 +5,18 @@ use core::future::Future; use core::mem; use core::pin::Pin; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::{Context, Poll}; use critical_section::CriticalSection; use embassy_hal_internal::interrupt::InterruptExt; -use embassy_hal_internal::{impl_peripheral, PeripheralType}; +use embassy_hal_internal::{PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; -use mspm0_metapac::common::{Reg, RW}; +use mspm0_metapac::common::{RW, Reg}; use mspm0_metapac::dma::regs; use mspm0_metapac::dma::vals::{self, Autoen, Em, Incr, Preirq, Wdth}; -use crate::{interrupt, pac, Peri}; +use crate::{Peri, interrupt, pac}; /// The burst size of a DMA transfer. #[derive(Debug, Clone, Copy, PartialEq, Eq)] diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs index 4668262a9..a4d41aa71 100644 --- a/embassy-mspm0/src/gpio.rs +++ b/embassy-mspm0/src/gpio.rs @@ -5,7 +5,7 @@ use core::future::Future; use core::pin::Pin as FuturePin; use core::task::{Context, Poll}; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use crate::pac::gpio::vals::*; diff --git a/embassy-mspm0/src/i2c.rs b/embassy-mspm0/src/i2c.rs index 1906e37ba..a12b4b4a2 100644 --- a/embassy-mspm0/src/i2c.rs +++ b/embassy-mspm0/src/i2c.rs @@ -10,13 +10,13 @@ use embassy_hal_internal::PeripheralType; use embassy_sync::waitqueue::AtomicWaker; use mspm0_metapac::i2c; +use crate::Peri; use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; use crate::interrupt::typelevel::Binding; use crate::interrupt::{Interrupt, InterruptExt}; use crate::mode::{Async, Blocking, Mode}; -use crate::pac::i2c::{vals, I2c as Regs}; +use crate::pac::i2c::{I2c as Regs, vals}; use crate::pac::{self}; -use crate::Peri; /// The clock source for the I2C. #[derive(Clone, Copy, PartialEq, Eq, Debug)] diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs index 06938c21d..55f3f9381 100644 --- a/embassy-mspm0/src/lib.rs +++ b/embassy-mspm0/src/lib.rs @@ -55,7 +55,7 @@ pub(crate) mod _generated { // Reexports pub(crate) use _generated::gpio_pincm; -pub use _generated::{peripherals, Peripherals}; +pub use _generated::{Peripherals, peripherals}; pub use embassy_hal_internal::Peri; #[cfg(feature = "unstable-pac")] pub use mspm0_metapac as pac; diff --git a/embassy-mspm0/src/time_driver.rs b/embassy-mspm0/src/time_driver.rs index e80e89e55..0743c667b 100644 --- a/embassy-mspm0/src/time_driver.rs +++ b/embassy-mspm0/src/time_driver.rs @@ -1,5 +1,5 @@ use core::cell::{Cell, RefCell}; -use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; +use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; use core::task::Waker; use critical_section::{CriticalSection, Mutex}; diff --git a/embassy-mspm0/src/uart/buffered.rs b/embassy-mspm0/src/uart/buffered.rs index cbc0b6c80..89e6bcc7b 100644 --- a/embassy-mspm0/src/uart/buffered.rs +++ b/embassy-mspm0/src/uart/buffered.rs @@ -1,4 +1,4 @@ -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::slice; use core::sync::atomic::{AtomicU8, Ordering}; @@ -14,7 +14,7 @@ use crate::gpio::{AnyPin, SealedPin}; use crate::interrupt::typelevel::Binding; use crate::pac::uart::Uart as Regs; use crate::uart::{Config, ConfigError, CtsPin, Error, Info, Instance, RtsPin, RxPin, State, TxPin}; -use crate::{interrupt, Peri}; +use crate::{Peri, interrupt}; /// Interrupt handler. pub struct BufferedInterruptHandler { diff --git a/embassy-mspm0/src/uart/mod.rs b/embassy-mspm0/src/uart/mod.rs index 6599cea06..03e68d297 100644 --- a/embassy-mspm0/src/uart/mod.rs +++ b/embassy-mspm0/src/uart/mod.rs @@ -3,17 +3,17 @@ mod buffered; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; +use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; pub use buffered::*; use embassy_embedded_hal::SetConfig; use embassy_hal_internal::PeripheralType; +use crate::Peri; use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; use crate::interrupt::{Interrupt, InterruptExt}; use crate::mode::{Blocking, Mode}; -use crate::pac::uart::{vals, Uart as Regs}; -use crate::Peri; +use crate::pac::uart::{Uart as Regs, vals}; /// The clock source for the UART. #[derive(Clone, Copy, PartialEq, Eq, Debug)] @@ -931,8 +931,7 @@ fn set_baudrate_inner(regs: Regs, clock: u32, baudrate: u32) -> Result<(), Confi let Some(min_clock) = baudrate.checked_mul(oversampling as u32) else { trace!( "{}x oversampling would cause overflow for clock: {} Hz", - oversampling, - clock + oversampling, clock ); continue; }; @@ -945,9 +944,7 @@ fn set_baudrate_inner(regs: Regs, clock: u32, baudrate: u32) -> Result<(), Confi for &(div, div_value) in &DIVS { trace!( "Trying div: {}, oversampling {} for {} baud", - div, - oversampling, - baudrate + div, oversampling, baudrate ); let Some((ibrd, fbrd)) = calculate_brd(clock, div, baudrate, oversampling) else { diff --git a/embassy-mspm0/src/wwdt.rs b/embassy-mspm0/src/wwdt.rs index e5c62c660..92aeb8b40 100644 --- a/embassy-mspm0/src/wwdt.rs +++ b/embassy-mspm0/src/wwdt.rs @@ -6,9 +6,9 @@ use embassy_hal_internal::PeripheralType; -use crate::pac::wwdt::{vals, Wwdt as Regs}; -use crate::pac::{self}; use crate::Peri; +use crate::pac::wwdt::{Wwdt as Regs, vals}; +use crate::pac::{self}; /// Possible watchdog timeout values. #[derive(Clone, Copy, PartialEq, Eq, Debug)] diff --git a/embassy-net-adin1110/src/crc8.rs b/embassy-net-adin1110/src/crc8.rs index 321983e64..a51353aab 100644 --- a/embassy-net-adin1110/src/crc8.rs +++ b/embassy-net-adin1110/src/crc8.rs @@ -23,7 +23,7 @@ pub fn crc8(data: &[u8]) -> u8 { #[cfg(test)] mod tests { - use ::crc::{Crc, CRC_8_SMBUS}; + use ::crc::{CRC_8_SMBUS, Crc}; use super::crc8; diff --git a/embassy-net-adin1110/src/lib.rs b/embassy-net-adin1110/src/lib.rs index 7f1c772e2..90ac242bd 100644 --- a/embassy-net-adin1110/src/lib.rs +++ b/embassy-net-adin1110/src/lib.rs @@ -17,9 +17,9 @@ mod phy; mod regs; use ch::driver::LinkState; -pub use crc32::ETH_FCS; use crc8::crc8; -use embassy_futures::select::{select, Either}; +pub use crc32::ETH_FCS; +use embassy_futures::select::{Either, select}; use embassy_net_driver_channel as ch; use embassy_time::Timer; use embedded_hal_1::digital::OutputPin; diff --git a/embassy-net-driver-channel/src/lib.rs b/embassy-net-driver-channel/src/lib.rs index 600efd9e5..d0a14aa52 100644 --- a/embassy-net-driver-channel/src/lib.rs +++ b/embassy-net-driver-channel/src/lib.rs @@ -11,8 +11,8 @@ use core::task::{Context, Poll}; pub use embassy_net_driver as driver; use embassy_net_driver::{Capabilities, LinkState}; -use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::waitqueue::WakerRegistration; use embassy_sync::zerocopy_channel; diff --git a/embassy-net-esp-hosted/src/control.rs b/embassy-net-esp-hosted/src/control.rs index b1838a425..cbc194877 100644 --- a/embassy-net-esp-hosted/src/control.rs +++ b/embassy-net-esp-hosted/src/control.rs @@ -65,8 +65,7 @@ macro_rules! ioctl { }; $self.ioctl(&mut msg).await?; #[allow(unused_mut)] - let Some(proto::CtrlMsgPayload::$resp_variant(mut $resp)) = msg.payload - else { + let Some(proto::CtrlMsgPayload::$resp_variant(mut $resp)) = msg.payload else { warn!("unexpected response variant"); return Err(Error::Internal); }; diff --git a/embassy-net-esp-hosted/src/ioctl.rs b/embassy-net-esp-hosted/src/ioctl.rs index 512023206..a516f80c7 100644 --- a/embassy-net-esp-hosted/src/ioctl.rs +++ b/embassy-net-esp-hosted/src/ioctl.rs @@ -1,5 +1,5 @@ use core::cell::RefCell; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::task::Poll; use embassy_sync::waitqueue::WakerRegistration; diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index f05e2a70a..4405d9f77 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs @@ -2,7 +2,7 @@ #![doc = include_str!("../README.md")] #![warn(missing_docs)] -use embassy_futures::select::{select4, Either4}; +use embassy_futures::select::{Either4, select4}; use embassy_net_driver_channel as ch; use embassy_net_driver_channel::driver::LinkState; use embassy_time::{Duration, Instant, Timer}; diff --git a/embassy-net-nrf91/src/lib.rs b/embassy-net-nrf91/src/lib.rs index 8778b65ab..dd4812aae 100644 --- a/embassy-net-nrf91/src/lib.rs +++ b/embassy-net-nrf91/src/lib.rs @@ -10,12 +10,12 @@ mod fmt; pub mod context; use core::cell::RefCell; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::mem::{self, MaybeUninit}; use core::ptr::{self, addr_of, addr_of_mut, copy_nonoverlapping}; use core::slice; -use core::sync::atomic::{compiler_fence, fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence, fence}; use core::task::{Poll, Waker}; use cortex_m::peripheral::NVIC; @@ -140,9 +140,7 @@ async fn new_internal<'a>( debug!("Setting IPC RAM as nonsecure..."); trace!( " SPU_REGION_SIZE={}, shmem_ptr=0x{:08X}, shmem_len={}", - SPU_REGION_SIZE, - shmem_ptr as usize, - shmem_len + SPU_REGION_SIZE, shmem_ptr as usize, shmem_len ); let region_start = (shmem_ptr as usize - 0x2000_0000) / SPU_REGION_SIZE; let region_end = region_start + shmem_len / SPU_REGION_SIZE; @@ -166,8 +164,7 @@ async fn new_internal<'a>( }; trace!( " Allocator: start=0x{:08X}, end=0x{:08X}", - alloc.start as usize, - alloc.end as usize + alloc.start as usize, alloc.end as usize ); let cb: &mut ControlBlock = alloc.alloc().write(unsafe { mem::zeroed() }); diff --git a/embassy-net-ppp/src/lib.rs b/embassy-net-ppp/src/lib.rs index 54a98c95f..ab42ecd26 100644 --- a/embassy-net-ppp/src/lib.rs +++ b/embassy-net-ppp/src/lib.rs @@ -8,7 +8,7 @@ mod fmt; use core::convert::Infallible; use core::mem::MaybeUninit; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_net_driver_channel as ch; use embassy_net_driver_channel::driver::LinkState; use embedded_io_async::{BufRead, Write}; diff --git a/embassy-net-wiznet/src/chip/mod.rs b/embassy-net-wiznet/src/chip/mod.rs index 47d7c5dc3..04346bb21 100644 --- a/embassy-net-wiznet/src/chip/mod.rs +++ b/embassy-net-wiznet/src/chip/mod.rs @@ -43,7 +43,7 @@ pub(crate) trait SealedChip { fn tx_addr(addr: u16) -> Self::Address; async fn bus_read(spi: &mut SPI, address: Self::Address, data: &mut [u8]) - -> Result<(), SPI::Error>; + -> Result<(), SPI::Error>; async fn bus_write(spi: &mut SPI, address: Self::Address, data: &[u8]) -> Result<(), SPI::Error>; } diff --git a/embassy-net-wiznet/src/lib.rs b/embassy-net-wiznet/src/lib.rs index 3fbd4c741..30a5db9f6 100644 --- a/embassy-net-wiznet/src/lib.rs +++ b/embassy-net-wiznet/src/lib.rs @@ -6,7 +6,7 @@ pub mod chip; mod device; -use embassy_futures::select::{select3, Either3}; +use embassy_futures::select::{Either3, select3}; use embassy_net_driver_channel as ch; use embassy_net_driver_channel::driver::LinkState; use embassy_time::{Duration, Ticker, Timer}; diff --git a/embassy-net/src/icmp.rs b/embassy-net/src/icmp.rs index 22c31a589..09e91a1ae 100644 --- a/embassy-net/src/icmp.rs +++ b/embassy-net/src/icmp.rs @@ -1,6 +1,6 @@ //! ICMP sockets. -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::mem; use core::task::{Context, Poll}; diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index f701f8add..a49955c96 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs @@ -27,7 +27,7 @@ mod time; pub mod udp; use core::cell::RefCell; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::mem::MaybeUninit; use core::pin::pin; use core::task::{Context, Poll}; diff --git a/embassy-net/src/raw.rs b/embassy-net/src/raw.rs index c9f753f13..89d2dd350 100644 --- a/embassy-net/src/raw.rs +++ b/embassy-net/src/raw.rs @@ -1,6 +1,6 @@ //! Raw sockets. -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::mem; use core::task::{Context, Poll}; diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index d0230b581..6792c5526 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs @@ -8,7 +8,7 @@ //! Incoming connections when no socket is listening are rejected. To accept many incoming //! connections, create many sockets and put them all into listening mode. -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::mem; use core::task::{Context, Poll}; @@ -18,8 +18,8 @@ use smoltcp::socket::tcp; pub use smoltcp::socket::tcp::State; use smoltcp::wire::{IpEndpoint, IpListenEndpoint}; -use crate::time::duration_to_smoltcp; use crate::Stack; +use crate::time::duration_to_smoltcp; /// Error returned by TcpSocket read/write functions. #[derive(PartialEq, Eq, Clone, Copy, Debug)] diff --git a/embassy-net/src/udp.rs b/embassy-net/src/udp.rs index 482eb0e56..448c25ecc 100644 --- a/embassy-net/src/udp.rs +++ b/embassy-net/src/udp.rs @@ -1,6 +1,6 @@ //! UDP sockets. -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::mem; use core::task::{Context, Poll}; diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index 40c679190..4c946497d 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs @@ -9,27 +9,27 @@ //! Please also see [crate::uarte] to understand when [BufferedUarte] should be used. use core::cmp::min; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::slice; -use core::sync::atomic::{compiler_fence, AtomicBool, AtomicU8, AtomicUsize, Ordering}; +use core::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering, compiler_fence}; use core::task::Poll; -use embassy_hal_internal::atomic_ring_buffer::RingBuffer; use embassy_hal_internal::Peri; +use embassy_hal_internal::atomic_ring_buffer::RingBuffer; use pac::uarte::vals; // Re-export SVD variants to allow user to directly set values pub use pac::uarte::vals::{Baudrate, ConfigParity as Parity}; use crate::gpio::{AnyPin, Pin as GpioPin}; -use crate::interrupt::typelevel::Interrupt; use crate::interrupt::InterruptExt; +use crate::interrupt::typelevel::Interrupt; use crate::ppi::{ self, AnyConfigurableChannel, AnyGroup, Channel, ConfigurableChannel, Event, Group, Ppi, PpiGroup, Task, }; use crate::timer::{Instance as TimerInstance, Timer}; -use crate::uarte::{configure, configure_rx_pins, configure_tx_pins, drop_tx_rx, Config, Instance as UarteInstance}; -use crate::{interrupt, pac, EASY_DMA_SIZE}; +use crate::uarte::{Config, Instance as UarteInstance, configure, configure_rx_pins, configure_tx_pins, drop_tx_rx}; +use crate::{EASY_DMA_SIZE, interrupt, pac}; pub(crate) struct State { tx_buf: RingBuffer, diff --git a/embassy-nrf/src/egu.rs b/embassy-nrf/src/egu.rs index f7372fca1..666986115 100644 --- a/embassy-nrf/src/egu.rs +++ b/embassy-nrf/src/egu.rs @@ -10,7 +10,7 @@ use core::marker::PhantomData; use embassy_hal_internal::PeripheralType; use crate::ppi::{Event, Task}; -use crate::{interrupt, pac, Peri}; +use crate::{Peri, interrupt, pac}; /// An instance of the EGU. pub struct Egu<'d> { diff --git a/embassy-nrf/src/embassy_net_802154_driver.rs b/embassy-nrf/src/embassy_net_802154_driver.rs index b3fc5df2c..4c47b7cbd 100644 --- a/embassy-nrf/src/embassy_net_802154_driver.rs +++ b/embassy-nrf/src/embassy_net_802154_driver.rs @@ -1,12 +1,12 @@ //! embassy-net IEEE 802.15.4 driver -use embassy_futures::select::{select3, Either3}; +use embassy_futures::select::{Either3, select3}; use embassy_net_driver_channel::driver::LinkState; use embassy_net_driver_channel::{self as ch}; use embassy_time::{Duration, Ticker}; -use crate::radio::ieee802154::{Packet, Radio}; use crate::radio::InterruptHandler; +use crate::radio::ieee802154::{Packet, Radio}; use crate::{self as nrf, interrupt}; /// MTU for the nrf radio. diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs index ab5e7ed4b..7ed3a7927 100644 --- a/embassy-nrf/src/gpio.rs +++ b/embassy-nrf/src/gpio.rs @@ -5,10 +5,10 @@ use core::convert::Infallible; use core::hint::unreachable_unchecked; use cfg_if::cfg_if; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use crate::pac; -use crate::pac::common::{Reg, RW}; +use crate::pac::common::{RW, Reg}; use crate::pac::gpio; use crate::pac::gpio::vals; #[cfg(not(feature = "_nrf51"))] diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index 43e43f0bf..a490d5b60 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs @@ -1,10 +1,10 @@ //! GPIO task/event (GPIOTE) driver. use core::convert::Infallible; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::task::{Context, Poll}; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use crate::gpio::{AnyPin, Flex, Input, Output, Pin as GpioPin, SealedPin as _}; diff --git a/embassy-nrf/src/i2s.rs b/embassy-nrf/src/i2s.rs index 1bfa18491..9cce9f1e8 100644 --- a/embassy-nrf/src/i2s.rs +++ b/embassy-nrf/src/i2s.rs @@ -6,7 +6,7 @@ use core::future::poll_fn; use core::marker::PhantomData; use core::mem::size_of; use core::ops::{Deref, DerefMut}; -use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; +use core::sync::atomic::{AtomicBool, Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::drop::OnDrop; @@ -17,7 +17,7 @@ use crate::gpio::{AnyPin, Pin as GpioPin, PselBits}; use crate::interrupt::typelevel::Interrupt; use crate::pac::i2s::vals; use crate::util::slice_in_ram_or; -use crate::{interrupt, pac, EASY_DMA_SIZE}; +use crate::{EASY_DMA_SIZE, interrupt, pac}; /// Type alias for `MultiBuffering` with 2 buffers. pub type DoubleBuffering = MultiBuffering; diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 7a0714cc0..1b7fb7e7f 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs @@ -285,7 +285,7 @@ macro_rules! bind_interrupts { pub use chip::pac; #[cfg(not(feature = "unstable-pac"))] pub(crate) use chip::pac; -pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE}; +pub use chip::{EASY_DMA_SIZE, Peripherals, peripherals}; pub use embassy_hal_internal::{Peri, PeripheralType}; pub use crate::chip::interrupt; diff --git a/embassy-nrf/src/nfct.rs b/embassy-nrf/src/nfct.rs index 8d70ec954..bfbdc2906 100644 --- a/embassy-nrf/src/nfct.rs +++ b/embassy-nrf/src/nfct.rs @@ -10,18 +10,18 @@ #![macro_use] use core::future::poll_fn; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_sync::waitqueue::AtomicWaker; pub use vals::{Bitframesdd as SddPat, Discardmode as DiscardMode}; use crate::interrupt::InterruptExt; -use crate::pac::nfct::vals; use crate::pac::NFCT; +use crate::pac::nfct::vals; use crate::peripherals::NFCT; use crate::util::slice_in_ram; -use crate::{interrupt, pac, Peri}; +use crate::{Peri, interrupt, pac}; /// NFCID1 (aka UID) of different sizes. #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] diff --git a/embassy-nrf/src/nvmc.rs b/embassy-nrf/src/nvmc.rs index c46af0b34..3f38cd0f5 100644 --- a/embassy-nrf/src/nvmc.rs +++ b/embassy-nrf/src/nvmc.rs @@ -8,7 +8,7 @@ use embedded_storage::nor_flash::{ use crate::pac::nvmc::vals; use crate::peripherals::NVMC; -use crate::{pac, Peri}; +use crate::{Peri, pac}; #[cfg(not(feature = "_nrf5340-net"))] /// Erase size of NVMC flash in bytes. diff --git a/embassy-nrf/src/pdm.rs b/embassy-nrf/src/pdm.rs index b6ee52850..bc28f5c8a 100644 --- a/embassy-nrf/src/pdm.rs +++ b/embassy-nrf/src/pdm.rs @@ -4,7 +4,7 @@ use core::future::poll_fn; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::drop::OnDrop; @@ -13,7 +13,7 @@ use embassy_sync::waitqueue::AtomicWaker; use fixed::types::I7F1; use crate::chip::EASY_DMA_SIZE; -use crate::gpio::{AnyPin, Pin as GpioPin, SealedPin, DISCONNECTED}; +use crate::gpio::{AnyPin, DISCONNECTED, Pin as GpioPin, SealedPin}; use crate::interrupt::typelevel::Interrupt; use crate::pac::gpio::vals as gpiovals; use crate::pac::pdm::vals; diff --git a/embassy-nrf/src/ppi/dppi.rs b/embassy-nrf/src/ppi/dppi.rs index 078d2fd1c..168647be3 100644 --- a/embassy-nrf/src/ppi/dppi.rs +++ b/embassy-nrf/src/ppi/dppi.rs @@ -1,5 +1,5 @@ use super::{Channel, ConfigurableChannel, Event, Ppi, Task}; -use crate::{pac, Peri}; +use crate::{Peri, pac}; const DPPI_ENABLE_BIT: u32 = 0x8000_0000; const DPPI_CHANNEL_MASK: u32 = 0x0000_00FF; diff --git a/embassy-nrf/src/ppi/mod.rs b/embassy-nrf/src/ppi/mod.rs index 2bcf72e9c..f30c2218d 100644 --- a/embassy-nrf/src/ppi/mod.rs +++ b/embassy-nrf/src/ppi/mod.rs @@ -18,9 +18,9 @@ use core::marker::PhantomData; use core::ptr::NonNull; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; -use crate::pac::common::{Reg, RW, W}; +use crate::pac::common::{RW, Reg, W}; use crate::peripherals; #[cfg_attr(feature = "_dppi", path = "dppi.rs")] diff --git a/embassy-nrf/src/ppi/ppi.rs b/embassy-nrf/src/ppi/ppi.rs index 531c25444..18bc8b8db 100644 --- a/embassy-nrf/src/ppi/ppi.rs +++ b/embassy-nrf/src/ppi/ppi.rs @@ -1,5 +1,5 @@ use super::{Channel, ConfigurableChannel, Event, Ppi, Task}; -use crate::{pac, Peri}; +use crate::{Peri, pac}; impl<'d> Task<'d> { fn reg_val(&self) -> u32 { diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index d67cb546b..e038f44b8 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs @@ -2,11 +2,11 @@ #![macro_use] -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use embassy_hal_internal::{Peri, PeripheralType}; -use crate::gpio::{convert_drive, AnyPin, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _, DISCONNECTED}; +use crate::gpio::{AnyPin, DISCONNECTED, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _, convert_drive}; use crate::pac::gpio::vals as gpiovals; use crate::pac::pwm::vals; use crate::ppi::{Event, Task}; diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs index 6f4524716..6bb7c033e 100755 --- a/embassy-nrf/src/qspi.rs +++ b/embassy-nrf/src/qspi.rs @@ -2,7 +2,7 @@ #![macro_use] -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::ptr; use core::task::Poll; diff --git a/embassy-nrf/src/radio/ieee802154.rs b/embassy-nrf/src/radio/ieee802154.rs index 844d3551e..54b463343 100644 --- a/embassy-nrf/src/radio/ieee802154.rs +++ b/embassy-nrf/src/radio/ieee802154.rs @@ -1,18 +1,18 @@ //! IEEE 802.15.4 radio driver use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::drop::OnDrop; use super::{Error, InterruptHandler, TxPower}; +use crate::Peri; use crate::interrupt::typelevel::Interrupt; use crate::interrupt::{self}; use crate::pac::radio::vals; pub use crate::pac::radio::vals::State as RadioState; use crate::radio::Instance; -use crate::Peri; /// Default (IEEE compliant) Start of Frame Delimiter pub const DEFAULT_SFD: u8 = 0xA7; diff --git a/embassy-nrf/src/rramc.rs b/embassy-nrf/src/rramc.rs index 7cb5660cb..521ac4ee7 100644 --- a/embassy-nrf/src/rramc.rs +++ b/embassy-nrf/src/rramc.rs @@ -7,7 +7,7 @@ use embedded_storage::nor_flash::{ }; use crate::peripherals::RRAMC; -use crate::{pac, Peri}; +use crate::{Peri, pac}; // // Export Nvmc alias and page size for downstream compatibility diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index fd48faabb..a199c1c4d 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs @@ -4,11 +4,11 @@ use core::future::poll_fn; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::drop::OnDrop; -use embassy_hal_internal::{impl_peripheral, Peri}; +use embassy_hal_internal::{Peri, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; pub(crate) use vals::Psel as InputChannel; diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index c410e49fd..ce994dbc9 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs @@ -6,17 +6,17 @@ use core::future::poll_fn; use core::marker::PhantomData; #[cfg(feature = "_nrf52832_anomaly_109")] use core::sync::atomic::AtomicU8; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_embedded_hal::SetConfig; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; -pub use embedded_hal_02::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; +pub use embedded_hal_02::spi::{MODE_0, MODE_1, MODE_2, MODE_3, Mode, Phase, Polarity}; pub use pac::spim::vals::{Frequency, Order as BitOrder}; use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; -use crate::gpio::{self, convert_drive, AnyPin, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _}; +use crate::gpio::{self, AnyPin, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _, convert_drive}; use crate::interrupt::typelevel::Interrupt; use crate::pac::gpio::vals as gpiovals; use crate::pac::spim::vals; diff --git a/embassy-nrf/src/spis.rs b/embassy-nrf/src/spis.rs index 713163a55..885821146 100644 --- a/embassy-nrf/src/spis.rs +++ b/embassy-nrf/src/spis.rs @@ -3,17 +3,17 @@ #![macro_use] use core::future::poll_fn; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_embedded_hal::SetConfig; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; -pub use embedded_hal_02::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; +pub use embedded_hal_02::spi::{MODE_0, MODE_1, MODE_2, MODE_3, Mode, Phase, Polarity}; pub use pac::spis::vals::Order as BitOrder; use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; -use crate::gpio::{self, convert_drive, AnyPin, OutputDrive, Pin as GpioPin, SealedPin as _}; +use crate::gpio::{self, AnyPin, OutputDrive, Pin as GpioPin, SealedPin as _, convert_drive}; use crate::interrupt::typelevel::Interrupt; use crate::pac::gpio::vals as gpiovals; use crate::pac::spis::vals; diff --git a/embassy-nrf/src/temp.rs b/embassy-nrf/src/temp.rs index 44be0f6d1..a20e300b7 100644 --- a/embassy-nrf/src/temp.rs +++ b/embassy-nrf/src/temp.rs @@ -9,7 +9,7 @@ use fixed::types::I30F2; use crate::interrupt::InterruptExt; use crate::peripherals::TEMP; -use crate::{interrupt, pac, Peri}; +use crate::{Peri, interrupt, pac}; /// Interrupt handler. pub struct InterruptHandler { diff --git a/embassy-nrf/src/time_driver.rs b/embassy-nrf/src/time_driver.rs index 03f4c2e2b..b723e2334 100644 --- a/embassy-nrf/src/time_driver.rs +++ b/embassy-nrf/src/time_driver.rs @@ -1,9 +1,9 @@ use core::cell::{Cell, RefCell}; -use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; +use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; use critical_section::CriticalSection; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_time_driver::Driver; use embassy_time_queue_utils::Queue; diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 943ea9d31..93255c832 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs @@ -4,8 +4,8 @@ use core::future::poll_fn; use core::marker::PhantomData; -use core::sync::atomic::compiler_fence; use core::sync::atomic::Ordering::SeqCst; +use core::sync::atomic::compiler_fence; use core::task::Poll; use embassy_embedded_hal::SetConfig; diff --git a/embassy-nrf/src/twis.rs b/embassy-nrf/src/twis.rs index dd4978b3e..2bc0a5c13 100644 --- a/embassy-nrf/src/twis.rs +++ b/embassy-nrf/src/twis.rs @@ -2,10 +2,10 @@ #![macro_use] -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; -use core::sync::atomic::compiler_fence; use core::sync::atomic::Ordering::SeqCst; +use core::sync::atomic::compiler_fence; use core::task::Poll; use embassy_hal_internal::{Peri, PeripheralType}; diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 66fb3b3f2..1ee452173 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs @@ -15,7 +15,7 @@ use core::future::poll_fn; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, AtomicU8, Ordering}; +use core::sync::atomic::{AtomicU8, Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::drop::OnDrop; @@ -25,7 +25,7 @@ use embassy_sync::waitqueue::AtomicWaker; pub use pac::uarte::vals::{Baudrate, ConfigParity as Parity}; use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; -use crate::gpio::{self, AnyPin, Pin as GpioPin, PselBits, SealedPin as _, DISCONNECTED}; +use crate::gpio::{self, AnyPin, DISCONNECTED, Pin as GpioPin, PselBits, SealedPin as _}; use crate::interrupt::typelevel::Interrupt; use crate::pac::gpio::vals as gpiovals; use crate::pac::uarte::vals; diff --git a/embassy-nrf/src/usb/mod.rs b/embassy-nrf/src/usb/mod.rs index 2a32fe922..07cf2578a 100644 --- a/embassy-nrf/src/usb/mod.rs +++ b/embassy-nrf/src/usb/mod.rs @@ -4,10 +4,10 @@ pub mod vbus_detect; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::mem::MaybeUninit; -use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; +use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; use core::task::Poll; use cortex_m::peripheral::NVIC; @@ -330,11 +330,7 @@ impl<'d, V: VbusDetect> driver::Bus for Bus<'d, V> { let mut was_enabled = false; regs.epinen().modify(|w| { was_enabled = (w.0 & mask) != 0; - if enabled { - w.0 |= mask - } else { - w.0 &= !mask - } + if enabled { w.0 |= mask } else { w.0 &= !mask } }); let ready_mask = In::mask(i); diff --git a/embassy-nrf/src/usb/vbus_detect.rs b/embassy-nrf/src/usb/vbus_detect.rs index 33cf91ee2..f24a7bff5 100644 --- a/embassy-nrf/src/usb/vbus_detect.rs +++ b/embassy-nrf/src/usb/vbus_detect.rs @@ -1,6 +1,6 @@ //! Trait and implementations for performing VBUS detection. -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::sync::atomic::{AtomicBool, Ordering}; use core::task::Poll; diff --git a/embassy-nrf/src/util.rs b/embassy-nrf/src/util.rs index 78f71719f..87118d347 100644 --- a/embassy-nrf/src/util.rs +++ b/embassy-nrf/src/util.rs @@ -15,9 +15,5 @@ pub(crate) fn slice_in_ram(slice: *const [T]) -> bool { /// Return an error if slice is not in RAM. Skips check if slice is zero-length. pub(crate) fn slice_in_ram_or(slice: *const [T], err: E) -> Result<(), E> { - if slice_in_ram(slice) { - Ok(()) - } else { - Err(err) - } + if slice_in_ram(slice) { Ok(()) } else { Err(err) } } diff --git a/embassy-nrf/src/wdt.rs b/embassy-nrf/src/wdt.rs index dc99a16f5..6afd73431 100644 --- a/embassy-nrf/src/wdt.rs +++ b/embassy-nrf/src/wdt.rs @@ -11,7 +11,7 @@ use embassy_hal_internal::PeripheralType; use crate::pac::wdt::vals; pub use crate::pac::wdt::vals::{Halt as HaltConfig, Sleep as SleepConfig}; -use crate::{interrupt, pac, peripherals, Peri}; +use crate::{Peri, interrupt, pac, peripherals}; const MIN_TICKS: u32 = 15; diff --git a/embassy-nxp/src/dma/lpc55.rs b/embassy-nxp/src/dma/lpc55.rs index 578d1fd88..5bd763f03 100644 --- a/embassy-nxp/src/dma/lpc55.rs +++ b/embassy-nxp/src/dma/lpc55.rs @@ -1,16 +1,16 @@ use core::cell::RefCell; use core::future::Future; use core::pin::Pin; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::{Context, Poll}; use critical_section::Mutex; use embassy_hal_internal::interrupt::InterruptExt; -use embassy_hal_internal::{impl_peripheral, PeripheralType}; +use embassy_hal_internal::{PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use crate::pac::{DMA0, SYSCON, *}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; #[interrupt] fn DMA0() { diff --git a/embassy-nxp/src/gpio/lpc55.rs b/embassy-nxp/src/gpio/lpc55.rs index 36ea99d21..ac8a27d4f 100644 --- a/embassy-nxp/src/gpio/lpc55.rs +++ b/embassy-nxp/src/gpio/lpc55.rs @@ -1,8 +1,8 @@ -use embassy_hal_internal::{impl_peripheral, PeripheralType}; +use embassy_hal_internal::{PeripheralType, impl_peripheral}; use crate::pac::iocon::vals::{PioDigimode, PioMode}; use crate::pac::{GPIO, IOCON, SYSCON}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; pub(crate) fn init() { // Enable clocks for GPIO, PINT, and IOCON diff --git a/embassy-nxp/src/gpio/rt1xxx.rs b/embassy-nxp/src/gpio/rt1xxx.rs index 1d60a0d51..c4dc110ff 100644 --- a/embassy-nxp/src/gpio/rt1xxx.rs +++ b/embassy-nxp/src/gpio/rt1xxx.rs @@ -5,13 +5,13 @@ use core::ops::Not; use core::pin::Pin as FuturePin; use core::task::{Context, Poll}; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use nxp_pac::gpio::vals::Icr; use nxp_pac::iomuxc::vals::Pus; use crate::chip::{mux_address, pad_address}; -use crate::pac::common::{Reg, RW}; +use crate::pac::common::{RW, Reg}; use crate::pac::gpio::Gpio; #[cfg(feature = "rt")] use crate::pac::interrupt; diff --git a/embassy-nxp/src/lib.rs b/embassy-nxp/src/lib.rs index 617045217..9576f02b1 100644 --- a/embassy-nxp/src/lib.rs +++ b/embassy-nxp/src/lib.rs @@ -30,7 +30,7 @@ pub use chip::interrupt; pub use chip::pac; #[cfg(not(feature = "unstable-pac"))] pub(crate) use chip::pac; -pub use chip::{peripherals, Peripherals}; +pub use chip::{Peripherals, peripherals}; pub use embassy_hal_internal::{Peri, PeripheralType}; /// Macro to bind interrupts to handlers. diff --git a/embassy-nxp/src/pint.rs b/embassy-nxp/src/pint.rs index e594aaa6a..5b10b4540 100644 --- a/embassy-nxp/src/pint.rs +++ b/embassy-nxp/src/pint.rs @@ -8,9 +8,9 @@ use critical_section::Mutex; use embassy_hal_internal::interrupt::InterruptExt; use embassy_sync::waitqueue::AtomicWaker; -use crate::gpio::{self, AnyPin, Level, SealedPin}; -use crate::pac::{interrupt, INPUTMUX, PINT, SYSCON}; use crate::Peri; +use crate::gpio::{self, AnyPin, Level, SealedPin}; +use crate::pac::{INPUTMUX, PINT, SYSCON, interrupt}; struct PinInterrupt { assigned: bool, diff --git a/embassy-nxp/src/time_driver/rtc.rs b/embassy-nxp/src/time_driver/rtc.rs index fb6de6a5e..0883fa2e8 100644 --- a/embassy-nxp/src/time_driver/rtc.rs +++ b/embassy-nxp/src/time_driver/rtc.rs @@ -4,10 +4,10 @@ use core::task::Waker; use critical_section::CriticalSection; use embassy_hal_internal::interrupt::{InterruptExt, Priority}; use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex; -use embassy_time_driver::{time_driver_impl, Driver}; +use embassy_time_driver::{Driver, time_driver_impl}; use embassy_time_queue_utils::Queue; -use crate::pac::{interrupt, pmc, rtc, PMC, RTC, SYSCON}; +use crate::pac::{PMC, RTC, SYSCON, interrupt, pmc, rtc}; struct AlarmState { timestamp: Cell, diff --git a/embassy-nxp/src/usart/lpc55.rs b/embassy-nxp/src/usart/lpc55.rs index 9034ed429..0be5a8ce7 100644 --- a/embassy-nxp/src/usart/lpc55.rs +++ b/embassy-nxp/src/usart/lpc55.rs @@ -4,16 +4,16 @@ use core::marker::PhantomData; use core::sync::atomic::{AtomicBool, Ordering}; use core::task::Poll; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_hal_internal::interrupt::InterruptExt; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; use embedded_io::{self, ErrorKind}; use crate::dma::{AnyChannel, Channel}; -use crate::gpio::{match_iocon, AnyPin, Bank, SealedPin}; -use crate::interrupt::typelevel::{Binding, Interrupt as _}; +use crate::gpio::{AnyPin, Bank, SealedPin, match_iocon}; use crate::interrupt::Interrupt; +use crate::interrupt::typelevel::{Binding, Interrupt as _}; use crate::pac::flexcomm::Flexcomm as FlexcommReg; use crate::pac::iocon::vals::PioFunc; use crate::pac::usart::Usart as UsartReg; diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs index 2db8e63d7..d16779e01 100644 --- a/embassy-rp/src/adc.rs +++ b/embassy-rp/src/adc.rs @@ -1,18 +1,18 @@ //! ADC driver. -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::mem; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_sync::waitqueue::AtomicWaker; use crate::gpio::{self, AnyPin, Pull, SealedPin as GpioPin}; -use crate::interrupt::typelevel::Binding; use crate::interrupt::InterruptExt; +use crate::interrupt::typelevel::Binding; use crate::pac::dma::vals::TreqSel; use crate::peripherals::{ADC, ADC_TEMP_SENSOR}; -use crate::{dma, interrupt, pac, peripherals, Peri, RegExt}; +use crate::{Peri, RegExt, dma, interrupt, pac, peripherals}; static WAKER: AtomicWaker = AtomicWaker::new(); diff --git a/embassy-rp/src/bootsel.rs b/embassy-rp/src/bootsel.rs index 5f0bac248..b24b98cd5 100644 --- a/embassy-rp/src/bootsel.rs +++ b/embassy-rp/src/bootsel.rs @@ -7,8 +7,8 @@ //! //! This module provides functionality to poll BOOTSEL from an embassy application. -use crate::flash::in_ram; use crate::Peri; +use crate::flash::in_ram; /// Reads the BOOTSEL button. Returns true if the button is pressed. /// diff --git a/embassy-rp/src/clocks.rs b/embassy-rp/src/clocks.rs index 2eddc0bcc..56892d7a2 100644 --- a/embassy-rp/src/clocks.rs +++ b/embassy-rp/src/clocks.rs @@ -72,8 +72,8 @@ use core::sync::atomic::{AtomicU32, Ordering}; use pac::clocks::vals::*; use crate::gpio::{AnyPin, SealedPin}; -use crate::pac::common::{Reg, RW}; -use crate::{pac, reset, Peri}; +use crate::pac::common::{RW, Reg}; +use crate::{Peri, pac, reset}; // NOTE: all gpin handling is commented out for future reference. // gpin is not usually safe to use during the boot init() call, so it won't diff --git a/embassy-rp/src/dma.rs b/embassy-rp/src/dma.rs index d31d1e159..18aec60a5 100644 --- a/embassy-rp/src/dma.rs +++ b/embassy-rp/src/dma.rs @@ -1,10 +1,10 @@ //! Direct Memory Access (DMA) use core::future::Future; use core::pin::Pin; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::{Context, Poll}; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use pac::dma::vals::DataSize; diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs index 6b5eda0a3..7cc8f0c1d 100644 --- a/embassy-rp/src/flash.rs +++ b/embassy-rp/src/flash.rs @@ -6,8 +6,8 @@ use core::task::{Context, Poll}; use embassy_hal_internal::{Peri, PeripheralType}; use embedded_storage::nor_flash::{ - check_erase, check_read, check_write, ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, - ReadNorFlash, + ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash, check_erase, check_read, + check_write, }; use crate::dma::{AnyChannel, Channel, Transfer}; diff --git a/embassy-rp/src/float/cmp.rs b/embassy-rp/src/float/cmp.rs index e540e3918..f917eb9b3 100644 --- a/embassy-rp/src/float/cmp.rs +++ b/embassy-rp/src/float/cmp.rs @@ -21,19 +21,11 @@ impl ROMCmp for f64 { } fn le_abi(a: F, b: F) -> i32 { - if a.is_nan() || b.is_nan() { - 1 - } else { - a.rom_cmp(b) - } + if a.is_nan() || b.is_nan() { 1 } else { a.rom_cmp(b) } } fn ge_abi(a: F, b: F) -> i32 { - if a.is_nan() || b.is_nan() { - -1 - } else { - a.rom_cmp(b) - } + if a.is_nan() || b.is_nan() { -1 } else { a.rom_cmp(b) } } intrinsics! { diff --git a/embassy-rp/src/float/functions.rs b/embassy-rp/src/float/functions.rs index de29ce336..170168237 100644 --- a/embassy-rp/src/float/functions.rs +++ b/embassy-rp/src/float/functions.rs @@ -114,19 +114,11 @@ fn sqrt(f: F) -> F { } fn ln(f: F) -> F { - if is_negative_nonzero_or_nan(f) { - F::NAN - } else { - f.ln() - } + if is_negative_nonzero_or_nan(f) { F::NAN } else { f.ln() } } fn exp(f: F) -> F { - if f.is_nan() { - F::NAN - } else { - f.exp() - } + if f.is_nan() { F::NAN } else { f.exp() } } fn sin(f: F) -> F { diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index f79bf8948..c15e0e41b 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs @@ -5,13 +5,13 @@ use core::future::Future; use core::pin::Pin as FuturePin; use core::task::{Context, Poll}; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use crate::interrupt::InterruptExt; -use crate::pac::common::{Reg, RW}; use crate::pac::SIO; -use crate::{interrupt, pac, peripherals, RegExt}; +use crate::pac::common::{RW, Reg}; +use crate::{RegExt, interrupt, pac, peripherals}; #[cfg(any(feature = "rp2040", feature = "rp235xa"))] pub(crate) const BANK0_PIN_COUNT: usize = 30; diff --git a/embassy-rp/src/i2c_slave.rs b/embassy-rp/src/i2c_slave.rs index c263047ad..770087bc8 100644 --- a/embassy-rp/src/i2c_slave.rs +++ b/embassy-rp/src/i2c_slave.rs @@ -5,9 +5,9 @@ use core::task::Poll; use pac::i2c; -use crate::i2c::{set_up_i2c_pin, AbortReason, Instance, InterruptHandler, SclPin, SdaPin, FIFO_SIZE}; +use crate::i2c::{AbortReason, FIFO_SIZE, Instance, InterruptHandler, SclPin, SdaPin, set_up_i2c_pin}; use crate::interrupt::typelevel::{Binding, Interrupt}; -use crate::{pac, Peri}; +use crate::{Peri, pac}; /// I2C error #[derive(Debug, PartialEq, Eq, Clone, Copy)] diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs index c305513ca..3b120e349 100644 --- a/embassy-rp/src/multicore.rs +++ b/embassy-rp/src/multicore.rs @@ -48,11 +48,11 @@ //! ``` use core::mem::ManuallyDrop; -use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; +use core::sync::atomic::{AtomicBool, Ordering, compiler_fence}; use crate::interrupt::InterruptExt; use crate::peripherals::CORE1; -use crate::{gpio, install_stack_guard, interrupt, pac, Peri}; +use crate::{Peri, gpio, install_stack_guard, interrupt, pac}; const PAUSE_TOKEN: u32 = 0xDEADBEEF; const RESUME_TOKEN: u32 = !0xDEADBEEF; diff --git a/embassy-rp/src/pio/mod.rs b/embassy-rp/src/pio/mod.rs index 5f554dfe3..38ee1f97c 100644 --- a/embassy-rp/src/pio/mod.rs +++ b/embassy-rp/src/pio/mod.rs @@ -2,21 +2,21 @@ use core::future::Future; use core::marker::PhantomData; use core::pin::Pin as FuturePin; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::{Context, Poll}; -use atomic_polyfill::{AtomicU64, AtomicU8}; +use atomic_polyfill::{AtomicU8, AtomicU64}; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; -use fixed::types::extra::U8; use fixed::FixedU32; +use fixed::types::extra::U8; use pio::{Program, SideSet, Wrap}; use crate::dma::{self, Channel, Transfer, Word}; use crate::gpio::{self, AnyPin, Drive, Level, Pull, SealedPin, SlewRate}; use crate::interrupt::typelevel::{Binding, Handler, Interrupt}; use crate::relocate::RelocatedProgram; -use crate::{pac, peripherals, RegExt}; +use crate::{RegExt, pac, peripherals}; mod instr; @@ -984,11 +984,7 @@ impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> { #[cfg(feature = "_rp235x")] fn pin_base() -> u8 { - if PIO::PIO.gpiobase().read().gpiobase() { - 16 - } else { - 0 - } + if PIO::PIO.gpiobase().read().gpiobase() { 16 } else { 0 } } /// Sets pin directions. This pauses the current state machine to run `SET` commands diff --git a/embassy-rp/src/pio_programs/hd44780.rs b/embassy-rp/src/pio_programs/hd44780.rs index 546c85a89..78281ddd4 100644 --- a/embassy-rp/src/pio_programs/hd44780.rs +++ b/embassy-rp/src/pio_programs/hd44780.rs @@ -1,12 +1,12 @@ //! [HD44780 display driver](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf) +use crate::Peri; use crate::dma::{AnyChannel, Channel}; use crate::pio::{ Common, Config, Direction, FifoJoin, Instance, Irq, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, }; use crate::pio_programs::clock_divider::calculate_pio_clock_divider; -use crate::Peri; /// This struct represents a HD44780 program that takes command words ( <0:4>) pub struct PioHD44780CommandWordProgram<'a, PIO: Instance> { diff --git a/embassy-rp/src/pio_programs/i2s.rs b/embassy-rp/src/pio_programs/i2s.rs index 2382a3f9f..7e5f68ad6 100644 --- a/embassy-rp/src/pio_programs/i2s.rs +++ b/embassy-rp/src/pio_programs/i2s.rs @@ -2,12 +2,12 @@ use fixed::traits::ToFixed; +use crate::Peri; use crate::dma::{AnyChannel, Channel, Transfer}; use crate::gpio::Pull; use crate::pio::{ Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, }; -use crate::Peri; /// This struct represents an i2s receiver & controller driver program pub struct PioI2sInProgram<'d, PIO: Instance> { diff --git a/embassy-rp/src/pio_programs/onewire.rs b/embassy-rp/src/pio_programs/onewire.rs index 980d0fe5f..09babc229 100644 --- a/embassy-rp/src/pio_programs/onewire.rs +++ b/embassy-rp/src/pio_programs/onewire.rs @@ -1,11 +1,11 @@ //! OneWire pio driver +use crate::Peri; use crate::clocks::clk_sys_freq; use crate::gpio::Level; use crate::pio::{ Common, Config, Direction, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, }; -use crate::Peri; /// This struct represents a onewire driver program pub struct PioOneWireProgram<'a, PIO: Instance> { @@ -321,11 +321,7 @@ impl PioOneWireSearch { /// Search for the next address on the bus pub async fn next(&mut self, pio: &mut PioOneWire<'_, PIO, SM>) -> Option { - if self.finished { - None - } else { - pio.search(self).await - } + if self.finished { None } else { pio.search(self).await } } /// Is finished when all devices have been found diff --git a/embassy-rp/src/pio_programs/pwm.rs b/embassy-rp/src/pio_programs/pwm.rs index f0f837bc5..ba06bb3c1 100644 --- a/embassy-rp/src/pio_programs/pwm.rs +++ b/embassy-rp/src/pio_programs/pwm.rs @@ -6,7 +6,7 @@ use pio::InstructionOperands; use crate::gpio::Level; use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine}; -use crate::{clocks, Peri}; +use crate::{Peri, clocks}; /// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time fn to_pio_cycles(duration: Duration) -> u32 { diff --git a/embassy-rp/src/pio_programs/rotary_encoder.rs b/embassy-rp/src/pio_programs/rotary_encoder.rs index 70b3795e9..6347527e6 100644 --- a/embassy-rp/src/pio_programs/rotary_encoder.rs +++ b/embassy-rp/src/pio_programs/rotary_encoder.rs @@ -1,11 +1,11 @@ //! PIO backed quadrature encoder +use crate::Peri; use crate::gpio::Pull; use crate::pio::{ Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, }; use crate::pio_programs::clock_divider::calculate_pio_clock_divider; -use crate::Peri; /// This struct represents an Encoder program loaded into pio instruction memory. pub struct PioEncoderProgram<'a, PIO: Instance> { diff --git a/embassy-rp/src/pio_programs/stepper.rs b/embassy-rp/src/pio_programs/stepper.rs index 0e9a8daf9..5762ee189 100644 --- a/embassy-rp/src/pio_programs/stepper.rs +++ b/embassy-rp/src/pio_programs/stepper.rs @@ -2,9 +2,9 @@ use core::mem::{self, MaybeUninit}; +use crate::Peri; use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine}; use crate::pio_programs::clock_divider::calculate_pio_clock_divider; -use crate::Peri; /// This struct represents a Stepper driver program loaded into pio instruction memory. pub struct PioStepperProgram<'a, PIO: Instance> { diff --git a/embassy-rp/src/pio_programs/uart.rs b/embassy-rp/src/pio_programs/uart.rs index 04e39a571..444efb5db 100644 --- a/embassy-rp/src/pio_programs/uart.rs +++ b/embassy-rp/src/pio_programs/uart.rs @@ -5,12 +5,12 @@ use core::convert::Infallible; use embedded_io_async::{ErrorType, Read, Write}; use fixed::traits::ToFixed; +use crate::Peri; use crate::clocks::clk_sys_freq; use crate::gpio::Level; use crate::pio::{ Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, }; -use crate::Peri; /// This struct represents a uart tx program loaded into pio instruction memory. pub struct PioUartTxProgram<'d, PIO: Instance> { diff --git a/embassy-rp/src/pio_programs/ws2812.rs b/embassy-rp/src/pio_programs/ws2812.rs index 37dd1c4e0..e6851b1a6 100644 --- a/embassy-rp/src/pio_programs/ws2812.rs +++ b/embassy-rp/src/pio_programs/ws2812.rs @@ -4,12 +4,12 @@ use embassy_time::Timer; use fixed::types::U24F8; use smart_leds::{RGB8, RGBW}; +use crate::Peri; use crate::clocks::clk_sys_freq; use crate::dma::{AnyChannel, Channel}; use crate::pio::{ Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, }; -use crate::Peri; const T1: u8 = 2; // start bit const T2: u8 = 5; // data bit diff --git a/embassy-rp/src/psram.rs b/embassy-rp/src/psram.rs index 22eb1ed25..25185ead2 100644 --- a/embassy-rp/src/psram.rs +++ b/embassy-rp/src/psram.rs @@ -10,7 +10,7 @@ #![cfg(feature = "_rp235x")] -use critical_section::{acquire, release, CriticalSection, RestoreState}; +use critical_section::{CriticalSection, RestoreState, acquire, release}; use crate::pac; use crate::qmi_cs1::QmiCs1; diff --git a/embassy-rp/src/pwm.rs b/embassy-rp/src/pwm.rs index 1e1ccc4c6..59a3fc9a2 100644 --- a/embassy-rp/src/pwm.rs +++ b/embassy-rp/src/pwm.rs @@ -3,13 +3,13 @@ use embassy_hal_internal::{Peri, PeripheralType}; pub use embedded_hal_1::pwm::SetDutyCycle; use embedded_hal_1::pwm::{Error, ErrorKind, ErrorType}; -use fixed::traits::ToFixed; use fixed::FixedU16; +use fixed::traits::ToFixed; use pac::pwm::regs::{ChDiv, Intr}; use pac::pwm::vals::Divmode; use crate::gpio::{AnyPin, Pin as GpioPin, Pull, SealedPin as _}; -use crate::{pac, peripherals, RegExt}; +use crate::{RegExt, pac, peripherals}; /// The configuration of a PWM slice. /// Note the period in clock cycles of a slice can be computed as: diff --git a/embassy-rp/src/rtc/mod.rs b/embassy-rp/src/rtc/mod.rs index 8b0deed21..68fb3b765 100644 --- a/embassy-rp/src/rtc/mod.rs +++ b/embassy-rp/src/rtc/mod.rs @@ -2,7 +2,7 @@ mod filter; use core::future::poll_fn; -use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; +use core::sync::atomic::{AtomicBool, Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::{Peri, PeripheralType}; diff --git a/embassy-rp/src/time_driver.rs b/embassy-rp/src/time_driver.rs index d598287a9..ec1c17ed5 100644 --- a/embassy-rp/src/time_driver.rs +++ b/embassy-rp/src/time_driver.rs @@ -2,8 +2,8 @@ use core::cell::{Cell, RefCell}; use critical_section::CriticalSection; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_time_driver::Driver; use embassy_time_queue_utils::Queue; #[cfg(feature = "rp2040")] diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs index 6f4e2ee07..43187df2d 100644 --- a/embassy-rp/src/uart/mod.rs +++ b/embassy-rp/src/uart/mod.rs @@ -4,7 +4,7 @@ use core::marker::PhantomData; use core::task::Poll; use atomic_polyfill::{AtomicU16, Ordering}; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; use embassy_time::{Delay, Timer}; @@ -16,7 +16,7 @@ use crate::gpio::{AnyPin, SealedPin}; use crate::interrupt::typelevel::{Binding, Interrupt as _}; use crate::interrupt::{Interrupt, InterruptExt}; use crate::pac::io::vals::{Inover, Outover}; -use crate::{interrupt, pac, peripherals, RegExt}; +use crate::{RegExt, interrupt, pac, peripherals}; mod buffered; pub use buffered::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, BufferedUartTx}; @@ -863,11 +863,7 @@ impl<'d, M: Mode> Uart<'d, M> { if let Some(pin) = &tx { let funcsel = { let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8; - if (pin_number % 4) == 0 { - 2 - } else { - 11 - } + if (pin_number % 4) == 0 { 2 } else { 11 } }; pin.gpio().ctrl().write(|w| { w.set_funcsel(funcsel); @@ -886,11 +882,7 @@ impl<'d, M: Mode> Uart<'d, M> { if let Some(pin) = &rx { let funcsel = { let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8; - if ((pin_number - 1) % 4) == 0 { - 2 - } else { - 11 - } + if ((pin_number - 1) % 4) == 0 { 2 } else { 11 } }; pin.gpio().ctrl().write(|w| { w.set_funcsel(funcsel); diff --git a/embassy-rp/src/usb.rs b/embassy-rp/src/usb.rs index 671ecbd32..e8273c3f2 100644 --- a/embassy-rp/src/usb.rs +++ b/embassy-rp/src/usb.rs @@ -2,7 +2,7 @@ use core::future::poll_fn; use core::marker::PhantomData; use core::slice; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::PeripheralType; @@ -13,7 +13,7 @@ use embassy_usb_driver::{ }; use crate::interrupt::typelevel::{Binding, Interrupt}; -use crate::{interrupt, pac, peripherals, Peri, RegExt}; +use crate::{Peri, RegExt, interrupt, pac, peripherals}; trait SealedInstance { fn regs() -> crate::pac::usb::Usb; @@ -545,11 +545,7 @@ impl<'d, T: Instance> driver::Endpoint for Endpoint<'d, T, In> { poll_fn(|cx| { EP_IN_WAKERS[index].register(cx.waker()); let val = T::dpram().ep_in_control(self.info.addr.index() - 1).read(); - if val.enable() { - Poll::Ready(()) - } else { - Poll::Pending - } + if val.enable() { Poll::Ready(()) } else { Poll::Pending } }) .await; trace!("wait_enabled IN OK"); @@ -567,11 +563,7 @@ impl<'d, T: Instance> driver::Endpoint for Endpoint<'d, T, Out> { poll_fn(|cx| { EP_OUT_WAKERS[index].register(cx.waker()); let val = T::dpram().ep_out_control(self.info.addr.index() - 1).read(); - if val.enable() { - Poll::Ready(()) - } else { - Poll::Pending - } + if val.enable() { Poll::Ready(()) } else { Poll::Pending } }) .await; trace!("wait_enabled OUT OK"); diff --git a/embassy-rp/src/watchdog.rs b/embassy-rp/src/watchdog.rs index 49cf03850..d42601745 100644 --- a/embassy-rp/src/watchdog.rs +++ b/embassy-rp/src/watchdog.rs @@ -11,7 +11,7 @@ use core::marker::PhantomData; use embassy_time::Duration; use crate::peripherals::WATCHDOG; -use crate::{pac, Peri}; +use crate::{Peri, pac}; /// The reason for a system reset from the watchdog. #[derive(Debug, Copy, Clone, PartialEq, Eq)] diff --git a/embassy-stm32-wpan/src/cmd.rs b/embassy-stm32-wpan/src/cmd.rs index 928357384..5c81a4aa7 100644 --- a/embassy-stm32-wpan/src/cmd.rs +++ b/embassy-stm32-wpan/src/cmd.rs @@ -1,7 +1,7 @@ use core::ptr; -use crate::consts::TlPacketType; use crate::PacketHeader; +use crate::consts::TlPacketType; #[derive(Copy, Clone)] #[repr(C, packed)] diff --git a/embassy-stm32-wpan/src/consts.rs b/embassy-stm32-wpan/src/consts.rs index e2ae6ca86..7ecb22974 100644 --- a/embassy-stm32-wpan/src/consts.rs +++ b/embassy-stm32-wpan/src/consts.rs @@ -1,5 +1,5 @@ -use crate::evt::CsEvt; use crate::PacketHeader; +use crate::evt::CsEvt; #[derive(Debug)] #[repr(C)] diff --git a/embassy-stm32-wpan/src/lhci.rs b/embassy-stm32-wpan/src/lhci.rs index 89f204f99..59c8bfb5d 100644 --- a/embassy-stm32-wpan/src/lhci.rs +++ b/embassy-stm32-wpan/src/lhci.rs @@ -1,9 +1,9 @@ use core::ptr; use crate::cmd::CmdPacket; -use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE}; +use crate::consts::{TL_EVT_HEADER_SIZE, TlPacketType}; use crate::evt::{CcEvt, EvtPacket, EvtSerial}; -use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, WirelessFwInfoTable, TL_DEVICE_INFO_TABLE}; +use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, TL_DEVICE_INFO_TABLE, WirelessFwInfoTable}; const TL_BLEEVT_CC_OPCODE: u8 = 0x0e; const LHCI_OPCODE_C1_DEVICE_INF: u16 = 0xfd62; diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs index f4eb0069f..f6b1f6021 100644 --- a/embassy-stm32-wpan/src/lib.rs +++ b/embassy-stm32-wpan/src/lib.rs @@ -22,7 +22,7 @@ mod fmt; use core::mem::MaybeUninit; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use embassy_hal_internal::Peri; use embassy_stm32::interrupt; @@ -95,7 +95,7 @@ impl<'d> TlMbox<'d> { pub fn init( ipcc: Peri<'d, IPCC>, _irqs: impl interrupt::typelevel::Binding - + interrupt::typelevel::Binding, + + interrupt::typelevel::Binding, config: Config, ) -> Self { // this is an inlined version of TL_Init from the STM32WB firmware as requested by AN5289. diff --git a/embassy-stm32-wpan/src/mac/driver.rs b/embassy-stm32-wpan/src/mac/driver.rs index 41cca09e3..480ac3790 100644 --- a/embassy-stm32-wpan/src/mac/driver.rs +++ b/embassy-stm32-wpan/src/mac/driver.rs @@ -6,9 +6,9 @@ use embassy_net_driver::{Capabilities, HardwareAddress, LinkState}; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; +use crate::mac::MTU; use crate::mac::event::MacEvent; use crate::mac::runner::Runner; -use crate::mac::MTU; pub struct Driver<'d> { runner: &'d Runner<'d>, diff --git a/embassy-stm32-wpan/src/mac/runner.rs b/embassy-stm32-wpan/src/mac/runner.rs index d3099b6b7..2409f994d 100644 --- a/embassy-stm32-wpan/src/mac/runner.rs +++ b/embassy-stm32-wpan/src/mac/runner.rs @@ -7,10 +7,10 @@ use embassy_sync::channel::Channel; use embassy_sync::mutex::Mutex; use embassy_sync::signal::Signal; +use crate::mac::MTU; use crate::mac::commands::DataRequest; use crate::mac::event::MacEvent; use crate::mac::typedefs::{AddressMode, MacAddress, PanId, SecurityLevel}; -use crate::mac::MTU; use crate::sub::mac::Mac; type ZeroCopyPubSub = blocking_mutex::Mutex>>>; diff --git a/embassy-stm32-wpan/src/sub/ble.rs b/embassy-stm32-wpan/src/sub/ble.rs index 0f770d92c..cd69a0479 100644 --- a/embassy-stm32-wpan/src/sub/ble.rs +++ b/embassy-stm32-wpan/src/sub/ble.rs @@ -4,10 +4,10 @@ use embassy_stm32::ipcc::Ipcc; use hci::Opcode; use crate::cmd::CmdPacket; -use crate::consts::{TlPacketType, TL_BLEEVT_CC_OPCODE, TL_BLEEVT_CS_OPCODE}; +use crate::consts::{TL_BLEEVT_CC_OPCODE, TL_BLEEVT_CS_OPCODE, TlPacketType}; use crate::evt::{EvtBox, EvtPacket, EvtStub}; use crate::sub::mm; -use crate::tables::{BleTable, BLE_CMD_BUFFER, CS_BUFFER, EVT_QUEUE, HCI_ACL_DATA_BUFFER, TL_BLE_TABLE}; +use crate::tables::{BLE_CMD_BUFFER, BleTable, CS_BUFFER, EVT_QUEUE, HCI_ACL_DATA_BUFFER, TL_BLE_TABLE}; use crate::unsafe_linked_list::LinkedListNode; use crate::{channels, evt}; diff --git a/embassy-stm32-wpan/src/sub/mm.rs b/embassy-stm32-wpan/src/sub/mm.rs index 4e4d2f854..62d0de8bd 100644 --- a/embassy-stm32-wpan/src/sub/mm.rs +++ b/embassy-stm32-wpan/src/sub/mm.rs @@ -3,7 +3,7 @@ use core::future::poll_fn; use core::mem::MaybeUninit; use core::task::Poll; -use aligned::{Aligned, A4}; +use aligned::{A4, Aligned}; use cortex_m::interrupt; use embassy_stm32::ipcc::Ipcc; use embassy_sync::waitqueue::AtomicWaker; @@ -12,7 +12,7 @@ use crate::consts::POOL_SIZE; use crate::evt::EvtPacket; #[cfg(feature = "ble")] use crate::tables::BLE_SPARE_EVT_BUF; -use crate::tables::{MemManagerTable, EVT_POOL, FREE_BUF_QUEUE, SYS_SPARE_EVT_BUF, TL_MEM_MANAGER_TABLE}; +use crate::tables::{EVT_POOL, FREE_BUF_QUEUE, MemManagerTable, SYS_SPARE_EVT_BUF, TL_MEM_MANAGER_TABLE}; use crate::unsafe_linked_list::LinkedListNode; use crate::{channels, evt}; diff --git a/embassy-stm32-wpan/src/sub/sys.rs b/embassy-stm32-wpan/src/sub/sys.rs index cf6df58bf..8a3382f86 100644 --- a/embassy-stm32-wpan/src/sub/sys.rs +++ b/embassy-stm32-wpan/src/sub/sys.rs @@ -8,7 +8,7 @@ use crate::shci::{SchiCommandStatus, ShciBleInitCmdParam, ShciOpcode}; use crate::sub::mm; use crate::tables::{SysTable, WirelessFwInfoTable}; use crate::unsafe_linked_list::LinkedListNode; -use crate::{channels, Ipcc, SYSTEM_EVT_QUEUE, SYS_CMD_BUF, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE}; +use crate::{Ipcc, SYS_CMD_BUF, SYSTEM_EVT_QUEUE, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE, channels}; /// A guard that, once constructed, allows for sys commands to be sent to CPU2. pub struct Sys { @@ -35,11 +35,7 @@ impl Sys { let info = unsafe { TL_DEVICE_INFO_TABLE.as_mut_ptr().read_volatile().wireless_fw_info_table }; // Zero version indicates that CPU2 wasn't active and didn't fill the information table - if info.version != 0 { - Some(info) - } else { - None - } + if info.version != 0 { Some(info) } else { None } } pub async fn write(&self, opcode: ShciOpcode, payload: &[u8]) { @@ -66,8 +62,8 @@ impl Sys { #[cfg(feature = "mac")] pub async fn shci_c2_mac_802_15_4_init(&self) -> Result { use crate::tables::{ - Mac802_15_4Table, TracesTable, MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, - TL_MAC_802_15_4_TABLE, TL_TRACES_TABLE, TRACES_EVT_QUEUE, + MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, Mac802_15_4Table, TL_MAC_802_15_4_TABLE, + TL_TRACES_TABLE, TRACES_EVT_QUEUE, TracesTable, }; unsafe { diff --git a/embassy-stm32-wpan/src/tables.rs b/embassy-stm32-wpan/src/tables.rs index 204790e6d..1dafed159 100644 --- a/embassy-stm32-wpan/src/tables.rs +++ b/embassy-stm32-wpan/src/tables.rs @@ -1,6 +1,6 @@ use core::mem::MaybeUninit; -use aligned::{Aligned, A4}; +use aligned::{A4, Aligned}; use bit_field::BitField; use crate::cmd::{AclDataPacket, CmdPacket}; diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index b5f1261fe..eea1acf68 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs @@ -9,8 +9,8 @@ use proc_macro2::{Ident, TokenStream}; use quote::{format_ident, quote}; use stm32_metapac::metadata::ir::BitOffset; use stm32_metapac::metadata::{ - MemoryRegion, MemoryRegionKind, PeripheralRccKernelClock, PeripheralRccRegister, PeripheralRegisters, StopMode, - ALL_CHIPS, ALL_PERIPHERAL_VERSIONS, METADATA, + ALL_CHIPS, ALL_PERIPHERAL_VERSIONS, METADATA, MemoryRegion, MemoryRegionKind, PeripheralRccKernelClock, + PeripheralRccRegister, PeripheralRegisters, StopMode, }; #[path = "./build_common.rs"] @@ -105,7 +105,9 @@ fn main() { } (false, false) => { if METADATA.memory.len() != 1 { - panic!("Chip supports single and dual bank configuration. No Cargo feature to select one is enabled. Use the 'single-bank' or 'dual-bank' feature to make your selection") + panic!( + "Chip supports single and dual bank configuration. No Cargo feature to select one is enabled. Use the 'single-bank' or 'dual-bank' feature to make your selection" + ) } METADATA.memory[0] } diff --git a/embassy-stm32/src/adc/adc4.rs b/embassy-stm32/src/adc/adc4.rs index 255dc7956..2608160a3 100644 --- a/embassy-stm32/src/adc/adc4.rs +++ b/embassy-stm32/src/adc/adc4.rs @@ -4,7 +4,7 @@ use pac::adc::vals::{Adc4Dmacfg as Dmacfg, Adc4Exten as Exten, Adc4OversamplingR #[cfg(stm32wba)] use pac::adc::vals::{Chselrmod, Cont, Dmacfg, Exten, OversamplingRatio, Ovss, Smpsel}; -use super::{blocking_delay_us, AdcChannel, AnyAdcChannel, RxDma4, SealedAdcChannel}; +use super::{AdcChannel, AnyAdcChannel, RxDma4, SealedAdcChannel, blocking_delay_us}; use crate::dma::Transfer; #[cfg(stm32u5)] pub use crate::pac::adc::regs::Adc4Chselrmod0 as Chselr; @@ -15,7 +15,7 @@ pub use crate::pac::adc::vals::{Adc4Presc as Presc, Adc4Res as Resolution, Adc4S #[cfg(stm32wba)] pub use crate::pac::adc::vals::{Presc, Res as Resolution, SampleTime}; use crate::time::Hertz; -use crate::{pac, rcc, Peri}; +use crate::{Peri, pac, rcc}; const MAX_ADC_CLK_FREQ: Hertz = Hertz::mhz(55); @@ -208,7 +208,10 @@ impl<'d, T: Instance> Adc4<'d, T> { info!("ADC4 frequency set to {}", frequency); if frequency > MAX_ADC_CLK_FREQ { - panic!("Maximal allowed frequency for ADC4 is {} MHz and it varies with different packages, refer to ST docs for more information.", MAX_ADC_CLK_FREQ.0 / 1_000_000 ); + panic!( + "Maximal allowed frequency for ADC4 is {} MHz and it varies with different packages, refer to ST docs for more information.", + MAX_ADC_CLK_FREQ.0 / 1_000_000 + ); } let mut s = Self { adc }; diff --git a/embassy-stm32/src/adc/c0.rs b/embassy-stm32/src/adc/c0.rs index f2837a8f1..fc28df346 100644 --- a/embassy-stm32/src/adc/c0.rs +++ b/embassy-stm32/src/adc/c0.rs @@ -4,11 +4,11 @@ use pac::adc::vals::{Adstp, Align, Ckmode, Dmacfg, Exten, Ovrmod, Ovsr}; use pac::adccommon::vals::Presc; use super::{ - blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, + Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, blocking_delay_us, }; use crate::dma::Transfer; use crate::time::Hertz; -use crate::{pac, rcc, Peri}; +use crate::{Peri, pac, rcc}; /// Default VREF voltage used for sample conversion to millivolts. pub const VREF_DEFAULT_MV: u32 = 3300; @@ -168,7 +168,10 @@ impl<'d, T: Instance> Adc<'d, T> { debug!("ADC frequency set to {}", frequency); if frequency > MAX_ADC_CLK_FREQ { - panic!("Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.", MAX_ADC_CLK_FREQ.0 / 1_000_000 ); + panic!( + "Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.", + MAX_ADC_CLK_FREQ.0 / 1_000_000 + ); } let mut s = Self { diff --git a/embassy-stm32/src/adc/f1.rs b/embassy-stm32/src/adc/f1.rs index 3cdc9d8fb..f9c23d72b 100644 --- a/embassy-stm32/src/adc/f1.rs +++ b/embassy-stm32/src/adc/f1.rs @@ -7,7 +7,7 @@ use crate::adc::{Adc, AdcChannel, Instance, SampleTime}; use crate::interrupt::typelevel::Interrupt; use crate::interrupt::{self}; use crate::time::Hertz; -use crate::{rcc, Peri}; +use crate::{Peri, rcc}; pub const VDDA_CALIB_MV: u32 = 3300; pub const ADC_MAX: u32 = (1 << 12) - 1; diff --git a/embassy-stm32/src/adc/f3.rs b/embassy-stm32/src/adc/f3.rs index 3aeb6f2c7..73ceb087a 100644 --- a/embassy-stm32/src/adc/f3.rs +++ b/embassy-stm32/src/adc/f3.rs @@ -6,7 +6,7 @@ use super::blocking_delay_us; use crate::adc::{Adc, AdcChannel, Instance, SampleTime}; use crate::interrupt::typelevel::Interrupt; use crate::time::Hertz; -use crate::{interrupt, rcc, Peri}; +use crate::{Peri, interrupt, rcc}; pub const VDDA_CALIB_MV: u32 = 3300; pub const ADC_MAX: u32 = (1 << 12) - 1; diff --git a/embassy-stm32/src/adc/f3_v1_1.rs b/embassy-stm32/src/adc/f3_v1_1.rs index 84613078c..cd5de54f5 100644 --- a/embassy-stm32/src/adc/f3_v1_1.rs +++ b/embassy-stm32/src/adc/f3_v1_1.rs @@ -9,7 +9,7 @@ use super::Resolution; use crate::adc::{Adc, AdcChannel, Instance, SampleTime}; use crate::interrupt::typelevel::Interrupt; use crate::time::Hertz; -use crate::{interrupt, rcc, Peri}; +use crate::{Peri, interrupt, rcc}; const ADC_FREQ: Hertz = crate::rcc::HSI_FREQ; diff --git a/embassy-stm32/src/adc/g4.rs b/embassy-stm32/src/adc/g4.rs index 43498966f..5098aadd8 100644 --- a/embassy-stm32/src/adc/g4.rs +++ b/embassy-stm32/src/adc/g4.rs @@ -7,11 +7,11 @@ use pac::adc::vals::{Adcaldif, Difsel, Exten, Rovsm, Trovs}; use pac::adccommon::vals::Presc; use stm32_metapac::adc::vals::{Adstp, Dmacfg, Dmaen}; -use super::{blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime}; +use super::{Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, blocking_delay_us}; use crate::adc::SealedAdcChannel; use crate::dma::Transfer; use crate::time::Hertz; -use crate::{pac, rcc, Peri}; +use crate::{Peri, pac, rcc}; /// Default VREF voltage used for sample conversion to millivolts. pub const VREF_DEFAULT_MV: u32 = 3300; @@ -133,7 +133,10 @@ impl<'d, T: Instance> Adc<'d, T> { trace!("ADC frequency set to {}", frequency); if frequency > MAX_ADC_CLK_FREQ { - panic!("Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.", MAX_ADC_CLK_FREQ.0 / 1_000_000 ); + panic!( + "Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.", + MAX_ADC_CLK_FREQ.0 / 1_000_000 + ); } let mut s = Self { diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs index ea986f4cf..22ed8295f 100644 --- a/embassy-stm32/src/adc/mod.rs +++ b/embassy-stm32/src/adc/mod.rs @@ -22,7 +22,7 @@ use core::marker::PhantomData; #[allow(unused)] #[cfg(not(any(adc_f3v3, adc_wba)))] pub use _version::*; -use embassy_hal_internal::{impl_peripheral, PeripheralType}; +use embassy_hal_internal::{PeripheralType, impl_peripheral}; #[cfg(any(adc_f1, adc_f3v1, adc_v1, adc_l0, adc_f3v2))] use embassy_sync::waitqueue::AtomicWaker; diff --git a/embassy-stm32/src/adc/ringbuffered_v2.rs b/embassy-stm32/src/adc/ringbuffered_v2.rs index 6f69e8486..9b2e5b8fe 100644 --- a/embassy-stm32/src/adc/ringbuffered_v2.rs +++ b/embassy-stm32/src/adc/ringbuffered_v2.rs @@ -1,13 +1,13 @@ use core::marker::PhantomData; use core::mem; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use stm32_metapac::adc::vals::SampleTime; use crate::adc::{Adc, AdcChannel, Instance, RxDma}; use crate::dma::{Priority, ReadableRingBuffer, TransferOptions}; use crate::pac::adc::vals; -use crate::{rcc, Peri}; +use crate::{Peri, rcc}; #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct OverrunError; diff --git a/embassy-stm32/src/adc/v1.rs b/embassy-stm32/src/adc/v1.rs index d09374876..a5869d110 100644 --- a/embassy-stm32/src/adc/v1.rs +++ b/embassy-stm32/src/adc/v1.rs @@ -9,7 +9,7 @@ use super::blocking_delay_us; use crate::adc::{Adc, AdcChannel, Instance, Resolution, SampleTime}; use crate::interrupt::typelevel::Interrupt; use crate::peripherals::ADC1; -use crate::{interrupt, rcc, Peri}; +use crate::{Peri, interrupt, rcc}; mod watchdog_v1; pub use watchdog_v1::WatchdogChannels; @@ -66,11 +66,7 @@ pub struct Temperature; impl AdcChannel for Temperature {} impl super::SealedAdcChannel for Temperature { fn channel(&self) -> u8 { - if cfg!(adc_l0) { - 18 - } else { - 16 - } + if cfg!(adc_l0) { 18 } else { 16 } } } diff --git a/embassy-stm32/src/adc/v2.rs b/embassy-stm32/src/adc/v2.rs index e94a25b24..93ec78548 100644 --- a/embassy-stm32/src/adc/v2.rs +++ b/embassy-stm32/src/adc/v2.rs @@ -2,7 +2,7 @@ use super::blocking_delay_us; use crate::adc::{Adc, AdcChannel, Instance, Resolution, SampleTime}; use crate::peripherals::ADC1; use crate::time::Hertz; -use crate::{rcc, Peri}; +use crate::{Peri, rcc}; mod ringbuffered_v2; pub use ringbuffered_v2::{RingBufferedAdc, Sequence}; diff --git a/embassy-stm32/src/adc/v3.rs b/embassy-stm32/src/adc/v3.rs index 16063ce4d..47632263b 100644 --- a/embassy-stm32/src/adc/v3.rs +++ b/embassy-stm32/src/adc/v3.rs @@ -10,10 +10,10 @@ use pac::adc::vals::{OversamplingRatio, OversamplingShift, Rovsm, Trovs}; pub use pac::adc::vals::{Ovsr, Ovss, Presc}; use super::{ - blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, + Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, blocking_delay_us, }; use crate::dma::Transfer; -use crate::{pac, rcc, Peri}; +use crate::{Peri, pac, rcc}; /// Default VREF voltage used for sample conversion to millivolts. pub const VREF_DEFAULT_MV: u32 = 3300; diff --git a/embassy-stm32/src/adc/v4.rs b/embassy-stm32/src/adc/v4.rs index b66437e6e..c7d0103a6 100644 --- a/embassy-stm32/src/adc/v4.rs +++ b/embassy-stm32/src/adc/v4.rs @@ -5,11 +5,11 @@ use pac::adc::vals::{Adstp, Difsel, Dmngt, Exten, Pcsel}; use pac::adccommon::vals::Presc; use super::{ - blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, + Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, blocking_delay_us, }; use crate::dma::Transfer; use crate::time::Hertz; -use crate::{pac, rcc, Peri}; +use crate::{Peri, pac, rcc}; /// Default VREF voltage used for sample conversion to millivolts. pub const VREF_DEFAULT_MV: u32 = 3300; @@ -171,7 +171,10 @@ impl<'d, T: Instance> Adc<'d, T> { info!("ADC frequency set to {}", frequency); if frequency > MAX_ADC_CLK_FREQ { - panic!("Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.", MAX_ADC_CLK_FREQ.0 / 1_000_000 ); + panic!( + "Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.", + MAX_ADC_CLK_FREQ.0 / 1_000_000 + ); } #[cfg(stm32h7)] diff --git a/embassy-stm32/src/can/bxcan/mod.rs b/embassy-stm32/src/can/bxcan/mod.rs index 8eb188560..507350c42 100644 --- a/embassy-stm32/src/can/bxcan/mod.rs +++ b/embassy-stm32/src/can/bxcan/mod.rs @@ -5,8 +5,8 @@ use core::future::poll_fn; use core::marker::PhantomData; use core::task::Poll; -use embassy_hal_internal::interrupt::InterruptExt; use embassy_hal_internal::PeripheralType; +use embassy_hal_internal::interrupt::InterruptExt; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use embassy_sync::waitqueue::AtomicWaker; @@ -22,7 +22,7 @@ use crate::can::enums::{BusError, RefCountOp, TryReadError}; use crate::gpio::{AfType, OutputType, Pull, Speed}; use crate::interrupt::typelevel::Interrupt; use crate::rcc::{self, RccPeripheral}; -use crate::{interrupt, peripherals, Peri}; +use crate::{Peri, interrupt, peripherals}; /// Interrupt handler. pub struct TxInterruptHandler { @@ -186,10 +186,10 @@ impl<'d> Can<'d> { rx: Peri<'d, if_afio!(impl RxPin)>, tx: Peri<'d, if_afio!(impl TxPin)>, _irqs: impl interrupt::typelevel::Binding> - + interrupt::typelevel::Binding> - + interrupt::typelevel::Binding> - + interrupt::typelevel::Binding> - + 'd, + + interrupt::typelevel::Binding> + + interrupt::typelevel::Binding> + + interrupt::typelevel::Binding> + + 'd, ) -> Self { let info = T::info(); let regs = &T::info().regs; diff --git a/embassy-stm32/src/can/fd/config.rs b/embassy-stm32/src/can/fd/config.rs index c6a66b469..e08349f02 100644 --- a/embassy-stm32/src/can/fd/config.rs +++ b/embassy-stm32/src/can/fd/config.rs @@ -1,7 +1,7 @@ //! Configuration for FDCAN Module // Note: This file is copied and modified from fdcan crate by Richard Meadows -use core::num::{NonZeroU16, NonZeroU8}; +use core::num::{NonZeroU8, NonZeroU16}; /// Configures the bit timings. /// diff --git a/embassy-stm32/src/can/fdcan.rs b/embassy-stm32/src/can/fdcan.rs index d8f71e03e..a142a6d63 100644 --- a/embassy-stm32/src/can/fdcan.rs +++ b/embassy-stm32/src/can/fdcan.rs @@ -3,8 +3,8 @@ use core::future::poll_fn; use core::marker::PhantomData; use core::task::Poll; -use embassy_hal_internal::interrupt::InterruptExt; use embassy_hal_internal::PeripheralType; +use embassy_hal_internal::interrupt::InterruptExt; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use embassy_sync::waitqueue::AtomicWaker; @@ -13,7 +13,7 @@ use crate::can::fd::peripheral::Registers; use crate::gpio::{AfType, OutputType, Pull, SealedPin as _, Speed}; use crate::interrupt::typelevel::Interrupt; use crate::rcc::{self, RccPeripheral}; -use crate::{interrupt, peripherals, Peri}; +use crate::{Peri, interrupt, peripherals}; pub(crate) mod fd; @@ -182,8 +182,8 @@ impl<'d> CanConfigurator<'d> { rx: Peri<'d, impl RxPin>, tx: Peri<'d, impl TxPin>, _irqs: impl interrupt::typelevel::Binding> - + interrupt::typelevel::Binding> - + 'd, + + interrupt::typelevel::Binding> + + 'd, ) -> CanConfigurator<'d> { set_as_af!(rx, AfType::input(Pull::None)); set_as_af!(tx, AfType::output(OutputType::PushPull, Speed::VeryHigh)); @@ -459,7 +459,7 @@ impl<'c, 'd, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> BufferedCan<'d, pub async fn write(&mut self, frame: Frame) { self.tx_buf.send(frame).await; self.info.interrupt0.pend(); // Wake for Tx - //T::IT0Interrupt::pend(); // Wake for Tx + //T::IT0Interrupt::pend(); // Wake for Tx } /// Async read frame from RX buffer. @@ -548,7 +548,7 @@ impl<'c, 'd, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> BufferedCanFd<' pub async fn write(&mut self, frame: FdFrame) { self.tx_buf.send(frame).await; self.info.interrupt0.pend(); // Wake for Tx - //T::IT0Interrupt::pend(); // Wake for Tx + //T::IT0Interrupt::pend(); // Wake for Tx } /// Async read frame from RX buffer. diff --git a/embassy-stm32/src/can/util.rs b/embassy-stm32/src/can/util.rs index fcdbbad62..6d7f0c16a 100644 --- a/embassy-stm32/src/can/util.rs +++ b/embassy-stm32/src/can/util.rs @@ -1,6 +1,6 @@ //! Utility functions shared between CAN controller types. -use core::num::{NonZeroU16, NonZeroU8}; +use core::num::{NonZeroU8, NonZeroU16}; /// Shared struct to represent bit timings used by calc_can_timings. #[derive(Clone, Copy, Debug)] diff --git a/embassy-stm32/src/crc/v1.rs b/embassy-stm32/src/crc/v1.rs index 13e5263de..836228599 100644 --- a/embassy-stm32/src/crc/v1.rs +++ b/embassy-stm32/src/crc/v1.rs @@ -1,6 +1,6 @@ use crate::pac::CRC as PAC_CRC; use crate::peripherals::CRC; -use crate::{rcc, Peri}; +use crate::{Peri, rcc}; /// CRC driver. pub struct Crc<'d> { diff --git a/embassy-stm32/src/crc/v2v3.rs b/embassy-stm32/src/crc/v2v3.rs index d834d0971..a566a2e04 100644 --- a/embassy-stm32/src/crc/v2v3.rs +++ b/embassy-stm32/src/crc/v2v3.rs @@ -1,7 +1,7 @@ -use crate::pac::crc::vals; use crate::pac::CRC as PAC_CRC; +use crate::pac::crc::vals; use crate::peripherals::CRC; -use crate::{rcc, Peri}; +use crate::{Peri, rcc}; /// CRC driver. pub struct Crc<'d> { diff --git a/embassy-stm32/src/cryp/mod.rs b/embassy-stm32/src/cryp/mod.rs index 0173b2b5d..4f1115fb7 100644 --- a/embassy-stm32/src/cryp/mod.rs +++ b/embassy-stm32/src/cryp/mod.rs @@ -1236,7 +1236,10 @@ impl<'d, T: Instance, M: Mode> Cryp<'d, T, M> { } if C::REQUIRES_PADDING { if last_block_remainder != 0 { - panic!("Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.", C::BLOCK_SIZE); + panic!( + "Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.", + C::BLOCK_SIZE + ); } } if last_block { @@ -1703,7 +1706,10 @@ impl<'d, T: Instance> Cryp<'d, T, Async> { } if C::REQUIRES_PADDING { if last_block_remainder != 0 { - panic!("Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.", C::BLOCK_SIZE); + panic!( + "Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.", + C::BLOCK_SIZE + ); } } if last_block { diff --git a/embassy-stm32/src/dac/mod.rs b/embassy-stm32/src/dac/mod.rs index 08e001337..d74d4a4be 100644 --- a/embassy-stm32/src/dac/mod.rs +++ b/embassy-stm32/src/dac/mod.rs @@ -8,7 +8,7 @@ use crate::mode::{Async, Blocking, Mode as PeriMode}; #[cfg(any(dac_v3, dac_v4, dac_v5, dac_v6, dac_v7))] use crate::pac::dac; use crate::rcc::{self, RccPeripheral}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; mod tsel; use embassy_hal_internal::PeripheralType; diff --git a/embassy-stm32/src/dcmi.rs b/embassy-stm32/src/dcmi.rs index bd03f1e00..dcae9f298 100644 --- a/embassy-stm32/src/dcmi.rs +++ b/embassy-stm32/src/dcmi.rs @@ -9,7 +9,7 @@ use embassy_sync::waitqueue::AtomicWaker; use crate::dma::Transfer; use crate::gpio::{AfType, Pull}; use crate::interrupt::typelevel::Interrupt; -use crate::{interrupt, rcc, Peri}; +use crate::{Peri, interrupt, rcc}; /// Interrupt handler. pub struct InterruptHandler { diff --git a/embassy-stm32/src/dma/dma_bdma.rs b/embassy-stm32/src/dma/dma_bdma.rs index 73ecab070..90dbf4f09 100644 --- a/embassy-stm32/src/dma/dma_bdma.rs +++ b/embassy-stm32/src/dma/dma_bdma.rs @@ -1,6 +1,6 @@ -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::pin::Pin; -use core::sync::atomic::{fence, AtomicUsize, Ordering}; +use core::sync::atomic::{AtomicUsize, Ordering, fence}; use core::task::{Context, Poll, Waker}; use embassy_hal_internal::Peri; diff --git a/embassy-stm32/src/dma/gpdma/mod.rs b/embassy-stm32/src/dma/gpdma/mod.rs index 4a14c2a8e..3e117c331 100644 --- a/embassy-stm32/src/dma/gpdma/mod.rs +++ b/embassy-stm32/src/dma/gpdma/mod.rs @@ -2,7 +2,7 @@ use core::future::Future; use core::pin::Pin; -use core::sync::atomic::{fence, AtomicUsize, Ordering}; +use core::sync::atomic::{AtomicUsize, Ordering, fence}; use core::task::{Context, Poll}; use embassy_hal_internal::Peri; diff --git a/embassy-stm32/src/dma/gpdma/ringbuffered.rs b/embassy-stm32/src/dma/gpdma/ringbuffered.rs index 9ee52193b..94c597e0d 100644 --- a/embassy-stm32/src/dma/gpdma/ringbuffered.rs +++ b/embassy-stm32/src/dma/gpdma/ringbuffered.rs @@ -3,12 +3,12 @@ //! FIXME: Add request_pause functionality? //! FIXME: Stop the DMA, if a user does not queue new transfers (chain of linked-list items ends automatically). use core::future::poll_fn; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use core::task::Waker; use embassy_hal_internal::Peri; -use super::{AnyChannel, TransferOptions, STATE}; +use super::{AnyChannel, STATE, TransferOptions}; use crate::dma::gpdma::linked_list::{RunMode, Table}; use crate::dma::ringbuffer::{DmaCtrl, Error, ReadableDmaRingBuffer, WritableDmaRingBuffer}; use crate::dma::word::Word; diff --git a/embassy-stm32/src/dma/mod.rs b/embassy-stm32/src/dma/mod.rs index 5989bfd7c..297fa3674 100644 --- a/embassy-stm32/src/dma/mod.rs +++ b/embassy-stm32/src/dma/mod.rs @@ -24,7 +24,7 @@ pub(crate) use util::*; pub(crate) mod ringbuffer; pub mod word; -use embassy_hal_internal::{impl_peripheral, PeripheralType}; +use embassy_hal_internal::{PeripheralType, impl_peripheral}; use crate::interrupt; diff --git a/embassy-stm32/src/dma/ringbuffer/tests/prop_test/mod.rs b/embassy-stm32/src/dma/ringbuffer/tests/prop_test/mod.rs index 661fb1728..eff5b4058 100644 --- a/embassy-stm32/src/dma/ringbuffer/tests/prop_test/mod.rs +++ b/embassy-stm32/src/dma/ringbuffer/tests/prop_test/mod.rs @@ -2,7 +2,7 @@ use std::task::Waker; use proptest::prop_oneof; use proptest::strategy::{self, BoxedStrategy, Strategy as _}; -use proptest_state_machine::{prop_state_machine, ReferenceStateMachine, StateMachineTest}; +use proptest_state_machine::{ReferenceStateMachine, StateMachineTest, prop_state_machine}; use super::*; diff --git a/embassy-stm32/src/dsihost.rs b/embassy-stm32/src/dsihost.rs index deda956af..fd1682d2b 100644 --- a/embassy-stm32/src/dsihost.rs +++ b/embassy-stm32/src/dsihost.rs @@ -7,7 +7,7 @@ use embassy_hal_internal::PeripheralType; //use crate::gpio::{AnyPin, SealedPin}; use crate::gpio::{AfType, AnyPin, OutputType, Speed}; use crate::rcc::{self, RccPeripheral}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; /// Performs a busy-wait delay for a specified number of microseconds. pub fn blocking_delay_ms(ms: u32) { diff --git a/embassy-stm32/src/dts/mod.rs b/embassy-stm32/src/dts/mod.rs index 1f39c8db5..a75ae0560 100644 --- a/embassy-stm32/src/dts/mod.rs +++ b/embassy-stm32/src/dts/mod.rs @@ -1,7 +1,7 @@ //! Digital Temperature Sensor (DTS) use core::future::poll_fn; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_hal_internal::Peri; diff --git a/embassy-stm32/src/eth/v1/mod.rs b/embassy-stm32/src/eth/v1/mod.rs index 5be1c9739..a77eb8719 100644 --- a/embassy-stm32/src/eth/v1/mod.rs +++ b/embassy-stm32/src/eth/v1/mod.rs @@ -4,7 +4,7 @@ mod rx_desc; mod tx_desc; use core::marker::PhantomData; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use embassy_hal_internal::Peri; use stm32_metapac::eth::vals::{Apcs, Cr, Dm, DmaomrSr, Fes, Ftf, Ifg, MbProgress, Mw, Pbl, Rsf, St, Tsf}; @@ -190,7 +190,7 @@ impl<'d, T: Instance, P: Phy> Ethernet<'d, T, P> { w.set_apcs(Apcs::STRIP); // automatic padding and crc stripping w.set_fes(Fes::FES100); // fast ethernet speed w.set_dm(Dm::FULL_DUPLEX); // full duplex - // TODO: Carrier sense ? ECRSFD + // TODO: Carrier sense ? ECRSFD }); // Set the mac to pass all multicast packets @@ -350,7 +350,9 @@ impl<'d, T: Instance, P: Phy> Ethernet<'d, T, P> { } #[cfg(any(eth_v1b, eth_v1c))] - config_pins!(rx_clk, tx_clk, mdio, mdc, rxdv, rx_d0, rx_d1, rx_d2, rx_d3, tx_d0, tx_d1, tx_d2, tx_d3, tx_en); + config_pins!( + rx_clk, tx_clk, mdio, mdc, rxdv, rx_d0, rx_d1, rx_d2, rx_d3, tx_d0, tx_d1, tx_d2, tx_d3, tx_en + ); let pins = Pins::Mii([ rx_clk.into(), diff --git a/embassy-stm32/src/eth/v1/rx_desc.rs b/embassy-stm32/src/eth/v1/rx_desc.rs index 2a46c1895..6ade1f29c 100644 --- a/embassy-stm32/src/eth/v1/rx_desc.rs +++ b/embassy-stm32/src/eth/v1/rx_desc.rs @@ -1,4 +1,4 @@ -use core::sync::atomic::{compiler_fence, fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence, fence}; use stm32_metapac::eth::vals::{Rpd, Rps}; use vcell::VolatileCell; diff --git a/embassy-stm32/src/eth/v1/tx_desc.rs b/embassy-stm32/src/eth/v1/tx_desc.rs index 1317d20f4..ba99b66cb 100644 --- a/embassy-stm32/src/eth/v1/tx_desc.rs +++ b/embassy-stm32/src/eth/v1/tx_desc.rs @@ -1,4 +1,4 @@ -use core::sync::atomic::{compiler_fence, fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence, fence}; use vcell::VolatileCell; diff --git a/embassy-stm32/src/eth/v2/descriptors.rs b/embassy-stm32/src/eth/v2/descriptors.rs index 645bfdb14..e335ed8f3 100644 --- a/embassy-stm32/src/eth/v2/descriptors.rs +++ b/embassy-stm32/src/eth/v2/descriptors.rs @@ -1,4 +1,4 @@ -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use vcell::VolatileCell; diff --git a/embassy-stm32/src/eth/v2/mod.rs b/embassy-stm32/src/eth/v2/mod.rs index cf7a9901b..39a6e8b0f 100644 --- a/embassy-stm32/src/eth/v2/mod.rs +++ b/embassy-stm32/src/eth/v2/mod.rs @@ -1,7 +1,7 @@ mod descriptors; use core::marker::PhantomData; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use embassy_hal_internal::Peri; use stm32_metapac::syscfg::vals::EthSelPhy; @@ -144,7 +144,9 @@ impl<'d, T: Instance, P: Phy> Ethernet<'d, T, P> { .modify(|w| w.set_eth_sel_phy(EthSelPhy::MII_GMII)); }); - config_pins!(rx_clk, tx_clk, mdio, mdc, rxdv, rx_d0, rx_d1, rx_d2, rx_d3, tx_d0, tx_d1, tx_d2, tx_d3, tx_en); + config_pins!( + rx_clk, tx_clk, mdio, mdc, rxdv, rx_d0, rx_d1, rx_d2, rx_d3, tx_d0, tx_d1, tx_d2, tx_d3, tx_en + ); let pins = Pins::Mii([ rx_clk.into(), diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index 9fce78f95..12600d4eb 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs @@ -5,13 +5,13 @@ use core::marker::PhantomData; use core::pin::Pin; use core::task::{Context, Poll}; -use embassy_hal_internal::{impl_peripheral, PeripheralType}; +use embassy_hal_internal::{PeripheralType, impl_peripheral}; use embassy_sync::waitqueue::AtomicWaker; use crate::gpio::{AnyPin, Input, Level, Pin as GpioPin, Pull}; -use crate::pac::exti::regs::Lines; use crate::pac::EXTI; -use crate::{interrupt, pac, peripherals, Peri}; +use crate::pac::exti::regs::Lines; +use crate::{Peri, interrupt, pac, peripherals}; const EXTI_COUNT: usize = 16; static EXTI_WAKERS: [AtomicWaker; EXTI_COUNT] = [const { AtomicWaker::new() }; EXTI_COUNT]; diff --git a/embassy-stm32/src/flash/asynch.rs b/embassy-stm32/src/flash/asynch.rs index 006dcddeb..a131217b7 100644 --- a/embassy-stm32/src/flash/asynch.rs +++ b/embassy-stm32/src/flash/asynch.rs @@ -1,17 +1,17 @@ use core::marker::PhantomData; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use embassy_hal_internal::drop::OnDrop; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::mutex::Mutex; use super::{ - blocking_read, ensure_sector_aligned, family, get_flash_regions, get_sector, Async, Error, Flash, FlashLayout, - FLASH_BASE, FLASH_SIZE, WRITE_SIZE, + Async, Error, FLASH_BASE, FLASH_SIZE, Flash, FlashLayout, WRITE_SIZE, blocking_read, ensure_sector_aligned, family, + get_flash_regions, get_sector, }; use crate::interrupt::InterruptExt; use crate::peripherals::FLASH; -use crate::{interrupt, Peri}; +use crate::{Peri, interrupt}; pub(super) static REGION_ACCESS: Mutex = Mutex::new(()); diff --git a/embassy-stm32/src/flash/common.rs b/embassy-stm32/src/flash/common.rs index 10023e637..b595938a6 100644 --- a/embassy-stm32/src/flash/common.rs +++ b/embassy-stm32/src/flash/common.rs @@ -1,14 +1,14 @@ use core::marker::PhantomData; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use embassy_hal_internal::drop::OnDrop; use super::{ - family, get_flash_regions, Async, Blocking, Error, FlashBank, FlashLayout, FlashRegion, FlashSector, FLASH_SIZE, - MAX_ERASE_SIZE, READ_SIZE, WRITE_SIZE, + Async, Blocking, Error, FLASH_SIZE, FlashBank, FlashLayout, FlashRegion, FlashSector, MAX_ERASE_SIZE, READ_SIZE, + WRITE_SIZE, family, get_flash_regions, }; -use crate::Peri; use crate::_generated::FLASH_BASE; +use crate::Peri; use crate::peripherals::FLASH; /// Internal flash memory driver. diff --git a/embassy-stm32/src/flash/eeprom.rs b/embassy-stm32/src/flash/eeprom.rs index cc3529eb9..39c497e3f 100644 --- a/embassy-stm32/src/flash/eeprom.rs +++ b/embassy-stm32/src/flash/eeprom.rs @@ -1,6 +1,6 @@ use embassy_hal_internal::drop::OnDrop; -use super::{family, Blocking, Error, Flash, EEPROM_BASE, EEPROM_SIZE}; +use super::{Blocking, EEPROM_BASE, EEPROM_SIZE, Error, Flash, family}; #[cfg(eeprom)] impl<'d> Flash<'d, Blocking> { diff --git a/embassy-stm32/src/flash/f0.rs b/embassy-stm32/src/flash/f0.rs index 3f9dbe945..5c01fce9c 100644 --- a/embassy-stm32/src/flash/f0.rs +++ b/embassy-stm32/src/flash/f0.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use super::{FlashSector, WRITE_SIZE}; use crate::flash::Error; diff --git a/embassy-stm32/src/flash/f1f3.rs b/embassy-stm32/src/flash/f1f3.rs index bf9ad2893..9e469ffbc 100644 --- a/embassy-stm32/src/flash/f1f3.rs +++ b/embassy-stm32/src/flash/f1f3.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use super::{FlashSector, WRITE_SIZE}; use crate::flash::Error; diff --git a/embassy-stm32/src/flash/f2.rs b/embassy-stm32/src/flash/f2.rs index 67e380619..b48ab3b76 100644 --- a/embassy-stm32/src/flash/f2.rs +++ b/embassy-stm32/src/flash/f2.rs @@ -1,9 +1,9 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, AtomicBool, Ordering}; +use core::sync::atomic::{AtomicBool, Ordering, fence}; use pac::flash::regs::Sr; -use super::{get_flash_regions, FlashBank, FlashSector, WRITE_SIZE}; +use super::{FlashBank, FlashSector, WRITE_SIZE, get_flash_regions}; use crate::flash::Error; use crate::pac; diff --git a/embassy-stm32/src/flash/f4.rs b/embassy-stm32/src/flash/f4.rs index 62e0492b5..9c5051492 100644 --- a/embassy-stm32/src/flash/f4.rs +++ b/embassy-stm32/src/flash/f4.rs @@ -1,10 +1,10 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, AtomicBool, Ordering}; +use core::sync::atomic::{AtomicBool, Ordering, fence}; use embassy_sync::waitqueue::AtomicWaker; use pac::flash::regs::Sr; -use super::{get_flash_regions, FlashBank, FlashSector, WRITE_SIZE}; +use super::{FlashBank, FlashSector, WRITE_SIZE, get_flash_regions}; use crate::_generated::FLASH_SIZE; use crate::flash::Error; use crate::pac; @@ -246,7 +246,9 @@ pub(crate) fn assert_not_corrupted_read(end_address: u32) { feature = "stm32f439zi", ))] if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() { - panic!("Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11"); + panic!( + "Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11" + ); } #[cfg(any( @@ -270,14 +272,16 @@ pub(crate) fn assert_not_corrupted_read(end_address: u32) { feature = "stm32f439zg", ))] if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() { - panic!("Read corruption for stm32f42xxG and stm32f43xxG in dual bank mode when PA12 is in use for chips below revision 3, see errata 2.2.11"); + panic!( + "Read corruption for stm32f42xxG and stm32f43xxG in dual bank mode when PA12 is in use for chips below revision 3, see errata 2.2.11" + ); } } #[allow(unused)] fn pa12_is_output_pull_low() -> bool { - use pac::gpio::vals; use pac::GPIOA; + use pac::gpio::vals; const PIN: usize = 12; GPIOA.moder().read().moder(PIN) == vals::Moder::OUTPUT && GPIOA.pupdr().read().pupdr(PIN) == vals::Pupdr::PULL_DOWN @@ -287,7 +291,7 @@ fn pa12_is_output_pull_low() -> bool { #[cfg(test)] mod tests { use super::*; - use crate::flash::{get_sector, FlashBank}; + use crate::flash::{FlashBank, get_sector}; #[test] #[cfg(stm32f429)] @@ -370,9 +374,13 @@ mod tests { #[cfg(all(bank_setup_configurable))] pub(crate) fn check_bank_setup() { if cfg!(feature = "single-bank") && pac::FLASH.optcr().read().db1m() { - panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use dual-bank config"); + panic!( + "Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use dual-bank config" + ); } if cfg!(feature = "dual-bank") && !pac::FLASH.optcr().read().db1m() { - panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use single-bank config"); + panic!( + "Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use single-bank config" + ); } } diff --git a/embassy-stm32/src/flash/f7.rs b/embassy-stm32/src/flash/f7.rs index 0547c747a..09389c417 100644 --- a/embassy-stm32/src/flash/f7.rs +++ b/embassy-stm32/src/flash/f7.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use super::{FlashSector, WRITE_SIZE}; use crate::flash::Error; @@ -99,7 +99,7 @@ unsafe fn blocking_wait_ready() -> Result<(), Error> { #[cfg(test)] mod tests { use super::*; - use crate::flash::{get_sector, FlashBank}; + use crate::flash::{FlashBank, get_sector}; #[test] #[cfg(stm32f732)] @@ -218,9 +218,13 @@ mod tests { #[cfg(all(bank_setup_configurable))] pub(crate) fn check_bank_setup() { if cfg!(feature = "single-bank") && !pac::FLASH.optcr().read().n_dbank() { - panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the ndbank value in the user option bytes or configure embassy to use dual-bank config"); + panic!( + "Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the ndbank value in the user option bytes or configure embassy to use dual-bank config" + ); } if cfg!(feature = "dual-bank") && pac::FLASH.optcr().read().n_dbank() { - panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the ndbank value in the user option bytes or configure embassy to use single-bank config"); + panic!( + "Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the ndbank value in the user option bytes or configure embassy to use single-bank config" + ); } } diff --git a/embassy-stm32/src/flash/g.rs b/embassy-stm32/src/flash/g.rs index bc1fd360c..d026541a4 100644 --- a/embassy-stm32/src/flash/g.rs +++ b/embassy-stm32/src/flash/g.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use cortex_m::interrupt; @@ -105,19 +105,27 @@ fn wait_busy() { #[cfg(all(bank_setup_configurable, any(flash_g4c2, flash_g4c3, flash_g4c4)))] pub(crate) fn check_bank_setup() { if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() { - panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config"); + panic!( + "Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config" + ); } if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() { - panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use single-bank config"); + panic!( + "Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use single-bank config" + ); } } #[cfg(all(bank_setup_configurable, flash_g0x1))] pub(crate) fn check_bank_setup() { if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dual_bank() { - panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use dual-bank config"); + panic!( + "Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use dual-bank config" + ); } if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dual_bank() { - panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use single-bank config"); + panic!( + "Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use single-bank config" + ); } } diff --git a/embassy-stm32/src/flash/h5.rs b/embassy-stm32/src/flash/h5.rs index fd9bfcc75..88f247879 100644 --- a/embassy-stm32/src/flash/h5.rs +++ b/embassy-stm32/src/flash/h5.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use super::{FlashSector, WRITE_SIZE}; use crate::flash::Error; diff --git a/embassy-stm32/src/flash/h50.rs b/embassy-stm32/src/flash/h50.rs index f8e210556..91d5da4d6 100644 --- a/embassy-stm32/src/flash/h50.rs +++ b/embassy-stm32/src/flash/h50.rs @@ -1,7 +1,7 @@ /// STM32H50 series flash impl. See RM0492 use core::{ ptr::write_volatile, - sync::atomic::{fence, Ordering}, + sync::atomic::{Ordering, fence}, }; use cortex_m::interrupt; diff --git a/embassy-stm32/src/flash/h7.rs b/embassy-stm32/src/flash/h7.rs index f1d84101c..8a43cce3f 100644 --- a/embassy-stm32/src/flash/h7.rs +++ b/embassy-stm32/src/flash/h7.rs @@ -1,7 +1,7 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; -use super::{FlashSector, BANK1_REGION, FLASH_REGIONS, WRITE_SIZE}; +use super::{BANK1_REGION, FLASH_REGIONS, FlashSector, WRITE_SIZE}; use crate::flash::Error; use crate::pac; diff --git a/embassy-stm32/src/flash/l.rs b/embassy-stm32/src/flash/l.rs index 1b82704ec..cd23cda5c 100644 --- a/embassy-stm32/src/flash/l.rs +++ b/embassy-stm32/src/flash/l.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use super::{FlashSector, WRITE_SIZE}; use crate::flash::Error; @@ -234,19 +234,27 @@ pub(crate) unsafe fn wait_ready_blocking() -> Result<(), Error> { #[cfg(all(bank_setup_configurable, flash_l5))] pub(crate) fn check_bank_setup() { if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() { - panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config"); + panic!( + "Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config" + ); } if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() { - panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use single-bank config"); + panic!( + "Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use single-bank config" + ); } } #[cfg(all(bank_setup_configurable, flash_l4))] pub(crate) fn check_bank_setup() { if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dualbank() { - panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use dual-bank config"); + panic!( + "Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use dual-bank config" + ); } if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dualbank() { - panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use single-bank config"); + panic!( + "Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use single-bank config" + ); } } diff --git a/embassy-stm32/src/flash/u0.rs b/embassy-stm32/src/flash/u0.rs index 68d847eca..a64f6c492 100644 --- a/embassy-stm32/src/flash/u0.rs +++ b/embassy-stm32/src/flash/u0.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use cortex_m::interrupt; diff --git a/embassy-stm32/src/flash/u5.rs b/embassy-stm32/src/flash/u5.rs index 6c3d4b422..5f1f562c0 100644 --- a/embassy-stm32/src/flash/u5.rs +++ b/embassy-stm32/src/flash/u5.rs @@ -1,5 +1,5 @@ use core::ptr::write_volatile; -use core::sync::atomic::{fence, Ordering}; +use core::sync::atomic::{Ordering, fence}; use super::{FlashBank, FlashSector, WRITE_SIZE}; use crate::flash::Error; diff --git a/embassy-stm32/src/fmc.rs b/embassy-stm32/src/fmc.rs index ff18a8bee..8ecfbc522 100644 --- a/embassy-stm32/src/fmc.rs +++ b/embassy-stm32/src/fmc.rs @@ -4,7 +4,7 @@ use core::marker::PhantomData; use embassy_hal_internal::PeripheralType; use crate::gpio::{AfType, OutputType, Pull, Speed}; -use crate::{rcc, Peri}; +use crate::{Peri, rcc}; /// FMC driver pub struct Fmc<'d, T: Instance> { diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index 5a8d23183..b55baffdc 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs @@ -4,7 +4,7 @@ use core::convert::Infallible; use critical_section::CriticalSection; -use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; +use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; use crate::pac::gpio::{self, vals}; use crate::peripherals; diff --git a/embassy-stm32/src/hash/mod.rs b/embassy-stm32/src/hash/mod.rs index 90c06c0d8..ba573267c 100644 --- a/embassy-stm32/src/hash/mod.rs +++ b/embassy-stm32/src/hash/mod.rs @@ -19,7 +19,7 @@ use crate::interrupt::typelevel::Interrupt; use crate::mode::Async; use crate::mode::{Blocking, Mode}; use crate::peripherals::HASH; -use crate::{interrupt, pac, peripherals, rcc, Peri}; +use crate::{Peri, interrupt, pac, peripherals, rcc}; #[cfg(hash_v1)] const NUM_CONTEXT_REGS: usize = 51; @@ -514,11 +514,7 @@ impl<'d, T: Instance> Hash<'d, T, Async> { T::regs().imr().modify(|reg| reg.set_dcie(true)); // Check for completion. let bits = T::regs().sr().read(); - if bits.dcis() { - Poll::Ready(()) - } else { - Poll::Pending - } + if bits.dcis() { Poll::Ready(()) } else { Poll::Pending } }) .await; diff --git a/embassy-stm32/src/hsem/mod.rs b/embassy-stm32/src/hsem/mod.rs index 573a1851d..4d3a5d68d 100644 --- a/embassy-stm32/src/hsem/mod.rs +++ b/embassy-stm32/src/hsem/mod.rs @@ -2,13 +2,13 @@ use embassy_hal_internal::PeripheralType; -use crate::pac; -use crate::rcc::{self, RccPeripheral}; // TODO: This code works for all HSEM implemenations except for the STM32WBA52/4/5xx MCUs. // Those MCUs have a different HSEM implementation (Secure semaphore lock support, // Privileged / unprivileged semaphore lock support, Semaphore lock protection via semaphore attribute), // which is not yet supported by this code. use crate::Peri; +use crate::pac; +use crate::rcc::{self, RccPeripheral}; /// HSEM error. #[derive(Debug)] diff --git a/embassy-stm32/src/hspi/mod.rs b/embassy-stm32/src/hspi/mod.rs index 95d9e5099..69baa708e 100644 --- a/embassy-stm32/src/hspi/mod.rs +++ b/embassy-stm32/src/hspi/mod.rs @@ -16,7 +16,7 @@ use embassy_embedded_hal::{GetConfig, SetConfig}; use embassy_hal_internal::{Peri, PeripheralType}; pub use enums::*; -use crate::dma::{word, ChannelAndRequest}; +use crate::dma::{ChannelAndRequest, word}; use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; use crate::mode::{Async, Blocking, Mode as PeriMode}; use crate::pac::hspi::Hspi as Regs; diff --git a/embassy-stm32/src/i2c/mod.rs b/embassy-stm32/src/i2c/mod.rs index 249bac41c..f4bf55d34 100644 --- a/embassy-stm32/src/i2c/mod.rs +++ b/embassy-stm32/src/i2c/mod.rs @@ -154,8 +154,8 @@ impl<'d> I2c<'d, Async, Master> { scl: Peri<'d, if_afio!(impl SclPin)>, sda: Peri<'d, if_afio!(impl SdaPin)>, _irq: impl interrupt::typelevel::Binding> - + interrupt::typelevel::Binding> - + 'd, + + interrupt::typelevel::Binding> + + 'd, tx_dma: Peri<'d, impl TxDma>, rx_dma: Peri<'d, impl RxDma>, config: Config, diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs index 081eb1191..e6b6c7c42 100644 --- a/embassy-stm32/src/i2c/v1.rs +++ b/embassy-stm32/src/i2c/v1.rs @@ -8,7 +8,7 @@ use core::future::poll_fn; use core::task::Poll; use embassy_embedded_hal::SetConfig; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_hal_internal::drop::OnDrop; use embedded_hal_1::i2c::Operation; use mode::Master; @@ -762,11 +762,7 @@ impl Timings { mode = Mode::Standard; ccr = { let ccr = clock / (frequency * 2); - if ccr < 4 { - 4 - } else { - ccr - } + if ccr < 4 { 4 } else { ccr } }; } else { const DUTYCYCLE: u8 = 0; diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index 0bfc795ac..01b6b8800 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs @@ -2,7 +2,7 @@ use core::cmp; use core::future::poll_fn; use core::task::Poll; -use config::{Address, OwnAddresses, OA2}; +use config::{Address, OA2, OwnAddresses}; use embassy_embedded_hal::SetConfig; use embassy_hal_internal::drop::OnDrop; use embedded_hal_1::i2c::Operation; diff --git a/embassy-stm32/src/i2s.rs b/embassy-stm32/src/i2s.rs index b6d3daf54..db22cfa11 100644 --- a/embassy-stm32/src/i2s.rs +++ b/embassy-stm32/src/i2s.rs @@ -3,12 +3,12 @@ use embassy_futures::join::join; use stm32_metapac::spi::vals; -use crate::dma::{ringbuffer, ChannelAndRequest, ReadableRingBuffer, TransferOptions, WritableRingBuffer}; +use crate::Peri; +use crate::dma::{ChannelAndRequest, ReadableRingBuffer, TransferOptions, WritableRingBuffer, ringbuffer}; use crate::gpio::{AfType, AnyPin, OutputType, SealedPin, Speed}; use crate::mode::Async; use crate::spi::{Config as SpiConfig, RegsExt as _, *}; use crate::time::Hertz; -use crate::Peri; /// I2S mode #[derive(Copy, Clone)] diff --git a/embassy-stm32/src/ipcc.rs b/embassy-stm32/src/ipcc.rs index 670d8332c..e1d8b1c2a 100644 --- a/embassy-stm32/src/ipcc.rs +++ b/embassy-stm32/src/ipcc.rs @@ -1,7 +1,7 @@ //! Inter-Process Communication Controller (IPCC) use core::future::poll_fn; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_sync::waitqueue::AtomicWaker; diff --git a/embassy-stm32/src/low_power.rs b/embassy-stm32/src/low_power.rs index 342f73bc8..1b66ca680 100644 --- a/embassy-stm32/src/low_power.rs +++ b/embassy-stm32/src/low_power.rs @@ -56,13 +56,13 @@ use core::arch::asm; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use cortex_m::peripheral::SCB; use embassy_executor::*; use crate::interrupt; -use crate::time_driver::{get_driver, RtcDriver}; +use crate::time_driver::{RtcDriver, get_driver}; const THREAD_PENDER: usize = usize::MAX; diff --git a/embassy-stm32/src/lptim/pwm.rs b/embassy-stm32/src/lptim/pwm.rs index 96af9f4d9..a69db3caf 100644 --- a/embassy-stm32/src/lptim/pwm.rs +++ b/embassy-stm32/src/lptim/pwm.rs @@ -4,12 +4,12 @@ use core::marker::PhantomData; use embassy_hal_internal::Peri; -use super::timer::Timer; #[cfg(not(any(lptim_v2a, lptim_v2b)))] use super::OutputPin; -#[cfg(any(lptim_v2a, lptim_v2b))] -use super::{channel::Channel, timer::ChannelDirection, Channel1Pin, Channel2Pin}; +use super::timer::Timer; use super::{BasicInstance, Instance}; +#[cfg(any(lptim_v2a, lptim_v2b))] +use super::{Channel1Pin, Channel2Pin, channel::Channel, timer::ChannelDirection}; #[cfg(gpio_v2)] use crate::gpio::Pull; use crate::gpio::{AfType, AnyPin, OutputType, Speed}; diff --git a/embassy-stm32/src/ltdc.rs b/embassy-stm32/src/ltdc.rs index 0f6ef569c..de2db9872 100644 --- a/embassy-stm32/src/ltdc.rs +++ b/embassy-stm32/src/ltdc.rs @@ -14,7 +14,7 @@ use stm32_metapac::ltdc::vals::{Bf1, Bf2, Cfuif, Clif, Crrif, Cterrif, Pf, Vbr}; use crate::gpio::{AfType, OutputType, Speed}; use crate::interrupt::typelevel::Interrupt; use crate::interrupt::{self}; -use crate::{peripherals, rcc, Peri}; +use crate::{Peri, peripherals, rcc}; static LTDC_WAKER: AtomicWaker = AtomicWaker::new(); diff --git a/embassy-stm32/src/opamp.rs b/embassy-stm32/src/opamp.rs index e36719ef3..ac8d5de21 100644 --- a/embassy-stm32/src/opamp.rs +++ b/embassy-stm32/src/opamp.rs @@ -3,10 +3,10 @@ use embassy_hal_internal::PeripheralType; +use crate::Peri; use crate::pac::opamp::vals::*; #[cfg(not(any(stm32g4, stm32f3)))] use crate::rcc::RccInfo; -use crate::Peri; /// Performs a busy-wait delay for a specified number of microseconds. #[cfg(opamp_v5)] diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs index d93cecb69..592a8594a 100644 --- a/embassy-stm32/src/ospi/mod.rs +++ b/embassy-stm32/src/ospi/mod.rs @@ -12,14 +12,14 @@ use embassy_hal_internal::PeripheralType; pub use enums::*; use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits}; -use crate::dma::{word, ChannelAndRequest}; +use crate::dma::{ChannelAndRequest, word}; use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; use crate::mode::{Async, Blocking, Mode as PeriMode}; -use crate::pac::octospi::{vals, Octospi as Regs}; +use crate::pac::octospi::{Octospi as Regs, vals}; #[cfg(octospim_v1)] use crate::pac::octospim::Octospim; use crate::rcc::{self, RccPeripheral}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; /// OPSI driver config. #[derive(Clone, Copy)] diff --git a/embassy-stm32/src/qspi/mod.rs b/embassy-stm32/src/qspi/mod.rs index b03cd9009..bb4f4f1d0 100644 --- a/embassy-stm32/src/qspi/mod.rs +++ b/embassy-stm32/src/qspi/mod.rs @@ -14,7 +14,7 @@ use crate::gpio::{AfType, AnyPin, OutputType, Pull, Speed}; use crate::mode::{Async, Blocking, Mode as PeriMode}; use crate::pac::quadspi::Quadspi as Regs; use crate::rcc::{self, RccPeripheral}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; /// QSPI transfer configuration. #[derive(Clone, Copy)] diff --git a/embassy-stm32/src/rcc/bd.rs b/embassy-stm32/src/rcc/bd.rs index 63fc195dd..3b2a10581 100644 --- a/embassy-stm32/src/rcc/bd.rs +++ b/embassy-stm32/src/rcc/bd.rs @@ -1,6 +1,6 @@ -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; -use crate::pac::common::{Reg, RW}; +use crate::pac::common::{RW, Reg}; pub use crate::pac::rcc::vals::Rtcsel as RtcClockSource; use crate::time::Hertz; diff --git a/embassy-stm32/src/rcc/f247.rs b/embassy-stm32/src/rcc/f247.rs index 8f2e8db5f..d941054cd 100644 --- a/embassy-stm32/src/rcc/f247.rs +++ b/embassy-stm32/src/rcc/f247.rs @@ -1,13 +1,13 @@ use stm32_metapac::flash::vals::Latency; +#[cfg(any(stm32f4, stm32f7))] +use crate::pac::PWR; #[cfg(any(stm32f413, stm32f423, stm32f412))] pub use crate::pac::rcc::vals::Plli2ssrc as Plli2sSource; pub use crate::pac::rcc::vals::{ Hpre as AHBPrescaler, Pllm as PllPreDiv, Plln as PllMul, Pllp as PllPDiv, Pllq as PllQDiv, Pllr as PllRDiv, Pllsrc as PllSource, Ppre as APBPrescaler, Sw as Sysclk, }; -#[cfg(any(stm32f4, stm32f7))] -use crate::pac::PWR; use crate::pac::{FLASH, RCC}; use crate::time::Hertz; diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs index 331bab7a0..485edd390 100644 --- a/embassy-stm32/src/rcc/h.rs +++ b/embassy-stm32/src/rcc/h.rs @@ -597,7 +597,10 @@ pub(crate) unsafe fn init(config: Config) { Hertz(24_000_000) => Usbrefcksel::MHZ24, Hertz(26_000_000) => Usbrefcksel::MHZ26, Hertz(32_000_000) => Usbrefcksel::MHZ32, - _ => panic!("cannot select USBPHYC reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz", clk_val), + _ => panic!( + "cannot select USBPHYC reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz", + clk_val + ), }, None => Usbrefcksel::MHZ24, }; diff --git a/embassy-stm32/src/rcc/l.rs b/embassy-stm32/src/rcc/l.rs index 81b89046e..2e1cbd702 100644 --- a/embassy-stm32/src/rcc/l.rs +++ b/embassy-stm32/src/rcc/l.rs @@ -499,9 +499,9 @@ pub use pll::*; #[cfg(any(stm32l0, stm32l1))] mod pll { - use super::{pll_enable, PllInstance}; - pub use crate::pac::rcc::vals::{Plldiv as PllDiv, Pllmul as PllMul, Pllsrc as PllSource}; + use super::{PllInstance, pll_enable}; use crate::pac::RCC; + pub use crate::pac::rcc::vals::{Plldiv as PllDiv, Pllmul as PllMul, Pllsrc as PllSource}; use crate::time::Hertz; #[derive(Clone, Copy)] @@ -563,11 +563,11 @@ mod pll { #[cfg(any(stm32l4, stm32l5, stm32wb, stm32wl, stm32u0))] mod pll { - use super::{pll_enable, PllInstance}; + use super::{PllInstance, pll_enable}; + use crate::pac::RCC; pub use crate::pac::rcc::vals::{ Pllm as PllPreDiv, Plln as PllMul, Pllp as PllPDiv, Pllq as PllQDiv, Pllr as PllRDiv, Pllsrc as PllSource, }; - use crate::pac::RCC; use crate::time::Hertz; #[derive(Clone, Copy)] diff --git a/embassy-stm32/src/rcc/mco.rs b/embassy-stm32/src/rcc/mco.rs index fa4b45a20..3d961df03 100644 --- a/embassy-stm32/src/rcc/mco.rs +++ b/embassy-stm32/src/rcc/mco.rs @@ -3,6 +3,7 @@ use core::marker::PhantomData; use embassy_hal_internal::PeripheralType; use crate::gpio::{AfType, OutputType, Speed}; +use crate::pac::RCC; #[cfg(not(any(stm32f1, rcc_f0v1, rcc_f3v1, rcc_f37)))] pub use crate::pac::rcc::vals::Mcopre as McoPrescaler; #[cfg(not(any( @@ -31,8 +32,7 @@ pub use crate::pac::rcc::vals::Mcosel as McoSource; rcc_h7rs ))] pub use crate::pac::rcc::vals::{Mco1sel as Mco1Source, Mco2sel as Mco2Source}; -use crate::pac::RCC; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; #[cfg(any(stm32f1, rcc_f0v1, rcc_f3v1, rcc_f37))] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index c41f81816..addfca3c3 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs @@ -33,7 +33,7 @@ mod _version; pub use _version::*; use stm32_metapac::RCC; -pub use crate::_generated::{mux, Clocks}; +pub use crate::_generated::{Clocks, mux}; use crate::time::Hertz; #[cfg(feature = "low-power")] diff --git a/embassy-stm32/src/rcc/u5.rs b/embassy-stm32/src/rcc/u5.rs index 06895a99a..7b0dcb63f 100644 --- a/embassy-stm32/src/rcc/u5.rs +++ b/embassy-stm32/src/rcc/u5.rs @@ -6,9 +6,9 @@ pub use crate::pac::rcc::vals::{ Pllsrc as PllSource, Ppre as APBPrescaler, Sw as Sysclk, }; use crate::pac::rcc::vals::{Hseext, Msipllfast, Msipllsel, Msirgsel, Pllmboost, Pllrge}; -#[cfg(all(peri_usb_otg_hs))] -pub use crate::pac::{syscfg::vals::Usbrefcksel, SYSCFG}; use crate::pac::{FLASH, PWR, RCC}; +#[cfg(all(peri_usb_otg_hs))] +pub use crate::pac::{SYSCFG, syscfg::vals::Usbrefcksel}; use crate::rcc::LSI_FREQ; use crate::time::Hertz; @@ -442,7 +442,10 @@ pub(crate) unsafe fn init(config: Config) { Hertz(24_000_000) => Usbrefcksel::MHZ24, Hertz(26_000_000) => Usbrefcksel::MHZ26, Hertz(32_000_000) => Usbrefcksel::MHZ32, - _ => panic!("cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz", clk_val), + _ => panic!( + "cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz", + clk_val + ), }, None => Usbrefcksel::MHZ24, }; diff --git a/embassy-stm32/src/rcc/wba.rs b/embassy-stm32/src/rcc/wba.rs index 481437939..2528996d5 100644 --- a/embassy-stm32/src/rcc/wba.rs +++ b/embassy-stm32/src/rcc/wba.rs @@ -7,9 +7,9 @@ pub use crate::pac::rcc::vals::{ Hdiv5, Hpre as AHBPrescaler, Hpre5 as AHB5Prescaler, Hsepre as HsePrescaler, Plldiv as PllDiv, Pllm as PllPreDiv, Plln as PllMul, Pllsrc as PllSource, Ppre as APBPrescaler, Sai1sel, Sw as Sysclk, }; -#[cfg(all(peri_usb_otg_hs))] -pub use crate::pac::{syscfg::vals::Usbrefcksel, SYSCFG}; use crate::pac::{FLASH, RCC}; +#[cfg(all(peri_usb_otg_hs))] +pub use crate::pac::{SYSCFG, syscfg::vals::Usbrefcksel}; use crate::rcc::LSI_FREQ; use crate::time::Hertz; @@ -245,7 +245,10 @@ pub(crate) unsafe fn init(config: Config) { Hertz(24_000_000) => Usbrefcksel::MHZ24, Hertz(26_000_000) => Usbrefcksel::MHZ26, Hertz(32_000_000) => Usbrefcksel::MHZ32, - _ => panic!("cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz", clk_val), + _ => panic!( + "cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz", + clk_val + ), }, None => Usbrefcksel::MHZ24, }; diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 63654639e..dada9bda1 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs @@ -9,7 +9,7 @@ use embassy_hal_internal::PeripheralType; use embassy_sync::waitqueue::AtomicWaker; use crate::interrupt::typelevel::Interrupt; -use crate::{interrupt, pac, peripherals, rcc, Peri}; +use crate::{Peri, interrupt, pac, peripherals, rcc}; static RNG_WAKER: AtomicWaker = AtomicWaker::new(); diff --git a/embassy-stm32/src/rtc/low_power.rs b/embassy-stm32/src/rtc/low_power.rs index a81ac6746..999f24714 100644 --- a/embassy-stm32/src/rtc/low_power.rs +++ b/embassy-stm32/src/rtc/low_power.rs @@ -1,7 +1,7 @@ #[cfg(feature = "time")] use embassy_time::{Duration, TICK_HZ}; -use super::{bcd2_to_byte, DateTimeError, Rtc, RtcError}; +use super::{DateTimeError, Rtc, RtcError, bcd2_to_byte}; use crate::interrupt::typelevel::Interrupt; use crate::peripherals::RTC; use crate::rtc::SealedInstance; diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs index 92dec0960..bc6df528b 100644 --- a/embassy-stm32/src/rtc/mod.rs +++ b/embassy-stm32/src/rtc/mod.rs @@ -7,13 +7,13 @@ mod low_power; #[cfg(feature = "low-power")] use core::cell::Cell; -#[cfg(feature = "low-power")] -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; #[cfg(feature = "low-power")] use embassy_sync::blocking_mutex::Mutex; +#[cfg(feature = "low-power")] +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; -use self::datetime::{day_of_week_from_u8, day_of_week_to_u8}; pub use self::datetime::{DateTime, DayOfWeek, Error as DateTimeError}; +use self::datetime::{day_of_week_from_u8, day_of_week_to_u8}; use crate::pac::rtc::regs::{Dr, Tr}; use crate::time::Hertz; @@ -25,8 +25,8 @@ mod _version; #[allow(unused_imports)] pub use _version::*; -use crate::peripherals::RTC; use crate::Peri; +use crate::peripherals::RTC; /// Errors that can occur on methods on [RtcClock] #[non_exhaustive] diff --git a/embassy-stm32/src/rtc/v3.rs b/embassy-stm32/src/rtc/v3.rs index d0b52049e..01da5d70a 100644 --- a/embassy-stm32/src/rtc/v3.rs +++ b/embassy-stm32/src/rtc/v3.rs @@ -1,4 +1,4 @@ -use stm32_metapac::rtc::vals::{Calp, Calw16, Calw8, Fmt, Key, Osel, Pol, TampalrmType}; +use stm32_metapac::rtc::vals::{Calp, Calw8, Calw16, Fmt, Key, Osel, Pol, TampalrmType}; use super::RtcCalibrationCyclePeriod; use crate::pac::rtc::Rtc; diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs index fb8b23b79..726d1729a 100644 --- a/embassy-stm32/src/sai/mod.rs +++ b/embassy-stm32/src/sai/mod.rs @@ -6,12 +6,12 @@ use core::marker::PhantomData; use embassy_hal_internal::PeripheralType; pub use crate::dma::word; -use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer}; +use crate::dma::{Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer, ringbuffer}; use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; pub use crate::pac::sai::vals::Mckdiv as MasterClockDivider; -use crate::pac::sai::{vals, Sai as Regs}; +use crate::pac::sai::{Sai as Regs, vals}; use crate::rcc::{self, RccPeripheral}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; /// SAI error #[derive(Debug, PartialEq, Eq, Clone, Copy)] diff --git a/embassy-stm32/src/sdmmc/mod.rs b/embassy-stm32/src/sdmmc/mod.rs index ccbd16cbf..408d1b764 100644 --- a/embassy-stm32/src/sdmmc/mod.rs +++ b/embassy-stm32/src/sdmmc/mod.rs @@ -11,9 +11,9 @@ use embassy_hal_internal::drop::OnDrop; use embassy_hal_internal::{Peri, PeripheralType}; use embassy_sync::waitqueue::AtomicWaker; use sdio_host::common_cmd::{self, Resp, ResponseLen}; -use sdio_host::emmc::{ExtCSD, EMMC}; -use sdio_host::sd::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatus, CIC, CID, CSD, OCR, RCA, SCR, SD}; -use sdio_host::{emmc_cmd, sd_cmd, Cmd}; +use sdio_host::emmc::{EMMC, ExtCSD}; +use sdio_host::sd::{BusWidth, CIC, CID, CSD, CardCapacity, CardStatus, CurrentState, OCR, RCA, SCR, SD, SDStatus}; +use sdio_host::{Cmd, emmc_cmd, sd_cmd}; #[cfg(sdmmc_v1)] use crate::dma::ChannelAndRequest; diff --git a/embassy-stm32/src/spdifrx/mod.rs b/embassy-stm32/src/spdifrx/mod.rs index b0a32d5d1..6f2d24560 100644 --- a/embassy-stm32/src/spdifrx/mod.rs +++ b/embassy-stm32/src/spdifrx/mod.rs @@ -13,7 +13,7 @@ use crate::gpio::{AfType, AnyPin, Pull, SealedPin as _}; use crate::interrupt::typelevel::Interrupt; use crate::pac::spdifrx::Spdifrx as Regs; use crate::rcc::{RccInfo, SealedRccPeripheral}; -use crate::{interrupt, peripherals, Peri}; +use crate::{Peri, interrupt, peripherals}; /// Possible S/PDIF preamble types. #[allow(dead_code)] diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs index c5373a54d..c27d09ea7 100644 --- a/embassy-stm32/src/spi/mod.rs +++ b/embassy-stm32/src/spi/mod.rs @@ -6,15 +6,15 @@ use core::ptr; use embassy_embedded_hal::SetConfig; use embassy_futures::join::join; -pub use embedded_hal_02::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; +pub use embedded_hal_02::spi::{MODE_0, MODE_1, MODE_2, MODE_3, Mode, Phase, Polarity}; -use crate::dma::{word, ChannelAndRequest}; +use crate::Peri; +use crate::dma::{ChannelAndRequest, word}; use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; use crate::mode::{Async, Blocking, Mode as PeriMode}; -use crate::pac::spi::{regs, vals, Spi as Regs}; +use crate::pac::spi::{Spi as Regs, regs, vals}; use crate::rcc::{RccInfo, SealedRccPeripheral}; use crate::time::Hertz; -use crate::Peri; /// SPI error. #[derive(Debug, PartialEq, Eq, Clone, Copy)] diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index 7db74bdf6..74b10a183 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs @@ -1,14 +1,14 @@ #![allow(non_snake_case)] use core::cell::{Cell, RefCell}; -use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; +use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; use critical_section::CriticalSection; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_time_driver::{Driver, TICK_HZ}; use embassy_time_queue_utils::Queue; -use stm32_metapac::timer::{regs, TimGp16}; +use stm32_metapac::timer::{TimGp16, regs}; use crate::interrupt::typelevel::Interrupt; use crate::pac::timer::vals; diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs index 484aae1d0..75a83629c 100644 --- a/embassy-stm32/src/timer/complementary_pwm.rs +++ b/embassy-stm32/src/timer/complementary_pwm.rs @@ -7,11 +7,11 @@ pub use stm32_metapac::timer::vals::{Ckd, Ossi, Ossr}; use super::low_level::{CountingMode, OutputPolarity, Timer}; use super::simple_pwm::PwmPin; use super::{AdvancedInstance4Channel, Ch1, Ch2, Ch3, Ch4, Channel, TimerComplementaryPin}; +use crate::Peri; use crate::gpio::{AnyPin, OutputType}; use crate::time::Hertz; -use crate::timer::low_level::OutputCompareMode; use crate::timer::TimerChannel; -use crate::Peri; +use crate::timer::low_level::OutputCompareMode; /// Complementary PWM pin wrapper. /// @@ -388,7 +388,7 @@ fn compute_dead_time_value(value: u16) -> (Ckd, u8) { #[cfg(test)] mod tests { - use super::{compute_dead_time_value, Ckd}; + use super::{Ckd, compute_dead_time_value}; #[test] fn test_compute_dead_time_value() { diff --git a/embassy-stm32/src/timer/input_capture.rs b/embassy-stm32/src/timer/input_capture.rs index 7a25e6c21..2a4ec2db0 100644 --- a/embassy-stm32/src/timer/input_capture.rs +++ b/embassy-stm32/src/timer/input_capture.rs @@ -8,11 +8,11 @@ use core::task::{Context, Poll}; use super::low_level::{CountingMode, FilterValue, InputCaptureMode, InputTISelection, Timer}; use super::{CaptureCompareInterruptHandler, Channel, GeneralInstance4Channel, TimerPin}; pub use super::{Ch1, Ch2, Ch3, Ch4}; +use crate::Peri; use crate::gpio::{AfType, AnyPin, Pull}; use crate::interrupt::typelevel::{Binding, Interrupt}; use crate::time::Hertz; use crate::timer::TimerChannel; -use crate::Peri; /// Capture pin wrapper. /// diff --git a/embassy-stm32/src/timer/one_pulse.rs b/embassy-stm32/src/timer/one_pulse.rs index a75b41bd7..fe8681356 100644 --- a/embassy-stm32/src/timer/one_pulse.rs +++ b/embassy-stm32/src/timer/one_pulse.rs @@ -11,12 +11,12 @@ use super::low_level::{ }; use super::{CaptureCompareInterruptHandler, Channel, ExternalTriggerPin, GeneralInstance4Channel, TimerPin}; pub use super::{Ch1, Ch2}; +use crate::Peri; use crate::gpio::{AfType, AnyPin, Pull}; use crate::interrupt::typelevel::{Binding, Interrupt}; use crate::pac::timer::vals::Etp; use crate::time::Hertz; use crate::timer::TimerChannel; -use crate::Peri; /// External input marker type. pub enum Ext {} diff --git a/embassy-stm32/src/timer/pwm_input.rs b/embassy-stm32/src/timer/pwm_input.rs index 159b5a177..da8a79b09 100644 --- a/embassy-stm32/src/timer/pwm_input.rs +++ b/embassy-stm32/src/timer/pwm_input.rs @@ -2,9 +2,9 @@ use super::low_level::{CountingMode, InputCaptureMode, InputTISelection, SlaveMode, Timer, TriggerSource}; use super::{Ch1, Ch2, Channel, GeneralInstance4Channel, TimerPin}; +use crate::Peri; use crate::gpio::{AfType, Pull}; use crate::time::Hertz; -use crate::Peri; /// PWM Input driver. /// diff --git a/embassy-stm32/src/timer/qei.rs b/embassy-stm32/src/timer/qei.rs index bb152731c..a547a2a19 100644 --- a/embassy-stm32/src/timer/qei.rs +++ b/embassy-stm32/src/timer/qei.rs @@ -5,9 +5,9 @@ use stm32_metapac::timer::vals::{self, Sms}; use super::low_level::Timer; pub use super::{Ch1, Ch2}; use super::{GeneralInstance4Channel, TimerPin}; +use crate::Peri; use crate::gpio::{AfType, AnyPin, Pull}; use crate::timer::TimerChannel; -use crate::Peri; /// Qei driver config. #[cfg_attr(feature = "defmt", derive(defmt::Format))] diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs index e6165e42b..06315d7f3 100644 --- a/embassy-stm32/src/timer/simple_pwm.rs +++ b/embassy-stm32/src/timer/simple_pwm.rs @@ -5,11 +5,11 @@ use core::mem::ManuallyDrop; use super::low_level::{CountingMode, OutputCompareMode, OutputPolarity, Timer}; use super::{Ch1, Ch2, Ch3, Ch4, Channel, GeneralInstance4Channel, TimerBits, TimerChannel, TimerPin}; +use crate::Peri; #[cfg(gpio_v2)] use crate::gpio::Pull; use crate::gpio::{AfType, AnyPin, OutputType, Speed}; use crate::time::Hertz; -use crate::Peri; /// PWM pin wrapper. /// diff --git a/embassy-stm32/src/tsc/acquisition_banks.rs b/embassy-stm32/src/tsc/acquisition_banks.rs index 7d6442b48..097cf7942 100644 --- a/embassy-stm32/src/tsc/acquisition_banks.rs +++ b/embassy-stm32/src/tsc/acquisition_banks.rs @@ -1,11 +1,11 @@ +use super::TSC_NUM_GROUPS; use super::io_pin::*; #[cfg(any(tsc_v2, tsc_v3))] use super::pin_groups::G7; #[cfg(tsc_v3)] use super::pin_groups::G8; -use super::pin_groups::{pin_roles, G1, G2, G3, G4, G5, G6}; +use super::pin_groups::{G1, G2, G3, G4, G5, G6, pin_roles}; use super::types::{Group, GroupStatus}; -use super::TSC_NUM_GROUPS; /// Represents a collection of TSC (Touch Sensing Controller) pins for an acquisition bank. /// diff --git a/embassy-stm32/src/tsc/pin_groups.rs b/embassy-stm32/src/tsc/pin_groups.rs index 84421f7ff..9347e6bc0 100644 --- a/embassy-stm32/src/tsc/pin_groups.rs +++ b/embassy-stm32/src/tsc/pin_groups.rs @@ -1,11 +1,11 @@ use core::marker::PhantomData; use core::ops::BitOr; +use super::Instance; use super::errors::GroupError; use super::io_pin::*; -use super::Instance; -use crate::gpio::{AfType, AnyPin, OutputType, Speed}; use crate::Peri; +use crate::gpio::{AfType, AnyPin, OutputType, Speed}; /// Pin type definition to control IO parameters #[derive(PartialEq, Clone, Copy)] diff --git a/embassy-stm32/src/ucpd.rs b/embassy-stm32/src/ucpd.rs index 18aff4fbd..8f259a917 100644 --- a/embassy-stm32/src/ucpd.rs +++ b/embassy-stm32/src/ucpd.rs @@ -19,8 +19,8 @@ use core::marker::PhantomData; use core::sync::atomic::{AtomicBool, Ordering}; use core::task::Poll; -use embassy_hal_internal::drop::OnDrop; use embassy_hal_internal::PeripheralType; +use embassy_hal_internal::drop::OnDrop; use embassy_sync::waitqueue::AtomicWaker; use crate::dma::{ChannelAndRequest, TransferOptions}; @@ -28,7 +28,7 @@ use crate::interrupt::typelevel::Interrupt; use crate::pac::ucpd::vals::{Anamode, Ccenable, PscUsbpdclk, Txmode}; pub use crate::pac::ucpd::vals::{Phyccsel as CcSel, Rxordset, TypecVstateCc as CcVState}; use crate::rcc::{self, RccPeripheral}; -use crate::{interrupt, Peri}; +use crate::{Peri, interrupt}; pub(crate) fn init( _cs: critical_section::CriticalSection, diff --git a/embassy-stm32/src/usart/buffered.rs b/embassy-stm32/src/usart/buffered.rs index 10dc02334..69c3a740f 100644 --- a/embassy-stm32/src/usart/buffered.rs +++ b/embassy-stm32/src/usart/buffered.rs @@ -5,16 +5,16 @@ use core::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering}; use core::task::Poll; use embassy_embedded_hal::SetConfig; -use embassy_hal_internal::atomic_ring_buffer::RingBuffer; use embassy_hal_internal::Peri; +use embassy_hal_internal::atomic_ring_buffer::RingBuffer; use embassy_sync::waitqueue::AtomicWaker; #[cfg(not(any(usart_v1, usart_v2)))] use super::DePin; use super::{ + Config, ConfigError, CtsPin, Duplex, Error, HalfDuplexReadback, Info, Instance, Regs, RtsPin, RxPin, TxPin, clear_interrupt_flags, configure, half_duplex_set_rx_tx_before_write, rdr, reconfigure, send_break, set_baudrate, - sr, tdr, Config, ConfigError, CtsPin, Duplex, Error, HalfDuplexReadback, Info, Instance, Regs, RtsPin, RxPin, - TxPin, + sr, tdr, }; use crate::gpio::{AfType, AnyPin, Pull, SealedPin as _}; use crate::interrupt::{self, InterruptExt}; diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs index 0d2d86aca..0e7da634d 100644 --- a/embassy-stm32/src/usart/mod.rs +++ b/embassy-stm32/src/usart/mod.rs @@ -4,15 +4,16 @@ use core::future::poll_fn; use core::marker::PhantomData; -use core::sync::atomic::{compiler_fence, AtomicU8, AtomicUsize, Ordering}; +use core::sync::atomic::{AtomicU8, AtomicUsize, Ordering, compiler_fence}; use core::task::Poll; use embassy_embedded_hal::SetConfig; -use embassy_hal_internal::drop::OnDrop; use embassy_hal_internal::PeripheralType; +use embassy_hal_internal::drop::OnDrop; use embassy_sync::waitqueue::AtomicWaker; -use futures_util::future::{select, Either}; +use futures_util::future::{Either, select}; +use crate::Peri; use crate::dma::ChannelAndRequest; use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; use crate::interrupt::typelevel::Interrupt as _; @@ -25,7 +26,6 @@ use crate::pac::usart::Usart as Regs; use crate::pac::usart::{regs, vals}; use crate::rcc::{RccInfo, SealedRccPeripheral}; use crate::time::Hertz; -use crate::Peri; /// Interrupt handler. pub struct InterruptHandler { diff --git a/embassy-stm32/src/usart/ringbuffered.rs b/embassy-stm32/src/usart/ringbuffered.rs index 27071fb31..20bfefd9e 100644 --- a/embassy-stm32/src/usart/ringbuffered.rs +++ b/embassy-stm32/src/usart/ringbuffered.rs @@ -1,19 +1,19 @@ use core::future::poll_fn; use core::mem; -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use core::task::Poll; use embassy_embedded_hal::SetConfig; use embedded_io_async::ReadReady; -use futures_util::future::{select, Either}; +use futures_util::future::{Either, select}; -use super::{rdr, reconfigure, set_baudrate, sr, Config, ConfigError, Error, Info, State, UartRx}; +use super::{Config, ConfigError, Error, Info, State, UartRx, rdr, reconfigure, set_baudrate, sr}; +use crate::Peri; use crate::dma::ReadableRingBuffer; use crate::gpio::{AnyPin, SealedPin as _}; use crate::mode::Async; use crate::time::Hertz; use crate::usart::Regs; -use crate::Peri; /// Rx-only Ring-buffered UART Driver /// diff --git a/embassy-stm32/src/usb/otg.rs b/embassy-stm32/src/usb/otg.rs index 5ce81b131..f6b1a81db 100644 --- a/embassy-stm32/src/usb/otg.rs +++ b/embassy-stm32/src/usb/otg.rs @@ -2,18 +2,18 @@ use core::marker::PhantomData; use embassy_hal_internal::PeripheralType; use embassy_usb_driver::{EndpointAddress, EndpointAllocError, EndpointType, Event, Unsupported}; -use embassy_usb_synopsys_otg::otg_v1::vals::Dspd; -use embassy_usb_synopsys_otg::otg_v1::Otg; pub use embassy_usb_synopsys_otg::Config; +use embassy_usb_synopsys_otg::otg_v1::Otg; +use embassy_usb_synopsys_otg::otg_v1::vals::Dspd; use embassy_usb_synopsys_otg::{ - on_interrupt as on_interrupt_impl, Bus as OtgBus, ControlPipe, Driver as OtgDriver, Endpoint, In, OtgInstance, Out, - PhyType, State, + Bus as OtgBus, ControlPipe, Driver as OtgDriver, Endpoint, In, OtgInstance, Out, PhyType, State, + on_interrupt as on_interrupt_impl, }; use crate::gpio::{AfType, OutputType, Speed}; use crate::interrupt::typelevel::Interrupt; use crate::rcc::{self, RccPeripheral}; -use crate::{interrupt, Peri}; +use crate::{Peri, interrupt}; const MAX_EP_COUNT: usize = 9; diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs index 9e08d99b3..d405e4802 100644 --- a/embassy-stm32/src/usb/usb.rs +++ b/embassy-stm32/src/usb/usb.rs @@ -12,11 +12,11 @@ use embassy_usb_driver::{ Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointInfo, EndpointType, Event, Unsupported, }; +use crate::pac::USBRAM; use crate::pac::usb::regs; use crate::pac::usb::vals::{EpType, Stat}; -use crate::pac::USBRAM; use crate::rcc::RccPeripheral; -use crate::{interrupt, Peri}; +use crate::{Peri, interrupt}; /// Interrupt handler. pub struct InterruptHandler { diff --git a/embassy-stm32/src/vrefbuf/mod.rs b/embassy-stm32/src/vrefbuf/mod.rs index ccbd748d5..b061306a0 100644 --- a/embassy-stm32/src/vrefbuf/mod.rs +++ b/embassy-stm32/src/vrefbuf/mod.rs @@ -62,8 +62,7 @@ impl<'d, T: Instance> VoltageReferenceBuffer<'d, T> { } trace!( "Vrefbuf configured with voltage scale {} and impedance mode {}", - voltage_scale as u8, - impedance_mode as u8, + voltage_scale as u8, impedance_mode as u8, ); VoltageReferenceBuffer { vrefbuf: PhantomData } } diff --git a/embassy-stm32/src/wdg/mod.rs b/embassy-stm32/src/wdg/mod.rs index fb5c3d930..1164739ff 100644 --- a/embassy-stm32/src/wdg/mod.rs +++ b/embassy-stm32/src/wdg/mod.rs @@ -4,8 +4,8 @@ use core::marker::PhantomData; use embassy_hal_internal::PeripheralType; use stm32_metapac::iwdg::vals::{Key, Pr}; -use crate::rcc::LSI_FREQ; use crate::Peri; +use crate::rcc::LSI_FREQ; /// Independent watchdog (IWDG) driver. pub struct IndependentWatchdog<'d, T: Instance> { diff --git a/embassy-stm32/src/xspi/mod.rs b/embassy-stm32/src/xspi/mod.rs index 901569f64..a80a2692b 100644 --- a/embassy-stm32/src/xspi/mod.rs +++ b/embassy-stm32/src/xspi/mod.rs @@ -11,15 +11,15 @@ use embassy_embedded_hal::{GetConfig, SetConfig}; use embassy_hal_internal::PeripheralType; pub use enums::*; -use crate::dma::{word, ChannelAndRequest}; +use crate::dma::{ChannelAndRequest, word}; use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; use crate::mode::{Async, Blocking, Mode as PeriMode}; -use crate::pac::xspi::vals::*; use crate::pac::xspi::Xspi as Regs; +use crate::pac::xspi::vals::*; #[cfg(xspim_v1)] use crate::pac::xspim::Xspim; use crate::rcc::{self, RccPeripheral}; -use crate::{peripherals, Peri}; +use crate::{Peri, peripherals}; /// XPSI driver config. #[derive(Clone, Copy)] diff --git a/embassy-sync/src/channel.rs b/embassy-sync/src/channel.rs index de437cc52..dbd24a6c7 100644 --- a/embassy-sync/src/channel.rs +++ b/embassy-sync/src/channel.rs @@ -50,8 +50,8 @@ use core::task::{Context, Poll}; use heapless::Deque; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; use crate::waitqueue::WakerRegistration; /// Send-only access to a [`Channel`]. @@ -1112,11 +1112,13 @@ mod tests { static CHANNEL: StaticCell> = StaticCell::new(); let c = &*CHANNEL.init(Channel::new()); let c2 = c; - assert!(executor - .spawn(async move { - assert!(c2.try_send(1).is_ok()); - }) - .is_ok()); + assert!( + executor + .spawn(async move { + assert!(c2.try_send(1).is_ok()); + }) + .is_ok() + ); assert_eq!(c.receive().await, 1); } @@ -1143,13 +1145,15 @@ mod tests { // However, I've used the debugger to observe that the send does indeed wait. Delay::new(Duration::from_millis(500)).await; assert_eq!(c.receive().await, 1); - assert!(executor - .spawn(async move { - loop { - c.receive().await; - } - }) - .is_ok()); + assert!( + executor + .spawn(async move { + loop { + c.receive().await; + } + }) + .is_ok() + ); send_task_1.unwrap().await; send_task_2.unwrap().await; } diff --git a/embassy-sync/src/mutex.rs b/embassy-sync/src/mutex.rs index aea682899..96b834f02 100644 --- a/embassy-sync/src/mutex.rs +++ b/embassy-sync/src/mutex.rs @@ -2,13 +2,13 @@ //! //! This module provides a mutex that can be used to synchronize data between asynchronous tasks. use core::cell::{RefCell, UnsafeCell}; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::ops::{Deref, DerefMut}; use core::task::Poll; use core::{fmt, mem}; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex as BlockingMutex; +use crate::blocking_mutex::raw::RawMutex; use crate::waitqueue::WakerRegistration; /// Error returned by [`Mutex::try_lock`] diff --git a/embassy-sync/src/once_lock.rs b/embassy-sync/src/once_lock.rs index 73edfea9a..2af19ca20 100644 --- a/embassy-sync/src/once_lock.rs +++ b/embassy-sync/src/once_lock.rs @@ -2,7 +2,7 @@ use core::cell::Cell; use core::fmt::{Debug, Formatter}; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::mem::MaybeUninit; use core::sync::atomic::{AtomicBool, Ordering}; use core::task::Poll; diff --git a/embassy-sync/src/pipe.rs b/embassy-sync/src/pipe.rs index 6d624979a..215a556d9 100644 --- a/embassy-sync/src/pipe.rs +++ b/embassy-sync/src/pipe.rs @@ -7,8 +7,8 @@ use core::ops::Range; use core::pin::Pin; use core::task::{Context, Poll}; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; use crate::ring_buffer::RingBuffer; use crate::waitqueue::WakerRegistration; diff --git a/embassy-sync/src/priority_channel.rs b/embassy-sync/src/priority_channel.rs index 715a20e86..1af7d9221 100644 --- a/embassy-sync/src/priority_channel.rs +++ b/embassy-sync/src/priority_channel.rs @@ -8,11 +8,11 @@ use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; -pub use heapless::binary_heap::{Kind, Max, Min}; use heapless::BinaryHeap; +pub use heapless::binary_heap::{Kind, Max, Min}; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; use crate::channel::{DynamicChannel, DynamicReceiver, DynamicSender, TryReceiveError, TrySendError}; use crate::waitqueue::WakerRegistration; @@ -799,11 +799,13 @@ mod tests { static CHANNEL: StaticCell> = StaticCell::new(); let c = &*CHANNEL.init(PriorityChannel::new()); let c2 = c; - assert!(executor - .spawn(async move { - assert!(c2.try_send(1).is_ok()); - }) - .is_ok()); + assert!( + executor + .spawn(async move { + assert!(c2.try_send(1).is_ok()); + }) + .is_ok() + ); assert_eq!(c.receive().await, 1); } @@ -830,13 +832,15 @@ mod tests { // However, I've used the debugger to observe that the send does indeed wait. Delay::new(Duration::from_millis(500)).await; assert_eq!(c.receive().await, 1); - assert!(executor - .spawn(async move { - loop { - c.receive().await; - } - }) - .is_ok()); + assert!( + executor + .spawn(async move { + loop { + c.receive().await; + } + }) + .is_ok() + ); send_task_1.unwrap().await; send_task_2.unwrap().await; } diff --git a/embassy-sync/src/pubsub/mod.rs b/embassy-sync/src/pubsub/mod.rs index ad9402f5a..127a208f1 100644 --- a/embassy-sync/src/pubsub/mod.rs +++ b/embassy-sync/src/pubsub/mod.rs @@ -10,8 +10,8 @@ use heapless::Deque; use self::publisher::{ImmediatePub, Pub}; use self::subscriber::Sub; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; use crate::waitqueue::MultiWakerRegistration; pub mod publisher; diff --git a/embassy-sync/src/ring_buffer.rs b/embassy-sync/src/ring_buffer.rs index f03b7dd8f..608447cd6 100644 --- a/embassy-sync/src/ring_buffer.rs +++ b/embassy-sync/src/ring_buffer.rs @@ -95,11 +95,7 @@ impl RingBuffer { fn wrap(&self, n: usize) -> usize { assert!(n <= N); - if n == N { - 0 - } else { - n - } + if n == N { 0 } else { n } } } diff --git a/embassy-sync/src/rwlock.rs b/embassy-sync/src/rwlock.rs index e43388c4d..918a6aa41 100644 --- a/embassy-sync/src/rwlock.rs +++ b/embassy-sync/src/rwlock.rs @@ -3,12 +3,12 @@ //! This module provides a read-write lock that can be used to synchronize data between asynchronous tasks. use core::cell::{RefCell, UnsafeCell}; use core::fmt; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::ops::{Deref, DerefMut}; use core::task::Poll; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex as BlockingMutex; +use crate::blocking_mutex::raw::RawMutex; use crate::waitqueue::WakerRegistration; /// Error returned by [`RwLock::try_read`] and [`RwLock::try_write`] when the lock is already held. diff --git a/embassy-sync/src/semaphore.rs b/embassy-sync/src/semaphore.rs index 4e82b0fcd..8d2413931 100644 --- a/embassy-sync/src/semaphore.rs +++ b/embassy-sync/src/semaphore.rs @@ -1,13 +1,13 @@ //! A synchronization primitive for controlling access to a pool of resources. use core::cell::{Cell, RefCell}; use core::convert::Infallible; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::task::{Poll, Waker}; use heapless::Deque; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; use crate::waitqueue::WakerRegistration; /// An asynchronous semaphore. diff --git a/embassy-sync/src/signal.rs b/embassy-sync/src/signal.rs index 229b1fa99..cc02228cf 100644 --- a/embassy-sync/src/signal.rs +++ b/embassy-sync/src/signal.rs @@ -1,10 +1,10 @@ //! A synchronization primitive for passing the latest value to a task. use core::cell::Cell; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::task::{Context, Poll, Waker}; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; /// Single-slot signaling primitive for a _single_ consumer. /// diff --git a/embassy-sync/src/waitqueue/atomic_waker.rs b/embassy-sync/src/waitqueue/atomic_waker.rs index 5a9910e7f..d2bf890e5 100644 --- a/embassy-sync/src/waitqueue/atomic_waker.rs +++ b/embassy-sync/src/waitqueue/atomic_waker.rs @@ -1,8 +1,8 @@ use core::cell::Cell; use core::task::Waker; -use crate::blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex}; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex}; /// Utility struct to register and wake a waker. /// If a waker is registered, registering another waker will replace the previous one without waking it. diff --git a/embassy-sync/src/watch.rs b/embassy-sync/src/watch.rs index 332ab5405..0f8a8d679 100644 --- a/embassy-sync/src/watch.rs +++ b/embassy-sync/src/watch.rs @@ -1,13 +1,13 @@ //! A synchronization primitive for passing the latest value to **multiple** receivers. use core::cell::RefCell; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::ops::{Deref, DerefMut}; use core::task::{Context, Poll}; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; use crate::waitqueue::MultiWakerRegistration; /// The `Watch` is a single-slot signaling primitive that allows _multiple_ (`N`) receivers to concurrently await diff --git a/embassy-sync/src/zerocopy_channel.rs b/embassy-sync/src/zerocopy_channel.rs index b3f7dbe8c..c572592b8 100644 --- a/embassy-sync/src/zerocopy_channel.rs +++ b/embassy-sync/src/zerocopy_channel.rs @@ -15,12 +15,12 @@ //! another message will result in an error being returned. use core::cell::RefCell; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::task::{Context, Poll}; -use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; +use crate::blocking_mutex::raw::RawMutex; use crate::waitqueue::WakerRegistration; /// A bounded zero-copy channel for communicating between asynchronous tasks @@ -296,11 +296,7 @@ struct State { impl State { fn increment(&self, i: usize) -> usize { - if i + 1 == self.capacity { - 0 - } else { - i + 1 - } + if i + 1 == self.capacity { 0 } else { i + 1 } } fn clear(&mut self) { diff --git a/embassy-time-queue-utils/src/queue_generic.rs b/embassy-time-queue-utils/src/queue_generic.rs index bff7a4735..88986953d 100644 --- a/embassy-time-queue-utils/src/queue_generic.rs +++ b/embassy-time-queue-utils/src/queue_generic.rs @@ -2,7 +2,7 @@ //! //! Time queue drivers may use this to simplify their implementation. -use core::cmp::{min, Ordering}; +use core::cmp::{Ordering, min}; use core::task::Waker; use heapless::Vec; diff --git a/embassy-time/src/duration.rs b/embassy-time/src/duration.rs index b3ea0468d..b2bfd6de9 100644 --- a/embassy-time/src/duration.rs +++ b/embassy-time/src/duration.rs @@ -175,13 +175,7 @@ impl Duration { /// NOTE: Giving this function a hz >= the TICK_HZ of your platform will clamp the Duration to 1 /// tick. Doing so will not deadlock, but will certainly not produce the desired output. pub const fn from_hz(hz: u64) -> Duration { - let ticks = { - if hz >= TICK_HZ { - 1 - } else { - (TICK_HZ + hz / 2) / hz - } - }; + let ticks = { if hz >= TICK_HZ { 1 } else { (TICK_HZ + hz / 2) / hz } }; Duration { ticks } } diff --git a/embassy-time/src/lib.rs b/embassy-time/src/lib.rs index 5a511a0bd..e375fe93e 100644 --- a/embassy-time/src/lib.rs +++ b/embassy-time/src/lib.rs @@ -28,18 +28,14 @@ mod driver_std; #[cfg(feature = "wasm")] mod driver_wasm; -pub use delay::{block_for, Delay}; +pub use delay::{Delay, block_for}; pub use duration::Duration; pub use embassy_time_driver::TICK_HZ; pub use instant::Instant; -pub use timer::{with_deadline, with_timeout, Ticker, TimeoutError, Timer, WithTimeout}; +pub use timer::{Ticker, TimeoutError, Timer, WithTimeout, with_deadline, with_timeout}; const fn gcd(a: u64, b: u64) -> u64 { - if b == 0 { - a - } else { - gcd(b, a % b) - } + if b == 0 { a } else { gcd(b, a % b) } } pub(crate) const GCD_1K: u64 = gcd(TICK_HZ, 1_000); diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index fcf79f58e..2f5967c63 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs @@ -1,9 +1,9 @@ -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::pin::Pin; use core::task::{Context, Poll}; -use futures_core::stream::FusedStream; use futures_core::Stream; +use futures_core::stream::FusedStream; use crate::{Duration, Instant}; diff --git a/embassy-usb-dfu/src/application.rs b/embassy-usb-dfu/src/application.rs index 78eb2c083..1ea1a74fe 100644 --- a/embassy-usb-dfu/src/application.rs +++ b/embassy-usb-dfu/src/application.rs @@ -6,11 +6,11 @@ use embassy_usb::driver::Driver; use embassy_usb::{Builder, FunctionBuilder, Handler}; use embedded_storage::nor_flash::NorFlash; +use crate::Reset; use crate::consts::{ - DfuAttributes, Request, State, Status, APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_RT, + APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_RT, DfuAttributes, Request, State, Status, USB_CLASS_APPN_SPEC, }; -use crate::Reset; /// Generic interface for a system that can signal to the bootloader that USB DFU mode is needed on the next boot. /// diff --git a/embassy-usb-dfu/src/dfu.rs b/embassy-usb-dfu/src/dfu.rs index 7c28d04cf..2ed4511ce 100644 --- a/embassy-usb-dfu/src/dfu.rs +++ b/embassy-usb-dfu/src/dfu.rs @@ -5,11 +5,11 @@ use embassy_usb::driver::Driver; use embassy_usb::{Builder, FunctionBuilder, Handler}; use embedded_storage::nor_flash::{NorFlash, NorFlashErrorKind}; +use crate::Reset; use crate::consts::{ - DfuAttributes, Request, State, Status, APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_DFU, + APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_DFU, DfuAttributes, Request, State, Status, USB_CLASS_APPN_SPEC, }; -use crate::Reset; /// Internal state for USB DFU pub struct Control<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> { diff --git a/embassy-usb-synopsys-otg/src/lib.rs b/embassy-usb-synopsys-otg/src/lib.rs index b8750491d..d94209f45 100644 --- a/embassy-usb-synopsys-otg/src/lib.rs +++ b/embassy-usb-synopsys-otg/src/lib.rs @@ -23,7 +23,7 @@ use crate::fmt::Bytes; pub mod otg_v1; -use otg_v1::{regs, vals, Otg}; +use otg_v1::{Otg, regs, vals}; /// Handle interrupts. pub unsafe fn on_interrupt(r: Otg, state: &State, ep_count: usize) { @@ -680,9 +680,7 @@ impl<'d, const MAX_EP_COUNT: usize> Bus<'d, MAX_EP_COUNT> { if let Some(ep) = self.ep_in[i] { trace!( "configuring tx fifo ep={}, offset={}, size={}", - i, - fifo_top, - ep.fifo_size_words + i, fifo_top, ep.fifo_size_words ); let dieptxf = if i == 0 { regs.dieptxf0() } else { regs.dieptxf(i - 1) }; @@ -1159,9 +1157,7 @@ impl<'d> embassy_usb_driver::EndpointIn for Endpoint<'d, In> { let dtxfsts = self.regs.dtxfsts(index).read(); trace!( "write ep={:?}: diepctl {:08x} ftxfsts {:08x}", - self.info.addr, - diepctl.0, - dtxfsts.0 + self.info.addr, diepctl.0, dtxfsts.0 ); if !diepctl.usbaep() { trace!("write ep={:?} wait for prev: error disabled", self.info.addr); @@ -1376,11 +1372,7 @@ fn ep_irq_mask(eps: &[Option]) -> u16 { eps.iter().enumerate().fold( 0, |mask, (index, ep)| { - if ep.is_some() { - mask | (1 << index) - } else { - mask - } + if ep.is_some() { mask | (1 << index) } else { mask } }, ) } diff --git a/embassy-usb/src/builder.rs b/embassy-usb/src/builder.rs index 8d7abe46c..6fc2a5a22 100644 --- a/embassy-usb/src/builder.rs +++ b/embassy-usb/src/builder.rs @@ -5,7 +5,7 @@ use crate::descriptor::{BosWriter, DescriptorWriter, SynchronizationType, UsageT use crate::driver::{Driver, Endpoint, EndpointAddress, EndpointInfo, EndpointType}; use crate::msos::{DeviceLevelDescriptor, FunctionLevelDescriptor, MsOsDescriptorWriter}; use crate::types::{InterfaceNumber, StringIndex}; -use crate::{Handler, Interface, UsbDevice, MAX_INTERFACE_COUNT, STRING_INDEX_CUSTOM_START}; +use crate::{Handler, Interface, MAX_INTERFACE_COUNT, STRING_INDEX_CUSTOM_START, UsbDevice}; #[derive(Debug, Copy, Clone)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] @@ -176,7 +176,9 @@ impl<'d, D: Driver<'d>> Builder<'d, D> { if config.composite_with_iads && (config.device_class != 0xEF || config.device_sub_class != 0x02 || config.device_protocol != 0x01) { - panic!("if composite_with_iads is set, you must set device_class = 0xEF, device_sub_class = 0x02, device_protocol = 0x01"); + panic!( + "if composite_with_iads is set, you must set device_class = 0xEF, device_sub_class = 0x02, device_protocol = 0x01" + ); } assert!( @@ -337,7 +339,8 @@ impl<'a, 'd, D: Driver<'d>> FunctionBuilder<'a, 'd, D> { num_alt_settings: 0, }; - assert!(self.builder.interfaces.push(iface).is_ok(), + assert!( + self.builder.interfaces.push(iface).is_ok(), "embassy-usb: interface list full. Increase the `max_interface_count` compile-time setting. Current value: {}", MAX_INTERFACE_COUNT ); diff --git a/embassy-usb/src/class/cdc_acm.rs b/embassy-usb/src/class/cdc_acm.rs index 0a1a5e64f..388e21fbd 100644 --- a/embassy-usb/src/class/cdc_acm.rs +++ b/embassy-usb/src/class/cdc_acm.rs @@ -1,7 +1,7 @@ //! CDC-ACM class implementation, aka Serial over USB. use core::cell::{Cell, RefCell}; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::mem::{self, MaybeUninit}; use core::sync::atomic::{AtomicBool, Ordering}; use core::task::Poll; diff --git a/embassy-usb/src/class/cdc_ncm/embassy_net.rs b/embassy-usb/src/class/cdc_ncm/embassy_net.rs index 57d322946..c83ff468a 100644 --- a/embassy-usb/src/class/cdc_ncm/embassy_net.rs +++ b/embassy-usb/src/class/cdc_ncm/embassy_net.rs @@ -1,6 +1,6 @@ //! [`embassy-net`](https://crates.io/crates/embassy-net) driver for the CDC-NCM class. -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_net_driver_channel as ch; use embassy_net_driver_channel::driver::LinkState; use embassy_usb_driver::Driver; diff --git a/embassy-usb/src/class/cdc_ncm/mod.rs b/embassy-usb/src/class/cdc_ncm/mod.rs index 3af853091..9b6dd9f21 100644 --- a/embassy-usb/src/class/cdc_ncm/mod.rs +++ b/embassy-usb/src/class/cdc_ncm/mod.rs @@ -14,7 +14,7 @@ //! This is due to regex spaghetti: //! and this nonsense in the linux kernel: -use core::mem::{size_of, MaybeUninit}; +use core::mem::{MaybeUninit, size_of}; use core::ptr::{addr_of, copy_nonoverlapping}; use crate::control::{self, InResponse, OutResponse, Recipient, Request, RequestType}; diff --git a/embassy-usb/src/class/cmsis_dap_v2.rs b/embassy-usb/src/class/cmsis_dap_v2.rs index a9fd9cdf0..0e2356f17 100644 --- a/embassy-usb/src/class/cmsis_dap_v2.rs +++ b/embassy-usb/src/class/cmsis_dap_v2.rs @@ -4,7 +4,7 @@ use core::mem::MaybeUninit; use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; use crate::types::StringIndex; -use crate::{msos, Builder, Handler}; +use crate::{Builder, Handler, msos}; /// State for the CMSIS-DAP v2 USB class. pub struct State { diff --git a/embassy-usb/src/class/midi.rs b/embassy-usb/src/class/midi.rs index 1d152ca44..d29172be1 100644 --- a/embassy-usb/src/class/midi.rs +++ b/embassy-usb/src/class/midi.rs @@ -1,7 +1,7 @@ //! MIDI class implementation. -use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; use crate::Builder; +use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; /// This should be used as `device_class` when building the `UsbDevice`. pub const USB_AUDIO_CLASS: u8 = 0x01; diff --git a/embassy-usb/src/class/uac1/speaker.rs b/embassy-usb/src/class/uac1/speaker.rs index 9565e2a25..46e0420d5 100644 --- a/embassy-usb/src/class/uac1/speaker.rs +++ b/embassy-usb/src/class/uac1/speaker.rs @@ -11,7 +11,7 @@ //! The class provides volume and mute controls for each channel. use core::cell::{Cell, RefCell}; -use core::future::{poll_fn, Future}; +use core::future::{Future, poll_fn}; use core::marker::PhantomData; use core::sync::atomic::{AtomicBool, AtomicU32, Ordering}; use core::task::Poll; @@ -22,7 +22,7 @@ use heapless::Vec; use super::class_codes::*; use super::terminal_type::TerminalType; -use super::{Channel, ChannelConfig, FeedbackRefresh, SampleWidth, MAX_AUDIO_CHANNEL_COUNT, MAX_AUDIO_CHANNEL_INDEX}; +use super::{Channel, ChannelConfig, FeedbackRefresh, MAX_AUDIO_CHANNEL_COUNT, MAX_AUDIO_CHANNEL_INDEX, SampleWidth}; use crate::control::{self, InResponse, OutResponse, Recipient, Request, RequestType}; use crate::descriptor::{SynchronizationType, UsageType}; use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut, EndpointType}; diff --git a/embassy-usb/src/descriptor.rs b/embassy-usb/src/descriptor.rs index e9a6fd79a..c79dd02eb 100644 --- a/embassy-usb/src/descriptor.rs +++ b/embassy-usb/src/descriptor.rs @@ -1,10 +1,10 @@ //! Utilities for writing USB descriptors. use embassy_usb_driver::EndpointType; +use crate::CONFIGURATION_VALUE; use crate::builder::Config; use crate::driver::EndpointInfo; use crate::types::{InterfaceNumber, StringIndex}; -use crate::CONFIGURATION_VALUE; /// Standard descriptor types #[allow(missing_docs)] diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs index 7f78de29d..0c10c08df 100644 --- a/embassy-usb/src/lib.rs +++ b/embassy-usb/src/lib.rs @@ -21,7 +21,7 @@ mod config { include!(concat!(env!("OUT_DIR"), "/config.rs")); } -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use heapless::Vec; pub use crate::builder::{Builder, Config, FunctionBuilder, InterfaceAltBuilder, InterfaceBuilder, UsbVersion}; diff --git a/embassy-usb/src/msos.rs b/embassy-usb/src/msos.rs index 9f4e1a57b..66689871e 100644 --- a/embassy-usb/src/msos.rs +++ b/embassy-usb/src/msos.rs @@ -4,7 +4,7 @@ use core::mem::size_of; -use crate::descriptor::{capability_type, BosWriter}; +use crate::descriptor::{BosWriter, capability_type}; use crate::types::InterfaceNumber; /// A serialized Microsoft OS 2.0 Descriptor set. diff --git a/examples/boot/application/stm32wb-dfu/src/main.rs b/examples/boot/application/stm32wb-dfu/src/main.rs index 5e7b71f5a..1ae28bf3a 100644 --- a/examples/boot/application/stm32wb-dfu/src/main.rs +++ b/examples/boot/application/stm32wb-dfu/src/main.rs @@ -13,9 +13,9 @@ use embassy_stm32::usb::{self, Driver}; use embassy_stm32::{bind_interrupts, peripherals}; use embassy_sync::blocking_mutex::Mutex; use embassy_time::Duration; -use embassy_usb::{msos, Builder}; +use embassy_usb::{Builder, msos}; use embassy_usb_dfu::consts::DfuAttributes; -use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; +use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu}; use panic_reset as _; bind_interrupts!(struct Irqs { diff --git a/examples/boot/application/stm32wba-dfu/src/main.rs b/examples/boot/application/stm32wba-dfu/src/main.rs index bf17a7150..8adb2e7c0 100644 --- a/examples/boot/application/stm32wba-dfu/src/main.rs +++ b/examples/boot/application/stm32wba-dfu/src/main.rs @@ -12,9 +12,9 @@ use embassy_stm32::usb::{self, Driver}; use embassy_stm32::{bind_interrupts, peripherals}; use embassy_sync::blocking_mutex::Mutex; use embassy_time::Duration; -use embassy_usb::{msos, Builder}; +use embassy_usb::{Builder, msos}; use embassy_usb_dfu::consts::DfuAttributes; -use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; +use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu}; use panic_reset as _; bind_interrupts!(struct Irqs { diff --git a/examples/boot/application/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs index e4526927f..3f381fd80 100644 --- a/examples/boot/application/stm32wl/src/bin/a.rs +++ b/examples/boot/application/stm32wl/src/bin/a.rs @@ -8,10 +8,10 @@ use defmt_rtt::*; use embassy_boot_stm32::{AlignedBuffer, FirmwareUpdater, FirmwareUpdaterConfig}; use embassy_embedded_hal::adapter::BlockingAsync; use embassy_executor::Spawner; +use embassy_stm32::SharedData; use embassy_stm32::exti::ExtiInput; use embassy_stm32::flash::{Flash, WRITE_SIZE}; use embassy_stm32::gpio::{Level, Output, Pull, Speed}; -use embassy_stm32::SharedData; use embassy_sync::mutex::Mutex; use panic_reset as _; diff --git a/examples/boot/application/stm32wl/src/bin/b.rs b/examples/boot/application/stm32wl/src/bin/b.rs index 6016a9555..952e94a58 100644 --- a/examples/boot/application/stm32wl/src/bin/b.rs +++ b/examples/boot/application/stm32wl/src/bin/b.rs @@ -6,8 +6,8 @@ use core::mem::MaybeUninit; #[cfg(feature = "defmt")] use defmt_rtt::*; use embassy_executor::Spawner; -use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::SharedData; +use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_time::Timer; use panic_reset as _; diff --git a/examples/boot/bootloader/stm32-dual-bank/src/main.rs b/examples/boot/bootloader/stm32-dual-bank/src/main.rs index ea81e1fe5..f0063fb5c 100644 --- a/examples/boot/bootloader/stm32-dual-bank/src/main.rs +++ b/examples/boot/bootloader/stm32-dual-bank/src/main.rs @@ -7,7 +7,7 @@ use cortex_m_rt::{entry, exception}; #[cfg(feature = "defmt")] use defmt_rtt as _; use embassy_boot_stm32::*; -use embassy_stm32::flash::{Flash, BANK1_REGION}; +use embassy_stm32::flash::{BANK1_REGION, Flash}; use embassy_sync::blocking_mutex::Mutex; #[entry] diff --git a/examples/boot/bootloader/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs index f74edd75f..383ad912d 100644 --- a/examples/boot/bootloader/stm32/src/main.rs +++ b/examples/boot/bootloader/stm32/src/main.rs @@ -7,7 +7,7 @@ use cortex_m_rt::{entry, exception}; #[cfg(feature = "defmt")] use defmt_rtt as _; use embassy_boot_stm32::*; -use embassy_stm32::flash::{Flash, BANK1_REGION}; +use embassy_stm32::flash::{BANK1_REGION, Flash}; use embassy_sync::blocking_mutex::Mutex; #[entry] diff --git a/examples/boot/bootloader/stm32wb-dfu/src/main.rs b/examples/boot/bootloader/stm32wb-dfu/src/main.rs index 475f1234d..9ee82846d 100644 --- a/examples/boot/bootloader/stm32wb-dfu/src/main.rs +++ b/examples/boot/bootloader/stm32wb-dfu/src/main.rs @@ -7,14 +7,14 @@ use cortex_m_rt::{entry, exception}; #[cfg(feature = "defmt")] use defmt_rtt as _; use embassy_boot_stm32::*; -use embassy_stm32::flash::{Flash, BANK1_REGION, WRITE_SIZE}; +use embassy_stm32::flash::{BANK1_REGION, Flash, WRITE_SIZE}; use embassy_stm32::rcc::WPAN_DEFAULT; use embassy_stm32::usb::Driver; use embassy_stm32::{bind_interrupts, peripherals, usb}; use embassy_sync::blocking_mutex::Mutex; -use embassy_usb::{msos, Builder}; +use embassy_usb::{Builder, msos}; use embassy_usb_dfu::consts::DfuAttributes; -use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; +use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu}; bind_interrupts!(struct Irqs { USB_LP => usb::InterruptHandler; diff --git a/examples/boot/bootloader/stm32wba-dfu/src/main.rs b/examples/boot/bootloader/stm32wba-dfu/src/main.rs index e4aacbca9..b33a75d95 100644 --- a/examples/boot/bootloader/stm32wba-dfu/src/main.rs +++ b/examples/boot/bootloader/stm32wba-dfu/src/main.rs @@ -7,13 +7,13 @@ use cortex_m_rt::{entry, exception}; #[cfg(feature = "defmt")] use defmt_rtt as _; use embassy_boot_stm32::*; -use embassy_stm32::flash::{Flash, BANK1_REGION, WRITE_SIZE}; +use embassy_stm32::flash::{BANK1_REGION, Flash, WRITE_SIZE}; use embassy_stm32::usb::Driver; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_sync::blocking_mutex::Mutex; -use embassy_usb::{msos, Builder}; +use embassy_usb::{Builder, msos}; use embassy_usb_dfu::consts::DfuAttributes; -use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; +use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu}; bind_interrupts!(struct Irqs { USB_OTG_HS => usb::InterruptHandler; diff --git a/examples/mimxrt6/src/bin/button.rs b/examples/mimxrt6/src/bin/button.rs index efb7f14af..a9bdde98e 100644 --- a/examples/mimxrt6/src/bin/button.rs +++ b/examples/mimxrt6/src/bin/button.rs @@ -3,7 +3,7 @@ use defmt::info; use embassy_executor::Spawner; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_imxrt::gpio; use {defmt_rtt as _, embassy_imxrt_examples as _, panic_probe as _}; diff --git a/examples/mspm0c1104/src/bin/blinky.rs b/examples/mspm0c1104/src/bin/blinky.rs index 0d974cc5e..345077b37 100644 --- a/examples/mspm0c1104/src/bin/blinky.rs +++ b/examples/mspm0c1104/src/bin/blinky.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Level, Output}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Level, Output}; use embassy_time::Timer; use {defmt_rtt as _, panic_halt as _}; diff --git a/examples/mspm0c1104/src/bin/button.rs b/examples/mspm0c1104/src/bin/button.rs index 7face1618..557d997cd 100644 --- a/examples/mspm0c1104/src/bin/button.rs +++ b/examples/mspm0c1104/src/bin/button.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use {defmt_rtt as _, panic_halt as _}; #[embassy_executor::main] diff --git a/examples/mspm0g3507/src/bin/adc.rs b/examples/mspm0g3507/src/bin/adc.rs index ceccc7c02..cf1abb471 100644 --- a/examples/mspm0g3507/src/bin/adc.rs +++ b/examples/mspm0g3507/src/bin/adc.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_mspm0::adc::{self, Adc, Vrsel}; -use embassy_mspm0::{bind_interrupts, peripherals, Config}; +use embassy_mspm0::{Config, bind_interrupts, peripherals}; use embassy_time::Timer; use {defmt_rtt as _, panic_halt as _}; diff --git a/examples/mspm0g3507/src/bin/blinky.rs b/examples/mspm0g3507/src/bin/blinky.rs index 055a5cd81..47eaf1535 100644 --- a/examples/mspm0g3507/src/bin/blinky.rs +++ b/examples/mspm0g3507/src/bin/blinky.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Level, Output}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Level, Output}; use embassy_time::Timer; use {defmt_rtt as _, panic_halt as _}; diff --git a/examples/mspm0g3507/src/bin/button.rs b/examples/mspm0g3507/src/bin/button.rs index cde1f2892..76f3a1aba 100644 --- a/examples/mspm0g3507/src/bin/button.rs +++ b/examples/mspm0g3507/src/bin/button.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use {defmt_rtt as _, panic_halt as _}; #[embassy_executor::main] diff --git a/examples/mspm0g3519/src/bin/blinky.rs b/examples/mspm0g3519/src/bin/blinky.rs index 055a5cd81..47eaf1535 100644 --- a/examples/mspm0g3519/src/bin/blinky.rs +++ b/examples/mspm0g3519/src/bin/blinky.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Level, Output}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Level, Output}; use embassy_time::Timer; use {defmt_rtt as _, panic_halt as _}; diff --git a/examples/mspm0g3519/src/bin/button.rs b/examples/mspm0g3519/src/bin/button.rs index c81cc2918..21e7873d8 100644 --- a/examples/mspm0g3519/src/bin/button.rs +++ b/examples/mspm0g3519/src/bin/button.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use {defmt_rtt as _, panic_halt as _}; #[embassy_executor::main] diff --git a/examples/mspm0l1306/src/bin/adc.rs b/examples/mspm0l1306/src/bin/adc.rs index 2806b98cc..235396b8a 100644 --- a/examples/mspm0l1306/src/bin/adc.rs +++ b/examples/mspm0l1306/src/bin/adc.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_mspm0::adc::{self, Adc, Vrsel}; -use embassy_mspm0::{bind_interrupts, peripherals, Config}; +use embassy_mspm0::{Config, bind_interrupts, peripherals}; use embassy_time::Timer; use {defmt_rtt as _, panic_halt as _}; diff --git a/examples/mspm0l1306/src/bin/blinky.rs b/examples/mspm0l1306/src/bin/blinky.rs index 055a5cd81..47eaf1535 100644 --- a/examples/mspm0l1306/src/bin/blinky.rs +++ b/examples/mspm0l1306/src/bin/blinky.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Level, Output}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Level, Output}; use embassy_time::Timer; use {defmt_rtt as _, panic_halt as _}; diff --git a/examples/mspm0l1306/src/bin/button.rs b/examples/mspm0l1306/src/bin/button.rs index d8c85947f..33e682272 100644 --- a/examples/mspm0l1306/src/bin/button.rs +++ b/examples/mspm0l1306/src/bin/button.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use {defmt_rtt as _, panic_halt as _}; #[embassy_executor::main] diff --git a/examples/mspm0l2228/src/bin/blinky.rs b/examples/mspm0l2228/src/bin/blinky.rs index 055a5cd81..47eaf1535 100644 --- a/examples/mspm0l2228/src/bin/blinky.rs +++ b/examples/mspm0l2228/src/bin/blinky.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Level, Output}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Level, Output}; use embassy_time::Timer; use {defmt_rtt as _, panic_halt as _}; diff --git a/examples/mspm0l2228/src/bin/button.rs b/examples/mspm0l2228/src/bin/button.rs index 47bfd274b..bad1cb138 100644 --- a/examples/mspm0l2228/src/bin/button.rs +++ b/examples/mspm0l2228/src/bin/button.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use embassy_mspm0::Config; +use embassy_mspm0::gpio::{Input, Level, Output, Pull}; use {defmt_rtt as _, panic_halt as _}; #[embassy_executor::main] diff --git a/examples/nrf52840-edf/src/bin/basic.rs b/examples/nrf52840-edf/src/bin/basic.rs index d888e17d1..f7214790d 100644 --- a/examples/nrf52840-edf/src/bin/basic.rs +++ b/examples/nrf52840-edf/src/bin/basic.rs @@ -12,7 +12,7 @@ #![no_std] #![no_main] -use core::sync::atomic::{compiler_fence, Ordering}; +use core::sync::atomic::{Ordering, compiler_fence}; use defmt::unwrap; use embassy_executor::Spawner; diff --git a/examples/nrf52840-rtic/src/bin/blinky.rs b/examples/nrf52840-rtic/src/bin/blinky.rs index 2adac7e0a..671082117 100644 --- a/examples/nrf52840-rtic/src/bin/blinky.rs +++ b/examples/nrf52840-rtic/src/bin/blinky.rs @@ -7,7 +7,7 @@ use {defmt_rtt as _, panic_probe as _}; mod app { use defmt::info; use embassy_nrf::gpio::{Level, Output, OutputDrive}; - use embassy_nrf::{peripherals, Peri}; + use embassy_nrf::{Peri, peripherals}; use embassy_time::Timer; #[shared] diff --git a/examples/nrf52840/src/bin/channel_sender_receiver.rs b/examples/nrf52840/src/bin/channel_sender_receiver.rs index 09050db68..de694eaa0 100644 --- a/examples/nrf52840/src/bin/channel_sender_receiver.rs +++ b/examples/nrf52840/src/bin/channel_sender_receiver.rs @@ -3,8 +3,8 @@ use defmt::unwrap; use embassy_executor::Spawner; -use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive}; use embassy_nrf::Peri; +use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive}; use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::channel::{Channel, Receiver, Sender}; use embassy_time::Timer; diff --git a/examples/nrf52840/src/bin/ethernet_enc28j60.rs b/examples/nrf52840/src/bin/ethernet_enc28j60.rs index e59afd37f..5a988d89b 100644 --- a/examples/nrf52840/src/bin/ethernet_enc28j60.rs +++ b/examples/nrf52840/src/bin/ethernet_enc28j60.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_net::tcp::TcpSocket; use embassy_net::StackResources; +use embassy_net::tcp::TcpSocket; use embassy_net_enc28j60::Enc28j60; use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::rng::Rng; diff --git a/examples/nrf52840/src/bin/i2s_effect.rs b/examples/nrf52840/src/bin/i2s_effect.rs index 9eadeb4e4..c31b78614 100644 --- a/examples/nrf52840/src/bin/i2s_effect.rs +++ b/examples/nrf52840/src/bin/i2s_effect.rs @@ -5,7 +5,7 @@ use core::f32::consts::PI; use defmt::{error, info}; use embassy_executor::Spawner; -use embassy_nrf::i2s::{self, Channels, Config, MasterClock, MultiBuffering, Sample as _, SampleWidth, I2S}; +use embassy_nrf::i2s::{self, Channels, Config, I2S, MasterClock, MultiBuffering, Sample as _, SampleWidth}; use embassy_nrf::{bind_interrupts, peripherals}; use {defmt_rtt as _, panic_probe as _}; @@ -102,11 +102,7 @@ impl SineOsc { #[inline] fn abs(value: f32) -> f32 { - if value < 0.0 { - -value - } else { - value - } + if value < 0.0 { -value } else { value } } #[inline] diff --git a/examples/nrf52840/src/bin/i2s_monitor.rs b/examples/nrf52840/src/bin/i2s_monitor.rs index 799be351f..66b429b09 100644 --- a/examples/nrf52840/src/bin/i2s_monitor.rs +++ b/examples/nrf52840/src/bin/i2s_monitor.rs @@ -3,7 +3,7 @@ use defmt::{debug, error, info}; use embassy_executor::Spawner; -use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, MasterClock, Sample as _, SampleWidth, I2S}; +use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, I2S, MasterClock, Sample as _, SampleWidth}; use embassy_nrf::pwm::{Prescaler, SimplePwm}; use embassy_nrf::{bind_interrupts, peripherals}; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/nrf52840/src/bin/i2s_waveform.rs b/examples/nrf52840/src/bin/i2s_waveform.rs index 137d82840..ce7a68d3a 100644 --- a/examples/nrf52840/src/bin/i2s_waveform.rs +++ b/examples/nrf52840/src/bin/i2s_waveform.rs @@ -5,7 +5,7 @@ use core::f32::consts::PI; use defmt::{error, info}; use embassy_executor::Spawner; -use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, MasterClock, Sample as _, SampleWidth, I2S}; +use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, I2S, MasterClock, Sample as _, SampleWidth}; use embassy_nrf::{bind_interrupts, peripherals}; use {defmt_rtt as _, panic_probe as _}; @@ -140,11 +140,7 @@ impl SineOsc { #[inline] fn abs(value: f32) -> f32 { - if value < 0.0 { - -value - } else { - value - } + if value < 0.0 { -value } else { value } } #[inline] diff --git a/examples/nrf52840/src/bin/raw_spawn.rs b/examples/nrf52840/src/bin/raw_spawn.rs index faa8517c8..783be763d 100644 --- a/examples/nrf52840/src/bin/raw_spawn.rs +++ b/examples/nrf52840/src/bin/raw_spawn.rs @@ -5,8 +5,8 @@ use core::mem; use cortex_m_rt::entry; use defmt::{info, unwrap}; -use embassy_executor::raw::TaskStorage; use embassy_executor::Executor; +use embassy_executor::raw::TaskStorage; use embassy_time::Timer; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/nrf52840/src/bin/rtc.rs b/examples/nrf52840/src/bin/rtc.rs index 9d475df7f..56a0c25f4 100644 --- a/examples/nrf52840/src/bin/rtc.rs +++ b/examples/nrf52840/src/bin/rtc.rs @@ -7,8 +7,8 @@ use embassy_executor::Spawner; use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::interrupt; use embassy_nrf::rtc::Rtc; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use portable_atomic::AtomicU64; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/nrf52840/src/bin/usb_ethernet.rs b/examples/nrf52840/src/bin/usb_ethernet.rs index a75b967b4..14a1004d7 100644 --- a/examples/nrf52840/src/bin/usb_ethernet.rs +++ b/examples/nrf52840/src/bin/usb_ethernet.rs @@ -3,11 +3,11 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_net::tcp::TcpSocket; use embassy_net::StackResources; +use embassy_net::tcp::TcpSocket; use embassy_nrf::rng::Rng; -use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::usb::Driver; +use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::{bind_interrupts, pac, peripherals, rng, usb}; use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; diff --git a/examples/nrf52840/src/bin/usb_hid_keyboard.rs b/examples/nrf52840/src/bin/usb_hid_keyboard.rs index 5a9dc90a2..1cd730503 100644 --- a/examples/nrf52840/src/bin/usb_hid_keyboard.rs +++ b/examples/nrf52840/src/bin/usb_hid_keyboard.rs @@ -6,10 +6,10 @@ use core::sync::atomic::{AtomicBool, Ordering}; use defmt::*; use embassy_executor::Spawner; use embassy_futures::join::join; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_nrf::gpio::{Input, Pull}; -use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::usb::Driver; +use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::signal::Signal; @@ -210,7 +210,9 @@ impl Handler for MyDeviceHandler { fn suspended(&mut self, suspended: bool) { if suspended { - info!("Device suspended, the Vbus current limit is 500µA (or 2.5mA for high-power devices with remote wakeup enabled)."); + info!( + "Device suspended, the Vbus current limit is 500µA (or 2.5mA for high-power devices with remote wakeup enabled)." + ); SUSPENDED.store(true, Ordering::Release); } else { SUSPENDED.store(false, Ordering::Release); diff --git a/examples/nrf52840/src/bin/usb_hid_mouse.rs b/examples/nrf52840/src/bin/usb_hid_mouse.rs index 80cda70e3..3c0fc04e8 100644 --- a/examples/nrf52840/src/bin/usb_hid_mouse.rs +++ b/examples/nrf52840/src/bin/usb_hid_mouse.rs @@ -4,8 +4,8 @@ use defmt::*; use embassy_executor::Spawner; use embassy_futures::join::join; -use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::usb::Driver; +use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; use embassy_time::Timer; use embassy_usb::class::hid::{HidWriter, ReportId, RequestHandler, State}; diff --git a/examples/nrf52840/src/bin/usb_serial.rs b/examples/nrf52840/src/bin/usb_serial.rs index e7c2d0854..469002bc7 100644 --- a/examples/nrf52840/src/bin/usb_serial.rs +++ b/examples/nrf52840/src/bin/usb_serial.rs @@ -4,8 +4,8 @@ use defmt::{info, panic}; use embassy_executor::Spawner; use embassy_futures::join::join; -use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect}; use embassy_nrf::usb::Driver; +use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect}; use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; diff --git a/examples/nrf52840/src/bin/usb_serial_multitask.rs b/examples/nrf52840/src/bin/usb_serial_multitask.rs index b6a983854..67b2bccbb 100644 --- a/examples/nrf52840/src/bin/usb_serial_multitask.rs +++ b/examples/nrf52840/src/bin/usb_serial_multitask.rs @@ -3,8 +3,8 @@ use defmt::{info, panic, unwrap}; use embassy_executor::Spawner; -use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::usb::Driver; +use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; diff --git a/examples/nrf52840/src/bin/usb_serial_winusb.rs b/examples/nrf52840/src/bin/usb_serial_winusb.rs index e30e08a01..cd4d5bca1 100644 --- a/examples/nrf52840/src/bin/usb_serial_winusb.rs +++ b/examples/nrf52840/src/bin/usb_serial_winusb.rs @@ -4,8 +4,8 @@ use defmt::{info, panic}; use embassy_executor::Spawner; use embassy_futures::join::join; -use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect}; use embassy_nrf::usb::Driver; +use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect}; use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; diff --git a/examples/nrf52840/src/bin/wifi_esp_hosted.rs b/examples/nrf52840/src/bin/wifi_esp_hosted.rs index 1bc35746a..07752ffc4 100644 --- a/examples/nrf52840/src/bin/wifi_esp_hosted.rs +++ b/examples/nrf52840/src/bin/wifi_esp_hosted.rs @@ -3,8 +3,8 @@ use defmt::{info, unwrap, warn}; use embassy_executor::Spawner; -use embassy_net::tcp::TcpSocket; use embassy_net::StackResources; +use embassy_net::tcp::TcpSocket; use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; use embassy_nrf::rng::Rng; use embassy_nrf::spim::{self, Spim}; diff --git a/examples/nrf9160/src/bin/modem_tcp_client.rs b/examples/nrf9160/src/bin/modem_tcp_client.rs index c9d879662..07fa57e63 100644 --- a/examples/nrf9160/src/bin/modem_tcp_client.rs +++ b/examples/nrf9160/src/bin/modem_tcp_client.rs @@ -11,11 +11,11 @@ use defmt::{info, unwrap, warn}; use embassy_executor::Spawner; use embassy_net::{Ipv4Cidr, Stack, StackResources}; use embassy_net_nrf91::context::Status; -use embassy_net_nrf91::{context, Runner, State, TraceBuffer, TraceReader}; +use embassy_net_nrf91::{Runner, State, TraceBuffer, TraceReader, context}; use embassy_nrf::buffered_uarte::{self, BufferedUarteTx}; use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive}; use embassy_nrf::uarte::Baudrate; -use embassy_nrf::{bind_interrupts, interrupt, peripherals, uarte, Peri}; +use embassy_nrf::{Peri, bind_interrupts, interrupt, peripherals, uarte}; use embassy_time::{Duration, Timer}; use embedded_io_async::Write; use heapless::Vec; diff --git a/examples/rp/src/bin/assign_resources.rs b/examples/rp/src/bin/assign_resources.rs index 4ee4278b5..aaa134768 100644 --- a/examples/rp/src/bin/assign_resources.rs +++ b/examples/rp/src/bin/assign_resources.rs @@ -14,9 +14,9 @@ use assign_resources::assign_resources; use defmt::*; use embassy_executor::Spawner; +use embassy_rp::Peri; use embassy_rp::gpio::{Level, Output}; use embassy_rp::peripherals::{self, PIN_20, PIN_21}; -use embassy_rp::Peri; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp/src/bin/debounce.rs b/examples/rp/src/bin/debounce.rs index 0077f19fc..6eeb01d0a 100644 --- a/examples/rp/src/bin/debounce.rs +++ b/examples/rp/src/bin/debounce.rs @@ -7,7 +7,7 @@ use defmt::info; use embassy_executor::Spawner; use embassy_rp::gpio::{Input, Level, Pull}; -use embassy_time::{with_deadline, Duration, Instant, Timer}; +use embassy_time::{Duration, Instant, Timer, with_deadline}; use {defmt_rtt as _, panic_probe as _}; pub struct Debouncer<'a> { diff --git a/examples/rp/src/bin/ethernet_w5500_icmp_ping.rs b/examples/rp/src/bin/ethernet_w5500_icmp_ping.rs index 49d28071a..cb667f24f 100644 --- a/examples/rp/src/bin/ethernet_w5500_icmp_ping.rs +++ b/examples/rp/src/bin/ethernet_w5500_icmp_ping.rs @@ -12,8 +12,8 @@ use core::str::FromStr; use defmt::*; use embassy_executor::Spawner; use embassy_futures::yield_now; -use embassy_net::icmp::ping::{PingManager, PingParams}; use embassy_net::icmp::PacketMetadata; +use embassy_net::icmp::ping::{PingManager, PingParams}; use embassy_net::{Ipv4Cidr, Stack, StackResources}; use embassy_net_wiznet::chip::W5500; use embassy_net_wiznet::*; @@ -99,7 +99,7 @@ async fn main(spawner: Spawner) { // Create the ping manager instance let mut ping_manager = PingManager::new(stack, &mut rx_meta, &mut rx_buffer, &mut tx_meta, &mut tx_buffer); let addr = "192.168.8.1"; // Address to ping to - // Create the PingParams with the target address + // Create the PingParams with the target address let mut ping_params = PingParams::new(Ipv4Addr::from_str(addr).unwrap()); // (optional) Set custom properties of the ping ping_params.set_payload(b"Hello, Ping!"); // custom payload diff --git a/examples/rp/src/bin/ethernet_w55rp20_tcp_server.rs b/examples/rp/src/bin/ethernet_w55rp20_tcp_server.rs index f51df2df9..b402029b5 100644 --- a/examples/rp/src/bin/ethernet_w55rp20_tcp_server.rs +++ b/examples/rp/src/bin/ethernet_w55rp20_tcp_server.rs @@ -65,7 +65,7 @@ async fn main(spawner: Spawner) { // Construct an SPI driver backed by a PIO state machine let mut spi_cfg = SpiConfig::default(); spi_cfg.frequency = 12_500_000; // The PIO SPI program is much less stable than the actual SPI - // peripheral, use higher speeds at your peril + // peripheral, use higher speeds at your peril let spi = Spi::new(&mut common, sm0, clk, mosi, miso, p.DMA_CH0, p.DMA_CH1, spi_cfg); // Further control pins diff --git a/examples/rp/src/bin/interrupt.rs b/examples/rp/src/bin/interrupt.rs index 2748f778a..2605622ab 100644 --- a/examples/rp/src/bin/interrupt.rs +++ b/examples/rp/src/bin/interrupt.rs @@ -16,8 +16,8 @@ use embassy_rp::adc::{self, Adc, Blocking}; use embassy_rp::gpio::Pull; use embassy_rp::interrupt; use embassy_rp::pwm::{Config, Pwm}; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use embassy_time::{Duration, Ticker}; use portable_atomic::{AtomicU32, Ordering}; diff --git a/examples/rp/src/bin/multicore.rs b/examples/rp/src/bin/multicore.rs index 3a6367420..d289f8020 100644 --- a/examples/rp/src/bin/multicore.rs +++ b/examples/rp/src/bin/multicore.rs @@ -8,7 +8,7 @@ use defmt::*; use embassy_executor::Executor; use embassy_rp::gpio::{Level, Output}; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use embassy_time::Timer; diff --git a/examples/rp/src/bin/multiprio.rs b/examples/rp/src/bin/multiprio.rs index 0750d9bb7..310047505 100644 --- a/examples/rp/src/bin/multiprio.rs +++ b/examples/rp/src/bin/multiprio.rs @@ -61,7 +61,7 @@ use defmt::{info, unwrap}; use embassy_executor::{Executor, InterruptExecutor}; use embassy_rp::interrupt; use embassy_rp::interrupt::{InterruptExt, Priority}; -use embassy_time::{Instant, Timer, TICK_HZ}; +use embassy_time::{Instant, TICK_HZ, Timer}; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp/src/bin/orchestrate_tasks.rs b/examples/rp/src/bin/orchestrate_tasks.rs index 9f25e1087..cd26a5371 100644 --- a/examples/rp/src/bin/orchestrate_tasks.rs +++ b/examples/rp/src/bin/orchestrate_tasks.rs @@ -20,11 +20,11 @@ use assign_resources::assign_resources; use defmt::*; use embassy_executor::Spawner; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler}; use embassy_rp::clocks::RoscRng; use embassy_rp::gpio::{Input, Pull}; -use embassy_rp::{bind_interrupts, peripherals, Peri}; +use embassy_rp::{Peri, bind_interrupts, peripherals}; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::mutex::Mutex; use embassy_sync::{channel, signal}; diff --git a/examples/rp/src/bin/overclock.rs b/examples/rp/src/bin/overclock.rs index 83b17308b..a98185a8e 100644 --- a/examples/rp/src/bin/overclock.rs +++ b/examples/rp/src/bin/overclock.rs @@ -7,7 +7,7 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig}; +use embassy_rp::clocks::{ClockConfig, clk_sys_freq, core_voltage}; use embassy_rp::config::Config; use embassy_rp::gpio::{Level, Output}; use embassy_time::{Duration, Instant, Timer}; diff --git a/examples/rp/src/bin/overclock_manual.rs b/examples/rp/src/bin/overclock_manual.rs index dea5cfb3c..18397f9a8 100644 --- a/examples/rp/src/bin/overclock_manual.rs +++ b/examples/rp/src/bin/overclock_manual.rs @@ -7,7 +7,7 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage, PllConfig}; +use embassy_rp::clocks::{ClockConfig, CoreVoltage, PllConfig, clk_sys_freq, core_voltage}; use embassy_rp::config::Config; use embassy_rp::gpio::{Level, Output}; use embassy_time::{Duration, Instant, Timer}; diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index 1743a417e..55e983c36 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs @@ -7,7 +7,7 @@ use embassy_executor::Spawner; use embassy_rp::peripherals::PIO0; use embassy_rp::pio::program::pio_asm; use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; -use embassy_rp::{bind_interrupts, Peri}; +use embassy_rp::{Peri, bind_interrupts}; use fixed::traits::ToFixed; use fixed_macro::types::U56F8; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp/src/bin/pio_stepper.rs b/examples/rp/src/bin/pio_stepper.rs index 3862c248b..e8f203990 100644 --- a/examples/rp/src/bin/pio_stepper.rs +++ b/examples/rp/src/bin/pio_stepper.rs @@ -10,7 +10,7 @@ use embassy_rp::bind_interrupts; use embassy_rp::peripherals::PIO0; use embassy_rp::pio::{InterruptHandler, Pio}; use embassy_rp::pio_programs::stepper::{PioStepper, PioStepperProgram}; -use embassy_time::{with_timeout, Duration, Timer}; +use embassy_time::{Duration, Timer, with_timeout}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/rp/src/bin/pwm.rs b/examples/rp/src/bin/pwm.rs index 9dd07ab6e..f985bf7cf 100644 --- a/examples/rp/src/bin/pwm.rs +++ b/examples/rp/src/bin/pwm.rs @@ -9,9 +9,9 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4}; -use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; use embassy_rp::Peri; +use embassy_rp::peripherals::{PIN_4, PIN_25, PWM_SLICE2, PWM_SLICE4}; +use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp/src/bin/rtc_alarm.rs b/examples/rp/src/bin/rtc_alarm.rs index 94b5fbd27..bde49ccd5 100644 --- a/examples/rp/src/bin/rtc_alarm.rs +++ b/examples/rp/src/bin/rtc_alarm.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_rp::bind_interrupts; use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc}; use embassy_time::Timer; diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs index dd114a4ae..4bf924e56 100644 --- a/examples/rp/src/bin/spi_display.rs +++ b/examples/rp/src/bin/spi_display.rs @@ -15,19 +15,19 @@ use embassy_executor::Spawner; use embassy_rp::gpio::{Level, Output}; use embassy_rp::spi; use embassy_rp::spi::Spi; -use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_time::Delay; use embedded_graphics::image::{Image, ImageRawLE}; -use embedded_graphics::mono_font::ascii::FONT_10X20; use embedded_graphics::mono_font::MonoTextStyle; +use embedded_graphics::mono_font::ascii::FONT_10X20; use embedded_graphics::pixelcolor::Rgb565; use embedded_graphics::prelude::*; use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle}; use embedded_graphics::text::Text; +use mipidsi::Builder; use mipidsi::models::ST7789; use mipidsi::options::{Orientation, Rotation}; -use mipidsi::Builder; use {defmt_rtt as _, panic_probe as _}; use crate::touch::Touch; @@ -167,11 +167,7 @@ mod touch { let x = ((x - cal.x1) * cal.sx / (cal.x2 - cal.x1)).clamp(0, cal.sx); let y = ((y - cal.y1) * cal.sy / (cal.y2 - cal.y1)).clamp(0, cal.sy); - if x == 0 && y == 0 { - None - } else { - Some((x, y)) - } + if x == 0 && y == 0 { None } else { Some((x, y)) } } } } diff --git a/examples/rp/src/bin/spi_gc9a01.rs b/examples/rp/src/bin/spi_gc9a01.rs index fdef09d4b..fd007b9bd 100644 --- a/examples/rp/src/bin/spi_gc9a01.rs +++ b/examples/rp/src/bin/spi_gc9a01.rs @@ -16,16 +16,16 @@ use embassy_rp::clocks::RoscRng; use embassy_rp::gpio::{Level, Output}; use embassy_rp::spi; use embassy_rp::spi::{Blocking, Spi}; -use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_time::{Delay, Duration, Timer}; use embedded_graphics::image::{Image, ImageRawLE}; use embedded_graphics::pixelcolor::Rgb565; use embedded_graphics::prelude::*; use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle}; +use mipidsi::Builder; use mipidsi::models::GC9A01; use mipidsi::options::{ColorInversion, ColorOrder}; -use mipidsi::Builder; use {defmt_rtt as _, panic_probe as _}; const DISPLAY_FREQ: u32 = 64_000_000; diff --git a/examples/rp/src/bin/uart_r503.rs b/examples/rp/src/bin/uart_r503.rs index 085be280b..a25d45b18 100644 --- a/examples/rp/src/bin/uart_r503.rs +++ b/examples/rp/src/bin/uart_r503.rs @@ -6,7 +6,7 @@ use embassy_executor::Spawner; use embassy_rp::bind_interrupts; use embassy_rp::peripherals::UART0; use embassy_rp::uart::{Config, DataBits, InterruptHandler as UARTInterruptHandler, Parity, StopBits, Uart}; -use embassy_time::{with_timeout, Duration, Timer}; +use embassy_time::{Duration, Timer, with_timeout}; use heapless::Vec; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp/src/bin/usb_ethernet.rs b/examples/rp/src/bin/usb_ethernet.rs index 912e52e96..b62a602b1 100644 --- a/examples/rp/src/bin/usb_ethernet.rs +++ b/examples/rp/src/bin/usb_ethernet.rs @@ -7,8 +7,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_net::tcp::TcpSocket; use embassy_net::StackResources; +use embassy_net::tcp::TcpSocket; use embassy_rp::clocks::RoscRng; use embassy_rp::peripherals::USB; use embassy_rp::usb::{Driver, InterruptHandler}; diff --git a/examples/rp/src/bin/usb_serial.rs b/examples/rp/src/bin/usb_serial.rs index b79012acb..23d0c9e8b 100644 --- a/examples/rp/src/bin/usb_serial.rs +++ b/examples/rp/src/bin/usb_serial.rs @@ -10,9 +10,9 @@ use embassy_executor::Spawner; use embassy_rp::bind_interrupts; use embassy_rp::peripherals::USB; use embassy_rp::usb::{Driver, Instance, InterruptHandler}; +use embassy_usb::UsbDevice; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::UsbDevice; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp/src/bin/wifi_ap_tcp_server.rs b/examples/rp/src/bin/wifi_ap_tcp_server.rs index 128599e0d..0828dbbb9 100644 --- a/examples/rp/src/bin/wifi_ap_tcp_server.rs +++ b/examples/rp/src/bin/wifi_ap_tcp_server.rs @@ -7,7 +7,7 @@ use core::str::from_utf8; -use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; +use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; use defmt::*; use embassy_executor::Spawner; use embassy_net::tcp::TcpSocket; diff --git a/examples/rp/src/bin/wifi_blinky.rs b/examples/rp/src/bin/wifi_blinky.rs index b2e08c517..aa6ee4df0 100644 --- a/examples/rp/src/bin/wifi_blinky.rs +++ b/examples/rp/src/bin/wifi_blinky.rs @@ -5,7 +5,7 @@ #![no_std] #![no_main] -use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; +use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; use defmt::*; use embassy_executor::Spawner; use embassy_rp::bind_interrupts; diff --git a/examples/rp/src/bin/wifi_scan.rs b/examples/rp/src/bin/wifi_scan.rs index c884aa2ba..7e3de1db9 100644 --- a/examples/rp/src/bin/wifi_scan.rs +++ b/examples/rp/src/bin/wifi_scan.rs @@ -7,7 +7,7 @@ use core::str; -use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; +use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; use defmt::*; use embassy_executor::Spawner; use embassy_rp::bind_interrupts; diff --git a/examples/rp/src/bin/wifi_tcp_server.rs b/examples/rp/src/bin/wifi_tcp_server.rs index 126475779..e39de4902 100644 --- a/examples/rp/src/bin/wifi_tcp_server.rs +++ b/examples/rp/src/bin/wifi_tcp_server.rs @@ -8,7 +8,7 @@ use core::str::from_utf8; use cyw43::JoinOptions; -use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; +use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; use defmt::*; use embassy_executor::Spawner; use embassy_net::tcp::TcpSocket; diff --git a/examples/rp/src/bin/wifi_webrequest.rs b/examples/rp/src/bin/wifi_webrequest.rs index 079def370..b618d2b38 100644 --- a/examples/rp/src/bin/wifi_webrequest.rs +++ b/examples/rp/src/bin/wifi_webrequest.rs @@ -8,7 +8,7 @@ use core::str::from_utf8; use cyw43::JoinOptions; -use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; +use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; use defmt::*; use embassy_executor::Spawner; use embassy_net::dns::DnsSocket; diff --git a/examples/rp/src/bin/zerocopy.rs b/examples/rp/src/bin/zerocopy.rs index d603e1ed3..fc5f95e6e 100644 --- a/examples/rp/src/bin/zerocopy.rs +++ b/examples/rp/src/bin/zerocopy.rs @@ -11,7 +11,7 @@ use embassy_executor::Spawner; use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; use embassy_rp::gpio::Pull; use embassy_rp::peripherals::DMA_CH0; -use embassy_rp::{bind_interrupts, Peri}; +use embassy_rp::{Peri, bind_interrupts}; use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; use embassy_time::{Duration, Ticker, Timer}; diff --git a/examples/rp235x/src/bin/assign_resources.rs b/examples/rp235x/src/bin/assign_resources.rs index 4ee4278b5..aaa134768 100644 --- a/examples/rp235x/src/bin/assign_resources.rs +++ b/examples/rp235x/src/bin/assign_resources.rs @@ -14,9 +14,9 @@ use assign_resources::assign_resources; use defmt::*; use embassy_executor::Spawner; +use embassy_rp::Peri; use embassy_rp::gpio::{Level, Output}; use embassy_rp::peripherals::{self, PIN_20, PIN_21}; -use embassy_rp::Peri; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp235x/src/bin/debounce.rs b/examples/rp235x/src/bin/debounce.rs index 0077f19fc..6eeb01d0a 100644 --- a/examples/rp235x/src/bin/debounce.rs +++ b/examples/rp235x/src/bin/debounce.rs @@ -7,7 +7,7 @@ use defmt::info; use embassy_executor::Spawner; use embassy_rp::gpio::{Input, Level, Pull}; -use embassy_time::{with_deadline, Duration, Instant, Timer}; +use embassy_time::{Duration, Instant, Timer, with_deadline}; use {defmt_rtt as _, panic_probe as _}; pub struct Debouncer<'a> { diff --git a/examples/rp235x/src/bin/ethernet_w5500_icmp_ping.rs b/examples/rp235x/src/bin/ethernet_w5500_icmp_ping.rs index 309d3e4f7..227e68029 100644 --- a/examples/rp235x/src/bin/ethernet_w5500_icmp_ping.rs +++ b/examples/rp235x/src/bin/ethernet_w5500_icmp_ping.rs @@ -12,8 +12,8 @@ use core::str::FromStr; use defmt::*; use embassy_executor::Spawner; use embassy_futures::yield_now; -use embassy_net::icmp::ping::{PingManager, PingParams}; use embassy_net::icmp::PacketMetadata; +use embassy_net::icmp::ping::{PingManager, PingParams}; use embassy_net::{Ipv4Cidr, Stack, StackResources}; use embassy_net_wiznet::chip::W5500; use embassy_net_wiznet::*; @@ -99,7 +99,7 @@ async fn main(spawner: Spawner) { // Create the ping manager instance let mut ping_manager = PingManager::new(stack, &mut rx_meta, &mut rx_buffer, &mut tx_meta, &mut tx_buffer); let addr = "192.168.8.1"; // Address to ping to - // Create the PingParams with the target address + // Create the PingParams with the target address let mut ping_params = PingParams::new(Ipv4Addr::from_str(addr).unwrap()); // (optional) Set custom properties of the ping ping_params.set_payload(b"Hello, Ping!"); // custom payload diff --git a/examples/rp235x/src/bin/interrupt.rs b/examples/rp235x/src/bin/interrupt.rs index 88513180c..1b18f6931 100644 --- a/examples/rp235x/src/bin/interrupt.rs +++ b/examples/rp235x/src/bin/interrupt.rs @@ -16,8 +16,8 @@ use embassy_rp::adc::{self, Adc, Blocking}; use embassy_rp::gpio::Pull; use embassy_rp::interrupt; use embassy_rp::pwm::{Config, Pwm}; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use embassy_time::{Duration, Ticker}; use portable_atomic::{AtomicU32, Ordering}; diff --git a/examples/rp235x/src/bin/multicore.rs b/examples/rp235x/src/bin/multicore.rs index 4f82801d6..9b61fdbca 100644 --- a/examples/rp235x/src/bin/multicore.rs +++ b/examples/rp235x/src/bin/multicore.rs @@ -8,7 +8,7 @@ use defmt::*; use embassy_executor::Executor; use embassy_rp::gpio::{Level, Output}; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use embassy_time::Timer; diff --git a/examples/rp235x/src/bin/multicore_stack_overflow.rs b/examples/rp235x/src/bin/multicore_stack_overflow.rs index dba44aa23..9efe89318 100644 --- a/examples/rp235x/src/bin/multicore_stack_overflow.rs +++ b/examples/rp235x/src/bin/multicore_stack_overflow.rs @@ -6,7 +6,7 @@ use defmt::*; use embassy_executor::Executor; use embassy_rp::gpio::{Level, Output}; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_time::Timer; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp235x/src/bin/multiprio.rs b/examples/rp235x/src/bin/multiprio.rs index 0750d9bb7..310047505 100644 --- a/examples/rp235x/src/bin/multiprio.rs +++ b/examples/rp235x/src/bin/multiprio.rs @@ -61,7 +61,7 @@ use defmt::{info, unwrap}; use embassy_executor::{Executor, InterruptExecutor}; use embassy_rp::interrupt; use embassy_rp::interrupt::{InterruptExt, Priority}; -use embassy_time::{Instant, Timer, TICK_HZ}; +use embassy_time::{Instant, TICK_HZ, Timer}; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp235x/src/bin/overclock.rs b/examples/rp235x/src/bin/overclock.rs index 5fd97ef97..cba137f3a 100644 --- a/examples/rp235x/src/bin/overclock.rs +++ b/examples/rp235x/src/bin/overclock.rs @@ -12,7 +12,7 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage}; +use embassy_rp::clocks::{ClockConfig, CoreVoltage, clk_sys_freq, core_voltage}; use embassy_rp::config::Config; use embassy_rp::gpio::{Level, Output}; use embassy_time::{Duration, Instant, Timer}; diff --git a/examples/rp235x/src/bin/pio_async.rs b/examples/rp235x/src/bin/pio_async.rs index d76930f5c..a392fe37e 100644 --- a/examples/rp235x/src/bin/pio_async.rs +++ b/examples/rp235x/src/bin/pio_async.rs @@ -7,7 +7,7 @@ use embassy_executor::Spawner; use embassy_rp::peripherals::PIO0; use embassy_rp::pio::program::pio_asm; use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; -use embassy_rp::{bind_interrupts, Peri}; +use embassy_rp::{Peri, bind_interrupts}; use fixed::traits::ToFixed; use fixed_macro::types::U56F8; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp235x/src/bin/pio_i2s_rx.rs b/examples/rp235x/src/bin/pio_i2s_rx.rs index c3f505b13..6735c402f 100644 --- a/examples/rp235x/src/bin/pio_i2s_rx.rs +++ b/examples/rp235x/src/bin/pio_i2s_rx.rs @@ -34,7 +34,7 @@ const SAMPLE_RATE: u32 = 48_000; const BIT_DEPTH: u32 = 16; const CHANNELS: u32 = 2; const USE_ONBOARD_PULLDOWN: bool = false; // whether or not to use the onboard pull-down resistor, - // which has documented issues on many RP235x boards +// which has documented issues on many RP235x boards #[embassy_executor::main] async fn main(_spawner: Spawner) { let p = embassy_rp::init(Default::default()); diff --git a/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs b/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs index 61af94560..948699e40 100644 --- a/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs +++ b/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs @@ -9,7 +9,7 @@ use embassy_executor::Spawner; use embassy_rp::gpio::Pull; use embassy_rp::peripherals::PIO0; use embassy_rp::pio::program::pio_asm; -use embassy_rp::{bind_interrupts, pio, Peri}; +use embassy_rp::{Peri, bind_interrupts, pio}; use embassy_time::Timer; use fixed::traits::ToFixed; use pio::{Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftDirection, StateMachine}; diff --git a/examples/rp235x/src/bin/pio_stepper.rs b/examples/rp235x/src/bin/pio_stepper.rs index 931adbeda..9b33710ad 100644 --- a/examples/rp235x/src/bin/pio_stepper.rs +++ b/examples/rp235x/src/bin/pio_stepper.rs @@ -10,7 +10,7 @@ use embassy_rp::bind_interrupts; use embassy_rp::peripherals::PIO0; use embassy_rp::pio::{InterruptHandler, Pio}; use embassy_rp::pio_programs::stepper::{PioStepper, PioStepperProgram}; -use embassy_time::{with_timeout, Duration, Timer}; +use embassy_time::{Duration, Timer, with_timeout}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/rp235x/src/bin/pwm.rs b/examples/rp235x/src/bin/pwm.rs index 289480c85..971e86aa7 100644 --- a/examples/rp235x/src/bin/pwm.rs +++ b/examples/rp235x/src/bin/pwm.rs @@ -9,9 +9,9 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4}; -use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; use embassy_rp::Peri; +use embassy_rp::peripherals::{PIN_4, PIN_25, PWM_SLICE2, PWM_SLICE4}; +use embassy_rp::pwm::{Config, Pwm, SetDutyCycle}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs b/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs index 2cfb2038d..670f302a4 100644 --- a/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs +++ b/examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs @@ -10,7 +10,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_rp::config::Config; use embassy_rp::gpio::Output; -use embassy_rp::{gpio, peripherals, pwm, Peri}; +use embassy_rp::{Peri, gpio, peripherals, pwm}; use embassy_time::{Duration, Timer}; use tb6612fng::{DriveCommand, Motor, Tb6612fng}; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp235x/src/bin/spi_display.rs b/examples/rp235x/src/bin/spi_display.rs index 9967abefd..3cef93f62 100644 --- a/examples/rp235x/src/bin/spi_display.rs +++ b/examples/rp235x/src/bin/spi_display.rs @@ -15,19 +15,19 @@ use embassy_executor::Spawner; use embassy_rp::gpio::{Level, Output}; use embassy_rp::spi; use embassy_rp::spi::{Blocking, Spi}; -use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_time::Delay; use embedded_graphics::image::{Image, ImageRawLE}; -use embedded_graphics::mono_font::ascii::FONT_10X20; use embedded_graphics::mono_font::MonoTextStyle; +use embedded_graphics::mono_font::ascii::FONT_10X20; use embedded_graphics::pixelcolor::Rgb565; use embedded_graphics::prelude::*; use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle}; use embedded_graphics::text::Text; +use mipidsi::Builder; use mipidsi::models::ST7789; use mipidsi::options::{Orientation, Rotation}; -use mipidsi::Builder; use {defmt_rtt as _, panic_probe as _}; use crate::touch::Touch; @@ -167,11 +167,7 @@ mod touch { let x = ((x - cal.x1) * cal.sx / (cal.x2 - cal.x1)).clamp(0, cal.sx); let y = ((y - cal.y1) * cal.sy / (cal.y2 - cal.y1)).clamp(0, cal.sy); - if x == 0 && y == 0 { - None - } else { - Some((x, y)) - } + if x == 0 && y == 0 { None } else { Some((x, y)) } } } } diff --git a/examples/rp235x/src/bin/uart_r503.rs b/examples/rp235x/src/bin/uart_r503.rs index 085be280b..a25d45b18 100644 --- a/examples/rp235x/src/bin/uart_r503.rs +++ b/examples/rp235x/src/bin/uart_r503.rs @@ -6,7 +6,7 @@ use embassy_executor::Spawner; use embassy_rp::bind_interrupts; use embassy_rp::peripherals::UART0; use embassy_rp::uart::{Config, DataBits, InterruptHandler as UARTInterruptHandler, Parity, StopBits, Uart}; -use embassy_time::{with_timeout, Duration, Timer}; +use embassy_time::{Duration, Timer, with_timeout}; use heapless::Vec; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp235x/src/bin/zerocopy.rs b/examples/rp235x/src/bin/zerocopy.rs index 62ba4cfb8..55deffd5f 100644 --- a/examples/rp235x/src/bin/zerocopy.rs +++ b/examples/rp235x/src/bin/zerocopy.rs @@ -11,7 +11,7 @@ use embassy_executor::Spawner; use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; use embassy_rp::gpio::Pull; use embassy_rp::peripherals::DMA_CH0; -use embassy_rp::{bind_interrupts, Peri}; +use embassy_rp::{Peri, bind_interrupts}; use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; use embassy_time::{Duration, Ticker, Timer}; diff --git a/examples/stm32c0/src/bin/rtc.rs b/examples/stm32c0/src/bin/rtc.rs index 82d8a37ba..feb27f6d9 100644 --- a/examples/stm32c0/src/bin/rtc.rs +++ b/examples/stm32c0/src/bin/rtc.rs @@ -4,8 +4,8 @@ use chrono::{NaiveDate, NaiveDateTime}; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::rtc::{Rtc, RtcConfig}; use embassy_stm32::Config; +use embassy_stm32::rtc::{Rtc, RtcConfig}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f0/src/bin/button_controlled_blink.rs b/examples/stm32f0/src/bin/button_controlled_blink.rs index f232e3290..0b678af01 100644 --- a/examples/stm32f0/src/bin/button_controlled_blink.rs +++ b/examples/stm32f0/src/bin/button_controlled_blink.rs @@ -7,9 +7,9 @@ use core::sync::atomic::{AtomicU32, Ordering}; use defmt::info; use embassy_executor::Spawner; +use embassy_stm32::Peri; use embassy_stm32::exti::ExtiInput; use embassy_stm32::gpio::{AnyPin, Level, Output, Pull, Speed}; -use embassy_stm32::Peri; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f1/src/bin/can.rs b/examples/stm32f1/src/bin/can.rs index ad0c8a5a5..cbe13b206 100644 --- a/examples/stm32f1/src/bin/can.rs +++ b/examples/stm32f1/src/bin/can.rs @@ -5,11 +5,11 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::can::frame::Envelope; use embassy_stm32::can::{ - filter, Can, Fifo, Frame, Id, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, StandardId, - TxInterruptHandler, + Can, Fifo, Frame, Id, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, StandardId, + TxInterruptHandler, filter, }; use embassy_stm32::peripherals::CAN; -use embassy_stm32::{bind_interrupts, Config}; +use embassy_stm32::{Config, bind_interrupts}; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f1/src/bin/input_capture.rs b/examples/stm32f1/src/bin/input_capture.rs index b5b26938d..6232d8c17 100644 --- a/examples/stm32f1/src/bin/input_capture.rs +++ b/examples/stm32f1/src/bin/input_capture.rs @@ -7,7 +7,7 @@ use embassy_stm32::gpio::{AfioRemap, Level, Output, Pull, Speed}; use embassy_stm32::time::khz; use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; use embassy_stm32::timer::{self, Channel}; -use embassy_stm32::{bind_interrupts, peripherals, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f1/src/bin/pwm_input.rs b/examples/stm32f1/src/bin/pwm_input.rs index 9ae747018..136c5c555 100644 --- a/examples/stm32f1/src/bin/pwm_input.rs +++ b/examples/stm32f1/src/bin/pwm_input.rs @@ -6,7 +6,7 @@ use embassy_executor::Spawner; use embassy_stm32::gpio::{AfioRemap, Level, Output, Pull, Speed}; use embassy_stm32::time::khz; use embassy_stm32::timer::pwm_input::PwmInput; -use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals, timer}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f1/src/bin/usb_serial.rs b/examples/stm32f1/src/bin/usb_serial.rs index 77ec307b9..5ff54a521 100644 --- a/examples/stm32f1/src/bin/usb_serial.rs +++ b/examples/stm32f1/src/bin/usb_serial.rs @@ -7,11 +7,11 @@ use embassy_futures::join::join; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::time::Hertz; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_time::Timer; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32f2/src/bin/pll.rs b/examples/stm32f2/src/bin/pll.rs index e39e2daec..4418bf502 100644 --- a/examples/stm32f2/src/bin/pll.rs +++ b/examples/stm32f2/src/bin/pll.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::time::Hertz; use embassy_stm32::Config; +use embassy_stm32::time::Hertz; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index a54d03212..99957a641 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs @@ -15,7 +15,7 @@ use embassy_stm32::exti::ExtiInput; use embassy_stm32::gpio::{Level, Output, Pull, Speed}; use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; use embassy_sync::channel::Channel; -use embassy_time::{with_timeout, Duration, Timer}; +use embassy_time::{Duration, Timer, with_timeout}; use {defmt_rtt as _, panic_probe as _}; struct Leds<'a> { diff --git a/examples/stm32f3/src/bin/usb_serial.rs b/examples/stm32f3/src/bin/usb_serial.rs index 5760f2c1c..58b801c36 100644 --- a/examples/stm32f3/src/bin/usb_serial.rs +++ b/examples/stm32f3/src/bin/usb_serial.rs @@ -7,11 +7,11 @@ use embassy_futures::join::join; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::time::mhz; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_time::Timer; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32f334/src/bin/adc.rs b/examples/stm32f334/src/bin/adc.rs index 0528a9637..a993b00ca 100644 --- a/examples/stm32f334/src/bin/adc.rs +++ b/examples/stm32f334/src/bin/adc.rs @@ -6,7 +6,7 @@ use embassy_executor::Spawner; use embassy_stm32::adc::{Adc, SampleTime}; use embassy_stm32::peripherals::ADC1; use embassy_stm32::time::mhz; -use embassy_stm32::{adc, bind_interrupts, Config}; +use embassy_stm32::{Config, adc, bind_interrupts}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f334/src/bin/opamp.rs b/examples/stm32f334/src/bin/opamp.rs index c344935d7..3e621f2a1 100644 --- a/examples/stm32f334/src/bin/opamp.rs +++ b/examples/stm32f334/src/bin/opamp.rs @@ -7,7 +7,7 @@ use embassy_stm32::adc::{Adc, SampleTime}; use embassy_stm32::opamp::OpAmp; use embassy_stm32::peripherals::ADC2; use embassy_stm32::time::mhz; -use embassy_stm32::{adc, bind_interrupts, Config}; +use embassy_stm32::{Config, adc, bind_interrupts}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f334/src/bin/pwm.rs b/examples/stm32f334/src/bin/pwm.rs index 2b0686121..68a61ae22 100644 --- a/examples/stm32f334/src/bin/pwm.rs +++ b/examples/stm32f334/src/bin/pwm.rs @@ -3,9 +3,9 @@ use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::hrtim::*; use embassy_stm32::time::{khz, mhz}; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/adc_dma.rs b/examples/stm32f4/src/bin/adc_dma.rs index 2ec48640e..c24f01753 100644 --- a/examples/stm32f4/src/bin/adc_dma.rs +++ b/examples/stm32f4/src/bin/adc_dma.rs @@ -3,8 +3,8 @@ use cortex_m::singleton; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, RingBufferedAdc, SampleTime, Sequence}; use embassy_stm32::Peripherals; +use embassy_stm32::adc::{Adc, RingBufferedAdc, SampleTime, Sequence}; use embassy_time::Instant; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/eth.rs b/examples/stm32f4/src/bin/eth.rs index f41a60529..2d72b6b0b 100644 --- a/examples/stm32f4/src/bin/eth.rs +++ b/examples/stm32f4/src/bin/eth.rs @@ -9,7 +9,7 @@ use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; use embassy_stm32::peripherals::ETH; use embassy_stm32::rng::Rng; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use embedded_io_async::Write; use static_cell::StaticCell; diff --git a/examples/stm32f4/src/bin/eth_compliance_test.rs b/examples/stm32f4/src/bin/eth_compliance_test.rs index 52f9d57f6..734a14c2c 100644 --- a/examples/stm32f4/src/bin/eth_compliance_test.rs +++ b/examples/stm32f4/src/bin/eth_compliance_test.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, StationManagement}; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/eth_w5500.rs b/examples/stm32f4/src/bin/eth_w5500.rs index 7ce3bfe75..cccf20949 100644 --- a/examples/stm32f4/src/bin/eth_w5500.rs +++ b/examples/stm32f4/src/bin/eth_w5500.rs @@ -13,7 +13,7 @@ use embassy_stm32::mode::Async; use embassy_stm32::rng::Rng; use embassy_stm32::spi::Spi; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, peripherals, rng, spi, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, rng, spi}; use embassy_time::{Delay, Timer}; use embedded_hal_bus::spi::ExclusiveDevice; use embedded_io_async::Write; diff --git a/examples/stm32f4/src/bin/flash_async.rs b/examples/stm32f4/src/bin/flash_async.rs index 2feb9de09..14f029747 100644 --- a/examples/stm32f4/src/bin/flash_async.rs +++ b/examples/stm32f4/src/bin/flash_async.rs @@ -5,7 +5,7 @@ use defmt::{info, unwrap}; use embassy_executor::Spawner; use embassy_stm32::flash::{Flash, InterruptHandler}; use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; -use embassy_stm32::{bind_interrupts, Peri}; +use embassy_stm32::{Peri, bind_interrupts}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/input_capture.rs b/examples/stm32f4/src/bin/input_capture.rs index 9998c4733..3ff96584d 100644 --- a/examples/stm32f4/src/bin/input_capture.rs +++ b/examples/stm32f4/src/bin/input_capture.rs @@ -7,7 +7,7 @@ use embassy_stm32::gpio::{Level, Output, Pull, Speed}; use embassy_stm32::time::khz; use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; use embassy_stm32::timer::{self, Channel}; -use embassy_stm32::{bind_interrupts, peripherals, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/pwm_complementary.rs b/examples/stm32f4/src/bin/pwm_complementary.rs index c981f1a76..50008a37b 100644 --- a/examples/stm32f4/src/bin/pwm_complementary.rs +++ b/examples/stm32f4/src/bin/pwm_complementary.rs @@ -5,9 +5,9 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::gpio::OutputType; use embassy_stm32::time::khz; +use embassy_stm32::timer::Channel; use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; use embassy_stm32::timer::simple_pwm::PwmPin; -use embassy_stm32::timer::Channel; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/pwm_input.rs b/examples/stm32f4/src/bin/pwm_input.rs index e8bfa524f..d8ea56a34 100644 --- a/examples/stm32f4/src/bin/pwm_input.rs +++ b/examples/stm32f4/src/bin/pwm_input.rs @@ -6,7 +6,7 @@ use embassy_executor::Spawner; use embassy_stm32::gpio::{Level, Output, Pull, Speed}; use embassy_stm32::time::khz; use embassy_stm32::timer::pwm_input::PwmInput; -use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals, timer}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/rtc.rs b/examples/stm32f4/src/bin/rtc.rs index 82d8a37ba..feb27f6d9 100644 --- a/examples/stm32f4/src/bin/rtc.rs +++ b/examples/stm32f4/src/bin/rtc.rs @@ -4,8 +4,8 @@ use chrono::{NaiveDate, NaiveDateTime}; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::rtc::{Rtc, RtcConfig}; use embassy_stm32::Config; +use embassy_stm32::rtc::{Rtc, RtcConfig}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/sdmmc.rs b/examples/stm32f4/src/bin/sdmmc.rs index e97b63925..fe0f887bf 100644 --- a/examples/stm32f4/src/bin/sdmmc.rs +++ b/examples/stm32f4/src/bin/sdmmc.rs @@ -4,8 +4,8 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::sdmmc::{DataBlock, Sdmmc}; -use embassy_stm32::time::{mhz, Hertz}; -use embassy_stm32::{bind_interrupts, peripherals, sdmmc, Config}; +use embassy_stm32::time::{Hertz, mhz}; +use embassy_stm32::{Config, bind_interrupts, peripherals, sdmmc}; use {defmt_rtt as _, panic_probe as _}; /// This is a safeguard to not overwrite any data on the SD card. diff --git a/examples/stm32f4/src/bin/usb_ethernet.rs b/examples/stm32f4/src/bin/usb_ethernet.rs index 7abbe8719..a5e625edd 100644 --- a/examples/stm32f4/src/bin/usb_ethernet.rs +++ b/examples/stm32f4/src/bin/usb_ethernet.rs @@ -3,12 +3,12 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_net::tcp::TcpSocket; use embassy_net::StackResources; +use embassy_net::tcp::TcpSocket; use embassy_stm32::rng::{self, Rng}; use embassy_stm32::time::Hertz; use embassy_stm32::usb::Driver; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; use embassy_usb::{Builder, UsbDevice}; diff --git a/examples/stm32f4/src/bin/usb_hid_keyboard.rs b/examples/stm32f4/src/bin/usb_hid_keyboard.rs index d6b4a9bc9..a3afb887c 100644 --- a/examples/stm32f4/src/bin/usb_hid_keyboard.rs +++ b/examples/stm32f4/src/bin/usb_hid_keyboard.rs @@ -10,7 +10,7 @@ use embassy_stm32::exti::ExtiInput; use embassy_stm32::gpio::Pull; use embassy_stm32::time::Hertz; use embassy_stm32::usb::Driver; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_usb::class::hid::{HidReaderWriter, ReportId, RequestHandler, State}; use embassy_usb::control::OutResponse; use embassy_usb::{Builder, Handler}; diff --git a/examples/stm32f4/src/bin/usb_hid_mouse.rs b/examples/stm32f4/src/bin/usb_hid_mouse.rs index badb65e98..162a035f2 100644 --- a/examples/stm32f4/src/bin/usb_hid_mouse.rs +++ b/examples/stm32f4/src/bin/usb_hid_mouse.rs @@ -6,11 +6,11 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::time::Hertz; use embassy_stm32::usb::Driver; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_time::Timer; +use embassy_usb::Builder; use embassy_usb::class::hid::{HidWriter, ReportId, RequestHandler, State}; use embassy_usb::control::OutResponse; -use embassy_usb::Builder; use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f4/src/bin/usb_raw.rs b/examples/stm32f4/src/bin/usb_raw.rs index bbbcc082b..511f0b281 100644 --- a/examples/stm32f4/src/bin/usb_raw.rs +++ b/examples/stm32f4/src/bin/usb_raw.rs @@ -53,7 +53,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::time::Hertz; use embassy_stm32::usb::Driver; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_usb::control::{InResponse, OutResponse, Recipient, Request, RequestType}; use embassy_usb::msos::{self, windows_version}; use embassy_usb::types::InterfaceNumber; diff --git a/examples/stm32f4/src/bin/usb_serial.rs b/examples/stm32f4/src/bin/usb_serial.rs index e62b2d8d6..2e81e0a59 100644 --- a/examples/stm32f4/src/bin/usb_serial.rs +++ b/examples/stm32f4/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::time::Hertz; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32f4/src/bin/usb_uac_speaker.rs b/examples/stm32f4/src/bin/usb_uac_speaker.rs index 79bd2d914..b92f4531e 100644 --- a/examples/stm32f4/src/bin/usb_uac_speaker.rs +++ b/examples/stm32f4/src/bin/usb_uac_speaker.rs @@ -6,9 +6,9 @@ use core::cell::{Cell, RefCell}; use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, interrupt, peripherals, timer, usb, Config}; -use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex}; +use embassy_stm32::{Config, bind_interrupts, interrupt, peripherals, timer, usb}; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex}; use embassy_sync::signal::Signal; use embassy_sync::zerocopy_channel; use embassy_usb::class::uac1; diff --git a/examples/stm32f4/src/bin/ws2812_pwm.rs b/examples/stm32f4/src/bin/ws2812_pwm.rs index 5153e1cfd..ccfd0661e 100644 --- a/examples/stm32f4/src/bin/ws2812_pwm.rs +++ b/examples/stm32f4/src/bin/ws2812_pwm.rs @@ -15,9 +15,9 @@ use embassy_executor::Spawner; use embassy_stm32::gpio::OutputType; use embassy_stm32::time::khz; +use embassy_stm32::timer::Channel; use embassy_stm32::timer::low_level::CountingMode; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; -use embassy_stm32::timer::Channel; use embassy_time::{Duration, Ticker, Timer}; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f469/src/bin/dsi_bsp.rs b/examples/stm32f469/src/bin/dsi_bsp.rs index 3a24d5dcf..d659291ff 100644 --- a/examples/stm32f469/src/bin/dsi_bsp.rs +++ b/examples/stm32f469/src/bin/dsi_bsp.rs @@ -3,7 +3,7 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::dsihost::{blocking_delay_ms, DsiHost, PacketType}; +use embassy_stm32::dsihost::{DsiHost, PacketType, blocking_delay_ms}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::ltdc::Ltdc; use embassy_stm32::pac::dsihost::regs::{Ier0, Ier1}; @@ -211,7 +211,7 @@ async fn main(_spawner: Spawner) { const HORIZONTAL_SYNC_ACTIVE: u16 = 4; // ((HSA as u32 * LANE_BYTE_CLK_K_HZ as u32 ) / LCD_CLOCK as u32 ) as u16; const HORIZONTAL_BACK_PORCH: u16 = 77; //((HBP as u32 * LANE_BYTE_CLK_K_HZ as u32 ) / LCD_CLOCK as u32) as u16; const HORIZONTAL_LINE: u16 = 1982; //(((HACT + HSA + HBP + HFP) as u32 * LANE_BYTE_CLK_K_HZ as u32 ) / LCD_CLOCK as u32 ) as u16; /* Value depending on display orientation choice portrait/landscape */ - // FIXME: Make depend on orientation + // FIXME: Make depend on orientation const VERTICAL_SYNC_ACTIVE: u16 = VSA; const VERTICAL_BACK_PORCH: u16 = VBP; const VERTICAL_FRONT_PORCH: u16 = VFP; @@ -658,7 +658,7 @@ const NT35510_RASET_LANDSCAPE: &[u8] = &[NT35510_CMD_RASET, 0x00, 0x00, 0x01, 0x const NT35510_WRITES_26: &[u8] = &[NT35510_CMD_TEEON, 0x00]; // Tear on const NT35510_WRITES_27: &[u8] = &[NT35510_CMD_SLPOUT, 0x00]; // Sleep out - // 28,29 missing +// 28,29 missing const NT35510_WRITES_30: &[u8] = &[NT35510_CMD_DISPON, 0x00]; // Display on const NT35510_WRITES_31: &[u8] = &[NT35510_CMD_WRDISBV, 0x7F]; diff --git a/examples/stm32f7/src/bin/can.rs b/examples/stm32f7/src/bin/can.rs index 9a91ac814..2f3f6db84 100644 --- a/examples/stm32f7/src/bin/can.rs +++ b/examples/stm32f7/src/bin/can.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -use core::num::{NonZeroU16, NonZeroU8}; +use core::num::{NonZeroU8, NonZeroU16}; use defmt::*; use embassy_executor::Spawner; diff --git a/examples/stm32f7/src/bin/cryp.rs b/examples/stm32f7/src/bin/cryp.rs index a31e9b4f2..9ccef0b82 100644 --- a/examples/stm32f7/src/bin/cryp.rs +++ b/examples/stm32f7/src/bin/cryp.rs @@ -1,13 +1,13 @@ #![no_std] #![no_main] +use aes_gcm::Aes128Gcm; use aes_gcm::aead::heapless::Vec; use aes_gcm::aead::{AeadInPlace, KeyInit}; -use aes_gcm::Aes128Gcm; use defmt::info; use embassy_executor::Spawner; use embassy_stm32::cryp::{self, *}; -use embassy_stm32::{bind_interrupts, peripherals, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals}; use embassy_time::Instant; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32f7/src/bin/eth.rs b/examples/stm32f7/src/bin/eth.rs index b13b7bdda..f8a129239 100644 --- a/examples/stm32f7/src/bin/eth.rs +++ b/examples/stm32f7/src/bin/eth.rs @@ -9,7 +9,7 @@ use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; use embassy_stm32::peripherals::ETH; use embassy_stm32::rng::Rng; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use embedded_io_async::Write; use static_cell::StaticCell; diff --git a/examples/stm32f7/src/bin/hash.rs b/examples/stm32f7/src/bin/hash.rs index c2d1a7158..4fd465df6 100644 --- a/examples/stm32f7/src/bin/hash.rs +++ b/examples/stm32f7/src/bin/hash.rs @@ -4,7 +4,7 @@ use defmt::info; use embassy_executor::Spawner; use embassy_stm32::hash::*; -use embassy_stm32::{bind_interrupts, hash, peripherals, Config}; +use embassy_stm32::{Config, bind_interrupts, hash, peripherals}; use embassy_time::Instant; use hmac::{Hmac, Mac}; use sha2::{Digest, Sha256}; diff --git a/examples/stm32f7/src/bin/qspi.rs b/examples/stm32f7/src/bin/qspi.rs index 80652b865..e8ef3ad81 100644 --- a/examples/stm32f7/src/bin/qspi.rs +++ b/examples/stm32f7/src/bin/qspi.rs @@ -4,11 +4,11 @@ use defmt::info; use embassy_executor::Spawner; +use embassy_stm32::Config as StmCfg; use embassy_stm32::mode::Async; use embassy_stm32::qspi::enums::{AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *}; use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig}; use embassy_stm32::time::mhz; -use embassy_stm32::Config as StmCfg; use {defmt_rtt as _, panic_probe as _}; const MEMORY_PAGE_SIZE: usize = 256; diff --git a/examples/stm32f7/src/bin/sdmmc.rs b/examples/stm32f7/src/bin/sdmmc.rs index 787bef25e..8809b5d0c 100644 --- a/examples/stm32f7/src/bin/sdmmc.rs +++ b/examples/stm32f7/src/bin/sdmmc.rs @@ -4,8 +4,8 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::sdmmc::Sdmmc; -use embassy_stm32::time::{mhz, Hertz}; -use embassy_stm32::{bind_interrupts, peripherals, sdmmc, Config}; +use embassy_stm32::time::{Hertz, mhz}; +use embassy_stm32::{Config, bind_interrupts, peripherals, sdmmc}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32f7/src/bin/usb_serial.rs b/examples/stm32f7/src/bin/usb_serial.rs index 349012888..9a30b2c20 100644 --- a/examples/stm32f7/src/bin/usb_serial.rs +++ b/examples/stm32f7/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::time::Hertz; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32g0/src/bin/hf_timer.rs b/examples/stm32g0/src/bin/hf_timer.rs index 705905f01..88ee7ea86 100644 --- a/examples/stm32g0/src/bin/hf_timer.rs +++ b/examples/stm32g0/src/bin/hf_timer.rs @@ -3,12 +3,12 @@ use defmt::info; use embassy_executor::Spawner; +use embassy_stm32::Config as PeripheralConfig; use embassy_stm32::gpio::OutputType; use embassy_stm32::time::khz; +use embassy_stm32::timer::Channel; use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; use embassy_stm32::timer::simple_pwm::PwmPin; -use embassy_stm32::timer::Channel; -use embassy_stm32::Config as PeripheralConfig; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32g0/src/bin/input_capture.rs b/examples/stm32g0/src/bin/input_capture.rs index 5501a6941..ca3e8eb41 100644 --- a/examples/stm32g0/src/bin/input_capture.rs +++ b/examples/stm32g0/src/bin/input_capture.rs @@ -13,10 +13,10 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::gpio::{Level, Output, OutputType, Pull, Speed}; use embassy_stm32::time::khz; +use embassy_stm32::timer::Channel; use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; -use embassy_stm32::timer::Channel; -use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals, timer}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g0/src/bin/pwm_complementary.rs b/examples/stm32g0/src/bin/pwm_complementary.rs index dbd9194c9..9856dd953 100644 --- a/examples/stm32g0/src/bin/pwm_complementary.rs +++ b/examples/stm32g0/src/bin/pwm_complementary.rs @@ -17,9 +17,9 @@ use defmt::info; use embassy_executor::Spawner; use embassy_stm32::gpio::OutputType; use embassy_stm32::time::khz; +use embassy_stm32::timer::Channel; use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; use embassy_stm32::timer::simple_pwm::PwmPin; -use embassy_stm32::timer::Channel; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32g0/src/bin/pwm_input.rs b/examples/stm32g0/src/bin/pwm_input.rs index 72aa07c03..5da19e077 100644 --- a/examples/stm32g0/src/bin/pwm_input.rs +++ b/examples/stm32g0/src/bin/pwm_input.rs @@ -14,7 +14,7 @@ use embassy_stm32::gpio::{Level, Output, OutputType, Pull, Speed}; use embassy_stm32::time::khz; use embassy_stm32::timer::pwm_input::PwmInput; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; -use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals, timer}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g0/src/bin/rtc.rs b/examples/stm32g0/src/bin/rtc.rs index 50fb6398e..21da204cc 100644 --- a/examples/stm32g0/src/bin/rtc.rs +++ b/examples/stm32g0/src/bin/rtc.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::rtc::{DateTime, DayOfWeek, Rtc, RtcConfig}; use embassy_stm32::Config; +use embassy_stm32::rtc::{DateTime, DayOfWeek, Rtc, RtcConfig}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g0/src/bin/usb_serial.rs b/examples/stm32g0/src/bin/usb_serial.rs index 162dfd86b..7dab393ac 100644 --- a/examples/stm32g0/src/bin/usb_serial.rs +++ b/examples/stm32g0/src/bin/usb_serial.rs @@ -5,10 +5,10 @@ use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32g4/src/bin/adc.rs b/examples/stm32g4/src/bin/adc.rs index adca846d8..920142a18 100644 --- a/examples/stm32g4/src/bin/adc.rs +++ b/examples/stm32g4/src/bin/adc.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, SampleTime}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, SampleTime}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g4/src/bin/adc_differential.rs b/examples/stm32g4/src/bin/adc_differential.rs index 78d071d45..301f0da84 100644 --- a/examples/stm32g4/src/bin/adc_differential.rs +++ b/examples/stm32g4/src/bin/adc_differential.rs @@ -8,8 +8,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, SampleTime}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, SampleTime}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g4/src/bin/adc_dma.rs b/examples/stm32g4/src/bin/adc_dma.rs index 202704085..a82067049 100644 --- a/examples/stm32g4/src/bin/adc_dma.rs +++ b/examples/stm32g4/src/bin/adc_dma.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g4/src/bin/adc_oversampling.rs b/examples/stm32g4/src/bin/adc_oversampling.rs index d31eb20f8..1e464183a 100644 --- a/examples/stm32g4/src/bin/adc_oversampling.rs +++ b/examples/stm32g4/src/bin/adc_oversampling.rs @@ -7,9 +7,9 @@ use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::adc::vals::{Rovsm, Trovs}; use embassy_stm32::adc::{Adc, SampleTime}; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g4/src/bin/can.rs b/examples/stm32g4/src/bin/can.rs index 90004f874..7ff7bd7b4 100644 --- a/examples/stm32g4/src/bin/can.rs +++ b/examples/stm32g4/src/bin/can.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::peripherals::*; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, can, Config}; +use embassy_stm32::{Config, bind_interrupts, can}; use embassy_time::Timer; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32g4/src/bin/usb_c_pd.rs b/examples/stm32g4/src/bin/usb_c_pd.rs index 2e87d3931..b23984b3a 100644 --- a/examples/stm32g4/src/bin/usb_c_pd.rs +++ b/examples/stm32g4/src/bin/usb_c_pd.rs @@ -1,11 +1,11 @@ #![no_std] #![no_main] -use defmt::{error, info, Format}; +use defmt::{Format, error, info}; use embassy_executor::Spawner; use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, Ucpd}; -use embassy_stm32::{bind_interrupts, peripherals, Config}; -use embassy_time::{with_timeout, Duration}; +use embassy_stm32::{Config, bind_interrupts, peripherals}; +use embassy_time::{Duration, with_timeout}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32g4/src/bin/usb_serial.rs b/examples/stm32g4/src/bin/usb_serial.rs index 9f66f0c53..a62da6d97 100644 --- a/examples/stm32g4/src/bin/usb_serial.rs +++ b/examples/stm32g4/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::time::Hertz; use embassy_stm32::usb::{self, Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h5/src/bin/adc.rs b/examples/stm32h5/src/bin/adc.rs index c5d508ece..0566320d4 100644 --- a/examples/stm32h5/src/bin/adc.rs +++ b/examples/stm32h5/src/bin/adc.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, SampleTime}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, SampleTime}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h5/src/bin/can.rs b/examples/stm32h5/src/bin/can.rs index 194239d47..b1923547e 100644 --- a/examples/stm32h5/src/bin/can.rs +++ b/examples/stm32h5/src/bin/can.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::peripherals::*; -use embassy_stm32::{bind_interrupts, can, rcc, Config}; +use embassy_stm32::{Config, bind_interrupts, can, rcc}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h5/src/bin/dts.rs b/examples/stm32h5/src/bin/dts.rs index 8c18fafea..7c856b5b3 100644 --- a/examples/stm32h5/src/bin/dts.rs +++ b/examples/stm32h5/src/bin/dts.rs @@ -6,7 +6,7 @@ use embassy_executor::Spawner; use embassy_stm32::dts::{Dts, InterruptHandler, SampleTime}; use embassy_stm32::peripherals::DTS; use embassy_stm32::rcc::frequency; -use embassy_stm32::{bind_interrupts, dts, Config}; +use embassy_stm32::{Config, bind_interrupts, dts}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h5/src/bin/eth.rs b/examples/stm32h5/src/bin/eth.rs index a84fe358b..a5c6cee26 100644 --- a/examples/stm32h5/src/bin/eth.rs +++ b/examples/stm32h5/src/bin/eth.rs @@ -12,7 +12,7 @@ use embassy_stm32::rcc::{ }; use embassy_stm32::rng::Rng; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use embedded_io_async::Write; use static_cell::StaticCell; diff --git a/examples/stm32h5/src/bin/sai.rs b/examples/stm32h5/src/bin/sai.rs index 0e182f9cf..6632a7f98 100644 --- a/examples/stm32h5/src/bin/sai.rs +++ b/examples/stm32h5/src/bin/sai.rs @@ -3,7 +3,7 @@ use defmt::info; use embassy_executor::Spawner; -use embassy_stm32::{sai, Config}; +use embassy_stm32::{Config, sai}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32h5/src/bin/usb_c_pd.rs b/examples/stm32h5/src/bin/usb_c_pd.rs index acb03e498..ab6efff32 100644 --- a/examples/stm32h5/src/bin/usb_c_pd.rs +++ b/examples/stm32h5/src/bin/usb_c_pd.rs @@ -3,12 +3,12 @@ #![no_std] #![no_main] -use defmt::{error, info, Format}; +use defmt::{Format, error, info}; use embassy_executor::Spawner; use embassy_stm32::gpio::Output; use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, Ucpd}; -use embassy_stm32::{bind_interrupts, peripherals, Config}; -use embassy_time::{with_timeout, Duration}; +use embassy_stm32::{Config, bind_interrupts, peripherals}; +use embassy_time::{Duration, with_timeout}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h5/src/bin/usb_serial.rs b/examples/stm32h5/src/bin/usb_serial.rs index e8f536133..f72851ed7 100644 --- a/examples/stm32h5/src/bin/usb_serial.rs +++ b/examples/stm32h5/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::time::Hertz; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h5/src/bin/usb_uac_speaker.rs b/examples/stm32h5/src/bin/usb_uac_speaker.rs index 86873cabd..f75b1fd8a 100644 --- a/examples/stm32h5/src/bin/usb_uac_speaker.rs +++ b/examples/stm32h5/src/bin/usb_uac_speaker.rs @@ -6,9 +6,9 @@ use core::cell::{Cell, RefCell}; use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, interrupt, peripherals, timer, usb, Config}; -use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex}; +use embassy_stm32::{Config, bind_interrupts, interrupt, peripherals, timer, usb}; use embassy_sync::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex}; use embassy_sync::signal::Signal; use embassy_sync::zerocopy_channel; use embassy_usb::class::uac1; diff --git a/examples/stm32h7/src/bin/adc.rs b/examples/stm32h7/src/bin/adc.rs index 98504ddf6..a53c9d8d5 100644 --- a/examples/stm32h7/src/bin/adc.rs +++ b/examples/stm32h7/src/bin/adc.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, SampleTime}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, SampleTime}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/adc_dma.rs b/examples/stm32h7/src/bin/adc_dma.rs index f06b5d06e..cedb32e47 100644 --- a/examples/stm32h7/src/bin/adc_dma.rs +++ b/examples/stm32h7/src/bin/adc_dma.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/camera.rs b/examples/stm32h7/src/bin/camera.rs index 039008d17..c593d5e0b 100644 --- a/examples/stm32h7/src/bin/camera.rs +++ b/examples/stm32h7/src/bin/camera.rs @@ -6,7 +6,7 @@ use embassy_stm32::dcmi::{self, *}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::i2c::I2c; use embassy_stm32::rcc::{Mco, Mco1Source, McoConfig, McoPrescaler}; -use embassy_stm32::{bind_interrupts, i2c, peripherals, Config}; +use embassy_stm32::{Config, bind_interrupts, i2c, peripherals}; use embassy_time::Timer; use ov7725::*; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/can.rs b/examples/stm32h7/src/bin/can.rs index 0af11ef3e..49830f9b7 100644 --- a/examples/stm32h7/src/bin/can.rs +++ b/examples/stm32h7/src/bin/can.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::peripherals::*; -use embassy_stm32::{bind_interrupts, can, rcc, Config}; +use embassy_stm32::{Config, bind_interrupts, can, rcc}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/dac.rs b/examples/stm32h7/src/bin/dac.rs index 27df80336..fa22837c5 100644 --- a/examples/stm32h7/src/bin/dac.rs +++ b/examples/stm32h7/src/bin/dac.rs @@ -3,8 +3,8 @@ use cortex_m_rt::entry; use defmt::*; -use embassy_stm32::dac::{DacCh1, Value}; use embassy_stm32::Config; +use embassy_stm32::dac::{DacCh1, Value}; use {defmt_rtt as _, panic_probe as _}; #[entry] diff --git a/examples/stm32h7/src/bin/dac_dma.rs b/examples/stm32h7/src/bin/dac_dma.rs index df37e9d78..9ccefa761 100644 --- a/examples/stm32h7/src/bin/dac_dma.rs +++ b/examples/stm32h7/src/bin/dac_dma.rs @@ -3,6 +3,7 @@ use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Peri; use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; use embassy_stm32::mode::Async; use embassy_stm32::pac::timer::vals::Mms; @@ -10,7 +11,6 @@ use embassy_stm32::peripherals::{DAC1, TIM6, TIM7}; use embassy_stm32::rcc::frequency; use embassy_stm32::time::Hertz; use embassy_stm32::timer::low_level::Timer; -use embassy_stm32::Peri; use micromath::F32Ext; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs index 6c215362d..589f4426e 100644 --- a/examples/stm32h7/src/bin/eth.rs +++ b/examples/stm32h7/src/bin/eth.rs @@ -8,7 +8,7 @@ use embassy_net::{Ipv4Address, StackResources}; use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; use embassy_stm32::peripherals::ETH; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use embedded_io_async::Write; use static_cell::StaticCell; diff --git a/examples/stm32h7/src/bin/eth_client.rs b/examples/stm32h7/src/bin/eth_client.rs index 10ac57fc9..fed8f1a9c 100644 --- a/examples/stm32h7/src/bin/eth_client.rs +++ b/examples/stm32h7/src/bin/eth_client.rs @@ -5,12 +5,12 @@ use core::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use defmt::*; use embassy_executor::Spawner; -use embassy_net::tcp::client::{TcpClient, TcpClientState}; use embassy_net::StackResources; +use embassy_net::tcp::client::{TcpClient, TcpClientState}; use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; use embassy_stm32::peripherals::ETH; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use embedded_io_async::Write; use embedded_nal_async::TcpConnect; diff --git a/examples/stm32h7/src/bin/eth_client_mii.rs b/examples/stm32h7/src/bin/eth_client_mii.rs index c6a108471..c3c631f0f 100644 --- a/examples/stm32h7/src/bin/eth_client_mii.rs +++ b/examples/stm32h7/src/bin/eth_client_mii.rs @@ -5,12 +5,12 @@ use core::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use defmt::*; use embassy_executor::Spawner; -use embassy_net::tcp::client::{TcpClient, TcpClientState}; use embassy_net::StackResources; +use embassy_net::tcp::client::{TcpClient, TcpClientState}; use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; use embassy_stm32::peripherals::ETH; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use embedded_io_async::Write; use embedded_nal_async::TcpConnect; diff --git a/examples/stm32h7/src/bin/fmc.rs b/examples/stm32h7/src/bin/fmc.rs index 5e5e6ccc8..b65d50443 100644 --- a/examples/stm32h7/src/bin/fmc.rs +++ b/examples/stm32h7/src/bin/fmc.rs @@ -3,8 +3,8 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::fmc::Fmc; use embassy_stm32::Config; +use embassy_stm32::fmc::Fmc; use embassy_time::{Delay, Timer}; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/i2c_shared.rs b/examples/stm32h7/src/bin/i2c_shared.rs index 9e45d845f..08ff812f2 100644 --- a/examples/stm32h7/src/bin/i2c_shared.rs +++ b/examples/stm32h7/src/bin/i2c_shared.rs @@ -9,8 +9,8 @@ use embassy_executor::Spawner; use embassy_stm32::i2c::{self, I2c}; use embassy_stm32::mode::Async; use embassy_stm32::{bind_interrupts, peripherals}; -use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::NoopMutex; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_time::{Duration, Timer}; use embedded_hal_1::i2c::I2c as _; use static_cell::StaticCell; diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs index 12abb8693..f17fb2aaa 100644 --- a/examples/stm32h7/src/bin/low_level_timer_api.rs +++ b/examples/stm32h7/src/bin/low_level_timer_api.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::gpio::{AfType, Flex, OutputType, Speed}; -use embassy_stm32::time::{khz, Hertz}; +use embassy_stm32::time::{Hertz, khz}; use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; use embassy_stm32::timer::{Ch1, Ch2, Ch3, Ch4, Channel, GeneralInstance32bit4Channel, TimerPin}; use embassy_stm32::{Config, Peri}; diff --git a/examples/stm32h7/src/bin/pwm.rs b/examples/stm32h7/src/bin/pwm.rs index 73b43be69..ffd117580 100644 --- a/examples/stm32h7/src/bin/pwm.rs +++ b/examples/stm32h7/src/bin/pwm.rs @@ -3,10 +3,10 @@ use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::gpio::OutputType; use embassy_stm32::time::khz; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/rng.rs b/examples/stm32h7/src/bin/rng.rs index a9ef7200d..489747678 100644 --- a/examples/stm32h7/src/bin/rng.rs +++ b/examples/stm32h7/src/bin/rng.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, rng}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h7/src/bin/rtc.rs b/examples/stm32h7/src/bin/rtc.rs index 0adb48877..1bd71637b 100644 --- a/examples/stm32h7/src/bin/rtc.rs +++ b/examples/stm32h7/src/bin/rtc.rs @@ -4,9 +4,9 @@ use chrono::{NaiveDate, NaiveDateTime}; use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::rcc::LsConfig; use embassy_stm32::rtc::{Rtc, RtcConfig}; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/sdmmc.rs b/examples/stm32h7/src/bin/sdmmc.rs index 96840d8ff..4977fec79 100644 --- a/examples/stm32h7/src/bin/sdmmc.rs +++ b/examples/stm32h7/src/bin/sdmmc.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::sdmmc::Sdmmc; use embassy_stm32::time::mhz; -use embassy_stm32::{bind_interrupts, peripherals, sdmmc, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, sdmmc}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h7/src/bin/spi.rs b/examples/stm32h7/src/bin/spi.rs index dce30a4a7..61f31be24 100644 --- a/examples/stm32h7/src/bin/spi.rs +++ b/examples/stm32h7/src/bin/spi.rs @@ -9,7 +9,7 @@ use defmt::*; use embassy_executor::Executor; use embassy_stm32::mode::Blocking; use embassy_stm32::time::mhz; -use embassy_stm32::{spi, Config}; +use embassy_stm32::{Config, spi}; use heapless::String; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/spi_bdma.rs b/examples/stm32h7/src/bin/spi_bdma.rs index 828f687b8..be6a26d82 100644 --- a/examples/stm32h7/src/bin/spi_bdma.rs +++ b/examples/stm32h7/src/bin/spi_bdma.rs @@ -9,7 +9,7 @@ use defmt::*; use embassy_executor::Executor; use embassy_stm32::mode::Async; use embassy_stm32::time::mhz; -use embassy_stm32::{spi, Config}; +use embassy_stm32::{Config, spi}; use grounded::uninit::GroundedArrayCell; use heapless::String; use static_cell::StaticCell; diff --git a/examples/stm32h7/src/bin/spi_dma.rs b/examples/stm32h7/src/bin/spi_dma.rs index 2197fabce..20cb67ba0 100644 --- a/examples/stm32h7/src/bin/spi_dma.rs +++ b/examples/stm32h7/src/bin/spi_dma.rs @@ -9,7 +9,7 @@ use defmt::*; use embassy_executor::Executor; use embassy_stm32::mode::Async; use embassy_stm32::time::mhz; -use embassy_stm32::{spi, Config}; +use embassy_stm32::{Config, spi}; use heapless::String; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7/src/bin/usb_serial.rs b/examples/stm32h7/src/bin/usb_serial.rs index 50bb964da..d0470101b 100644 --- a/examples/stm32h7/src/bin/usb_serial.rs +++ b/examples/stm32h7/src/bin/usb_serial.rs @@ -5,10 +5,10 @@ use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h723/src/bin/spdifrx.rs b/examples/stm32h723/src/bin/spdifrx.rs index b75a03ae8..cdbd69b89 100644 --- a/examples/stm32h723/src/bin/spdifrx.rs +++ b/examples/stm32h723/src/bin/spdifrx.rs @@ -7,9 +7,9 @@ use defmt::{info, trace}; use embassy_executor::Spawner; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_stm32::spdifrx::{self, Spdifrx}; -use embassy_stm32::{bind_interrupts, peripherals, sai, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals, sai}; use grounded::uninit::GroundedArrayCell; use hal::sai::*; use {defmt_rtt as _, embassy_stm32 as hal, panic_probe as _}; diff --git a/examples/stm32h735/src/bin/ltdc.rs b/examples/stm32h735/src/bin/ltdc.rs index 8a99f745d..f042e04c2 100644 --- a/examples/stm32h735/src/bin/ltdc.rs +++ b/examples/stm32h735/src/bin/ltdc.rs @@ -15,14 +15,14 @@ use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge}; use embassy_stm32::{bind_interrupts, peripherals}; use embassy_time::{Duration, Timer}; +use embedded_graphics::Pixel; use embedded_graphics::draw_target::DrawTarget; use embedded_graphics::geometry::{OriginDimensions, Point, Size}; use embedded_graphics::image::Image; -use embedded_graphics::pixelcolor::raw::RawU24; use embedded_graphics::pixelcolor::Rgb888; +use embedded_graphics::pixelcolor::raw::RawU24; use embedded_graphics::prelude::*; use embedded_graphics::primitives::Rectangle; -use embedded_graphics::Pixel; use heapless::{Entry, FnvIndexMap}; use tinybmp::Bmp; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h742/src/bin/qspi.rs b/examples/stm32h742/src/bin/qspi.rs index 9e79d7089..a88c8f249 100644 --- a/examples/stm32h742/src/bin/qspi.rs +++ b/examples/stm32h742/src/bin/qspi.rs @@ -4,10 +4,10 @@ use defmt::info; use embassy_executor::Spawner; +use embassy_stm32::Config as StmCfg; use embassy_stm32::mode::Blocking; use embassy_stm32::qspi::enums::{AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *}; use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig}; -use embassy_stm32::Config as StmCfg; use {defmt_rtt as _, panic_probe as _}; const MEMORY_PAGE_SIZE: usize = 256; diff --git a/examples/stm32h755cm4/src/bin/blinky.rs b/examples/stm32h755cm4/src/bin/blinky.rs index 39112c1f5..0ee3c68dc 100644 --- a/examples/stm32h755cm4/src/bin/blinky.rs +++ b/examples/stm32h755cm4/src/bin/blinky.rs @@ -5,8 +5,8 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::SharedData; +use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h755cm4/src/bin/intercore.rs b/examples/stm32h755cm4/src/bin/intercore.rs index d93d31786..c0db8cdd3 100644 --- a/examples/stm32h755cm4/src/bin/intercore.rs +++ b/examples/stm32h755cm4/src/bin/intercore.rs @@ -93,8 +93,8 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::SharedData; +use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_time::Timer; use shared::SHARED_LED_STATE; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h755cm7/src/bin/blinky.rs b/examples/stm32h755cm7/src/bin/blinky.rs index b30bf4de8..e8f5a1c43 100644 --- a/examples/stm32h755cm7/src/bin/blinky.rs +++ b/examples/stm32h755cm7/src/bin/blinky.rs @@ -5,8 +5,8 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::SharedData; +use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7b0/src/bin/ospi_memory_mapped.rs b/examples/stm32h7b0/src/bin/ospi_memory_mapped.rs index dffb740a9..865062f4b 100644 --- a/examples/stm32h7b0/src/bin/ospi_memory_mapped.rs +++ b/examples/stm32h7b0/src/bin/ospi_memory_mapped.rs @@ -5,6 +5,7 @@ use defmt::info; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::mode::Blocking; use embassy_stm32::ospi::{ @@ -12,7 +13,6 @@ use embassy_stm32::ospi::{ OspiWidth, TransferConfig, WrapSize, }; use embassy_stm32::time::Hertz; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7rs/src/bin/blinky.rs b/examples/stm32h7rs/src/bin/blinky.rs index 5fd50fb15..4c0864ff6 100644 --- a/examples/stm32h7rs/src/bin/blinky.rs +++ b/examples/stm32h7rs/src/bin/blinky.rs @@ -3,9 +3,9 @@ use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::time::Hertz; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7rs/src/bin/can.rs b/examples/stm32h7rs/src/bin/can.rs index 0af11ef3e..49830f9b7 100644 --- a/examples/stm32h7rs/src/bin/can.rs +++ b/examples/stm32h7rs/src/bin/can.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::peripherals::*; -use embassy_stm32::{bind_interrupts, can, rcc, Config}; +use embassy_stm32::{Config, bind_interrupts, can, rcc}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7rs/src/bin/eth.rs b/examples/stm32h7rs/src/bin/eth.rs index 67f541564..5ce1d4765 100644 --- a/examples/stm32h7rs/src/bin/eth.rs +++ b/examples/stm32h7rs/src/bin/eth.rs @@ -8,7 +8,7 @@ use embassy_net::{Ipv4Address, Ipv4Cidr, StackResources}; use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; use embassy_stm32::peripherals::ETH; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; use embassy_time::Timer; use heapless::Vec; use static_cell::StaticCell; diff --git a/examples/stm32h7rs/src/bin/rng.rs b/examples/stm32h7rs/src/bin/rng.rs index a9ef7200d..489747678 100644 --- a/examples/stm32h7rs/src/bin/rng.rs +++ b/examples/stm32h7rs/src/bin/rng.rs @@ -4,7 +4,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, rng}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h7rs/src/bin/rtc.rs b/examples/stm32h7rs/src/bin/rtc.rs index 0adb48877..1bd71637b 100644 --- a/examples/stm32h7rs/src/bin/rtc.rs +++ b/examples/stm32h7rs/src/bin/rtc.rs @@ -4,9 +4,9 @@ use chrono::{NaiveDate, NaiveDateTime}; use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::rcc::LsConfig; use embassy_stm32::rtc::{Rtc, RtcConfig}; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h7rs/src/bin/usb_serial.rs b/examples/stm32h7rs/src/bin/usb_serial.rs index 23abc3e2f..3e295dd51 100644 --- a/examples/stm32h7rs/src/bin/usb_serial.rs +++ b/examples/stm32h7rs/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::time::Hertz; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32h7rs/src/bin/xspi_memory_mapped.rs b/examples/stm32h7rs/src/bin/xspi_memory_mapped.rs index 4c1b450b4..d91ae9de0 100644 --- a/examples/stm32h7rs/src/bin/xspi_memory_mapped.rs +++ b/examples/stm32h7rs/src/bin/xspi_memory_mapped.rs @@ -8,6 +8,7 @@ use core::cmp::min; use defmt::info; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::mode::Blocking; use embassy_stm32::time::Hertz; @@ -15,7 +16,6 @@ use embassy_stm32::xspi::{ AddressSize, ChipSelectHighTime, DummyCycles, FIFOThresholdLevel, Instance, MemorySize, MemoryType, TransferConfig, WrapSize, Xspi, XspiWidth, }; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32l0/src/bin/button_exti.rs b/examples/stm32l0/src/bin/button_exti.rs index 4945da7ce..7ff4a7d52 100644 --- a/examples/stm32l0/src/bin/button_exti.rs +++ b/examples/stm32l0/src/bin/button_exti.rs @@ -3,9 +3,9 @@ use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::exti::ExtiInput; use embassy_stm32::gpio::Pull; -use embassy_stm32::Config; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32l0/src/bin/dds.rs b/examples/stm32l0/src/bin/dds.rs index eaa7a61a8..d8f9020d4 100644 --- a/examples/stm32l0/src/bin/dds.rs +++ b/examples/stm32l0/src/bin/dds.rs @@ -12,7 +12,7 @@ use embassy_stm32::time::hz; use embassy_stm32::timer::low_level::{Timer as LLTimer, *}; use embassy_stm32::timer::simple_pwm::PwmPin; use embassy_stm32::timer::{Ch3, Channel}; -use embassy_stm32::{interrupt, pac, Config}; +use embassy_stm32::{Config, interrupt, pac}; use panic_probe as _; const DDS_SINE_DATA: [u8; 256] = [ diff --git a/examples/stm32l0/src/bin/eeprom.rs b/examples/stm32l0/src/bin/eeprom.rs index 370246644..a33088f36 100644 --- a/examples/stm32l0/src/bin/eeprom.rs +++ b/examples/stm32l0/src/bin/eeprom.rs @@ -3,7 +3,7 @@ use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_stm32::flash::{Flash, EEPROM_BASE, EEPROM_SIZE}; +use embassy_stm32::flash::{EEPROM_BASE, EEPROM_SIZE, Flash}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32l0/src/bin/raw_spawn.rs b/examples/stm32l0/src/bin/raw_spawn.rs index 7eea910ca..8e8fe0240 100644 --- a/examples/stm32l0/src/bin/raw_spawn.rs +++ b/examples/stm32l0/src/bin/raw_spawn.rs @@ -5,8 +5,8 @@ use core::mem; use cortex_m_rt::entry; use defmt::*; -use embassy_executor::raw::TaskStorage; use embassy_executor::Executor; +use embassy_executor::raw::TaskStorage; use embassy_time::Timer; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32l0/src/bin/usb_serial.rs b/examples/stm32l0/src/bin/usb_serial.rs index fdb1aeb59..612082f29 100644 --- a/examples/stm32l0/src/bin/usb_serial.rs +++ b/examples/stm32l0/src/bin/usb_serial.rs @@ -6,9 +6,9 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{self, Driver, Instance}; use embassy_stm32::{bind_interrupts, peripherals}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32l1/src/bin/eeprom.rs b/examples/stm32l1/src/bin/eeprom.rs index 370246644..a33088f36 100644 --- a/examples/stm32l1/src/bin/eeprom.rs +++ b/examples/stm32l1/src/bin/eeprom.rs @@ -3,7 +3,7 @@ use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_stm32::flash::{Flash, EEPROM_BASE, EEPROM_SIZE}; +use embassy_stm32::flash::{EEPROM_BASE, EEPROM_SIZE, Flash}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32l1/src/bin/usb_serial.rs b/examples/stm32l1/src/bin/usb_serial.rs index a35f1d7a7..c54d37f9d 100644 --- a/examples/stm32l1/src/bin/usb_serial.rs +++ b/examples/stm32l1/src/bin/usb_serial.rs @@ -6,9 +6,9 @@ use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{self, Driver, Instance}; use embassy_stm32::{bind_interrupts, peripherals}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32l4/src/bin/adc.rs b/examples/stm32l4/src/bin/adc.rs index c557ac6d7..40e907940 100644 --- a/examples/stm32l4/src/bin/adc.rs +++ b/examples/stm32l4/src/bin/adc.rs @@ -2,8 +2,8 @@ #![no_main] use defmt::*; -use embassy_stm32::adc::{Adc, Resolution}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, Resolution}; use {defmt_rtt as _, panic_probe as _}; #[cortex_m_rt::entry] diff --git a/examples/stm32l4/src/bin/can.rs b/examples/stm32l4/src/bin/can.rs index 3c4cdac24..bd361417e 100644 --- a/examples/stm32l4/src/bin/can.rs +++ b/examples/stm32l4/src/bin/can.rs @@ -8,7 +8,7 @@ use embassy_stm32::can::{ Can, Fifo, Frame, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler, }; use embassy_stm32::peripherals::CAN1; -use embassy_stm32::{bind_interrupts, Config}; +use embassy_stm32::{Config, bind_interrupts}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32l4/src/bin/dac_dma.rs b/examples/stm32l4/src/bin/dac_dma.rs index 44edec728..bfdf858c5 100644 --- a/examples/stm32l4/src/bin/dac_dma.rs +++ b/examples/stm32l4/src/bin/dac_dma.rs @@ -3,6 +3,7 @@ use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Peri; use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; use embassy_stm32::mode::Async; use embassy_stm32::pac::timer::vals::Mms; @@ -10,7 +11,6 @@ use embassy_stm32::peripherals::{DAC1, TIM6, TIM7}; use embassy_stm32::rcc::frequency; use embassy_stm32::time::Hertz; use embassy_stm32::timer::low_level::Timer; -use embassy_stm32::Peri; use micromath::F32Ext; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32l4/src/bin/rng.rs b/examples/stm32l4/src/bin/rng.rs index 14d0e3c1e..4d9f83ad8 100644 --- a/examples/stm32l4/src/bin/rng.rs +++ b/examples/stm32l4/src/bin/rng.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::rcc::{Pll, PllMul, PllPreDiv, PllQDiv, PllRDiv, PllSource, Sysclk}; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, rng}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32l4/src/bin/rtc.rs b/examples/stm32l4/src/bin/rtc.rs index f554f0f78..1d26cd008 100644 --- a/examples/stm32l4/src/bin/rtc.rs +++ b/examples/stm32l4/src/bin/rtc.rs @@ -4,9 +4,9 @@ use chrono::{NaiveDate, NaiveDateTime}; use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::rtc::{Rtc, RtcConfig}; use embassy_stm32::time::Hertz; -use embassy_stm32::Config; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32l4/src/bin/spe_adin1110_http_server.rs b/examples/stm32l4/src/bin/spe_adin1110_http_server.rs index 24efe526f..8e54938d1 100644 --- a/examples/stm32l4/src/bin/spe_adin1110_http_server.rs +++ b/examples/stm32l4/src/bin/spe_adin1110_http_server.rs @@ -16,14 +16,14 @@ use core::marker::PhantomData; use core::sync::atomic::{AtomicI32, Ordering}; -use defmt::{error, info, println, unwrap, Format}; +use defmt::{Format, error, info, println, unwrap}; use defmt_rtt as _; // global logger use embassy_executor::Spawner; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_futures::yield_now; use embassy_net::tcp::TcpSocket; use embassy_net::{Ipv4Address, Ipv4Cidr, Stack, StackResources, StaticConfigV4}; -use embassy_net_adin1110::{Device, Runner, ADIN1110}; +use embassy_net_adin1110::{ADIN1110, Device, Runner}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::i2c::{self, Config as I2C_Config, I2c}; use embassy_stm32::mode::Async; @@ -159,7 +159,9 @@ async fn main(spawner: Spawner) { // Check the SPI mode selected with the "HW CFG" dip-switch if !cfg1_spi_mode { - error!("Driver doesn´t support SPI Protolcol \"OPEN Alliance\".\nplease use the \"Generic SPI\"! Turn On \"HW CFG\": \"SPI_CFG1\""); + error!( + "Driver doesn´t support SPI Protolcol \"OPEN Alliance\".\nplease use the \"Generic SPI\"! Turn On \"HW CFG\": \"SPI_CFG1\"" + ); loop { led_uc2_red.toggle(); Timer::after(Duration::from_hz(10)).await; diff --git a/examples/stm32l4/src/bin/usb_serial.rs b/examples/stm32l4/src/bin/usb_serial.rs index af90e297e..17cd107f6 100644 --- a/examples/stm32l4/src/bin/usb_serial.rs +++ b/examples/stm32l4/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use defmt_rtt as _; // global logger use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use panic_probe as _; bind_interrupts!(struct Irqs { diff --git a/examples/stm32l5/src/bin/rng.rs b/examples/stm32l5/src/bin/rng.rs index 0a644e73d..d6302e106 100644 --- a/examples/stm32l5/src/bin/rng.rs +++ b/examples/stm32l5/src/bin/rng.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::rcc::{Pll, PllMul, PllPreDiv, PllRDiv, PllSource, Sysclk}; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, rng}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs index 25aa9ef69..d2cbeb550 100644 --- a/examples/stm32l5/src/bin/usb_ethernet.rs +++ b/examples/stm32l5/src/bin/usb_ethernet.rs @@ -3,11 +3,11 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_net::tcp::TcpSocket; use embassy_net::StackResources; +use embassy_net::tcp::TcpSocket; use embassy_stm32::rng::Rng; use embassy_stm32::usb::Driver; -use embassy_stm32::{bind_interrupts, peripherals, rng, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, rng, usb}; use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; use embassy_usb::{Builder, UsbDevice}; diff --git a/examples/stm32l5/src/bin/usb_hid_mouse.rs b/examples/stm32l5/src/bin/usb_hid_mouse.rs index 3f8c52b82..b721f5b2e 100644 --- a/examples/stm32l5/src/bin/usb_hid_mouse.rs +++ b/examples/stm32l5/src/bin/usb_hid_mouse.rs @@ -5,11 +5,11 @@ use defmt::*; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::Driver; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; use embassy_time::Timer; +use embassy_usb::Builder; use embassy_usb::class::hid::{HidWriter, ReportId, RequestHandler, State}; use embassy_usb::control::OutResponse; -use embassy_usb::Builder; use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32l5/src/bin/usb_serial.rs b/examples/stm32l5/src/bin/usb_serial.rs index a64bda31b..4f77fc1d7 100644 --- a/examples/stm32l5/src/bin/usb_serial.rs +++ b/examples/stm32l5/src/bin/usb_serial.rs @@ -5,10 +5,10 @@ use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32u0/src/bin/adc.rs b/examples/stm32u0/src/bin/adc.rs index c8252e4e1..32a54299d 100644 --- a/examples/stm32u0/src/bin/adc.rs +++ b/examples/stm32u0/src/bin/adc.rs @@ -2,8 +2,8 @@ #![no_main] use defmt::*; -use embassy_stm32::adc::{Adc, Resolution}; use embassy_stm32::Config; +use embassy_stm32::adc::{Adc, Resolution}; use embassy_time::Duration; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32u0/src/bin/rng.rs b/examples/stm32u0/src/bin/rng.rs index 89445b042..07deda94c 100644 --- a/examples/stm32u0/src/bin/rng.rs +++ b/examples/stm32u0/src/bin/rng.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::rcc::mux::Clk48sel; use embassy_stm32::rng::Rng; -use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, rng}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32u0/src/bin/rtc.rs b/examples/stm32u0/src/bin/rtc.rs index 72fa0fde4..d071cfbc7 100644 --- a/examples/stm32u0/src/bin/rtc.rs +++ b/examples/stm32u0/src/bin/rtc.rs @@ -4,8 +4,8 @@ use chrono::{NaiveDate, NaiveDateTime}; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::rtc::{Rtc, RtcConfig}; use embassy_stm32::Config; +use embassy_stm32::rtc::{Rtc, RtcConfig}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32u0/src/bin/usb_serial.rs b/examples/stm32u0/src/bin/usb_serial.rs index 273f40643..77d0640f6 100644 --- a/examples/stm32u0/src/bin/usb_serial.rs +++ b/examples/stm32u0/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use defmt_rtt as _; // global logger use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use panic_probe as _; bind_interrupts!(struct Irqs { diff --git a/examples/stm32u5/src/bin/adc.rs b/examples/stm32u5/src/bin/adc.rs index d2aa28087..91e33053e 100644 --- a/examples/stm32u5/src/bin/adc.rs +++ b/examples/stm32u5/src/bin/adc.rs @@ -3,7 +3,7 @@ use defmt::*; use embassy_stm32::adc; -use embassy_stm32::adc::{adc4, AdcChannel}; +use embassy_stm32::adc::{AdcChannel, adc4}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32u5/src/bin/ltdc.rs b/examples/stm32u5/src/bin/ltdc.rs index 46d1c120f..d1fddb679 100644 --- a/examples/stm32u5/src/bin/ltdc.rs +++ b/examples/stm32u5/src/bin/ltdc.rs @@ -13,14 +13,14 @@ use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge}; use embassy_stm32::{bind_interrupts, peripherals}; use embassy_time::{Duration, Timer}; +use embedded_graphics::Pixel; use embedded_graphics::draw_target::DrawTarget; use embedded_graphics::geometry::{OriginDimensions, Point, Size}; use embedded_graphics::image::Image; -use embedded_graphics::pixelcolor::raw::RawU24; use embedded_graphics::pixelcolor::Rgb888; +use embedded_graphics::pixelcolor::raw::RawU24; use embedded_graphics::prelude::*; use embedded_graphics::primitives::Rectangle; -use embedded_graphics::Pixel; use heapless::{Entry, FnvIndexMap}; use tinybmp::Bmp; use {defmt_rtt as _, panic_probe as _}; @@ -317,7 +317,7 @@ impl OriginDimensions for DoubleBuffer { mod rcc_setup { use embassy_stm32::time::Hertz; - use embassy_stm32::{rcc, Config, Peripherals}; + use embassy_stm32::{Config, Peripherals, rcc}; /// Sets up clocks for the stm32u5g9zj mcu /// change this if you plan to use a different microcontroller diff --git a/examples/stm32u5/src/bin/usb_hs_serial.rs b/examples/stm32u5/src/bin/usb_hs_serial.rs index d37e7777b..c444d3479 100644 --- a/examples/stm32u5/src/bin/usb_hs_serial.rs +++ b/examples/stm32u5/src/bin/usb_hs_serial.rs @@ -6,10 +6,10 @@ use defmt_rtt as _; // global logger use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use panic_probe as _; bind_interrupts!(struct Irqs { diff --git a/examples/stm32u5/src/bin/usb_serial.rs b/examples/stm32u5/src/bin/usb_serial.rs index ff7f4e5be..c0a768cbb 100644 --- a/examples/stm32u5/src/bin/usb_serial.rs +++ b/examples/stm32u5/src/bin/usb_serial.rs @@ -6,10 +6,10 @@ use defmt_rtt as _; // global logger use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use panic_probe as _; bind_interrupts!(struct Irqs { diff --git a/examples/stm32wb/src/bin/eddystone_beacon.rs b/examples/stm32wb/src/bin/eddystone_beacon.rs index 3bd8b4a63..f309ca3a2 100644 --- a/examples/stm32wb/src/bin/eddystone_beacon.rs +++ b/examples/stm32wb/src/bin/eddystone_beacon.rs @@ -8,15 +8,15 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; +use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; -use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/examples/stm32wb/src/bin/gatt_server.rs b/examples/stm32wb/src/bin/gatt_server.rs index 5d927bc00..2ed257566 100644 --- a/examples/stm32wb/src/bin/gatt_server.rs +++ b/examples/stm32wb/src/bin/gatt_server.rs @@ -8,6 +8,7 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::hci::event::command::{CommandComplete, ReturnParameters}; use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; @@ -28,7 +29,6 @@ use embassy_stm32_wpan::hci::{BdAddr, Event}; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::sub::ble::Ble; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/examples/stm32wb/src/bin/mac_ffd.rs b/examples/stm32wb/src/bin/mac_ffd.rs index ede6cf4b9..18a52e162 100644 --- a/examples/stm32wb/src/bin/mac_ffd.rs +++ b/examples/stm32wb/src/bin/mac_ffd.rs @@ -6,11 +6,11 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::mac::commands::{AssociateResponse, ResetRequest, SetRequest, StartRequest}; use embassy_stm32_wpan::mac::event::MacEvent; use embassy_stm32_wpan::mac::typedefs::{MacChannel, MacStatus, PanId, PibId, SecurityLevel}; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/examples/stm32wb/src/bin/mac_ffd_net.rs b/examples/stm32wb/src/bin/mac_ffd_net.rs index cc3b21e2e..5296943a1 100644 --- a/examples/stm32wb/src/bin/mac_ffd_net.rs +++ b/examples/stm32wb/src/bin/mac_ffd_net.rs @@ -6,11 +6,11 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::mac::commands::{ResetRequest, SetRequest, StartRequest}; use embassy_stm32_wpan::mac::typedefs::{MacChannel, PanId, PibId}; use embassy_stm32_wpan::mac::{self, Runner}; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32wb/src/bin/mac_rfd.rs b/examples/stm32wb/src/bin/mac_rfd.rs index d872104a8..883179023 100644 --- a/examples/stm32wb/src/bin/mac_rfd.rs +++ b/examples/stm32wb/src/bin/mac_rfd.rs @@ -6,13 +6,13 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::mac::commands::{AssociateRequest, DataRequest, GetRequest, ResetRequest, SetRequest}; use embassy_stm32_wpan::mac::event::MacEvent; use embassy_stm32_wpan::mac::typedefs::{ AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, }; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/examples/stm32wb/src/bin/tl_mbox_mac.rs b/examples/stm32wb/src/bin/tl_mbox_mac.rs index 95c73872b..16d0a1527 100644 --- a/examples/stm32wb/src/bin/tl_mbox_mac.rs +++ b/examples/stm32wb/src/bin/tl_mbox_mac.rs @@ -6,8 +6,8 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; -use embassy_stm32_wpan::sub::mm; use embassy_stm32_wpan::TlMbox; +use embassy_stm32_wpan::sub::mm; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/examples/stm32wba/src/bin/adc.rs b/examples/stm32wba/src/bin/adc.rs index a9651d57e..8c80470b8 100644 --- a/examples/stm32wba/src/bin/adc.rs +++ b/examples/stm32wba/src/bin/adc.rs @@ -2,7 +2,7 @@ #![no_main] use defmt::*; -use embassy_stm32::adc::{adc4, AdcChannel}; +use embassy_stm32::adc::{AdcChannel, adc4}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32wba/src/bin/pwm.rs b/examples/stm32wba/src/bin/pwm.rs index de690fda0..f20c77a7c 100644 --- a/examples/stm32wba/src/bin/pwm.rs +++ b/examples/stm32wba/src/bin/pwm.rs @@ -4,13 +4,13 @@ use defmt::*; use defmt_rtt as _; // global logger use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::gpio::OutputType; use embassy_stm32::rcc::{ AHB5Prescaler, AHBPrescaler, APBPrescaler, PllDiv, PllMul, PllPreDiv, PllSource, Sysclk, VoltageScale, }; use embassy_stm32::time::khz; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; -use embassy_stm32::Config; use embassy_time::Timer; use panic_probe as _; diff --git a/examples/stm32wba6/src/bin/adc.rs b/examples/stm32wba6/src/bin/adc.rs index a9651d57e..8c80470b8 100644 --- a/examples/stm32wba6/src/bin/adc.rs +++ b/examples/stm32wba6/src/bin/adc.rs @@ -2,7 +2,7 @@ #![no_main] use defmt::*; -use embassy_stm32::adc::{adc4, AdcChannel}; +use embassy_stm32::adc::{AdcChannel, adc4}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/examples/stm32wba6/src/bin/pwm.rs b/examples/stm32wba6/src/bin/pwm.rs index 2c696834a..64ae01945 100644 --- a/examples/stm32wba6/src/bin/pwm.rs +++ b/examples/stm32wba6/src/bin/pwm.rs @@ -4,13 +4,13 @@ use defmt::*; use defmt_rtt as _; // global logger use embassy_executor::Spawner; +use embassy_stm32::Config; use embassy_stm32::gpio::OutputType; use embassy_stm32::rcc::{ AHB5Prescaler, AHBPrescaler, APBPrescaler, PllDiv, PllMul, PllPreDiv, PllSource, Sysclk, VoltageScale, }; use embassy_stm32::time::khz; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; -use embassy_stm32::Config; use embassy_time::Timer; use panic_probe as _; diff --git a/examples/stm32wba6/src/bin/usb_hs_serial.rs b/examples/stm32wba6/src/bin/usb_hs_serial.rs index 20bdeaac3..a60eeb480 100644 --- a/examples/stm32wba6/src/bin/usb_hs_serial.rs +++ b/examples/stm32wba6/src/bin/usb_hs_serial.rs @@ -5,10 +5,10 @@ use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::usb::{Driver, Instance}; -use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; +use embassy_stm32::{Config, bind_interrupts, peripherals, usb}; +use embassy_usb::Builder; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; use embassy_usb::driver::EndpointError; -use embassy_usb::Builder; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { diff --git a/examples/stm32wl/src/bin/adc.rs b/examples/stm32wl/src/bin/adc.rs index 118f02ae1..6b21b086b 100644 --- a/examples/stm32wl/src/bin/adc.rs +++ b/examples/stm32wl/src/bin/adc.rs @@ -5,8 +5,8 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::adc::{Adc, CkModePclk, Clock, SampleTime}; use embassy_stm32::SharedData; +use embassy_stm32::adc::{Adc, CkModePclk, Clock, SampleTime}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32wl/src/bin/blinky.rs b/examples/stm32wl/src/bin/blinky.rs index a2a90871d..f7f57e35c 100644 --- a/examples/stm32wl/src/bin/blinky.rs +++ b/examples/stm32wl/src/bin/blinky.rs @@ -5,8 +5,8 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::SharedData; +use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32wl/src/bin/button.rs b/examples/stm32wl/src/bin/button.rs index 21bcd2ac6..07bc95ad7 100644 --- a/examples/stm32wl/src/bin/button.rs +++ b/examples/stm32wl/src/bin/button.rs @@ -5,8 +5,8 @@ use core::mem::MaybeUninit; use cortex_m_rt::entry; use defmt::*; -use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::SharedData; +use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use {defmt_rtt as _, panic_probe as _}; #[unsafe(link_section = ".shared_data")] diff --git a/examples/stm32wl/src/bin/button_exti.rs b/examples/stm32wl/src/bin/button_exti.rs index 0a8aece34..953b13bac 100644 --- a/examples/stm32wl/src/bin/button_exti.rs +++ b/examples/stm32wl/src/bin/button_exti.rs @@ -5,9 +5,9 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; +use embassy_stm32::SharedData; use embassy_stm32::exti::ExtiInput; use embassy_stm32::gpio::Pull; -use embassy_stm32::SharedData; use {defmt_rtt as _, panic_probe as _}; #[unsafe(link_section = ".shared_data")] diff --git a/examples/stm32wl/src/bin/flash.rs b/examples/stm32wl/src/bin/flash.rs index 320a9723a..bc707820d 100644 --- a/examples/stm32wl/src/bin/flash.rs +++ b/examples/stm32wl/src/bin/flash.rs @@ -5,8 +5,8 @@ use core::mem::MaybeUninit; use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_stm32::flash::Flash; use embassy_stm32::SharedData; +use embassy_stm32::flash::Flash; use {defmt_rtt as _, panic_probe as _}; #[unsafe(link_section = ".shared_data")] diff --git a/examples/stm32wl/src/bin/random.rs b/examples/stm32wl/src/bin/random.rs index 68b9d7d00..931f9819a 100644 --- a/examples/stm32wl/src/bin/random.rs +++ b/examples/stm32wl/src/bin/random.rs @@ -7,7 +7,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_stm32::rng::{self, Rng}; use embassy_stm32::time::Hertz; -use embassy_stm32::{bind_interrupts, peripherals, SharedData}; +use embassy_stm32::{SharedData, bind_interrupts, peripherals}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/examples/stm32wl/src/bin/uart_async.rs b/examples/stm32wl/src/bin/uart_async.rs index 505a85f47..829ea2de7 100644 --- a/examples/stm32wl/src/bin/uart_async.rs +++ b/examples/stm32wl/src/bin/uart_async.rs @@ -6,7 +6,7 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; use embassy_stm32::usart::{Config, InterruptHandler, Uart}; -use embassy_stm32::{bind_interrupts, peripherals, SharedData}; +use embassy_stm32::{SharedData, bind_interrupts, peripherals}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/tests/mspm0/src/bin/dma.rs b/tests/mspm0/src/bin/dma.rs index 6fd973a18..9c56acadc 100644 --- a/tests/mspm0/src/bin/dma.rs +++ b/tests/mspm0/src/bin/dma.rs @@ -11,8 +11,8 @@ use core::slice; use defmt::{assert, assert_eq, *}; use embassy_executor::Spawner; -use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word}; use embassy_mspm0::Peri; +use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/tests/perf-client/src/lib.rs b/tests/perf-client/src/lib.rs index 4bd9e5674..1ba071e8d 100644 --- a/tests/perf-client/src/lib.rs +++ b/tests/perf-client/src/lib.rs @@ -4,7 +4,7 @@ use defmt::{assert, *}; use embassy_futures::join::join; use embassy_net::tcp::TcpSocket; use embassy_net::{Ipv4Address, Stack}; -use embassy_time::{with_timeout, Duration, Timer}; +use embassy_time::{Duration, Timer, with_timeout}; pub struct Expected { pub down_kbps: usize, diff --git a/tests/rp/src/bin/cyw43-perf.rs b/tests/rp/src/bin/cyw43-perf.rs index 555134ffd..9487f5e1a 100644 --- a/tests/rp/src/bin/cyw43-perf.rs +++ b/tests/rp/src/bin/cyw43-perf.rs @@ -3,7 +3,7 @@ teleprobe_meta::target!(b"rpi-pico"); use cyw43::JoinOptions; -use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; +use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_net::{Config, StackResources}; diff --git a/tests/rp/src/bin/gpio_multicore.rs b/tests/rp/src/bin/gpio_multicore.rs index f48dd207b..6abcba590 100644 --- a/tests/rp/src/bin/gpio_multicore.rs +++ b/tests/rp/src/bin/gpio_multicore.rs @@ -7,10 +7,10 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; +use embassy_rp::Peri; use embassy_rp::gpio::{Input, Level, Output, Pull}; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_rp::peripherals::{PIN_0, PIN_1}; -use embassy_rp::Peri; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use static_cell::StaticCell; diff --git a/tests/rp/src/bin/multicore.rs b/tests/rp/src/bin/multicore.rs index 11b03cfea..7e34bc778 100644 --- a/tests/rp/src/bin/multicore.rs +++ b/tests/rp/src/bin/multicore.rs @@ -7,7 +7,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use static_cell::StaticCell; diff --git a/tests/rp/src/bin/overclock.rs b/tests/rp/src/bin/overclock.rs index 167a26eb2..87a03b5e2 100644 --- a/tests/rp/src/bin/overclock.rs +++ b/tests/rp/src/bin/overclock.rs @@ -8,7 +8,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::info; use embassy_executor::Spawner; -use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage}; +use embassy_rp::clocks::{ClockConfig, CoreVoltage, clk_sys_freq, core_voltage}; use embassy_rp::config::Config; use embassy_time::Instant; use {defmt_rtt as _, panic_probe as _}; diff --git a/tests/rp/src/bin/pio_multi_load.rs b/tests/rp/src/bin/pio_multi_load.rs index aca476d56..82bbab272 100644 --- a/tests/rp/src/bin/pio_multi_load.rs +++ b/tests/rp/src/bin/pio_multi_load.rs @@ -57,7 +57,9 @@ async fn main(_spawner: Spawner) { assert_eq!(loaded2.wrap.target, 14); // wrapping around the end of program space automatically works - let prg3 = pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2",); + let prg3 = pio_asm!( + "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2", + ); let loaded3 = common.load_program(&prg3.program); assert_eq!(loaded3.origin, 24); assert_eq!(loaded3.wrap.source, 3); diff --git a/tests/rp/src/bin/rtc.rs b/tests/rp/src/bin/rtc.rs index c66981d95..e1def7b5b 100644 --- a/tests/rp/src/bin/rtc.rs +++ b/tests/rp/src/bin/rtc.rs @@ -5,7 +5,7 @@ teleprobe_meta::target!(b"rpi-pico"); use defmt::{assert, *}; use embassy_executor::Spawner; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_rp::bind_interrupts; use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc}; use embassy_time::{Duration, Instant, Timer}; diff --git a/tests/rp/src/bin/spinlock_mutex_multicore.rs b/tests/rp/src/bin/spinlock_mutex_multicore.rs index c56d43ade..25c4faf37 100644 --- a/tests/rp/src/bin/spinlock_mutex_multicore.rs +++ b/tests/rp/src/bin/spinlock_mutex_multicore.rs @@ -7,7 +7,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_rp::spinlock_mutex::SpinlockRawMutex; use embassy_sync::channel::Channel; use static_cell::StaticCell; diff --git a/tests/stm32/src/bin/afio.rs b/tests/stm32/src/bin/afio.rs index 81d50874b..d88765717 100644 --- a/tests/stm32/src/bin/afio.rs +++ b/tests/stm32/src/bin/afio.rs @@ -16,7 +16,7 @@ use embassy_stm32::timer::qei::Qei; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; use embassy_stm32::timer::{Ch1, Ch2}; use embassy_stm32::usart::{Uart, UartRx, UartTx}; -use embassy_stm32::{bind_interrupts, Peripherals}; +use embassy_stm32::{Peripherals, bind_interrupts}; #[cfg(not(feature = "afio-connectivity-line"))] bind_interrupts!(struct Irqs { diff --git a/tests/stm32/src/bin/cryp.rs b/tests/stm32/src/bin/cryp.rs index f54c99cc3..640de50e3 100644 --- a/tests/stm32/src/bin/cryp.rs +++ b/tests/stm32/src/bin/cryp.rs @@ -5,9 +5,9 @@ #[path = "../common.rs"] mod common; +use aes_gcm::Aes128Gcm; use aes_gcm::aead::heapless::Vec; use aes_gcm::aead::{AeadInPlace, KeyInit}; -use aes_gcm::Aes128Gcm; use common::*; use embassy_executor::Spawner; use embassy_stm32::cryp::{self, *}; diff --git a/tests/stm32/src/bin/fdcan.rs b/tests/stm32/src/bin/fdcan.rs index c2a1a7bb8..d97f493df 100644 --- a/tests/stm32/src/bin/fdcan.rs +++ b/tests/stm32/src/bin/fdcan.rs @@ -8,7 +8,7 @@ mod common; use common::*; use embassy_executor::Spawner; use embassy_stm32::peripherals::*; -use embassy_stm32::{bind_interrupts, can, Config}; +use embassy_stm32::{Config, bind_interrupts, can}; use embassy_time::Duration; use {defmt_rtt as _, panic_probe as _}; diff --git a/tests/stm32/src/bin/stop.rs b/tests/stm32/src/bin/stop.rs index 8119c1f39..833ca05d0 100644 --- a/tests/stm32/src/bin/stop.rs +++ b/tests/stm32/src/bin/stop.rs @@ -9,10 +9,10 @@ use chrono::NaiveDate; use common::*; use cortex_m_rt::entry; use embassy_executor::Spawner; -use embassy_stm32::low_power::{stop_ready, stop_with_rtc, Executor, StopMode}; +use embassy_stm32::Config; +use embassy_stm32::low_power::{Executor, StopMode, stop_ready, stop_with_rtc}; use embassy_stm32::rcc::LsConfig; use embassy_stm32::rtc::{Rtc, RtcConfig}; -use embassy_stm32::Config; use embassy_time::Timer; use static_cell::StaticCell; diff --git a/tests/stm32/src/bin/ucpd.rs b/tests/stm32/src/bin/ucpd.rs index 97aefe1a0..c794afff8 100644 --- a/tests/stm32/src/bin/ucpd.rs +++ b/tests/stm32/src/bin/ucpd.rs @@ -9,7 +9,7 @@ use defmt::{assert, assert_eq}; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd}; -use embassy_stm32::{bind_interrupts, peripherals, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals}; use embassy_time::Timer; bind_interrupts!(struct Irqs { diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs index 129c7b692..0b98d3eeb 100644 --- a/tests/stm32/src/bin/usart.rs +++ b/tests/stm32/src/bin/usart.rs @@ -7,7 +7,7 @@ use common::*; use defmt::{assert, assert_eq, unreachable}; use embassy_executor::Spawner; use embassy_stm32::usart::{Config, ConfigError, Error, Uart}; -use embassy_time::{block_for, Duration, Instant}; +use embassy_time::{Duration, Instant, block_for}; #[embassy_executor::main] async fn main(_spawner: Spawner) { diff --git a/tests/stm32/src/bin/wpan_ble.rs b/tests/stm32/src/bin/wpan_ble.rs index 8957bfc04..0f396b848 100644 --- a/tests/stm32/src/bin/wpan_ble.rs +++ b/tests/stm32/src/bin/wpan_ble.rs @@ -12,16 +12,16 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; +use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; -use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs index 79e13d524..f27146c44 100644 --- a/tests/stm32/src/bin/wpan_mac.rs +++ b/tests/stm32/src/bin/wpan_mac.rs @@ -10,13 +10,13 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; use embassy_stm32_wpan::mac::event::MacEvent; use embassy_stm32_wpan::mac::typedefs::{ AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, }; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index f800769ab..2bd934d6f 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs @@ -1,11 +1,11 @@ #![macro_use] pub use defmt::*; +use embassy_stm32::Config; #[allow(unused)] use embassy_stm32::rcc::*; #[allow(unused)] use embassy_stm32::time::Hertz; -use embassy_stm32::Config; use {defmt_rtt as _, panic_probe as _}; #[cfg(feature = "stm32f103c8")] diff --git a/tests/utils/src/bin/saturate_serial.rs b/tests/utils/src/bin/saturate_serial.rs index 85676b106..1c8a8b322 100644 --- a/tests/utils/src/bin/saturate_serial.rs +++ b/tests/utils/src/bin/saturate_serial.rs @@ -2,7 +2,7 @@ use std::path::Path; use std::time::Duration; use std::{env, io, process, thread}; -use rand::{rng, Rng}; +use rand::{Rng, rng}; use serial::SerialPort; pub fn main() { -- cgit