aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Meluzzi <[email protected]>2025-10-24 15:48:34 +0200
committerMatteo Meluzzi <[email protected]>2025-10-24 15:48:34 +0200
commit7976f950b0de72c521f92efa350c67ccd197fab9 (patch)
tree8759312eb000de09b92a4921f476d5c16b7e7342
parent828a8df18d04877df1f55f04354980b28ff2f2f8 (diff)
Merge branch 'main' into 17-add-support-for-boot-protocol
-rwxr-xr-x.github/ci/build-nightly.sh2
-rwxr-xr-x.github/ci/build-xtensa.sh2
-rwxr-xr-x.github/ci/build.sh2
-rwxr-xr-x.github/ci/doc.sh2
-rwxr-xr-x.github/ci/janitor.sh2
-rwxr-xr-x.github/ci/rustfmt.sh2
-rw-r--r--cyw43-pio/Cargo.toml2
-rw-r--r--cyw43-pio/src/lib.rs4
-rw-r--r--cyw43/Cargo.toml2
-rw-r--r--cyw43/src/bluetooth.rs2
-rw-r--r--cyw43/src/bus.rs6
-rw-r--r--cyw43/src/control.rs2
-rw-r--r--cyw43/src/ioctl.rs2
-rw-r--r--cyw43/src/lib.rs1
-rw-r--r--cyw43/src/runner.rs6
-rw-r--r--docs/examples/layer-by-layer/blinky-async/Cargo.toml2
-rw-r--r--docs/examples/layer-by-layer/blinky-hal/Cargo.toml2
-rw-r--r--docs/examples/layer-by-layer/blinky-irq/Cargo.toml2
-rw-r--r--docs/examples/layer-by-layer/blinky-pac/Cargo.toml2
-rw-r--r--docs/pages/embassy_in_the_wild.adoc7
-rw-r--r--embassy-boot-nrf/Cargo.toml2
-rw-r--r--embassy-boot-nrf/src/lib.rs3
-rw-r--r--embassy-boot-rp/Cargo.toml2
-rw-r--r--embassy-boot-rp/src/lib.rs5
-rw-r--r--embassy-boot-stm32/Cargo.toml2
-rw-r--r--embassy-boot-stm32/src/lib.rs1
-rw-r--r--embassy-boot/Cargo.toml2
-rw-r--r--embassy-boot/src/boot_loader.rs6
-rw-r--r--embassy-boot/src/firmware_updater/asynch.rs4
-rw-r--r--embassy-boot/src/firmware_updater/blocking.rs6
-rw-r--r--embassy-boot/src/lib.rs15
-rw-r--r--embassy-boot/src/test_flash/blocking.rs2
-rw-r--r--embassy-embedded-hal/Cargo.toml2
-rw-r--r--embassy-embedded-hal/src/flash/partition/blocking.rs2
-rw-r--r--embassy-embedded-hal/src/shared_bus/asynch/i2c.rs2
-rw-r--r--embassy-embedded-hal/src/shared_bus/asynch/spi.rs2
-rw-r--r--embassy-embedded-hal/src/shared_bus/blocking/i2c.rs4
-rw-r--r--embassy-embedded-hal/src/shared_bus/blocking/spi.rs4
-rw-r--r--embassy-executor-macros/Cargo.toml2
-rw-r--r--embassy-executor-macros/src/macros/main.rs4
-rw-r--r--embassy-executor-macros/src/macros/task.rs8
-rw-r--r--embassy-executor-macros/src/util.rs2
-rw-r--r--embassy-executor-timer-queue/Cargo.toml2
-rw-r--r--embassy-executor/CHANGELOG.md1
-rw-r--r--embassy-executor/Cargo.toml6
-rw-r--r--embassy-executor/src/arch/avr.rs4
-rw-r--r--embassy-executor/src/arch/cortex_ar.rs4
-rw-r--r--embassy-executor/src/arch/cortex_m.rs4
-rw-r--r--embassy-executor/src/arch/riscv32.rs4
-rw-r--r--embassy-executor/src/arch/spin.rs4
-rw-r--r--embassy-executor/src/arch/std.rs4
-rw-r--r--embassy-executor/src/arch/wasm.rs4
-rw-r--r--embassy-executor/src/lib.rs1
-rw-r--r--embassy-executor/src/metadata.rs2
-rw-r--r--embassy-executor/src/raw/mod.rs6
-rw-r--r--embassy-executor/src/raw/run_queue.rs4
-rw-r--r--embassy-executor/src/raw/state_atomics_arm.rs2
-rw-r--r--embassy-executor/src/raw/state_critical_section.rs2
-rw-r--r--embassy-executor/src/raw/trace.rs6
-rw-r--r--embassy-executor/src/raw/waker.rs6
-rw-r--r--embassy-executor/src/raw/waker_turbo.rs4
-rw-r--r--embassy-executor/src/spawner.rs12
-rw-r--r--embassy-executor/tests/test.rs6
-rw-r--r--embassy-executor/tests/ui/nonstatic_struct_elided.stderr12
-rw-r--r--embassy-executor/tests/ui/task_safety_attribute.rs2
-rw-r--r--embassy-futures/Cargo.toml2
-rw-r--r--embassy-hal-internal/Cargo.toml2
-rw-r--r--embassy-hal-internal/src/interrupt.rs2
-rw-r--r--embassy-hal-internal/src/lib.rs1
-rw-r--r--embassy-hal-internal/src/macros.rs2
-rw-r--r--embassy-imxrt/Cargo.toml2
-rw-r--r--embassy-imxrt/src/clocks.rs2
-rw-r--r--embassy-imxrt/src/crc.rs4
-rw-r--r--embassy-imxrt/src/dma.rs6
-rw-r--r--embassy-imxrt/src/flexcomm/mod.rs18
-rw-r--r--embassy-imxrt/src/flexcomm/uart.rs4
-rw-r--r--embassy-imxrt/src/gpio.rs2
-rw-r--r--embassy-imxrt/src/iopctl.rs2
-rw-r--r--embassy-imxrt/src/lib.rs5
-rw-r--r--embassy-imxrt/src/rng.rs4
-rw-r--r--embassy-imxrt/src/time_driver.rs4
-rw-r--r--embassy-mspm0/CHANGELOG.md4
-rw-r--r--embassy-mspm0/Cargo.toml20
-rw-r--r--embassy-mspm0/build.rs52
-rw-r--r--embassy-mspm0/src/adc.rs6
-rw-r--r--embassy-mspm0/src/dma.rs8
-rw-r--r--embassy-mspm0/src/gpio.rs32
-rw-r--r--embassy-mspm0/src/i2c.rs21
-rw-r--r--embassy-mspm0/src/i2c_target.rs509
-rw-r--r--embassy-mspm0/src/lib.rs6
-rw-r--r--embassy-mspm0/src/time_driver.rs2
-rw-r--r--embassy-mspm0/src/uart/buffered.rs4
-rw-r--r--embassy-mspm0/src/uart/mod.rs13
-rw-r--r--embassy-mspm0/src/wwdt.rs4
-rw-r--r--embassy-net-adin1110/Cargo.toml2
-rw-r--r--embassy-net-adin1110/src/crc8.rs2
-rw-r--r--embassy-net-adin1110/src/lib.rs4
-rw-r--r--embassy-net-driver-channel/Cargo.toml2
-rw-r--r--embassy-net-driver-channel/src/lib.rs2
-rw-r--r--embassy-net-driver/Cargo.toml2
-rw-r--r--embassy-net-driver/src/lib.rs1
-rw-r--r--embassy-net-enc28j60/Cargo.toml2
-rw-r--r--embassy-net-esp-hosted/Cargo.toml2
-rw-r--r--embassy-net-esp-hosted/src/control.rs3
-rw-r--r--embassy-net-esp-hosted/src/ioctl.rs2
-rw-r--r--embassy-net-esp-hosted/src/lib.rs2
-rw-r--r--embassy-net-nrf91/Cargo.toml2
-rw-r--r--embassy-net-nrf91/src/lib.rs12
-rw-r--r--embassy-net-ppp/Cargo.toml2
-rw-r--r--embassy-net-ppp/src/lib.rs2
-rw-r--r--embassy-net-tuntap/Cargo.toml2
-rw-r--r--embassy-net-wiznet/Cargo.toml2
-rw-r--r--embassy-net-wiznet/src/chip/mod.rs2
-rw-r--r--embassy-net-wiznet/src/lib.rs2
-rw-r--r--embassy-net/Cargo.toml2
-rw-r--r--embassy-net/src/icmp.rs2
-rw-r--r--embassy-net/src/lib.rs3
-rw-r--r--embassy-net/src/raw.rs2
-rw-r--r--embassy-net/src/tcp.rs4
-rw-r--r--embassy-net/src/udp.rs2
-rw-r--r--embassy-nrf/CHANGELOG.md6
-rw-r--r--embassy-nrf/Cargo.toml4
-rw-r--r--embassy-nrf/src/buffered_uarte.rs32
-rw-r--r--embassy-nrf/src/chips/nrf54l15_app.rs43
-rw-r--r--embassy-nrf/src/egu.rs2
-rw-r--r--embassy-nrf/src/embassy_net_802154_driver.rs4
-rw-r--r--embassy-nrf/src/gpio.rs4
-rw-r--r--embassy-nrf/src/gpiote.rs12
-rw-r--r--embassy-nrf/src/i2s.rs4
-rw-r--r--embassy-nrf/src/lib.rs70
-rw-r--r--embassy-nrf/src/nfct.rs6
-rw-r--r--embassy-nrf/src/nvmc.rs2
-rw-r--r--embassy-nrf/src/pdm.rs4
-rw-r--r--embassy-nrf/src/ppi/dppi.rs2
-rw-r--r--embassy-nrf/src/ppi/mod.rs4
-rw-r--r--embassy-nrf/src/ppi/ppi.rs2
-rw-r--r--embassy-nrf/src/pwm.rs4
-rwxr-xr-xembassy-nrf/src/qspi.rs2
-rw-r--r--embassy-nrf/src/radio/ieee802154.rs21
-rw-r--r--embassy-nrf/src/rramc.rs2
-rw-r--r--embassy-nrf/src/saadc.rs4
-rw-r--r--embassy-nrf/src/spim.rs6
-rw-r--r--embassy-nrf/src/spis.rs6
-rw-r--r--embassy-nrf/src/temp.rs2
-rw-r--r--embassy-nrf/src/time_driver.rs4
-rw-r--r--embassy-nrf/src/twim.rs2
-rw-r--r--embassy-nrf/src/twis.rs4
-rw-r--r--embassy-nrf/src/uarte.rs4
-rw-r--r--embassy-nrf/src/usb/mod.rs10
-rw-r--r--embassy-nrf/src/usb/vbus_detect.rs2
-rw-r--r--embassy-nrf/src/util.rs6
-rw-r--r--embassy-nrf/src/wdt.rs2
-rw-r--r--embassy-nxp/CHANGELOG.md2
-rw-r--r--embassy-nxp/Cargo.toml2
-rw-r--r--embassy-nxp/src/dma/lpc55.rs6
-rw-r--r--embassy-nxp/src/gpio/lpc55.rs70
-rw-r--r--embassy-nxp/src/gpio/rt1xxx.rs4
-rw-r--r--embassy-nxp/src/lib.rs5
-rw-r--r--embassy-nxp/src/pint.rs4
-rw-r--r--embassy-nxp/src/time_driver/rtc.rs4
-rw-r--r--embassy-nxp/src/usart/lpc55.rs177
-rw-r--r--embassy-rp/Cargo.toml6
-rw-r--r--embassy-rp/src/adc.rs8
-rw-r--r--embassy-rp/src/bootsel.rs4
-rw-r--r--embassy-rp/src/clocks.rs4
-rw-r--r--embassy-rp/src/dma.rs4
-rw-r--r--embassy-rp/src/flash.rs10
-rw-r--r--embassy-rp/src/float/cmp.rs12
-rw-r--r--embassy-rp/src/float/functions.rs12
-rw-r--r--embassy-rp/src/gpio.rs6
-rw-r--r--embassy-rp/src/i2c_slave.rs4
-rw-r--r--embassy-rp/src/intrinsics.rs6
-rw-r--r--embassy-rp/src/lib.rs14
-rw-r--r--embassy-rp/src/multicore.rs9
-rw-r--r--embassy-rp/src/pio/mod.rs14
-rw-r--r--embassy-rp/src/pio_programs/hd44780.rs2
-rw-r--r--embassy-rp/src/pio_programs/i2s.rs2
-rw-r--r--embassy-rp/src/pio_programs/onewire.rs8
-rw-r--r--embassy-rp/src/pio_programs/pwm.rs2
-rw-r--r--embassy-rp/src/pio_programs/rotary_encoder.rs2
-rw-r--r--embassy-rp/src/pio_programs/stepper.rs2
-rw-r--r--embassy-rp/src/pio_programs/uart.rs2
-rw-r--r--embassy-rp/src/pio_programs/ws2812.rs2
-rw-r--r--embassy-rp/src/psram.rs10
-rw-r--r--embassy-rp/src/pwm.rs4
-rw-r--r--embassy-rp/src/rtc/mod.rs2
-rw-r--r--embassy-rp/src/time_driver.rs2
-rw-r--r--embassy-rp/src/uart/mod.rs16
-rw-r--r--embassy-rp/src/usb.rs16
-rw-r--r--embassy-rp/src/watchdog.rs2
-rw-r--r--embassy-stm32-wpan/Cargo.toml2
-rw-r--r--embassy-stm32-wpan/src/cmd.rs2
-rw-r--r--embassy-stm32-wpan/src/consts.rs2
-rw-r--r--embassy-stm32-wpan/src/lhci.rs4
-rw-r--r--embassy-stm32-wpan/src/lib.rs5
-rw-r--r--embassy-stm32-wpan/src/mac/driver.rs2
-rw-r--r--embassy-stm32-wpan/src/mac/runner.rs2
-rw-r--r--embassy-stm32-wpan/src/sub/ble.rs4
-rw-r--r--embassy-stm32-wpan/src/sub/mm.rs4
-rw-r--r--embassy-stm32-wpan/src/sub/sys.rs12
-rw-r--r--embassy-stm32-wpan/src/tables.rs52
-rw-r--r--embassy-stm32/CHANGELOG.md4
-rw-r--r--embassy-stm32/Cargo.toml2
-rw-r--r--embassy-stm32/build.rs8
-rw-r--r--embassy-stm32/src/adc/adc4.rs9
-rw-r--r--embassy-stm32/src/adc/c0.rs9
-rw-r--r--embassy-stm32/src/adc/f1.rs2
-rw-r--r--embassy-stm32/src/adc/f3.rs2
-rw-r--r--embassy-stm32/src/adc/f3_v1_1.rs2
-rw-r--r--embassy-stm32/src/adc/g4.rs9
-rw-r--r--embassy-stm32/src/adc/mod.rs2
-rw-r--r--embassy-stm32/src/adc/ringbuffered_v2.rs4
-rw-r--r--embassy-stm32/src/adc/v1.rs8
-rw-r--r--embassy-stm32/src/adc/v2.rs2
-rw-r--r--embassy-stm32/src/adc/v3.rs4
-rw-r--r--embassy-stm32/src/adc/v4.rs9
-rw-r--r--embassy-stm32/src/can/bxcan/mod.rs12
-rw-r--r--embassy-stm32/src/can/fd/config.rs2
-rw-r--r--embassy-stm32/src/can/fdcan.rs12
-rw-r--r--embassy-stm32/src/can/util.rs2
-rw-r--r--embassy-stm32/src/crc/v1.rs2
-rw-r--r--embassy-stm32/src/crc/v2v3.rs4
-rw-r--r--embassy-stm32/src/cryp/mod.rs10
-rw-r--r--embassy-stm32/src/dac/mod.rs2
-rw-r--r--embassy-stm32/src/dcmi.rs2
-rw-r--r--embassy-stm32/src/dma/dma_bdma.rs4
-rw-r--r--embassy-stm32/src/dma/gpdma/mod.rs2
-rw-r--r--embassy-stm32/src/dma/gpdma/ringbuffered.rs4
-rw-r--r--embassy-stm32/src/dma/mod.rs2
-rw-r--r--embassy-stm32/src/dma/ringbuffer/tests/prop_test/mod.rs2
-rw-r--r--embassy-stm32/src/dsihost.rs2
-rw-r--r--embassy-stm32/src/dts/mod.rs2
-rw-r--r--embassy-stm32/src/eth/v1/mod.rs8
-rw-r--r--embassy-stm32/src/eth/v1/rx_desc.rs2
-rw-r--r--embassy-stm32/src/eth/v1/tx_desc.rs2
-rw-r--r--embassy-stm32/src/eth/v2/descriptors.rs2
-rw-r--r--embassy-stm32/src/eth/v2/mod.rs6
-rw-r--r--embassy-stm32/src/exti.rs6
-rw-r--r--embassy-stm32/src/flash/asynch.rs8
-rw-r--r--embassy-stm32/src/flash/common.rs8
-rw-r--r--embassy-stm32/src/flash/eeprom.rs2
-rw-r--r--embassy-stm32/src/flash/f0.rs2
-rw-r--r--embassy-stm32/src/flash/f1f3.rs2
-rw-r--r--embassy-stm32/src/flash/f2.rs4
-rw-r--r--embassy-stm32/src/flash/f4.rs24
-rw-r--r--embassy-stm32/src/flash/f7.rs12
-rw-r--r--embassy-stm32/src/flash/g.rs18
-rw-r--r--embassy-stm32/src/flash/h5.rs2
-rw-r--r--embassy-stm32/src/flash/h50.rs2
-rw-r--r--embassy-stm32/src/flash/h7.rs4
-rw-r--r--embassy-stm32/src/flash/l.rs30
-rw-r--r--embassy-stm32/src/flash/u0.rs2
-rw-r--r--embassy-stm32/src/flash/u5.rs2
-rw-r--r--embassy-stm32/src/fmc.rs2
-rw-r--r--embassy-stm32/src/gpio.rs2
-rw-r--r--embassy-stm32/src/hash/mod.rs8
-rw-r--r--embassy-stm32/src/hsem/mod.rs4
-rw-r--r--embassy-stm32/src/hspi/mod.rs2
-rw-r--r--embassy-stm32/src/i2c/mod.rs4
-rw-r--r--embassy-stm32/src/i2c/v1.rs8
-rw-r--r--embassy-stm32/src/i2c/v2.rs2
-rw-r--r--embassy-stm32/src/i2s.rs4
-rw-r--r--embassy-stm32/src/ipcc.rs2
-rw-r--r--embassy-stm32/src/lib.rs5
-rw-r--r--embassy-stm32/src/low_power.rs4
-rw-r--r--embassy-stm32/src/lptim/pwm.rs6
-rw-r--r--embassy-stm32/src/ltdc.rs2
-rw-r--r--embassy-stm32/src/opamp.rs2
-rw-r--r--embassy-stm32/src/ospi/mod.rs6
-rw-r--r--embassy-stm32/src/qspi/mod.rs2
-rw-r--r--embassy-stm32/src/rcc/bd.rs4
-rw-r--r--embassy-stm32/src/rcc/f247.rs4
-rw-r--r--embassy-stm32/src/rcc/h.rs5
-rw-r--r--embassy-stm32/src/rcc/l.rs8
-rw-r--r--embassy-stm32/src/rcc/mco.rs4
-rw-r--r--embassy-stm32/src/rcc/mod.rs2
-rw-r--r--embassy-stm32/src/rcc/u5.rs9
-rw-r--r--embassy-stm32/src/rcc/wba.rs9
-rw-r--r--embassy-stm32/src/rng.rs2
-rw-r--r--embassy-stm32/src/rtc/low_power.rs2
-rw-r--r--embassy-stm32/src/rtc/mod.rs8
-rw-r--r--embassy-stm32/src/rtc/v3.rs2
-rw-r--r--embassy-stm32/src/sai/mod.rs6
-rw-r--r--embassy-stm32/src/sdmmc/mod.rs6
-rw-r--r--embassy-stm32/src/spdifrx/mod.rs2
-rw-r--r--embassy-stm32/src/spi/mod.rs8
-rw-r--r--embassy-stm32/src/time_driver.rs6
-rw-r--r--embassy-stm32/src/timer/complementary_pwm.rs6
-rw-r--r--embassy-stm32/src/timer/input_capture.rs2
-rw-r--r--embassy-stm32/src/timer/one_pulse.rs2
-rw-r--r--embassy-stm32/src/timer/pwm_input.rs2
-rw-r--r--embassy-stm32/src/timer/qei.rs2
-rw-r--r--embassy-stm32/src/timer/simple_pwm.rs2
-rw-r--r--embassy-stm32/src/tsc/acquisition_banks.rs4
-rw-r--r--embassy-stm32/src/tsc/pin_groups.rs4
-rw-r--r--embassy-stm32/src/ucpd.rs4
-rw-r--r--embassy-stm32/src/uid.rs4
-rw-r--r--embassy-stm32/src/usart/buffered.rs6
-rw-r--r--embassy-stm32/src/usart/mod.rs8
-rw-r--r--embassy-stm32/src/usart/ringbuffered.rs8
-rw-r--r--embassy-stm32/src/usb/otg.rs10
-rw-r--r--embassy-stm32/src/usb/usb.rs4
-rw-r--r--embassy-stm32/src/vrefbuf/mod.rs3
-rw-r--r--embassy-stm32/src/wdg/mod.rs2
-rw-r--r--embassy-stm32/src/xspi/mod.rs6
-rw-r--r--embassy-sync/Cargo.toml2
-rw-r--r--embassy-sync/src/channel.rs30
-rw-r--r--embassy-sync/src/lib.rs1
-rw-r--r--embassy-sync/src/mutex.rs4
-rw-r--r--embassy-sync/src/once_lock.rs2
-rw-r--r--embassy-sync/src/pipe.rs2
-rw-r--r--embassy-sync/src/priority_channel.rs32
-rw-r--r--embassy-sync/src/pubsub/mod.rs2
-rw-r--r--embassy-sync/src/ring_buffer.rs6
-rw-r--r--embassy-sync/src/rwlock.rs4
-rw-r--r--embassy-sync/src/semaphore.rs4
-rw-r--r--embassy-sync/src/signal.rs4
-rw-r--r--embassy-sync/src/waitqueue/atomic_waker.rs2
-rw-r--r--embassy-sync/src/watch.rs4
-rw-r--r--embassy-sync/src/zerocopy_channel.rs10
-rw-r--r--embassy-time-driver/Cargo.toml2
-rw-r--r--embassy-time-driver/src/lib.rs8
-rw-r--r--embassy-time-queue-utils/Cargo.toml2
-rw-r--r--embassy-time-queue-utils/src/queue_generic.rs2
-rw-r--r--embassy-time/Cargo.toml2
-rw-r--r--embassy-time/src/duration.rs8
-rw-r--r--embassy-time/src/lib.rs11
-rw-r--r--embassy-time/src/timer.rs4
-rw-r--r--embassy-usb-dfu/Cargo.toml2
-rw-r--r--embassy-usb-dfu/src/application.rs4
-rw-r--r--embassy-usb-dfu/src/dfu.rs4
-rw-r--r--embassy-usb-driver/Cargo.toml2
-rw-r--r--embassy-usb-driver/src/lib.rs1
-rw-r--r--embassy-usb-logger/Cargo.toml2
-rw-r--r--embassy-usb-synopsys-otg/Cargo.toml2
-rw-r--r--embassy-usb-synopsys-otg/src/lib.rs17
-rw-r--r--embassy-usb/Cargo.toml2
-rw-r--r--embassy-usb/src/builder.rs9
-rw-r--r--embassy-usb/src/class/cdc_acm.rs2
-rw-r--r--embassy-usb/src/class/cdc_ncm/embassy_net.rs2
-rw-r--r--embassy-usb/src/class/cdc_ncm/mod.rs2
-rw-r--r--embassy-usb/src/class/cmsis_dap_v2.rs2
-rw-r--r--embassy-usb/src/class/midi.rs2
-rw-r--r--embassy-usb/src/class/uac1/speaker.rs4
-rw-r--r--embassy-usb/src/descriptor.rs2
-rw-r--r--embassy-usb/src/lib.rs3
-rw-r--r--embassy-usb/src/msos.rs2
-rw-r--r--examples/boot/application/nrf/Cargo.toml2
-rw-r--r--examples/boot/application/rp/Cargo.toml2
-rw-r--r--examples/boot/application/stm32f3/Cargo.toml2
-rw-r--r--examples/boot/application/stm32f7/Cargo.toml2
-rw-r--r--examples/boot/application/stm32h7/Cargo.toml2
-rw-r--r--examples/boot/application/stm32l0/Cargo.toml2
-rw-r--r--examples/boot/application/stm32l1/Cargo.toml2
-rw-r--r--examples/boot/application/stm32l4/Cargo.toml2
-rw-r--r--examples/boot/application/stm32wb-dfu/Cargo.toml2
-rw-r--r--examples/boot/application/stm32wb-dfu/src/main.rs4
-rw-r--r--examples/boot/application/stm32wba-dfu/Cargo.toml2
-rw-r--r--examples/boot/application/stm32wba-dfu/src/main.rs4
-rw-r--r--examples/boot/application/stm32wl/Cargo.toml2
-rw-r--r--examples/boot/application/stm32wl/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32wl/src/bin/b.rs2
-rw-r--r--examples/boot/bootloader/nrf/Cargo.toml2
-rw-r--r--examples/boot/bootloader/nrf/src/main.rs6
-rw-r--r--examples/boot/bootloader/rp/Cargo.toml2
-rw-r--r--examples/boot/bootloader/rp/src/main.rs6
-rw-r--r--examples/boot/bootloader/stm32-dual-bank/Cargo.toml2
-rw-r--r--examples/boot/bootloader/stm32-dual-bank/src/main.rs8
-rw-r--r--examples/boot/bootloader/stm32/Cargo.toml2
-rw-r--r--examples/boot/bootloader/stm32/src/main.rs8
-rw-r--r--examples/boot/bootloader/stm32wb-dfu/Cargo.toml2
-rw-r--r--examples/boot/bootloader/stm32wb-dfu/src/main.rs12
-rw-r--r--examples/boot/bootloader/stm32wba-dfu/Cargo.toml2
-rw-r--r--examples/boot/bootloader/stm32wba-dfu/src/main.rs14
-rw-r--r--examples/lpc55s69/Cargo.toml2
-rw-r--r--examples/mimxrt1011/Cargo.toml2
-rw-r--r--examples/mimxrt1011/src/lib.rs2
-rw-r--r--examples/mimxrt1062-evk/Cargo.toml2
-rw-r--r--examples/mimxrt1062-evk/src/lib.rs4
-rw-r--r--examples/mimxrt6/Cargo.toml2
-rw-r--r--examples/mimxrt6/src/bin/button.rs2
-rw-r--r--examples/mspm0c1104/Cargo.toml2
-rw-r--r--examples/mspm0c1104/src/bin/blinky.rs2
-rw-r--r--examples/mspm0c1104/src/bin/button.rs2
-rw-r--r--examples/mspm0g3507/Cargo.toml2
-rw-r--r--examples/mspm0g3507/src/bin/adc.rs2
-rw-r--r--examples/mspm0g3507/src/bin/blinky.rs2
-rw-r--r--examples/mspm0g3507/src/bin/button.rs2
-rw-r--r--examples/mspm0g3507/src/bin/i2c_target.rs63
-rw-r--r--examples/mspm0g3519/Cargo.toml2
-rw-r--r--examples/mspm0g3519/src/bin/blinky.rs2
-rw-r--r--examples/mspm0g3519/src/bin/button.rs2
-rw-r--r--examples/mspm0l1306/Cargo.toml2
-rw-r--r--examples/mspm0l1306/src/bin/adc.rs2
-rw-r--r--examples/mspm0l1306/src/bin/blinky.rs2
-rw-r--r--examples/mspm0l1306/src/bin/button.rs2
-rw-r--r--examples/mspm0l1306/src/bin/i2c_target.rs63
-rw-r--r--examples/mspm0l2228/Cargo.toml2
-rw-r--r--examples/mspm0l2228/src/bin/blinky.rs2
-rw-r--r--examples/mspm0l2228/src/bin/button.rs2
-rw-r--r--examples/nrf-rtos-trace/Cargo.toml2
-rw-r--r--examples/nrf51/Cargo.toml2
-rw-r--r--examples/nrf52810/Cargo.toml2
-rw-r--r--examples/nrf52840-edf/Cargo.toml2
-rw-r--r--examples/nrf52840-edf/src/bin/basic.rs2
-rw-r--r--examples/nrf52840-rtic/Cargo.toml2
-rw-r--r--examples/nrf52840-rtic/src/bin/blinky.rs2
-rw-r--r--examples/nrf52840/Cargo.toml2
-rw-r--r--examples/nrf52840/src/bin/channel_sender_receiver.rs2
-rw-r--r--examples/nrf52840/src/bin/ethernet_enc28j60.rs2
-rw-r--r--examples/nrf52840/src/bin/i2s_effect.rs8
-rw-r--r--examples/nrf52840/src/bin/i2s_monitor.rs2
-rw-r--r--examples/nrf52840/src/bin/i2s_waveform.rs8
-rw-r--r--examples/nrf52840/src/bin/multiprio.rs4
-rw-r--r--examples/nrf52840/src/bin/raw_spawn.rs4
-rw-r--r--examples/nrf52840/src/bin/rtc.rs2
-rw-r--r--examples/nrf52840/src/bin/usb_ethernet.rs4
-rw-r--r--examples/nrf52840/src/bin/usb_hid_keyboard.rs8
-rw-r--r--examples/nrf52840/src/bin/usb_hid_mouse.rs2
-rw-r--r--examples/nrf52840/src/bin/usb_serial.rs2
-rw-r--r--examples/nrf52840/src/bin/usb_serial_multitask.rs2
-rw-r--r--examples/nrf52840/src/bin/usb_serial_winusb.rs2
-rw-r--r--examples/nrf52840/src/bin/wifi_esp_hosted.rs2
-rw-r--r--examples/nrf5340/Cargo.toml2
-rw-r--r--examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs30
-rw-r--r--examples/nrf54l15/Cargo.toml4
-rw-r--r--examples/nrf54l15/src/bin/rtc.rs56
-rw-r--r--examples/nrf9151/ns/Cargo.toml2
-rw-r--r--examples/nrf9151/s/Cargo.toml2
-rw-r--r--examples/nrf9160/Cargo.toml2
-rw-r--r--examples/nrf9160/src/bin/modem_tcp_client.rs6
-rw-r--r--examples/rp/Cargo.toml2
-rw-r--r--examples/rp/src/bin/assign_resources.rs2
-rw-r--r--examples/rp/src/bin/debounce.rs2
-rw-r--r--examples/rp/src/bin/ethernet_w5500_icmp_ping.rs4
-rw-r--r--examples/rp/src/bin/ethernet_w55rp20_tcp_server.rs2
-rw-r--r--examples/rp/src/bin/interrupt.rs2
-rw-r--r--examples/rp/src/bin/multicore.rs2
-rw-r--r--examples/rp/src/bin/multiprio.rs6
-rw-r--r--examples/rp/src/bin/orchestrate_tasks.rs4
-rw-r--r--examples/rp/src/bin/overclock.rs2
-rw-r--r--examples/rp/src/bin/overclock_manual.rs2
-rw-r--r--examples/rp/src/bin/pio_async.rs2
-rw-r--r--examples/rp/src/bin/pio_stepper.rs2
-rw-r--r--examples/rp/src/bin/pwm.rs4
-rw-r--r--examples/rp/src/bin/rtc_alarm.rs2
-rw-r--r--examples/rp/src/bin/sharing.rs2
-rw-r--r--examples/rp/src/bin/spi_display.rs12
-rw-r--r--examples/rp/src/bin/spi_gc9a01.rs4
-rw-r--r--examples/rp/src/bin/uart_r503.rs2
-rw-r--r--examples/rp/src/bin/usb_ethernet.rs2
-rw-r--r--examples/rp/src/bin/usb_serial.rs2
-rw-r--r--examples/rp/src/bin/wifi_ap_tcp_server.rs2
-rw-r--r--examples/rp/src/bin/wifi_blinky.rs2
-rw-r--r--examples/rp/src/bin/wifi_scan.rs2
-rw-r--r--examples/rp/src/bin/wifi_tcp_server.rs2
-rw-r--r--examples/rp/src/bin/wifi_webrequest.rs2
-rw-r--r--examples/rp/src/bin/zerocopy.rs2
-rw-r--r--examples/rp235x/Cargo.toml2
-rw-r--r--examples/rp235x/src/bin/assign_resources.rs2
-rw-r--r--examples/rp235x/src/bin/debounce.rs2
-rw-r--r--examples/rp235x/src/bin/ethernet_w5500_icmp_ping.rs4
-rw-r--r--examples/rp235x/src/bin/interrupt.rs2
-rw-r--r--examples/rp235x/src/bin/multicore.rs2
-rw-r--r--examples/rp235x/src/bin/multicore_stack_overflow.rs2
-rw-r--r--examples/rp235x/src/bin/multiprio.rs6
-rw-r--r--examples/rp235x/src/bin/overclock.rs2
-rw-r--r--examples/rp235x/src/bin/pio_async.rs2
-rw-r--r--examples/rp235x/src/bin/pio_i2s_rx.rs2
-rw-r--r--examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs2
-rw-r--r--examples/rp235x/src/bin/pio_stepper.rs2
-rw-r--r--examples/rp235x/src/bin/pwm.rs4
-rw-r--r--examples/rp235x/src/bin/pwm_tb6612fng_motor_driver.rs2
-rw-r--r--examples/rp235x/src/bin/sharing.rs2
-rw-r--r--examples/rp235x/src/bin/spi_display.rs12
-rw-r--r--examples/rp235x/src/bin/uart_r503.rs2
-rw-r--r--examples/rp235x/src/bin/zerocopy.rs2
-rw-r--r--examples/std/Cargo.toml2
-rw-r--r--examples/stm32c0/Cargo.toml2
-rw-r--r--examples/stm32c0/src/bin/rtc.rs2
-rw-r--r--examples/stm32f0/Cargo.toml2
-rw-r--r--examples/stm32f0/src/bin/button_controlled_blink.rs2
-rw-r--r--examples/stm32f0/src/bin/multiprio.rs4
-rw-r--r--examples/stm32f1/Cargo.toml2
-rw-r--r--examples/stm32f1/src/bin/can.rs6
-rw-r--r--examples/stm32f1/src/bin/input_capture.rs2
-rw-r--r--examples/stm32f1/src/bin/pwm_input.rs2
-rw-r--r--examples/stm32f1/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32f2/Cargo.toml2
-rw-r--r--examples/stm32f2/src/bin/pll.rs2
-rw-r--r--examples/stm32f3/Cargo.toml2
-rw-r--r--examples/stm32f3/src/bin/button_events.rs2
-rw-r--r--examples/stm32f3/src/bin/multiprio.rs4
-rw-r--r--examples/stm32f3/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32f334/Cargo.toml2
-rw-r--r--examples/stm32f334/src/bin/adc.rs2
-rw-r--r--examples/stm32f334/src/bin/opamp.rs2
-rw-r--r--examples/stm32f334/src/bin/pwm.rs2
-rw-r--r--examples/stm32f4/Cargo.toml2
-rw-r--r--examples/stm32f4/src/bin/adc_dma.rs2
-rw-r--r--examples/stm32f4/src/bin/eth.rs2
-rw-r--r--examples/stm32f4/src/bin/eth_compliance_test.rs2
-rw-r--r--examples/stm32f4/src/bin/eth_w5500.rs2
-rw-r--r--examples/stm32f4/src/bin/flash_async.rs2
-rw-r--r--examples/stm32f4/src/bin/input_capture.rs2
-rw-r--r--examples/stm32f4/src/bin/multiprio.rs4
-rw-r--r--examples/stm32f4/src/bin/pwm_complementary.rs2
-rw-r--r--examples/stm32f4/src/bin/pwm_input.rs2
-rw-r--r--examples/stm32f4/src/bin/rtc.rs2
-rw-r--r--examples/stm32f4/src/bin/sdmmc.rs4
-rw-r--r--examples/stm32f4/src/bin/usb_ethernet.rs4
-rw-r--r--examples/stm32f4/src/bin/usb_hid_keyboard.rs2
-rw-r--r--examples/stm32f4/src/bin/usb_hid_mouse.rs4
-rw-r--r--examples/stm32f4/src/bin/usb_raw.rs2
-rw-r--r--examples/stm32f4/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32f4/src/bin/usb_uac_speaker.rs4
-rw-r--r--examples/stm32f4/src/bin/ws2812_pwm.rs2
-rw-r--r--examples/stm32f469/Cargo.toml2
-rw-r--r--examples/stm32f469/src/bin/dsi_bsp.rs6
-rw-r--r--examples/stm32f7/Cargo.toml2
-rw-r--r--examples/stm32f7/src/bin/can.rs2
-rw-r--r--examples/stm32f7/src/bin/cryp.rs4
-rw-r--r--examples/stm32f7/src/bin/eth.rs2
-rw-r--r--examples/stm32f7/src/bin/hash.rs2
-rw-r--r--examples/stm32f7/src/bin/qspi.rs2
-rw-r--r--examples/stm32f7/src/bin/sdmmc.rs4
-rw-r--r--examples/stm32f7/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32g0/Cargo.toml2
-rw-r--r--examples/stm32g0/src/bin/hf_timer.rs4
-rw-r--r--examples/stm32g0/src/bin/input_capture.rs4
-rw-r--r--examples/stm32g0/src/bin/pwm_complementary.rs2
-rw-r--r--examples/stm32g0/src/bin/pwm_input.rs2
-rw-r--r--examples/stm32g0/src/bin/rtc.rs2
-rw-r--r--examples/stm32g0/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32g4/Cargo.toml2
-rw-r--r--examples/stm32g4/src/bin/adc.rs2
-rw-r--r--examples/stm32g4/src/bin/adc_differential.rs2
-rw-r--r--examples/stm32g4/src/bin/adc_dma.rs2
-rw-r--r--examples/stm32g4/src/bin/adc_oversampling.rs2
-rw-r--r--examples/stm32g4/src/bin/can.rs2
-rw-r--r--examples/stm32g4/src/bin/usb_c_pd.rs6
-rw-r--r--examples/stm32g4/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32h5/Cargo.toml2
-rw-r--r--examples/stm32h5/src/bin/adc.rs2
-rw-r--r--examples/stm32h5/src/bin/can.rs2
-rw-r--r--examples/stm32h5/src/bin/dts.rs2
-rw-r--r--examples/stm32h5/src/bin/eth.rs2
-rw-r--r--examples/stm32h5/src/bin/sai.rs2
-rw-r--r--examples/stm32h5/src/bin/usb_c_pd.rs6
-rw-r--r--examples/stm32h5/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32h5/src/bin/usb_uac_speaker.rs4
-rw-r--r--examples/stm32h7/Cargo.toml2
-rw-r--r--examples/stm32h7/src/bin/adc.rs2
-rw-r--r--examples/stm32h7/src/bin/adc_dma.rs2
-rw-r--r--examples/stm32h7/src/bin/camera.rs2
-rw-r--r--examples/stm32h7/src/bin/can.rs2
-rw-r--r--examples/stm32h7/src/bin/dac.rs2
-rw-r--r--examples/stm32h7/src/bin/dac_dma.rs2
-rw-r--r--examples/stm32h7/src/bin/eth.rs2
-rw-r--r--examples/stm32h7/src/bin/eth_client.rs4
-rw-r--r--examples/stm32h7/src/bin/eth_client_mii.rs4
-rw-r--r--examples/stm32h7/src/bin/fmc.rs2
-rw-r--r--examples/stm32h7/src/bin/i2c_shared.rs2
-rw-r--r--examples/stm32h7/src/bin/low_level_timer_api.rs2
-rw-r--r--examples/stm32h7/src/bin/multiprio.rs4
-rw-r--r--examples/stm32h7/src/bin/pwm.rs2
-rw-r--r--examples/stm32h7/src/bin/rng.rs2
-rw-r--r--examples/stm32h7/src/bin/rtc.rs2
-rw-r--r--examples/stm32h7/src/bin/sdmmc.rs2
-rw-r--r--examples/stm32h7/src/bin/spi.rs2
-rw-r--r--examples/stm32h7/src/bin/spi_bdma.rs2
-rw-r--r--examples/stm32h7/src/bin/spi_dma.rs2
-rw-r--r--examples/stm32h7/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32h723/Cargo.toml2
-rw-r--r--examples/stm32h723/src/bin/spdifrx.rs4
-rw-r--r--examples/stm32h735/Cargo.toml2
-rw-r--r--examples/stm32h735/src/bin/ltdc.rs4
-rw-r--r--examples/stm32h742/Cargo.toml2
-rw-r--r--examples/stm32h742/src/bin/qspi.rs2
-rw-r--r--examples/stm32h755cm4/Cargo.toml2
-rw-r--r--examples/stm32h755cm4/src/bin/blinky.rs2
-rw-r--r--examples/stm32h755cm4/src/bin/intercore.rs6
-rw-r--r--examples/stm32h755cm7/Cargo.toml2
-rw-r--r--examples/stm32h755cm7/src/bin/blinky.rs2
-rw-r--r--examples/stm32h755cm7/src/bin/intercore.rs4
-rw-r--r--examples/stm32h7b0/Cargo.toml2
-rw-r--r--examples/stm32h7b0/src/bin/ospi_memory_mapped.rs2
-rw-r--r--examples/stm32h7rs/Cargo.toml2
-rw-r--r--examples/stm32h7rs/src/bin/blinky.rs2
-rw-r--r--examples/stm32h7rs/src/bin/can.rs2
-rw-r--r--examples/stm32h7rs/src/bin/eth.rs2
-rw-r--r--examples/stm32h7rs/src/bin/multiprio.rs4
-rw-r--r--examples/stm32h7rs/src/bin/rng.rs2
-rw-r--r--examples/stm32h7rs/src/bin/rtc.rs2
-rw-r--r--examples/stm32h7rs/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32h7rs/src/bin/xspi_memory_mapped.rs2
-rw-r--r--examples/stm32l0/Cargo.toml2
-rw-r--r--examples/stm32l0/src/bin/button_exti.rs2
-rw-r--r--examples/stm32l0/src/bin/dds.rs2
-rw-r--r--examples/stm32l0/src/bin/eeprom.rs2
-rw-r--r--examples/stm32l0/src/bin/raw_spawn.rs4
-rw-r--r--examples/stm32l0/src/bin/usb_serial.rs2
-rw-r--r--examples/stm32l1/Cargo.toml2
-rw-r--r--examples/stm32l1/src/bin/eeprom.rs2
-rw-r--r--examples/stm32l1/src/bin/usb_serial.rs2
-rw-r--r--examples/stm32l4/Cargo.toml2
-rw-r--r--examples/stm32l4/src/bin/adc.rs2
-rw-r--r--examples/stm32l4/src/bin/can.rs2
-rw-r--r--examples/stm32l4/src/bin/dac_dma.rs2
-rw-r--r--examples/stm32l4/src/bin/rng.rs2
-rw-r--r--examples/stm32l4/src/bin/rtc.rs2
-rw-r--r--examples/stm32l4/src/bin/spe_adin1110_http_server.rs10
-rw-r--r--examples/stm32l4/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32l432/Cargo.toml2
-rw-r--r--examples/stm32l5/Cargo.toml2
-rw-r--r--examples/stm32l5/src/bin/rng.rs2
-rw-r--r--examples/stm32l5/src/bin/usb_ethernet.rs4
-rw-r--r--examples/stm32l5/src/bin/usb_hid_mouse.rs4
-rw-r--r--examples/stm32l5/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32u0/Cargo.toml2
-rw-r--r--examples/stm32u0/src/bin/adc.rs2
-rw-r--r--examples/stm32u0/src/bin/rng.rs2
-rw-r--r--examples/stm32u0/src/bin/rtc.rs2
-rw-r--r--examples/stm32u0/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32u5/Cargo.toml2
-rw-r--r--examples/stm32u5/src/bin/adc.rs2
-rw-r--r--examples/stm32u5/src/bin/ltdc.rs6
-rw-r--r--examples/stm32u5/src/bin/usb_hs_serial.rs4
-rw-r--r--examples/stm32u5/src/bin/usb_serial.rs4
-rw-r--r--examples/stm32wb/Cargo.toml2
-rw-r--r--examples/stm32wb/src/bin/eddystone_beacon.rs4
-rw-r--r--examples/stm32wb/src/bin/gatt_server.rs2
-rw-r--r--examples/stm32wb/src/bin/mac_ffd.rs2
-rw-r--r--examples/stm32wb/src/bin/mac_ffd_net.rs2
-rw-r--r--examples/stm32wb/src/bin/mac_rfd.rs2
-rw-r--r--examples/stm32wb/src/bin/tl_mbox_mac.rs2
-rw-r--r--examples/stm32wba/Cargo.toml2
-rw-r--r--examples/stm32wba/src/bin/adc.rs2
-rw-r--r--examples/stm32wba/src/bin/pwm.rs2
-rw-r--r--examples/stm32wba6/Cargo.toml2
-rw-r--r--examples/stm32wba6/src/bin/adc.rs2
-rw-r--r--examples/stm32wba6/src/bin/pwm.rs2
-rw-r--r--examples/stm32wba6/src/bin/usb_hs_serial.rs4
-rw-r--r--examples/stm32wl/Cargo.toml2
-rw-r--r--examples/stm32wl/src/bin/adc.rs2
-rw-r--r--examples/stm32wl/src/bin/blinky.rs2
-rw-r--r--examples/stm32wl/src/bin/button.rs2
-rw-r--r--examples/stm32wl/src/bin/button_exti.rs2
-rw-r--r--examples/stm32wl/src/bin/flash.rs2
-rw-r--r--examples/stm32wl/src/bin/random.rs2
-rw-r--r--examples/stm32wl/src/bin/uart_async.rs2
-rw-r--r--examples/wasm/Cargo.toml2
-rw-r--r--rustfmt.toml2
-rw-r--r--tests/mspm0/Cargo.toml2
-rw-r--r--tests/mspm0/src/bin/dma.rs2
-rw-r--r--tests/nrf/Cargo.toml2
-rw-r--r--tests/perf-client/Cargo.toml2
-rw-r--r--tests/perf-client/src/lib.rs2
-rw-r--r--tests/perf-server/Cargo.toml2
-rw-r--r--tests/riscv32/Cargo.toml2
-rw-r--r--tests/rp/Cargo.toml2
-rw-r--r--tests/rp/src/bin/cyw43-perf.rs2
-rw-r--r--tests/rp/src/bin/gpio_multicore.rs4
-rw-r--r--tests/rp/src/bin/multicore.rs2
-rw-r--r--tests/rp/src/bin/overclock.rs2
-rw-r--r--tests/rp/src/bin/pio_multi_load.rs4
-rw-r--r--tests/rp/src/bin/rtc.rs2
-rw-r--r--tests/rp/src/bin/spinlock_mutex_multicore.rs2
-rw-r--r--tests/stm32/Cargo.toml2
-rw-r--r--tests/stm32/src/bin/afio.rs2
-rw-r--r--tests/stm32/src/bin/cryp.rs2
-rw-r--r--tests/stm32/src/bin/fdcan.rs2
-rw-r--r--tests/stm32/src/bin/stop.rs4
-rw-r--r--tests/stm32/src/bin/ucpd.rs2
-rw-r--r--tests/stm32/src/bin/usart.rs2
-rw-r--r--tests/stm32/src/bin/wpan_ble.rs4
-rw-r--r--tests/stm32/src/bin/wpan_mac.rs2
-rw-r--r--tests/stm32/src/common.rs2
-rw-r--r--tests/utils/Cargo.toml2
-rw-r--r--tests/utils/src/bin/saturate_serial.rs2
680 files changed, 2326 insertions, 1395 deletions
diff --git a/.github/ci/build-nightly.sh b/.github/ci/build-nightly.sh
index 8cca1b445..82e9436f3 100755
--- a/.github/ci/build-nightly.sh
+++ b/.github/ci/build-nightly.sh
@@ -23,7 +23,7 @@ fi
23hashtime restore /ci/cache/filetime.json || true 23hashtime restore /ci/cache/filetime.json || true
24hashtime save /ci/cache/filetime.json 24hashtime save /ci/cache/filetime.json
25 25
26cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev 676e6d602bf016dc71f1e98f2c7f191d7bd20707 26cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6
27 27
28./ci-nightly.sh 28./ci-nightly.sh
29 29
diff --git a/.github/ci/build-xtensa.sh b/.github/ci/build-xtensa.sh
index dbd2f7ffc..3f74b4a5a 100755
--- a/.github/ci/build-xtensa.sh
+++ b/.github/ci/build-xtensa.sh
@@ -25,7 +25,7 @@ fi
25hashtime restore /ci/cache/filetime.json || true 25hashtime restore /ci/cache/filetime.json || true
26hashtime save /ci/cache/filetime.json 26hashtime save /ci/cache/filetime.json
27 27
28cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev 676e6d602bf016dc71f1e98f2c7f191d7bd20707 28cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6
29 29
30./ci-xtensa.sh 30./ci-xtensa.sh
31 31
diff --git a/.github/ci/build.sh b/.github/ci/build.sh
index d5e0e0bd2..3c196f72b 100755
--- a/.github/ci/build.sh
+++ b/.github/ci/build.sh
@@ -28,7 +28,7 @@ fi
28hashtime restore /ci/cache/filetime.json || true 28hashtime restore /ci/cache/filetime.json || true
29hashtime save /ci/cache/filetime.json 29hashtime save /ci/cache/filetime.json
30 30
31cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev 676e6d602bf016dc71f1e98f2c7f191d7bd20707 31cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6
32 32
33./ci.sh 33./ci.sh
34 34
diff --git a/.github/ci/doc.sh b/.github/ci/doc.sh
index dab47e86d..535fc5262 100755
--- a/.github/ci/doc.sh
+++ b/.github/ci/doc.sh
@@ -12,7 +12,7 @@ export CARGO_TARGET_DIR=/ci/cache/target
12export PATH=$CARGO_HOME/bin:$PATH 12export PATH=$CARGO_HOME/bin:$PATH
13mv rust-toolchain-nightly.toml rust-toolchain.toml 13mv rust-toolchain-nightly.toml rust-toolchain.toml
14 14
15cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev 676e6d602bf016dc71f1e98f2c7f191d7bd20707 15cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6
16 16
17cargo embassy-devtool doc -o webroot 17cargo embassy-devtool doc -o webroot
18 18
diff --git a/.github/ci/janitor.sh b/.github/ci/janitor.sh
index 305c6b227..bc43075bd 100755
--- a/.github/ci/janitor.sh
+++ b/.github/ci/janitor.sh
@@ -9,7 +9,7 @@ export CARGO_HOME=/ci/cache/cargo
9export CARGO_TARGET_DIR=/ci/cache/target 9export CARGO_TARGET_DIR=/ci/cache/target
10export PATH=$CARGO_HOME/bin:$PATH 10export PATH=$CARGO_HOME/bin:$PATH
11 11
12cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev 676e6d602bf016dc71f1e98f2c7f191d7bd20707 12cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6
13 13
14cargo embassy-devtool check-crlf 14cargo embassy-devtool check-crlf
15cargo embassy-devtool check-manifest 15cargo embassy-devtool check-manifest
diff --git a/.github/ci/rustfmt.sh b/.github/ci/rustfmt.sh
index 369239cfe..7aaf93234 100755
--- a/.github/ci/rustfmt.sh
+++ b/.github/ci/rustfmt.sh
@@ -9,4 +9,4 @@ export CARGO_HOME=/ci/cache/cargo
9export CARGO_TARGET_DIR=/ci/cache/target 9export CARGO_TARGET_DIR=/ci/cache/target
10mv rust-toolchain-nightly.toml rust-toolchain.toml 10mv rust-toolchain-nightly.toml rust-toolchain.toml
11 11
12find . -name '*.rs' -not -path '*target*' | xargs rustfmt --check --skip-children --unstable-features --edition 2021 12find . -name '*.rs' -not -path '*target*' | xargs rustfmt --check --skip-children --unstable-features --edition 2024
diff --git a/cyw43-pio/Cargo.toml b/cyw43-pio/Cargo.toml
index 6ab5c453e..a10a091e9 100644
--- a/cyw43-pio/Cargo.toml
+++ b/cyw43-pio/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "cyw43-pio" 2name = "cyw43-pio"
3version = "0.8.0" 3version = "0.8.0"
4edition = "2021" 4edition = "2024"
5description = "RP2040 PIO SPI implementation for cyw43" 5description = "RP2040 PIO SPI implementation for cyw43"
6keywords = ["embedded", "cyw43", "embassy-net", "embedded-hal-async", "wifi"] 6keywords = ["embedded", "cyw43", "embassy-net", "embedded-hal-async", "wifi"]
7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
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 @@
6use core::slice; 6use core::slice;
7 7
8use cyw43::SpiBusCyw43; 8use cyw43::SpiBusCyw43;
9use embassy_rp::Peri;
9use embassy_rp::dma::Channel; 10use embassy_rp::dma::Channel;
10use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate}; 11use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate};
11use embassy_rp::pio::program::pio_asm; 12use embassy_rp::pio::program::pio_asm;
12use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; 13use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine};
13use embassy_rp::Peri;
14use fixed::types::extra::U8;
15use fixed::FixedU32; 14use fixed::FixedU32;
15use fixed::types::extra::U8;
16 16
17/// SPI comms driven by PIO. 17/// SPI comms driven by PIO.
18pub struct PioSpi<'d, PIO: Instance, const SM: usize, DMA: Channel> { 18pub struct PioSpi<'d, PIO: Instance, const SM: usize, DMA: Channel> {
diff --git a/cyw43/Cargo.toml b/cyw43/Cargo.toml
index c59c15a71..314427611 100644
--- a/cyw43/Cargo.toml
+++ b/cyw43/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "cyw43" 2name = "cyw43"
3version = "0.5.0" 3version = "0.5.0"
4edition = "2021" 4edition = "2024"
5description = "Rust driver for the CYW43439 WiFi chip, used in the Raspberry Pi Pico W." 5description = "Rust driver for the CYW43439 WiFi chip, used in the Raspberry Pi Pico W."
6keywords = ["embedded", "cyw43", "embassy-net", "embedded-hal-async", "wifi"] 6keywords = ["embedded", "cyw43", "embassy-net", "embedded-hal-async", "wifi"]
7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
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;
15pub use crate::bus::SpiBusCyw43; 15pub use crate::bus::SpiBusCyw43;
16use crate::consts::*; 16use crate::consts::*;
17use crate::util::round_up; 17use crate::util::round_up;
18use crate::{util, CHIP}; 18use crate::{CHIP, util};
19 19
20pub(crate) struct BtState { 20pub(crate) struct BtState {
21 rx: [BtPacketBuf; 4], 21 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
340 self.status = self.spi.cmd_read(cmd, &mut buf[..len]).await; 340 self.status = self.spi.cmd_read(cmd, &mut buf[..len]).await;
341 341
342 // if we read from the backplane, the result is in the second word, after the response delay 342 // if we read from the backplane, the result is in the second word, after the response delay
343 if func == FUNC_BACKPLANE { 343 if func == FUNC_BACKPLANE { buf[1] } else { buf[0] }
344 buf[1]
345 } else {
346 buf[0]
347 }
348 } 344 }
349 345
350 async fn writen(&mut self, func: u32, addr: u32, val: u32, len: u32) { 346 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};
10use crate::fmt::Bytes; 10use crate::fmt::Bytes;
11use crate::ioctl::{IoctlState, IoctlType}; 11use crate::ioctl::{IoctlState, IoctlType};
12use crate::structs::*; 12use crate::structs::*;
13use crate::{countries, events, PowerManagementMode}; 13use crate::{PowerManagementMode, countries, events};
14 14
15/// Control errors. 15/// Control errors.
16#[derive(Debug)] 16#[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 @@
1use core::cell::{Cell, RefCell}; 1use core::cell::{Cell, RefCell};
2use core::future::{poll_fn, Future}; 2use core::future::{Future, poll_fn};
3use core::task::{Poll, Waker}; 3use core::task::{Poll, Waker};
4 4
5use embassy_sync::waitqueue::WakerRegistration; 5use embassy_sync::waitqueue::WakerRegistration;
diff --git a/cyw43/src/lib.rs b/cyw43/src/lib.rs
index 16b436e66..82c636346 100644
--- a/cyw43/src/lib.rs
+++ b/cyw43/src/lib.rs
@@ -1,6 +1,7 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#![allow(async_fn_in_trait)] 3#![allow(async_fn_in_trait)]
4#![allow(unsafe_op_in_unsafe_fn)]
4#![deny(unused_must_use)] 5#![deny(unused_must_use)]
5#![doc = include_str!("../README.md")] 6#![doc = include_str!("../README.md")]
6#![warn(missing_docs)] 7#![warn(missing_docs)]
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 @@
1use embassy_futures::select::{select4, Either4}; 1use embassy_futures::select::{Either4, select4};
2use embassy_net_driver_channel as ch; 2use embassy_net_driver_channel as ch;
3use embassy_time::{block_for, Duration, Timer}; 3use embassy_time::{Duration, Timer, block_for};
4use embedded_hal_1::digital::OutputPin; 4use embedded_hal_1::digital::OutputPin;
5 5
6use crate::bus::Bus; 6use crate::bus::Bus;
@@ -12,7 +12,7 @@ use crate::ioctl::{IoctlState, IoctlType, PendingIoctl};
12use crate::nvram::NVRAM; 12use crate::nvram::NVRAM;
13use crate::structs::*; 13use crate::structs::*;
14use crate::util::slice8_mut; 14use crate::util::slice8_mut;
15use crate::{events, Core, CHIP, MTU}; 15use crate::{CHIP, Core, MTU, events};
16 16
17#[cfg(feature = "firmware-logs")] 17#[cfg(feature = "firmware-logs")]
18struct LogState { 18struct LogState {
diff --git a/docs/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
index ec718022c..797ae3097 100644
--- a/docs/examples/layer-by-layer/blinky-async/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-async/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "blinky-async" 2name = "blinky-async"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7publish = false 7publish = false
diff --git a/docs/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
index 4a0b03a83..802b8b32e 100644
--- a/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "blinky-hal" 2name = "blinky-hal"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7publish = false 7publish = false
diff --git a/docs/examples/layer-by-layer/blinky-irq/Cargo.toml b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
index 3c4bf8446..d1b893a1e 100644
--- a/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-irq/Cargo.toml
@@ -3,7 +3,7 @@
3[package] 3[package]
4name = "blinky-irq" 4name = "blinky-irq"
5version = "0.1.0" 5version = "0.1.0"
6edition = "2021" 6edition = "2024"
7license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
8 8
9publish = false 9publish = false
diff --git a/docs/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
index 0d4711da2..fa093a3af 100644
--- a/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
+++ b/docs/examples/layer-by-layer/blinky-pac/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "blinky-pac" 2name = "blinky-pac"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7publish = false 7publish = false
diff --git a/docs/pages/embassy_in_the_wild.adoc b/docs/pages/embassy_in_the_wild.adoc
index cedbedada..3b58bb9b4 100644
--- a/docs/pages/embassy_in_the_wild.adoc
+++ b/docs/pages/embassy_in_the_wild.adoc
@@ -4,6 +4,8 @@ Here are known examples of real-world projects which make use of Embassy. Feel f
4 4
5_newer entries at the top_ 5_newer entries at the top_
6 6
7* link:https://github.com/1-rafael-1/air-quality-monitor[Air Quality Monitor]
8** Air Quality Monitor based on rp2350 board, ens160 and aht21 sensors and ssd1306 display. Code and 3D printable enclosure included.
7* link:https://github.com/CarlKCarlK/clock[Embassy Clock: Layered, modular bare-metal clock with emulation] 9* link:https://github.com/CarlKCarlK/clock[Embassy Clock: Layered, modular bare-metal clock with emulation]
8** A `no_std` Raspberry Pi Pico clock demonstrating layered Embassy tasks (Display->Blinker->Clock) for clean separation of multiplexing, blinking, and UI logic. Features single-button HH:MM/MM:SS time-set UI, heapless data structures, and a Renode emulator for hardware-free testing. See link:https://medium.com/@carlmkadie/how-rust-embassy-shine-on-embedded-devices-part-2-aad1adfccf72[this article] for details. 10** A `no_std` Raspberry Pi Pico clock demonstrating layered Embassy tasks (Display->Blinker->Clock) for clean separation of multiplexing, blinking, and UI logic. Features single-button HH:MM/MM:SS time-set UI, heapless data structures, and a Renode emulator for hardware-free testing. See link:https://medium.com/@carlmkadie/how-rust-embassy-shine-on-embedded-devices-part-2-aad1adfccf72[this article] for details.
9* link:https://github.com/1-rafael-1/simple-robot[A simple tracked robot based on Raspberry Pi Pico 2] 11* link:https://github.com/1-rafael-1/simple-robot[A simple tracked robot based on Raspberry Pi Pico 2]
@@ -11,7 +13,7 @@ _newer entries at the top_
11* link:https://github.com/1-rafael-1/pi-pico-alarmclock-rust[A Raspberry Pi Pico W Alarmclock] 13* link:https://github.com/1-rafael-1/pi-pico-alarmclock-rust[A Raspberry Pi Pico W Alarmclock]
12** A hobbyist project building an alarm clock around a Pi Pico W complete with code, components list and enclosure design files. 14** A hobbyist project building an alarm clock around a Pi Pico W complete with code, components list and enclosure design files.
13* link:https://github.com/haobogu/rmk/[RMK: A feature-rich Rust keyboard firmware] 15* link:https://github.com/haobogu/rmk/[RMK: A feature-rich Rust keyboard firmware]
14** RMK has built-in layer support, wireless(BLE) support, real-time key editing support using vial, and more! 16** RMK has built-in layer support, wireless(BLE) support, real-time key editing support using vial, and more!
15** Targets STM32, RP2040, nRF52 and ESP32 MCUs 17** Targets STM32, RP2040, nRF52 and ESP32 MCUs
16* link:https://github.com/cbruiz/printhor/[Printhor: The highly reliable but not necessarily functional 3D printer firmware] 18* link:https://github.com/cbruiz/printhor/[Printhor: The highly reliable but not necessarily functional 3D printer firmware]
17** Targets some STM32 MCUs 19** Targets some STM32 MCUs
@@ -21,10 +23,9 @@ _newer entries at the top_
21* link:https://github.com/matoushybl/air-force-one[Air force one: A simple air quality monitoring system] 23* link:https://github.com/matoushybl/air-force-one[Air force one: A simple air quality monitoring system]
22** Targets nRF52 and uses nrf-softdevice 24** Targets nRF52 and uses nrf-softdevice
23 25
24* link:https://github.com/schmettow/ylab-edge-go[YLab Edge Go] and link:https://github.com/schmettow/ylab-edge-pro[YLab Edge Pro] projects develop 26* link:https://github.com/schmettow/ylab-edge-go[YLab Edge Go] and link:https://github.com/schmettow/ylab-edge-pro[YLab Edge Pro] projects develop
25firmware (RP2040, STM32) for capturing physiological data in behavioural science research. Included so far are: 27firmware (RP2040, STM32) for capturing physiological data in behavioural science research. Included so far are:
26** biopotentials (analog ports) 28** biopotentials (analog ports)
27** motion capture (6-axis accelerometers) 29** motion capture (6-axis accelerometers)
28** air quality (CO2, Temp, Humidity) 30** air quality (CO2, Temp, Humidity)
29** comes with an app for capturing and visualizing data [link:https://github.com/schmettow/ystudio-zero[Ystudio]] 31** comes with an app for capturing and visualizing data [link:https://github.com/schmettow/ystudio-zero[Ystudio]]
30
diff --git a/embassy-boot-nrf/Cargo.toml b/embassy-boot-nrf/Cargo.toml
index 466f18631..787a28d70 100644
--- a/embassy-boot-nrf/Cargo.toml
+++ b/embassy-boot-nrf/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-nrf" 3name = "embassy-boot-nrf"
4version = "0.9.0" 4version = "0.9.0"
5description = "Bootloader lib for nRF chips" 5description = "Bootloader lib for nRF chips"
diff --git a/embassy-boot-nrf/src/lib.rs b/embassy-boot-nrf/src/lib.rs
index f1c9da080..b4c3c1151 100644
--- a/embassy-boot-nrf/src/lib.rs
+++ b/embassy-boot-nrf/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2#![warn(missing_docs)] 3#![warn(missing_docs)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4mod fmt; 5mod fmt;
@@ -8,7 +9,7 @@ pub use embassy_boot::{
8 FirmwareUpdater, FirmwareUpdaterConfig, 9 FirmwareUpdater, FirmwareUpdaterConfig,
9}; 10};
10use embassy_nrf::nvmc::PAGE_SIZE; 11use embassy_nrf::nvmc::PAGE_SIZE;
11use embassy_nrf::{wdt, Peri}; 12use embassy_nrf::{Peri, wdt};
12use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; 13use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash};
13 14
14/// A bootloader for nRF devices. 15/// A bootloader for nRF devices.
diff --git a/embassy-boot-rp/Cargo.toml b/embassy-boot-rp/Cargo.toml
index 894b77595..e80c79374 100644
--- a/embassy-boot-rp/Cargo.toml
+++ b/embassy-boot-rp/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-rp" 3name = "embassy-boot-rp"
4version = "0.8.0" 4version = "0.8.0"
5description = "Bootloader lib for RP2040 chips" 5description = "Bootloader lib for RP2040 chips"
diff --git a/embassy-boot-rp/src/lib.rs b/embassy-boot-rp/src/lib.rs
index f704380ef..d090aee49 100644
--- a/embassy-boot-rp/src/lib.rs
+++ b/embassy-boot-rp/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2#![warn(missing_docs)] 3#![warn(missing_docs)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4mod fmt; 5mod fmt;
@@ -7,10 +8,10 @@ pub use embassy_boot::{
7 AlignedBuffer, BlockingFirmwareState, BlockingFirmwareUpdater, BootError, BootLoaderConfig, FirmwareState, 8 AlignedBuffer, BlockingFirmwareState, BlockingFirmwareUpdater, BootError, BootLoaderConfig, FirmwareState,
8 FirmwareUpdater, FirmwareUpdaterConfig, State, 9 FirmwareUpdater, FirmwareUpdaterConfig, State,
9}; 10};
10use embassy_rp::flash::{Blocking, Flash, ERASE_SIZE}; 11use embassy_rp::Peri;
12use embassy_rp::flash::{Blocking, ERASE_SIZE, Flash};
11use embassy_rp::peripherals::{FLASH, WATCHDOG}; 13use embassy_rp::peripherals::{FLASH, WATCHDOG};
12use embassy_rp::watchdog::Watchdog; 14use embassy_rp::watchdog::Watchdog;
13use embassy_rp::Peri;
14use embassy_time::Duration; 15use embassy_time::Duration;
15use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; 16use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash};
16 17
diff --git a/embassy-boot-stm32/Cargo.toml b/embassy-boot-stm32/Cargo.toml
index 24eafcdbf..c8c7f4409 100644
--- a/embassy-boot-stm32/Cargo.toml
+++ b/embassy-boot-stm32/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32" 3name = "embassy-boot-stm32"
4version = "0.6.0" 4version = "0.6.0"
5description = "Bootloader lib for STM32 chips" 5description = "Bootloader lib for STM32 chips"
diff --git a/embassy-boot-stm32/src/lib.rs b/embassy-boot-stm32/src/lib.rs
index 387cc0ce5..ee6ae41b7 100644
--- a/embassy-boot-stm32/src/lib.rs
+++ b/embassy-boot-stm32/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2#![warn(missing_docs)] 3#![warn(missing_docs)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4mod fmt; 5mod fmt;
diff --git a/embassy-boot/Cargo.toml b/embassy-boot/Cargo.toml
index a18438c81..8c5c1f633 100644
--- a/embassy-boot/Cargo.toml
+++ b/embassy-boot/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot" 3name = "embassy-boot"
4version = "0.6.1" 4version = "0.6.1"
5description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks." 5description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks."
diff --git a/embassy-boot/src/boot_loader.rs b/embassy-boot/src/boot_loader.rs
index 5bffdc5ea..c38940d6e 100644
--- a/embassy-boot/src/boot_loader.rs
+++ b/embassy-boot/src/boot_loader.rs
@@ -1,11 +1,11 @@
1use core::cell::RefCell; 1use core::cell::RefCell;
2 2
3use embassy_embedded_hal::flash::partition::BlockingPartition; 3use embassy_embedded_hal::flash::partition::BlockingPartition;
4use embassy_sync::blocking_mutex::raw::NoopRawMutex;
5use embassy_sync::blocking_mutex::Mutex; 4use embassy_sync::blocking_mutex::Mutex;
5use embassy_sync::blocking_mutex::raw::NoopRawMutex;
6use embedded_storage::nor_flash::{NorFlash, NorFlashError, NorFlashErrorKind}; 6use embedded_storage::nor_flash::{NorFlash, NorFlashError, NorFlashErrorKind};
7 7
8use crate::{State, DFU_DETACH_MAGIC, REVERT_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; 8use crate::{DFU_DETACH_MAGIC, REVERT_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC, State};
9 9
10/// Errors returned by bootloader 10/// Errors returned by bootloader
11#[derive(PartialEq, Eq, Debug)] 11#[derive(PartialEq, Eq, Debug)]
@@ -94,7 +94,7 @@ impl<'a, ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>
94 dfu_flash: &'a Mutex<NoopRawMutex, RefCell<DFU>>, 94 dfu_flash: &'a Mutex<NoopRawMutex, RefCell<DFU>>,
95 state_flash: &'a Mutex<NoopRawMutex, RefCell<STATE>>, 95 state_flash: &'a Mutex<NoopRawMutex, RefCell<STATE>>,
96 ) -> Self { 96 ) -> Self {
97 extern "C" { 97 unsafe extern "C" {
98 static __bootloader_state_start: u32; 98 static __bootloader_state_start: u32;
99 static __bootloader_state_end: u32; 99 static __bootloader_state_end: u32;
100 static __bootloader_active_start: u32; 100 static __bootloader_active_start: u32;
diff --git a/embassy-boot/src/firmware_updater/asynch.rs b/embassy-boot/src/firmware_updater/asynch.rs
index 66e311e38..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;
6use embedded_storage_async::nor_flash::NorFlash; 6use embedded_storage_async::nor_flash::NorFlash;
7 7
8use super::FirmwareUpdaterConfig; 8use super::FirmwareUpdaterConfig;
9use crate::{FirmwareUpdaterError, State, BOOT_MAGIC, DFU_DETACH_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; 9use crate::{BOOT_MAGIC, DFU_DETACH_MAGIC, FirmwareUpdaterError, STATE_ERASE_VALUE, SWAP_MAGIC, State};
10 10
11/// FirmwareUpdater is an application API for interacting with the BootLoader without the ability to 11/// FirmwareUpdater is an application API for interacting with the BootLoader without the ability to
12/// 'mess up' the internal bootloader state 12/// 'mess up' the internal bootloader state
@@ -25,7 +25,7 @@ impl<'a, DFU: NorFlash, STATE: NorFlash>
25 dfu_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, DFU>, 25 dfu_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, DFU>,
26 state_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, STATE>, 26 state_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, STATE>,
27 ) -> Self { 27 ) -> Self {
28 extern "C" { 28 unsafe extern "C" {
29 static __bootloader_state_start: u32; 29 static __bootloader_state_start: u32;
30 static __bootloader_state_end: u32; 30 static __bootloader_state_end: u32;
31 static __bootloader_dfu_start: u32; 31 static __bootloader_dfu_start: u32;
diff --git a/embassy-boot/src/firmware_updater/blocking.rs b/embassy-boot/src/firmware_updater/blocking.rs
index 0fedac1ea..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;
6use embedded_storage::nor_flash::NorFlash; 6use embedded_storage::nor_flash::NorFlash;
7 7
8use super::FirmwareUpdaterConfig; 8use super::FirmwareUpdaterConfig;
9use crate::{FirmwareUpdaterError, State, BOOT_MAGIC, DFU_DETACH_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; 9use crate::{BOOT_MAGIC, DFU_DETACH_MAGIC, FirmwareUpdaterError, STATE_ERASE_VALUE, SWAP_MAGIC, State};
10 10
11/// Blocking FirmwareUpdater is an application API for interacting with the BootLoader without the ability to 11/// Blocking FirmwareUpdater is an application API for interacting with the BootLoader without the ability to
12/// 'mess up' the internal bootloader state 12/// 'mess up' the internal bootloader state
@@ -55,7 +55,7 @@ impl<'a, DFU: NorFlash, STATE: NorFlash>
55 dfu_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<DFU>>, 55 dfu_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<DFU>>,
56 state_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<STATE>>, 56 state_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<STATE>>,
57 ) -> Self { 57 ) -> Self {
58 extern "C" { 58 unsafe extern "C" {
59 static __bootloader_state_start: u32; 59 static __bootloader_state_start: u32;
60 static __bootloader_state_end: u32; 60 static __bootloader_state_end: u32;
61 static __bootloader_dfu_start: u32; 61 static __bootloader_dfu_start: u32;
@@ -399,8 +399,8 @@ mod tests {
399 use core::cell::RefCell; 399 use core::cell::RefCell;
400 400
401 use embassy_embedded_hal::flash::partition::BlockingPartition; 401 use embassy_embedded_hal::flash::partition::BlockingPartition;
402 use embassy_sync::blocking_mutex::raw::NoopRawMutex;
403 use embassy_sync::blocking_mutex::Mutex; 402 use embassy_sync::blocking_mutex::Mutex;
403 use embassy_sync::blocking_mutex::raw::NoopRawMutex;
404 use sha1::{Digest, Sha1}; 404 use sha1::{Digest, Sha1};
405 405
406 use super::*; 406 use super::*;
diff --git a/embassy-boot/src/lib.rs b/embassy-boot/src/lib.rs
index e2c4cf771..7dc811f66 100644
--- a/embassy-boot/src/lib.rs
+++ b/embassy-boot/src/lib.rs
@@ -1,5 +1,6 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![warn(missing_docs)] 4#![warn(missing_docs)]
4#![doc = include_str!("../README.md")] 5#![doc = include_str!("../README.md")]
5mod fmt; 6mod fmt;
@@ -341,11 +342,13 @@ mod tests {
341 &mut aligned, 342 &mut aligned,
342 ); 343 );
343 344
344 assert!(block_on(updater.verify_and_mark_updated( 345 assert!(
345 &public_key.to_bytes(), 346 block_on(updater.verify_and_mark_updated(
346 &signature.to_bytes(), 347 &public_key.to_bytes(),
347 firmware_len as u32, 348 &signature.to_bytes(),
348 )) 349 firmware_len as u32,
349 .is_ok()); 350 ))
351 .is_ok()
352 );
350 } 353 }
351} 354}
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 @@
1use core::cell::RefCell; 1use core::cell::RefCell;
2 2
3use embassy_embedded_hal::flash::partition::BlockingPartition; 3use embassy_embedded_hal::flash::partition::BlockingPartition;
4use embassy_sync::blocking_mutex::raw::NoopRawMutex;
5use embassy_sync::blocking_mutex::Mutex; 4use embassy_sync::blocking_mutex::Mutex;
5use embassy_sync::blocking_mutex::raw::NoopRawMutex;
6use embedded_storage::nor_flash::NorFlash; 6use embedded_storage::nor_flash::NorFlash;
7 7
8use crate::BootLoaderConfig; 8use crate::BootLoaderConfig;
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml
index 8b8122567..c9551257a 100644
--- a/embassy-embedded-hal/Cargo.toml
+++ b/embassy-embedded-hal/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-embedded-hal" 2name = "embassy-embedded-hal"
3version = "0.5.0" 3version = "0.5.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Collection of utilities to use `embedded-hal` and `embedded-storage` traits with Embassy." 6description = "Collection of utilities to use `embedded-hal` and `embedded-storage` traits with Embassy."
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
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 @@
1use core::cell::RefCell; 1use core::cell::RefCell;
2 2
3use embassy_sync::blocking_mutex::raw::RawMutex;
4use embassy_sync::blocking_mutex::Mutex; 3use embassy_sync::blocking_mutex::Mutex;
4use embassy_sync::blocking_mutex::raw::RawMutex;
5use embedded_storage::nor_flash::{ErrorType, MultiwriteNorFlash, NorFlash, ReadNorFlash}; 5use embedded_storage::nor_flash::{ErrorType, MultiwriteNorFlash, NorFlash, ReadNorFlash};
6 6
7use super::Error; 7use 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;
26use embassy_sync::mutex::Mutex; 26use embassy_sync::mutex::Mutex;
27use embedded_hal_async::i2c; 27use embedded_hal_async::i2c;
28 28
29use crate::shared_bus::I2cDeviceError;
30use crate::SetConfig; 29use crate::SetConfig;
30use crate::shared_bus::I2cDeviceError;
31 31
32/// I2C device on a shared bus. 32/// I2C device on a shared bus.
33pub struct I2cDevice<'a, M: RawMutex, BUS> { 33pub 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;
32use embedded_hal_1::spi::Operation; 32use embedded_hal_1::spi::Operation;
33use embedded_hal_async::spi; 33use embedded_hal_async::spi;
34 34
35use crate::shared_bus::SpiDeviceError;
36use crate::SetConfig; 35use crate::SetConfig;
36use crate::shared_bus::SpiDeviceError;
37 37
38/// SPI device on a shared bus. 38/// SPI device on a shared bus.
39pub struct SpiDevice<'a, M: RawMutex, BUS, CS> { 39pub 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 @@
17 17
18use core::cell::RefCell; 18use core::cell::RefCell;
19 19
20use embassy_sync::blocking_mutex::raw::RawMutex;
21use embassy_sync::blocking_mutex::Mutex; 20use embassy_sync::blocking_mutex::Mutex;
21use embassy_sync::blocking_mutex::raw::RawMutex;
22use embedded_hal_1::i2c::{ErrorType, I2c, Operation}; 22use embedded_hal_1::i2c::{ErrorType, I2c, Operation};
23 23
24use crate::shared_bus::I2cDeviceError;
25use crate::SetConfig; 24use crate::SetConfig;
25use crate::shared_bus::I2cDeviceError;
26 26
27/// I2C device on a shared bus. 27/// I2C device on a shared bus.
28pub struct I2cDevice<'a, M: RawMutex, BUS> { 28pub 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 @@
19 19
20use core::cell::RefCell; 20use core::cell::RefCell;
21 21
22use embassy_sync::blocking_mutex::raw::RawMutex;
23use embassy_sync::blocking_mutex::Mutex; 22use embassy_sync::blocking_mutex::Mutex;
23use embassy_sync::blocking_mutex::raw::RawMutex;
24use embedded_hal_1::digital::OutputPin; 24use embedded_hal_1::digital::OutputPin;
25use embedded_hal_1::spi::{self, Operation, SpiBus}; 25use embedded_hal_1::spi::{self, Operation, SpiBus};
26 26
27use crate::shared_bus::SpiDeviceError;
28use crate::SetConfig; 27use crate::SetConfig;
28use crate::shared_bus::SpiDeviceError;
29 29
30/// SPI device on a shared bus. 30/// SPI device on a shared bus.
31pub struct SpiDevice<'a, M: RawMutex, BUS, CS> { 31pub struct SpiDevice<'a, M: RawMutex, BUS, CS> {
diff --git a/embassy-executor-macros/Cargo.toml b/embassy-executor-macros/Cargo.toml
index 9c2b40d03..3eeed5e4d 100644
--- a/embassy-executor-macros/Cargo.toml
+++ b/embassy-executor-macros/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-executor-macros" 2name = "embassy-executor-macros"
3version = "0.7.0" 3version = "0.7.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "macros for creating the entry point and tasks for embassy-executor" 6description = "macros for creating the entry point and tasks for embassy-executor"
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
diff --git a/embassy-executor-macros/src/macros/main.rs b/embassy-executor-macros/src/macros/main.rs
index dc470e51c..c259c003f 100644
--- a/embassy-executor-macros/src/macros/main.rs
+++ b/embassy-executor-macros/src/macros/main.rs
@@ -1,7 +1,7 @@
1use std::str::FromStr; 1use std::str::FromStr;
2 2
3use darling::export::NestedMeta;
4use darling::FromMeta; 3use darling::FromMeta;
4use darling::export::NestedMeta;
5use proc_macro2::TokenStream; 5use proc_macro2::TokenStream;
6use quote::quote; 6use quote::quote;
7use syn::{ReturnType, Type}; 7use syn::{ReturnType, Type};
@@ -183,7 +183,7 @@ For example: `#[embassy_executor::main(entry = ..., executor = \"some_crate::Exe
183 quote!(!), 183 quote!(!),
184 quote! { 184 quote! {
185 unsafe fn __make_static<T>(t: &mut T) -> &'static mut T { 185 unsafe fn __make_static<T>(t: &mut T) -> &'static mut T {
186 ::core::mem::transmute(t) 186 unsafe { ::core::mem::transmute(t) }
187 } 187 }
188 188
189 let mut executor = #executor::new(); 189 let mut executor = #executor::new();
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 @@
1use std::str::FromStr; 1use std::str::FromStr;
2 2
3use darling::export::NestedMeta;
4use darling::FromMeta; 3use darling::FromMeta;
4use darling::export::NestedMeta;
5use proc_macro2::{Span, TokenStream}; 5use proc_macro2::{Span, TokenStream};
6use quote::{format_ident, quote}; 6use quote::{format_ident, quote};
7use syn::visit::{self, Visit}; 7use syn::visit::{self, Visit};
@@ -287,7 +287,11 @@ fn check_arg_ty(errors: &mut TokenStream, ty: &Type) {
287 } 287 }
288 288
289 fn visit_type_impl_trait(&mut self, i: &'ast syn::TypeImplTrait) { 289 fn visit_type_impl_trait(&mut self, i: &'ast syn::TypeImplTrait) {
290 error(self.errors, i, "`impl Trait` is not allowed in task arguments. It is syntax sugar for generics, and tasks can't be generic."); 290 error(
291 self.errors,
292 i,
293 "`impl Trait` is not allowed in task arguments. It is syntax sugar for generics, and tasks can't be generic.",
294 );
291 } 295 }
292 } 296 }
293 297
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;
3use proc_macro2::{TokenStream, TokenTree}; 3use proc_macro2::{TokenStream, TokenTree};
4use quote::{ToTokens, TokenStreamExt}; 4use quote::{ToTokens, TokenStreamExt};
5use syn::parse::{Parse, ParseStream}; 5use syn::parse::{Parse, ParseStream};
6use syn::{braced, bracketed, token, AttrStyle, Attribute, Signature, Token, Visibility}; 6use syn::{AttrStyle, Attribute, Signature, Token, Visibility, braced, bracketed, token};
7 7
8pub fn token_stream_with_error(mut tokens: TokenStream, error: syn::Error) -> TokenStream { 8pub fn token_stream_with_error(mut tokens: TokenStream, error: syn::Error) -> TokenStream {
9 tokens.extend(error.into_compile_error()); 9 tokens.extend(error.into_compile_error());
diff --git a/embassy-executor-timer-queue/Cargo.toml b/embassy-executor-timer-queue/Cargo.toml
index a0ac44420..6770ab26e 100644
--- a/embassy-executor-timer-queue/Cargo.toml
+++ b/embassy-executor-timer-queue/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-executor-timer-queue" 2name = "embassy-executor-timer-queue"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5description = "Timer queue item and interface between embassy-executor and timer queues" 5description = "Timer queue item and interface between embassy-executor and timer queues"
6repository = "https://github.com/embassy-rs/embassy" 6repository = "https://github.com/embassy-rs/embassy"
7documentation = "https://docs.embassy.dev/embassy-executor-timer-queue" 7documentation = "https://docs.embassy.dev/embassy-executor-timer-queue"
diff --git a/embassy-executor/CHANGELOG.md b/embassy-executor/CHANGELOG.md
index 6f079a11a..47a8ae995 100644
--- a/embassy-executor/CHANGELOG.md
+++ b/embassy-executor/CHANGELOG.md
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13- Upgraded rtos-trace 13- Upgraded rtos-trace
14- Added optional "highest priority" scheduling 14- Added optional "highest priority" scheduling
15- Added optional "earliest deadline first" EDF scheduling 15- Added optional "earliest deadline first" EDF scheduling
16- Bump `cortex-ar` to v0.3
16 17
17## 0.9.1 - 2025-08-31 18## 0.9.1 - 2025-08-31
18 19
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index 61d060630..ecc4b6338 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-executor" 2name = "embassy-executor"
3version = "0.9.1" 3version = "0.9.1"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "async/await executor designed for embedded usage" 6description = "async/await executor designed for embedded usage"
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
@@ -30,6 +30,8 @@ build = [
30 {target = "thumbv7em-none-eabi", features = ["arch-cortex-m", "executor-interrupt", "executor-thread", "embassy-time-driver", "scheduler-deadline"]}, 30 {target = "thumbv7em-none-eabi", features = ["arch-cortex-m", "executor-interrupt", "executor-thread", "embassy-time-driver", "scheduler-deadline"]},
31 {target = "thumbv7em-none-eabi", features = ["arch-cortex-m", "executor-interrupt", "executor-thread", "scheduler-priority", "scheduler-deadline"]}, 31 {target = "thumbv7em-none-eabi", features = ["arch-cortex-m", "executor-interrupt", "executor-thread", "scheduler-priority", "scheduler-deadline"]},
32 {target = "thumbv7em-none-eabi", features = ["arch-cortex-m", "executor-interrupt", "executor-thread", "scheduler-deadline"]}, 32 {target = "thumbv7em-none-eabi", features = ["arch-cortex-m", "executor-interrupt", "executor-thread", "scheduler-deadline"]},
33 {target = "thumbv7em-none-eabi", features = ["arch-spin"]},
34 {target = "thumbv7em-none-eabi", features = ["arch-spin", "scheduler-deadline"]},
33 {target = "armv7a-none-eabi", features = ["arch-cortex-ar", "executor-thread"]}, 35 {target = "armv7a-none-eabi", features = ["arch-cortex-ar", "executor-thread"]},
34 {target = "armv7r-none-eabi", features = ["arch-cortex-ar", "executor-thread"]}, 36 {target = "armv7r-none-eabi", features = ["arch-cortex-ar", "executor-thread"]},
35 {target = "armv7r-none-eabihf", features = ["arch-cortex-ar", "executor-thread"]}, 37 {target = "armv7r-none-eabihf", features = ["arch-cortex-ar", "executor-thread"]},
@@ -98,7 +100,7 @@ portable-atomic = { version = "1.5", optional = true }
98cortex-m = { version = "0.7.6", optional = true } 100cortex-m = { version = "0.7.6", optional = true }
99 101
100# arch-cortex-ar dependencies 102# arch-cortex-ar dependencies
101cortex-ar = { version = "0.2", optional = true } 103cortex-ar = { version = "0.3", optional = true }
102 104
103# arch-wasm dependencies 105# arch-wasm dependencies
104wasm-bindgen = { version = "0.2.82", optional = true } 106wasm-bindgen = { version = "0.2.82", optional = true }
diff --git a/embassy-executor/src/arch/avr.rs b/embassy-executor/src/arch/avr.rs
index 70085d04d..a841afe15 100644
--- a/embassy-executor/src/arch/avr.rs
+++ b/embassy-executor/src/arch/avr.rs
@@ -10,11 +10,11 @@ mod thread {
10 pub use embassy_executor_macros::main_avr as main; 10 pub use embassy_executor_macros::main_avr as main;
11 use portable_atomic::{AtomicBool, Ordering}; 11 use portable_atomic::{AtomicBool, Ordering};
12 12
13 use crate::{raw, Spawner}; 13 use crate::{Spawner, raw};
14 14
15 static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); 15 static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false);
16 16
17 #[export_name = "__pender"] 17 #[unsafe(export_name = "__pender")]
18 fn __pender(_context: *mut ()) { 18 fn __pender(_context: *mut ()) {
19 SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst); 19 SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst);
20 } 20 }
diff --git a/embassy-executor/src/arch/cortex_ar.rs b/embassy-executor/src/arch/cortex_ar.rs
index f9e2f3f7c..a9be3d323 100644
--- a/embassy-executor/src/arch/cortex_ar.rs
+++ b/embassy-executor/src/arch/cortex_ar.rs
@@ -1,7 +1,7 @@
1#[cfg(feature = "executor-interrupt")] 1#[cfg(feature = "executor-interrupt")]
2compile_error!("`executor-interrupt` is not supported with `arch-cortex-ar`."); 2compile_error!("`executor-interrupt` is not supported with `arch-cortex-ar`.");
3 3
4#[export_name = "__pender"] 4#[unsafe(export_name = "__pender")]
5#[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))] 5#[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))]
6fn __pender(context: *mut ()) { 6fn __pender(context: *mut ()) {
7 // `context` is always `usize::MAX` created by `Executor::run`. 7 // `context` is always `usize::MAX` created by `Executor::run`.
@@ -26,7 +26,7 @@ mod thread {
26 use cortex_ar::asm::wfe; 26 use cortex_ar::asm::wfe;
27 pub use embassy_executor_macros::main_cortex_ar as main; 27 pub use embassy_executor_macros::main_cortex_ar as main;
28 28
29 use crate::{raw, Spawner}; 29 use crate::{Spawner, raw};
30 30
31 /// Thread mode executor, using WFE/SEV. 31 /// Thread mode executor, using WFE/SEV.
32 /// 32 ///
diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs
index 1c9ddd8a0..1ce96d1d5 100644
--- a/embassy-executor/src/arch/cortex_m.rs
+++ b/embassy-executor/src/arch/cortex_m.rs
@@ -1,4 +1,4 @@
1#[export_name = "__pender"] 1#[unsafe(export_name = "__pender")]
2#[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))] 2#[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))]
3fn __pender(context: *mut ()) { 3fn __pender(context: *mut ()) {
4 unsafe { 4 unsafe {
@@ -53,7 +53,7 @@ mod thread {
53 53
54 pub use embassy_executor_macros::main_cortex_m as main; 54 pub use embassy_executor_macros::main_cortex_m as main;
55 55
56 use crate::{raw, Spawner}; 56 use crate::{Spawner, raw};
57 57
58 /// Thread mode executor, using WFE/SEV. 58 /// Thread mode executor, using WFE/SEV.
59 /// 59 ///
diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs
index 01e63a9fd..c70c1344a 100644
--- a/embassy-executor/src/arch/riscv32.rs
+++ b/embassy-executor/src/arch/riscv32.rs
@@ -10,12 +10,12 @@ mod thread {
10 10
11 pub use embassy_executor_macros::main_riscv as main; 11 pub use embassy_executor_macros::main_riscv as main;
12 12
13 use crate::{raw, Spawner}; 13 use crate::{Spawner, raw};
14 14
15 /// global atomic used to keep track of whether there is work to do since sev() is not available on RISCV 15 /// global atomic used to keep track of whether there is work to do since sev() is not available on RISCV
16 static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); 16 static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false);
17 17
18 #[export_name = "__pender"] 18 #[unsafe(export_name = "__pender")]
19 fn __pender(_context: *mut ()) { 19 fn __pender(_context: *mut ()) {
20 SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst); 20 SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst);
21 } 21 }
diff --git a/embassy-executor/src/arch/spin.rs b/embassy-executor/src/arch/spin.rs
index 340023620..49f3356a6 100644
--- a/embassy-executor/src/arch/spin.rs
+++ b/embassy-executor/src/arch/spin.rs
@@ -9,9 +9,9 @@ mod thread {
9 9
10 pub use embassy_executor_macros::main_spin as main; 10 pub use embassy_executor_macros::main_spin as main;
11 11
12 use crate::{raw, Spawner}; 12 use crate::{Spawner, raw};
13 13
14 #[export_name = "__pender"] 14 #[unsafe(export_name = "__pender")]
15 fn __pender(_context: *mut ()) {} 15 fn __pender(_context: *mut ()) {}
16 16
17 /// Spin Executor 17 /// Spin Executor
diff --git a/embassy-executor/src/arch/std.rs b/embassy-executor/src/arch/std.rs
index b02b15988..c62ab723b 100644
--- a/embassy-executor/src/arch/std.rs
+++ b/embassy-executor/src/arch/std.rs
@@ -10,9 +10,9 @@ mod thread {
10 10
11 pub use embassy_executor_macros::main_std as main; 11 pub use embassy_executor_macros::main_std as main;
12 12
13 use crate::{raw, Spawner}; 13 use crate::{Spawner, raw};
14 14
15 #[export_name = "__pender"] 15 #[unsafe(export_name = "__pender")]
16 fn __pender(context: *mut ()) { 16 fn __pender(context: *mut ()) {
17 let signaler: &'static Signaler = unsafe { std::mem::transmute(context) }; 17 let signaler: &'static Signaler = unsafe { std::mem::transmute(context) };
18 signaler.signal() 18 signaler.signal()
diff --git a/embassy-executor/src/arch/wasm.rs b/embassy-executor/src/arch/wasm.rs
index f9d0f935c..d2ff2fe51 100644
--- a/embassy-executor/src/arch/wasm.rs
+++ b/embassy-executor/src/arch/wasm.rs
@@ -13,9 +13,9 @@ mod thread {
13 use wasm_bindgen::prelude::*; 13 use wasm_bindgen::prelude::*;
14 14
15 use crate::raw::util::UninitCell; 15 use crate::raw::util::UninitCell;
16 use crate::{raw, Spawner}; 16 use crate::{Spawner, raw};
17 17
18 #[export_name = "__pender"] 18 #[unsafe(export_name = "__pender")]
19 fn __pender(context: *mut ()) { 19 fn __pender(context: *mut ()) {
20 let signaler: &'static WasmContext = unsafe { std::mem::transmute(context) }; 20 let signaler: &'static WasmContext = unsafe { std::mem::transmute(context) };
21 let _ = signaler.promise.then(unsafe { signaler.closure.as_mut() }); 21 let _ = signaler.promise.then(unsafe { signaler.closure.as_mut() });
diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs
index e47b8eb9f..cffc76699 100644
--- a/embassy-executor/src/lib.rs
+++ b/embassy-executor/src/lib.rs
@@ -1,5 +1,6 @@
1#![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)] 1#![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)]
2#![allow(clippy::new_without_default)] 2#![allow(clippy::new_without_default)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4#![warn(missing_docs)] 5#![warn(missing_docs)]
5 6
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 @@
1#[cfg(feature = "metadata-name")] 1#[cfg(feature = "metadata-name")]
2use core::cell::Cell; 2use core::cell::Cell;
3use core::future::{poll_fn, Future}; 3use core::future::{Future, poll_fn};
4#[cfg(feature = "scheduler-priority")] 4#[cfg(feature = "scheduler-priority")]
5use core::sync::atomic::{AtomicU8, Ordering}; 5use core::sync::atomic::{AtomicU8, Ordering};
6use core::task::Poll; 6use core::task::Poll;
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs
index dbd70cbf4..ab845ed3b 100644
--- a/embassy-executor/src/raw/mod.rs
+++ b/embassy-executor/src/raw/mod.rs
@@ -52,7 +52,7 @@ pub use self::waker::task_from_waker;
52use super::SpawnToken; 52use super::SpawnToken;
53use crate::{Metadata, SpawnError}; 53use crate::{Metadata, SpawnError};
54 54
55#[no_mangle] 55#[unsafe(no_mangle)]
56extern "Rust" fn __embassy_time_queue_item_from_waker(waker: &Waker) -> &'static mut TimerQueueItem { 56extern "Rust" fn __embassy_time_queue_item_from_waker(waker: &Waker) -> &'static mut TimerQueueItem {
57 unsafe { task_from_waker(waker).timer_queue_item() } 57 unsafe { task_from_waker(waker).timer_queue_item() }
58} 58}
@@ -407,7 +407,7 @@ unsafe impl Sync for Pender {}
407 407
408impl Pender { 408impl Pender {
409 pub(crate) fn pend(self) { 409 pub(crate) fn pend(self) {
410 extern "Rust" { 410 unsafe extern "Rust" {
411 fn __pender(context: *mut ()); 411 fn __pender(context: *mut ());
412 } 412 }
413 unsafe { __pender(self.0) }; 413 unsafe { __pender(self.0) };
@@ -507,7 +507,7 @@ impl SyncExecutor {
507/// The pender function must be exported with the name `__pender` and have the following signature: 507/// The pender function must be exported with the name `__pender` and have the following signature:
508/// 508///
509/// ```rust 509/// ```rust
510/// #[export_name = "__pender"] 510/// #[unsafe(export_name = "__pender")]
511/// fn pender(context: *mut ()) { 511/// fn pender(context: *mut ()) {
512/// // schedule `poll()` to be called 512/// // schedule `poll()` to be called
513/// } 513/// }
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 @@
1use core::ptr::{addr_of_mut, NonNull}; 1use core::ptr::{NonNull, addr_of_mut};
2 2
3use cordyceps::sorted_list::Links;
4use cordyceps::Linked; 3use cordyceps::Linked;
5#[cfg(any(feature = "scheduler-priority", feature = "scheduler-deadline"))] 4#[cfg(any(feature = "scheduler-priority", feature = "scheduler-deadline"))]
6use cordyceps::SortedList; 5use cordyceps::SortedList;
6use cordyceps::sorted_list::Links;
7 7
8#[cfg(target_has_atomic = "ptr")] 8#[cfg(target_has_atomic = "ptr")]
9type TransferStack<T> = cordyceps::TransferStack<T>; 9type TransferStack<T> = cordyceps::TransferStack<T>;
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 @@
1use core::sync::atomic::{compiler_fence, AtomicBool, AtomicU32, Ordering}; 1use core::sync::atomic::{AtomicBool, AtomicU32, Ordering, compiler_fence};
2 2
3#[derive(Clone, Copy)] 3#[derive(Clone, Copy)]
4pub(crate) struct Token(()); 4pub(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 @@
1use core::cell::Cell; 1use core::cell::Cell;
2 2
3pub(crate) use critical_section::{with as locked, CriticalSection as Token};
4use critical_section::{CriticalSection, Mutex}; 3use critical_section::{CriticalSection, Mutex};
4pub(crate) use critical_section::{CriticalSection as Token, with as locked};
5 5
6#[cfg(target_arch = "avr")] 6#[cfg(target_arch = "avr")]
7type StateBits = u8; 7type 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 {
368 } 368 }
369 fn time() -> u64 { 369 fn time() -> u64 {
370 const fn gcd(a: u64, b: u64) -> u64 { 370 const fn gcd(a: u64, b: u64) -> u64 {
371 if b == 0 { 371 if b == 0 { a } else { gcd(b, a % b) }
372 a
373 } else {
374 gcd(b, a % b)
375 }
376 } 372 }
377 373
378 const GCD_1M: u64 = gcd(embassy_time_driver::TICK_HZ, 1_000_000); 374 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 @@
1use core::task::{RawWaker, RawWakerVTable, Waker}; 1use core::task::{RawWaker, RawWakerVTable, Waker};
2 2
3use super::{wake_task, TaskHeader, TaskRef}; 3use super::{TaskHeader, TaskRef, wake_task};
4 4
5static VTABLE: RawWakerVTable = RawWakerVTable::new(clone, wake, wake, drop); 5static VTABLE: RawWakerVTable = RawWakerVTable::new(clone, wake, wake, drop);
6 6
@@ -35,7 +35,9 @@ pub fn task_from_waker(waker: &Waker) -> TaskRef {
35 // make sure to compare vtable addresses. Doing `==` on the references 35 // make sure to compare vtable addresses. Doing `==` on the references
36 // will compare the contents, which is slower. 36 // will compare the contents, which is slower.
37 if waker.vtable() as *const _ != &VTABLE as *const _ { 37 if waker.vtable() as *const _ != &VTABLE as *const _ {
38 panic!("Found waker not created by the Embassy executor. `embassy_time::Timer` only works with the Embassy executor.") 38 panic!(
39 "Found waker not created by the Embassy executor. `embassy_time::Timer` only works with the Embassy executor."
40 )
39 } 41 }
40 // safety: our wakers are always created with `TaskRef::as_ptr` 42 // safety: our wakers are always created with `TaskRef::as_ptr`
41 unsafe { TaskRef::from_ptr(waker.data() as *const TaskHeader) } 43 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 435a0ff7e..919bcc61a 100644
--- a/embassy-executor/src/raw/waker_turbo.rs
+++ b/embassy-executor/src/raw/waker_turbo.rs
@@ -1,7 +1,7 @@
1use core::ptr::NonNull; 1use core::ptr::NonNull;
2use core::task::Waker; 2use core::task::Waker;
3 3
4use super::{wake_task, TaskHeader, TaskRef}; 4use super::{TaskHeader, TaskRef, wake_task};
5 5
6pub(crate) unsafe fn from_task(p: TaskRef) -> Waker { 6pub(crate) unsafe fn from_task(p: TaskRef) -> Waker {
7 Waker::from_turbo_ptr(NonNull::new_unchecked(p.as_ptr() as _)) 7 Waker::from_turbo_ptr(NonNull::new_unchecked(p.as_ptr() as _))
@@ -26,7 +26,7 @@ pub fn task_from_waker(waker: &Waker) -> TaskRef {
26} 26}
27 27
28#[inline(never)] 28#[inline(never)]
29#[no_mangle] 29#[unsafe(no_mangle)]
30fn _turbo_wake(ptr: NonNull<()>) { 30fn _turbo_wake(ptr: NonNull<()>) {
31 // safety: our wakers are always created with `TaskRef::as_ptr` 31 // safety: our wakers are always created with `TaskRef::as_ptr`
32 let task = unsafe { TaskRef::from_ptr(ptr.as_ptr() as *const TaskHeader) }; 32 let task = unsafe { TaskRef::from_ptr(ptr.as_ptr() as *const TaskHeader) };
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 @@
1use core::future::{poll_fn, Future}; 1use core::future::{Future, poll_fn};
2use core::marker::PhantomData; 2use core::marker::PhantomData;
3use core::mem; 3use core::mem;
4use core::sync::atomic::Ordering; 4use core::sync::atomic::Ordering;
@@ -75,7 +75,10 @@ impl core::fmt::Debug for SpawnError {
75impl core::fmt::Display for SpawnError { 75impl core::fmt::Display for SpawnError {
76 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 76 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
77 match self { 77 match self {
78 SpawnError::Busy => write!(f, "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."), 78 SpawnError::Busy => write!(
79 f,
80 "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."
81 ),
79 } 82 }
80 } 83 }
81} 84}
@@ -84,7 +87,10 @@ impl core::fmt::Display for SpawnError {
84impl defmt::Format for SpawnError { 87impl defmt::Format for SpawnError {
85 fn format(&self, f: defmt::Formatter) { 88 fn format(&self, f: defmt::Formatter) {
86 match self { 89 match self {
87 SpawnError::Busy => defmt::write!(f, "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."), 90 SpawnError::Busy => defmt::write!(
91 f,
92 "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."
93 ),
88 } 94 }
89 } 95 }
90} 96}
diff --git a/embassy-executor/tests/test.rs b/embassy-executor/tests/test.rs
index 6baf3dc21..a99976168 100644
--- a/embassy-executor/tests/test.rs
+++ b/embassy-executor/tests/test.rs
@@ -2,14 +2,14 @@
2#![cfg_attr(feature = "nightly", feature(never_type))] 2#![cfg_attr(feature = "nightly", feature(never_type))]
3 3
4use std::boxed::Box; 4use std::boxed::Box;
5use std::future::{poll_fn, Future}; 5use std::future::{Future, poll_fn};
6use std::sync::{Arc, Mutex}; 6use std::sync::{Arc, Mutex};
7use std::task::Poll; 7use std::task::Poll;
8 8
9use embassy_executor::raw::Executor; 9use embassy_executor::raw::Executor;
10use embassy_executor::{task, Spawner}; 10use embassy_executor::{Spawner, task};
11 11
12#[export_name = "__pender"] 12#[unsafe(export_name = "__pender")]
13fn __pender(context: *mut ()) { 13fn __pender(context: *mut ()) {
14 unsafe { 14 unsafe {
15 let trace = &*(context as *const Trace); 15 let trace = &*(context as *const Trace);
diff --git a/embassy-executor/tests/ui/nonstatic_struct_elided.stderr b/embassy-executor/tests/ui/nonstatic_struct_elided.stderr
index 0ee1bfe0c..e6829bf5d 100644
--- a/embassy-executor/tests/ui/nonstatic_struct_elided.stderr
+++ b/embassy-executor/tests/ui/nonstatic_struct_elided.stderr
@@ -9,16 +9,16 @@ help: indicate the anonymous lifetime
96 | async fn task(_x: Foo<'_>) {} 96 | async fn task(_x: Foo<'_>) {}
10 | ++++ 10 | ++++
11 11
12error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds 12error: lifetime may not live long enough
13 --> tests/ui/nonstatic_struct_elided.rs:5:1 13 --> tests/ui/nonstatic_struct_elided.rs:5:1
14 | 14 |
155 | #[embassy_executor::task] 155 | #[embassy_executor::task]
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^ opaque type defined here 16 | ^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
176 | async fn task(_x: Foo) {} 176 | async fn task(_x: Foo) {}
18 | --- hidden type `impl Sized` captures the anonymous lifetime defined here 18 | -- has type `Foo<'1>`
19 | 19 |
20 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) 20 = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
21help: add a `use<...>` bound to explicitly capture `'_` 21help: to declare that `impl Sized` captures data from argument `_x`, you can add an explicit `'_` lifetime bound
22 | 22 |
235 | #[embassy_executor::task] + use<'_> 235 | #[embassy_executor::task] + '_
24 | +++++++++ 24 | ++++
diff --git a/embassy-executor/tests/ui/task_safety_attribute.rs b/embassy-executor/tests/ui/task_safety_attribute.rs
index ab5a2f99f..46a5c665f 100644
--- a/embassy-executor/tests/ui/task_safety_attribute.rs
+++ b/embassy-executor/tests/ui/task_safety_attribute.rs
@@ -9,7 +9,7 @@ async fn safe() {}
9#[embassy_executor::task] 9#[embassy_executor::task]
10async unsafe fn not_safe() {} 10async unsafe fn not_safe() {}
11 11
12#[export_name = "__pender"] 12#[unsafe(export_name = "__pender")]
13fn pender(_: *mut ()) { 13fn pender(_: *mut ()) {
14 // The test doesn't link if we don't include this. 14 // The test doesn't link if we don't include this.
15 // We never call this anyway. 15 // We never call this anyway.
diff --git a/embassy-futures/Cargo.toml b/embassy-futures/Cargo.toml
index 07d5219cf..d344e5c4b 100644
--- a/embassy-futures/Cargo.toml
+++ b/embassy-futures/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-futures" 2name = "embassy-futures"
3version = "0.1.2" 3version = "0.1.2"
4edition = "2021" 4edition = "2024"
5description = "no-std, no-alloc utilities for working with futures" 5description = "no-std, no-alloc utilities for working with futures"
6repository = "https://github.com/embassy-rs/embassy" 6repository = "https://github.com/embassy-rs/embassy"
7documentation = "https://docs.embassy.dev/embassy-futures" 7documentation = "https://docs.embassy.dev/embassy-futures"
diff --git a/embassy-hal-internal/Cargo.toml b/embassy-hal-internal/Cargo.toml
index 11dcc2466..c2e0bd30f 100644
--- a/embassy-hal-internal/Cargo.toml
+++ b/embassy-hal-internal/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-hal-internal" 2name = "embassy-hal-internal"
3version = "0.3.0" 3version = "0.3.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Internal implementation details for Embassy HALs. DO NOT USE DIRECTLY." 6description = "Internal implementation details for Embassy HALs. DO NOT USE DIRECTLY."
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
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 @@
1//! Interrupt handling for cortex-m devices. 1//! Interrupt handling for cortex-m devices.
2use core::mem; 2use core::mem;
3use core::sync::atomic::{compiler_fence, Ordering}; 3use core::sync::atomic::{Ordering, compiler_fence};
4 4
5use cortex_m::interrupt::InterruptNumber; 5use cortex_m::interrupt::InterruptNumber;
6use cortex_m::peripheral::NVIC; 6use cortex_m::peripheral::NVIC;
diff --git a/embassy-hal-internal/src/lib.rs b/embassy-hal-internal/src/lib.rs
index 7addb71e2..729f97f0c 100644
--- a/embassy-hal-internal/src/lib.rs
+++ b/embassy-hal-internal/src/lib.rs
@@ -1,5 +1,6 @@
1#![no_std] 1#![no_std]
2#![allow(clippy::new_without_default)] 2#![allow(clippy::new_without_default)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4#![warn(missing_docs)] 5#![warn(missing_docs)]
5 6
diff --git a/embassy-hal-internal/src/macros.rs b/embassy-hal-internal/src/macros.rs
index ce72ded5c..0fcca2baf 100644
--- a/embassy-hal-internal/src/macros.rs
+++ b/embassy-hal-internal/src/macros.rs
@@ -58,7 +58,7 @@ macro_rules! peripherals_struct {
58 ///Returns all the peripherals *once* 58 ///Returns all the peripherals *once*
59 #[inline] 59 #[inline]
60 pub(crate) fn take_with_cs(_cs: critical_section::CriticalSection) -> Self { 60 pub(crate) fn take_with_cs(_cs: critical_section::CriticalSection) -> Self {
61 #[no_mangle] 61 #[unsafe(no_mangle)]
62 static mut _EMBASSY_DEVICE_PERIPHERALS: bool = false; 62 static mut _EMBASSY_DEVICE_PERIPHERALS: bool = false;
63 63
64 // safety: OK because we're inside a CS. 64 // safety: OK because we're inside a CS.
diff --git a/embassy-imxrt/Cargo.toml b/embassy-imxrt/Cargo.toml
index 7561640dd..c47756f10 100644
--- a/embassy-imxrt/Cargo.toml
+++ b/embassy-imxrt/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-imxrt" 2name = "embassy-imxrt"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for the IMXRT microcontroller" 6description = "Embassy Hardware Abstraction Layer (HAL) for the IMXRT microcontroller"
7keywords = ["embedded", "async", "imxrt", "rt600", "embedded-hal"] 7keywords = ["embedded", "async", "imxrt", "rt600", "embedded-hal"]
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 @@
1//! Clock configuration for the `RT6xx` 1//! Clock configuration for the `RT6xx`
2use core::sync::atomic::{AtomicU32, AtomicU8, Ordering}; 2use core::sync::atomic::{AtomicU8, AtomicU32, Ordering};
3 3
4use paste::paste; 4use paste::paste;
5 5
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 @@
2 2
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4 4
5use crate::clocks::{enable_and_reset, SysconPeripheral}; 5use crate::clocks::{SysconPeripheral, enable_and_reset};
6pub use crate::pac::crc_engine::mode::CrcPolynomial as Polynomial; 6pub use crate::pac::crc_engine::mode::CrcPolynomial as Polynomial;
7use crate::{peripherals, Peri, PeripheralType}; 7use crate::{Peri, PeripheralType, peripherals};
8 8
9/// CRC driver. 9/// CRC driver.
10pub struct Crc<'d> { 10pub 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 @@
2 2
3use core::future::Future; 3use core::future::Future;
4use core::pin::Pin; 4use core::pin::Pin;
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10use pac::dma0::channel::cfg::Periphreqen; 10use pac::dma0::channel::cfg::Periphreqen;
11use pac::dma0::channel::xfercfg::{Dstinc, Srcinc, Width}; 11use pac::dma0::channel::xfercfg::{Dstinc, Srcinc, Width};
@@ -14,7 +14,7 @@ use crate::clocks::enable_and_reset;
14use crate::interrupt::InterruptExt; 14use crate::interrupt::InterruptExt;
15use crate::peripherals::DMA0; 15use crate::peripherals::DMA0;
16use crate::sealed::Sealed; 16use crate::sealed::Sealed;
17use crate::{interrupt, pac, peripherals, BitIter}; 17use crate::{BitIter, interrupt, pac, peripherals};
18 18
19#[cfg(feature = "rt")] 19#[cfg(feature = "rt")]
20#[interrupt] 20#[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;
4 4
5use paste::paste; 5use paste::paste;
6 6
7use crate::clocks::{enable_and_reset, SysconPeripheral}; 7use crate::clocks::{SysconPeripheral, enable_and_reset};
8use crate::peripherals::{ 8use crate::peripherals::{
9 FLEXCOMM0, FLEXCOMM1, FLEXCOMM14, FLEXCOMM15, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, 9 FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM14, FLEXCOMM15,
10}; 10};
11use crate::{pac, PeripheralType}; 11use crate::{PeripheralType, pac};
12 12
13/// clock selection option 13/// clock selection option
14#[derive(Copy, Clone, Debug)] 14#[derive(Copy, Clone, Debug)]
@@ -223,9 +223,15 @@ macro_rules! into_mode {
223 } 223 }
224} 224}
225 225
226into_mode!(usart, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7); 226into_mode!(
227into_mode!(spi, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM14); 227 usart, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7
228into_mode!(i2c, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM15); 228);
229into_mode!(
230 spi, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM14
231);
232into_mode!(
233 i2c, FLEXCOMM0, FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, FLEXCOMM15
234);
229 235
230into_mode!( 236into_mode!(
231 i2s_transmit, 237 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 @@
2 2
3use core::future::poll_fn; 3use core::future::poll_fn;
4use core::marker::PhantomData; 4use core::marker::PhantomData;
5use core::sync::atomic::{compiler_fence, AtomicU8, Ordering}; 5use core::sync::atomic::{AtomicU8, Ordering, compiler_fence};
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_futures::select::{select, Either}; 8use embassy_futures::select::{Either, select};
9use embassy_hal_internal::drop::OnDrop; 9use embassy_hal_internal::drop::OnDrop;
10use embassy_hal_internal::{Peri, PeripheralType}; 10use embassy_hal_internal::{Peri, PeripheralType};
11use embassy_sync::waitqueue::AtomicWaker; 11use 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;
13use crate::iopctl::IopctlPin; 13use crate::iopctl::IopctlPin;
14pub use crate::iopctl::{AnyPin, DriveMode, DriveStrength, Function, Inverter, Pull, SlewRate}; 14pub use crate::iopctl::{AnyPin, DriveMode, DriveStrength, Function, Inverter, Pull, SlewRate};
15use crate::sealed::Sealed; 15use crate::sealed::Sealed;
16use crate::{interrupt, peripherals, BitIter, Peri, PeripheralType}; 16use crate::{BitIter, Peri, PeripheralType, interrupt, peripherals};
17 17
18// This should be unique per IMXRT package 18// This should be unique per IMXRT package
19const PORT_COUNT: usize = 8; 19const 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 @@
2//! 2//!
3//! Also known as IO Pin Configuration (IOCON) 3//! Also known as IO Pin Configuration (IOCON)
4 4
5use crate::pac::{iopctl, Iopctl}; 5use crate::pac::{Iopctl, iopctl};
6 6
7// A generic pin of any type. 7// A generic pin of any type.
8// 8//
diff --git a/embassy-imxrt/src/lib.rs b/embassy-imxrt/src/lib.rs
index a3437c655..643dd0c8a 100644
--- a/embassy-imxrt/src/lib.rs
+++ b/embassy-imxrt/src/lib.rs
@@ -1,5 +1,6 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4#![warn(missing_docs)] 5#![warn(missing_docs)]
5 6
@@ -39,7 +40,7 @@ pub use chip::interrupts::*;
39pub use chip::pac; 40pub use chip::pac;
40#[cfg(not(feature = "unstable-pac"))] 41#[cfg(not(feature = "unstable-pac"))]
41pub(crate) use chip::pac; 42pub(crate) use chip::pac;
42pub use chip::{peripherals, Peripherals}; 43pub use chip::{Peripherals, peripherals};
43pub use embassy_hal_internal::{Peri, PeripheralType}; 44pub use embassy_hal_internal::{Peri, PeripheralType};
44 45
45#[cfg(feature = "rt")] 46#[cfg(feature = "rt")]
@@ -74,7 +75,7 @@ macro_rules! bind_interrupts {
74 75
75 $( 76 $(
76 #[allow(non_snake_case)] 77 #[allow(non_snake_case)]
77 #[no_mangle] 78 #[unsafe(no_mangle)]
78 unsafe extern "C" fn $irq() { 79 unsafe extern "C" fn $irq() {
79 unsafe { 80 unsafe {
80 $( 81 $(
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;
7use embassy_futures::block_on; 7use embassy_futures::block_on;
8use embassy_sync::waitqueue::AtomicWaker; 8use embassy_sync::waitqueue::AtomicWaker;
9 9
10use crate::clocks::{enable_and_reset, SysconPeripheral}; 10use crate::clocks::{SysconPeripheral, enable_and_reset};
11use crate::interrupt::typelevel::Interrupt; 11use crate::interrupt::typelevel::Interrupt;
12use crate::{interrupt, peripherals, Peri, PeripheralType}; 12use crate::{Peri, PeripheralType, interrupt, peripherals};
13 13
14static RNG_WAKER: AtomicWaker = AtomicWaker::new(); 14static RNG_WAKER: AtomicWaker = AtomicWaker::new();
15 15
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 @@
1//! Time Driver. 1//! Time Driver.
2use core::cell::{Cell, RefCell}; 2use core::cell::{Cell, RefCell};
3#[cfg(feature = "time-driver-rtc")] 3#[cfg(feature = "time-driver-rtc")]
4use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; 4use core::sync::atomic::{AtomicU32, Ordering, compiler_fence};
5 5
6use critical_section::CriticalSection; 6use critical_section::CriticalSection;
7use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
8use embassy_sync::blocking_mutex::Mutex; 7use embassy_sync::blocking_mutex::Mutex;
8use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
9use embassy_time_driver::Driver; 9use embassy_time_driver::Driver;
10use embassy_time_queue_utils::Queue; 10use embassy_time_queue_utils::Queue;
11 11
diff --git a/embassy-mspm0/CHANGELOG.md b/embassy-mspm0/CHANGELOG.md
index b846f21b1..fcb0f9dbd 100644
--- a/embassy-mspm0/CHANGELOG.md
+++ b/embassy-mspm0/CHANGELOG.md
@@ -13,3 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13- feat: Add window watchdog implementation based on WWDT0, WWDT1 peripherals (#4574) 13- feat: Add window watchdog implementation based on WWDT0, WWDT1 peripherals (#4574)
14- feat: Add MSPM0C1105/C1106 support 14- feat: Add MSPM0C1105/C1106 support
15- feat: Add adc implementation (#4646) 15- feat: Add adc implementation (#4646)
16- fix: gpio OutputOpenDrain config (#4735)
17- fix: add MSPM0C1106 to build test matrix
18- feat: add MSPM0H3216 support
19- feat: Add i2c target implementation (#4605)
diff --git a/embassy-mspm0/Cargo.toml b/embassy-mspm0/Cargo.toml
index 1b32c4d43..df6176ff6 100644
--- a/embassy-mspm0/Cargo.toml
+++ b/embassy-mspm0/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-mspm0" 2name = "embassy-mspm0"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for Texas Instruments MSPM0 series microcontrollers" 6description = "Embassy Hardware Abstraction Layer (HAL) for Texas Instruments MSPM0 series microcontrollers"
7keywords = ["embedded", "async", "mspm0", "hal", "embedded-hal"] 7keywords = ["embedded", "async", "mspm0", "hal", "embedded-hal"]
@@ -15,17 +15,19 @@ publish = false
15[package.metadata.embassy] 15[package.metadata.embassy]
16build = [ 16build = [
17 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0c1104dgs20", "time-driver-any"]}, 17 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0c1104dgs20", "time-driver-any"]},
18 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0c1106rgz", "time-driver-any"]},
19 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g1107ycj", "time-driver-any"]},
20 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g1505pt", "time-driver-any"]},
21 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g1519rhb", "time-driver-any"]},
22 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g3105rhb", "time-driver-any"]},
18 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g3507pm", "time-driver-any"]}, 23 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g3507pm", "time-driver-any"]},
19 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g3519pz", "time-driver-any"]}, 24 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g3519pz", "time-driver-any"]},
25 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0h3216pt", "time-driver-any"]},
20 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1306rhb", "time-driver-any"]}, 26 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1306rhb", "time-driver-any"]},
21 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l2228pn", "time-driver-any"]}, 27 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l2228pn", "time-driver-any"]},
22 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1345dgs28", "time-driver-any"]}, 28 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1345dgs28", "time-driver-any"]},
23 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1106dgs28", "time-driver-any"]}, 29 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1106dgs28", "time-driver-any"]},
24 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1228pm", "time-driver-any"]}, 30 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0l1228pt", "time-driver-any"]},
25 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g1107ycj", "time-driver-any"]},
26 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g3105rhb", "time-driver-any"]},
27 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g1505pt", "time-driver-any"]},
28 {target = "thumbv6m-none-eabi", features = ["defmt", "mspm0g1519rhb", "time-driver-any"]},
29] 31]
30 32
31[package.metadata.embassy_docs] 33[package.metadata.embassy_docs]
@@ -37,6 +39,7 @@ flavors = [
37 { regex_feature = "mspm0c.*", target = "thumbv6m-none-eabi" }, 39 { regex_feature = "mspm0c.*", target = "thumbv6m-none-eabi" },
38 { regex_feature = "mspm0l.*", target = "thumbv6m-none-eabi" }, 40 { regex_feature = "mspm0l.*", target = "thumbv6m-none-eabi" },
39 { regex_feature = "mspm0g.*", target = "thumbv6m-none-eabi" }, 41 { regex_feature = "mspm0g.*", target = "thumbv6m-none-eabi" },
42 { regex_feature = "mspm0h.*", target = "thumbv6m-none-eabi" },
40] 43]
41 44
42[package.metadata.docs.rs] 45[package.metadata.docs.rs]
@@ -69,7 +72,7 @@ cortex-m = "0.7.6"
69critical-section = "1.2.0" 72critical-section = "1.2.0"
70 73
71# mspm0-metapac = { version = "" } 74# mspm0-metapac = { version = "" }
72mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-d7bf3d01ac0780e716a45b0474234d39443dc5cf" } 75mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-e7de4103a0713772695ffcad52c3c2f07414dc29" }
73 76
74[build-dependencies] 77[build-dependencies]
75proc-macro2 = "1.0.94" 78proc-macro2 = "1.0.94"
@@ -77,7 +80,7 @@ quote = "1.0.40"
77cfg_aliases = "0.2.1" 80cfg_aliases = "0.2.1"
78 81
79# mspm0-metapac = { version = "", default-features = false, features = ["metadata"] } 82# mspm0-metapac = { version = "", default-features = false, features = ["metadata"] }
80mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-d7bf3d01ac0780e716a45b0474234d39443dc5cf", default-features = false, features = ["metadata"] } 83mspm0-metapac = { git = "https://github.com/mspm0-rs/mspm0-data-generated/", tag = "mspm0-data-e7de4103a0713772695ffcad52c3c2f07414dc29", default-features = false, features = ["metadata"] }
81 84
82[features] 85[features]
83default = ["rt"] 86default = ["rt"]
@@ -243,6 +246,7 @@ mspm0g3519pn = ["mspm0-metapac/mspm0g3519pn"]
243mspm0g3519pz = ["mspm0-metapac/mspm0g3519pz"] 246mspm0g3519pz = ["mspm0-metapac/mspm0g3519pz"]
244mspm0g3519rgz = ["mspm0-metapac/mspm0g3519rgz"] 247mspm0g3519rgz = ["mspm0-metapac/mspm0g3519rgz"]
245mspm0g3519rhb = ["mspm0-metapac/mspm0g3519rhb"] 248mspm0g3519rhb = ["mspm0-metapac/mspm0g3519rhb"]
249mspm0h3216pt = ["mspm0-metapac/mspm0h3216pt"]
246mspm0l1105dgs20 = ["mspm0-metapac/mspm0l1105dgs20"] 250mspm0l1105dgs20 = ["mspm0-metapac/mspm0l1105dgs20"]
247mspm0l1105dgs28 = ["mspm0-metapac/mspm0l1105dgs28"] 251mspm0l1105dgs28 = ["mspm0-metapac/mspm0l1105dgs28"]
248mspm0l1105dyy = ["mspm0-metapac/mspm0l1105dyy"] 252mspm0l1105dyy = ["mspm0-metapac/mspm0l1105dyy"]
diff --git a/embassy-mspm0/build.rs b/embassy-mspm0/build.rs
index d294bc422..1d118ad66 100644
--- a/embassy-mspm0/build.rs
+++ b/embassy-mspm0/build.rs
@@ -16,14 +16,15 @@ use quote::{format_ident, quote};
16mod common; 16mod common;
17 17
18fn main() { 18fn main() {
19 generate_code();
20 interrupt_group_linker_magic();
21}
22
23fn generate_code() {
24 let mut cfgs = common::CfgSet::new(); 19 let mut cfgs = common::CfgSet::new();
25 common::set_target_cfgs(&mut cfgs); 20 common::set_target_cfgs(&mut cfgs);
26 21
22 generate_code(&mut cfgs);
23 select_gpio_features(&mut cfgs);
24 interrupt_group_linker_magic();
25}
26
27fn generate_code(cfgs: &mut CfgSet) {
27 #[cfg(any(feature = "rt"))] 28 #[cfg(any(feature = "rt"))]
28 println!( 29 println!(
29 "cargo:rustc-link-search={}", 30 "cargo:rustc-link-search={}",
@@ -53,9 +54,9 @@ fn generate_code() {
53 cfgs.declare_all(&get_chip_cfgs(&chip)); 54 cfgs.declare_all(&get_chip_cfgs(&chip));
54 } 55 }
55 56
56 let mut singletons = get_singletons(&mut cfgs); 57 let mut singletons = get_singletons(cfgs);
57 58
58 time_driver(&mut singletons, &mut cfgs); 59 time_driver(&mut singletons, cfgs);
59 60
60 let mut g = TokenStream::new(); 61 let mut g = TokenStream::new();
61 62
@@ -68,7 +69,7 @@ fn generate_code() {
68 g.extend(generate_pin_trait_impls()); 69 g.extend(generate_pin_trait_impls());
69 g.extend(generate_groups()); 70 g.extend(generate_groups());
70 g.extend(generate_dma_channel_count()); 71 g.extend(generate_dma_channel_count());
71 g.extend(generate_adc_constants(&mut cfgs)); 72 g.extend(generate_adc_constants(cfgs));
72 73
73 let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); 74 let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
74 let out_file = out_dir.join("_generated.rs").to_string_lossy().to_string(); 75 let out_file = out_dir.join("_generated.rs").to_string_lossy().to_string();
@@ -115,6 +116,10 @@ fn get_chip_cfgs(chip_name: &str) -> Vec<String> {
115 cfgs.push("mspm0g351x".to_string()); 116 cfgs.push("mspm0g351x".to_string());
116 } 117 }
117 118
119 if chip_name.starts_with("mspm0h321") {
120 cfgs.push("mspm0h321x".to_string());
121 }
122
118 if chip_name.starts_with("mspm0l110") { 123 if chip_name.starts_with("mspm0l110") {
119 cfgs.push("mspm0l110x".to_string()); 124 cfgs.push("mspm0l110x".to_string());
120 } 125 }
@@ -208,7 +213,7 @@ fn generate_groups() -> TokenStream {
208 213
209 #[cfg(feature = "rt")] 214 #[cfg(feature = "rt")]
210 mod group_vectors { 215 mod group_vectors {
211 extern "Rust" { 216 unsafe extern "Rust" {
212 #(#group_vectors)* 217 #(#group_vectors)*
213 } 218 }
214 } 219 }
@@ -646,6 +651,35 @@ fn generate_pin_trait_impls() -> TokenStream {
646 } 651 }
647} 652}
648 653
654fn select_gpio_features(cfgs: &mut CfgSet) {
655 cfgs.declare_all(&[
656 "gpioa_interrupt",
657 "gpioa_group",
658 "gpiob_interrupt",
659 "gpiob_group",
660 "gpioc_group",
661 ]);
662
663 for interrupt in METADATA.interrupts.iter() {
664 match interrupt.name {
665 "GPIOA" => cfgs.enable("gpioa_interrupt"),
666 "GPIOB" => cfgs.enable("gpiob_interrupt"),
667 _ => (),
668 }
669 }
670
671 for group in METADATA.interrupt_groups.iter() {
672 for interrupt in group.interrupts {
673 match interrupt.name {
674 "GPIOA" => cfgs.enable("gpioa_group"),
675 "GPIOB" => cfgs.enable("gpiob_group"),
676 "GPIOC" => cfgs.enable("gpioc_group"),
677 _ => (),
678 }
679 }
680 }
681}
682
649/// rustfmt a given path. 683/// rustfmt a given path.
650/// Failures are logged to stderr and ignored. 684/// Failures are logged to stderr and ignored.
651fn rustfmt(path: impl AsRef<Path>) { 685fn rustfmt(path: impl AsRef<Path>) {
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;
4use core::marker::PhantomData; 4use core::marker::PhantomData;
5use core::task::Poll; 5use core::task::Poll;
6 6
7use embassy_hal_internal::{impl_peripheral, PeripheralType}; 7use embassy_hal_internal::{PeripheralType, impl_peripheral};
8use embassy_sync::waitqueue::AtomicWaker; 8use embassy_sync::waitqueue::AtomicWaker;
9 9
10use crate::interrupt::{Interrupt, InterruptExt}; 10use crate::interrupt::{Interrupt, InterruptExt};
11use crate::mode::{Async, Blocking, Mode}; 11use crate::mode::{Async, Blocking, Mode};
12use crate::pac::adc::{vals, Adc as Regs}; 12use crate::pac::adc::{Adc as Regs, vals};
13use crate::{interrupt, Peri}; 13use crate::{Peri, interrupt};
14 14
15/// Interrupt handler. 15/// Interrupt handler.
16pub struct InterruptHandler<T: Instance> { 16pub struct InterruptHandler<T: Instance> {
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 @@
5use core::future::Future; 5use core::future::Future;
6use core::mem; 6use core::mem;
7use core::pin::Pin; 7use core::pin::Pin;
8use core::sync::atomic::{compiler_fence, Ordering}; 8use core::sync::atomic::{Ordering, compiler_fence};
9use core::task::{Context, Poll}; 9use core::task::{Context, Poll};
10 10
11use critical_section::CriticalSection; 11use critical_section::CriticalSection;
12use embassy_hal_internal::interrupt::InterruptExt; 12use embassy_hal_internal::interrupt::InterruptExt;
13use embassy_hal_internal::{impl_peripheral, PeripheralType}; 13use embassy_hal_internal::{PeripheralType, impl_peripheral};
14use embassy_sync::waitqueue::AtomicWaker; 14use embassy_sync::waitqueue::AtomicWaker;
15use mspm0_metapac::common::{Reg, RW}; 15use mspm0_metapac::common::{RW, Reg};
16use mspm0_metapac::dma::regs; 16use mspm0_metapac::dma::regs;
17use mspm0_metapac::dma::vals::{self, Autoen, Em, Incr, Preirq, Wdth}; 17use mspm0_metapac::dma::vals::{self, Autoen, Em, Incr, Preirq, Wdth};
18 18
19use crate::{interrupt, pac, Peri}; 19use crate::{Peri, interrupt, pac};
20 20
21/// The burst size of a DMA transfer. 21/// The burst size of a DMA transfer.
22#[derive(Debug, Clone, Copy, PartialEq, Eq)] 22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs
index d5fd36dbf..d8eb42dc2 100644
--- a/embassy-mspm0/src/gpio.rs
+++ b/embassy-mspm0/src/gpio.rs
@@ -5,12 +5,12 @@ use core::future::Future;
5use core::pin::Pin as FuturePin; 5use core::pin::Pin as FuturePin;
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::pac::gpio::vals::*; 11use crate::pac::gpio::vals::*;
12use crate::pac::gpio::{self}; 12use crate::pac::gpio::{self};
13#[cfg(all(feature = "rt", any(mspm0c110x, mspm0c1105_c1106, mspm0l110x)))] 13#[cfg(all(feature = "rt", any(gpioa_interrupt, gpiob_interrupt)))]
14use crate::pac::interrupt; 14use crate::pac::interrupt;
15use crate::pac::{self}; 15use crate::pac::{self};
16 16
@@ -156,7 +156,12 @@ impl<'d> Flex<'d> {
156 w.set_pf(GPIO_PF); 156 w.set_pf(GPIO_PF);
157 w.set_hiz1(true); 157 w.set_hiz1(true);
158 w.set_pc(true); 158 w.set_pc(true);
159 w.set_inena(false); 159 w.set_inena(true);
160 });
161
162 // Enable output driver (DOE) - required for open-drain to drive low
163 self.pin.block().doeset31_0().write(|w| {
164 w.set_dio(self.pin.bit_index(), true);
160 }); 165 });
161 166
162 self.set_pull(Pull::None); 167 self.set_pull(Pull::None);
@@ -1105,16 +1110,21 @@ fn irq_handler(gpio: gpio::Gpio, wakers: &[AtomicWaker; 32]) {
1105 } 1110 }
1106} 1111}
1107 1112
1113#[cfg(all(gpioa_interrupt, gpioa_group))]
1114compile_error!("gpioa_interrupt and gpioa_group are mutually exclusive cfgs");
1115#[cfg(all(gpiob_interrupt, gpiob_group))]
1116compile_error!("gpiob_interrupt and gpiob_group are mutually exclusive cfgs");
1117
1108// C110x and L110x have a dedicated interrupts just for GPIOA. 1118// C110x and L110x have a dedicated interrupts just for GPIOA.
1109// 1119//
1110// These chips do not have a GROUP1 interrupt. 1120// These chips do not have a GROUP1 interrupt.
1111#[cfg(all(feature = "rt", any(mspm0c110x, mspm0c1105_c1106, mspm0l110x)))] 1121#[cfg(all(feature = "rt", gpioa_interrupt))]
1112#[interrupt] 1122#[interrupt]
1113fn GPIOA() { 1123fn GPIOA() {
1114 irq_handler(pac::GPIOA, &PORTA_WAKERS); 1124 irq_handler(pac::GPIOA, &PORTA_WAKERS);
1115} 1125}
1116 1126
1117#[cfg(all(feature = "rt", mspm0c1105_c1106))] 1127#[cfg(all(feature = "rt", gpiob_interrupt))]
1118#[interrupt] 1128#[interrupt]
1119fn GPIOB() { 1129fn GPIOB() {
1120 irq_handler(pac::GPIOB, &PORTB_WAKERS); 1130 irq_handler(pac::GPIOB, &PORTB_WAKERS);
@@ -1124,23 +1134,23 @@ fn GPIOB() {
1124// 1134//
1125// Defining these as no_mangle is required so that the linker will pick these over the default handler. 1135// Defining these as no_mangle is required so that the linker will pick these over the default handler.
1126 1136
1127#[cfg(all(feature = "rt", not(any(mspm0c110x, mspm0c1105_c1106, mspm0l110x))))] 1137#[cfg(all(feature = "rt", gpioa_group))]
1128#[no_mangle] 1138#[unsafe(no_mangle)]
1129#[allow(non_snake_case)] 1139#[allow(non_snake_case)]
1130fn GPIOA() { 1140fn GPIOA() {
1131 irq_handler(pac::GPIOA, &PORTA_WAKERS); 1141 irq_handler(pac::GPIOA, &PORTA_WAKERS);
1132} 1142}
1133 1143
1134#[cfg(all(feature = "rt", gpio_pb, not(mspm0c1105_c1106)))] 1144#[cfg(all(feature = "rt", gpiob_group))]
1135#[no_mangle] 1145#[unsafe(no_mangle)]
1136#[allow(non_snake_case)] 1146#[allow(non_snake_case)]
1137fn GPIOB() { 1147fn GPIOB() {
1138 irq_handler(pac::GPIOB, &PORTB_WAKERS); 1148 irq_handler(pac::GPIOB, &PORTB_WAKERS);
1139} 1149}
1140 1150
1141#[cfg(all(feature = "rt", gpio_pc))] 1151#[cfg(all(feature = "rt", gpioc_group))]
1142#[allow(non_snake_case)] 1152#[allow(non_snake_case)]
1143#[no_mangle] 1153#[unsafe(no_mangle)]
1144fn GPIOC() { 1154fn GPIOC() {
1145 irq_handler(pac::GPIOC, &PORTC_WAKERS); 1155 irq_handler(pac::GPIOC, &PORTC_WAKERS);
1146} 1156}
diff --git a/embassy-mspm0/src/i2c.rs b/embassy-mspm0/src/i2c.rs
index 1906e37ba..3067f4833 100644
--- a/embassy-mspm0/src/i2c.rs
+++ b/embassy-mspm0/src/i2c.rs
@@ -10,13 +10,13 @@ use embassy_hal_internal::PeripheralType;
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
11use mspm0_metapac::i2c; 11use mspm0_metapac::i2c;
12 12
13use crate::Peri;
13use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; 14use crate::gpio::{AnyPin, PfType, Pull, SealedPin};
14use crate::interrupt::typelevel::Binding; 15use crate::interrupt::typelevel::Binding;
15use crate::interrupt::{Interrupt, InterruptExt}; 16use crate::interrupt::{Interrupt, InterruptExt};
16use crate::mode::{Async, Blocking, Mode}; 17use crate::mode::{Async, Blocking, Mode};
17use crate::pac::i2c::{vals, I2c as Regs}; 18use crate::pac::i2c::{I2c as Regs, vals};
18use crate::pac::{self}; 19use crate::pac::{self};
19use crate::Peri;
20 20
21/// The clock source for the I2C. 21/// The clock source for the I2C.
22#[derive(Clone, Copy, PartialEq, Eq, Debug)] 22#[derive(Clone, Copy, PartialEq, Eq, Debug)]
@@ -56,7 +56,7 @@ pub enum ClockDiv {
56} 56}
57 57
58impl ClockDiv { 58impl ClockDiv {
59 fn into(self) -> vals::Ratio { 59 pub(crate) fn into(self) -> vals::Ratio {
60 match self { 60 match self {
61 Self::DivBy1 => vals::Ratio::DIV_BY_1, 61 Self::DivBy1 => vals::Ratio::DIV_BY_1,
62 Self::DivBy2 => vals::Ratio::DIV_BY_2, 62 Self::DivBy2 => vals::Ratio::DIV_BY_2,
@@ -133,6 +133,11 @@ pub enum ConfigError {
133 /// 133 ///
134 /// The clock soure is not enabled is SYSCTL. 134 /// The clock soure is not enabled is SYSCTL.
135 ClockSourceNotEnabled, 135 ClockSourceNotEnabled,
136
137 /// Invalid target address.
138 ///
139 /// The target address is not 7-bit.
140 InvalidTargetAddress,
136} 141}
137 142
138#[non_exhaustive] 143#[non_exhaustive]
@@ -140,7 +145,7 @@ pub enum ConfigError {
140/// Config 145/// Config
141pub struct Config { 146pub struct Config {
142 /// I2C clock source. 147 /// I2C clock source.
143 clock_source: ClockSel, 148 pub(crate) clock_source: ClockSel,
144 149
145 /// I2C clock divider. 150 /// I2C clock divider.
146 pub clock_div: ClockDiv, 151 pub clock_div: ClockDiv,
@@ -196,7 +201,7 @@ impl Config {
196 } 201 }
197 202
198 #[cfg(any(mspm0c110x, mspm0c1105_c1106))] 203 #[cfg(any(mspm0c110x, mspm0c1105_c1106))]
199 fn calculate_clock_source(&self) -> u32 { 204 pub(crate) fn calculate_clock_source(&self) -> u32 {
200 // Assume that BusClk has default value. 205 // Assume that BusClk has default value.
201 // TODO: calculate BusClk more precisely. 206 // TODO: calculate BusClk more precisely.
202 match self.clock_source { 207 match self.clock_source {
@@ -206,10 +211,10 @@ impl Config {
206 } 211 }
207 212
208 #[cfg(any( 213 #[cfg(any(
209 mspm0g110x, mspm0g150x, mspm0g151x, mspm0g310x, mspm0g350x, mspm0g351x, mspm0l110x, mspm0l122x, mspm0l130x, 214 mspm0g110x, mspm0g150x, mspm0g151x, mspm0g310x, mspm0g350x, mspm0g351x, mspm0h321x, mspm0l110x, mspm0l122x,
210 mspm0l134x, mspm0l222x 215 mspm0l130x, mspm0l134x, mspm0l222x
211 ))] 216 ))]
212 fn calculate_clock_source(&self) -> u32 { 217 pub(crate) fn calculate_clock_source(&self) -> u32 {
213 // Assume that BusClk has default value. 218 // Assume that BusClk has default value.
214 // TODO: calculate BusClk more precisely. 219 // TODO: calculate BusClk more precisely.
215 match self.clock_source { 220 match self.clock_source {
diff --git a/embassy-mspm0/src/i2c_target.rs b/embassy-mspm0/src/i2c_target.rs
new file mode 100644
index 000000000..86be91415
--- /dev/null
+++ b/embassy-mspm0/src/i2c_target.rs
@@ -0,0 +1,509 @@
1//! Inter-Integrated-Circuit (I2C) Target
2// The following code is modified from embassy-stm32 and embassy-rp
3// https://github.com/embassy-rs/embassy/tree/main/embassy-stm32
4// https://github.com/embassy-rs/embassy/tree/main/embassy-rp
5
6use core::future::poll_fn;
7use core::marker::PhantomData;
8use core::sync::atomic::Ordering;
9use core::task::Poll;
10
11use embassy_embedded_hal::SetConfig;
12use mspm0_metapac::i2c::vals::CpuIntIidxStat;
13
14use crate::gpio::{AnyPin, SealedPin};
15use crate::interrupt::InterruptExt;
16use crate::mode::{Async, Blocking, Mode};
17use crate::pac::{self, i2c::vals};
18use crate::{i2c, i2c_target, interrupt, Peri};
19// Re-use I2c controller types
20use crate::i2c::{ClockSel, ConfigError, Info, Instance, InterruptHandler, SclPin, SdaPin, State};
21
22#[non_exhaustive]
23#[derive(Clone, Copy, PartialEq, Eq, Debug)]
24/// Config
25pub struct Config {
26 /// 7-bit Target Address
27 pub target_addr: u8,
28
29 /// Control if the target should ack to and report general calls.
30 pub general_call: bool,
31}
32
33impl Default for Config {
34 fn default() -> Self {
35 Self {
36 target_addr: 0x48,
37 general_call: false,
38 }
39 }
40}
41
42/// I2C error
43#[derive(Debug, PartialEq, Eq, Clone, Copy)]
44#[cfg_attr(feature = "defmt", derive(defmt::Format))]
45#[non_exhaustive]
46pub enum Error {
47 /// User passed in a response buffer that was 0 length
48 InvalidResponseBufferLength,
49 /// The response buffer length was too short to contain the message
50 ///
51 /// The length parameter will always be the length of the buffer, and is
52 /// provided as a convenience for matching alongside `Command::Write`.
53 PartialWrite(usize),
54 /// The response buffer length was too short to contain the message
55 ///
56 /// The length parameter will always be the length of the buffer, and is
57 /// provided as a convenience for matching alongside `Command::GeneralCall`.
58 PartialGeneralCall(usize),
59}
60
61/// Received command from the controller.
62#[derive(Debug, Copy, Clone, Eq, PartialEq)]
63#[cfg_attr(feature = "defmt", derive(defmt::Format))]
64pub enum Command {
65 /// General Call Write: Controller sent the General Call address (0x00) followed by data.
66 /// Contains the number of bytes written by the controller.
67 GeneralCall(usize),
68 /// Read: Controller wants to read data from the target.
69 Read,
70 /// Write: Controller sent the target's address followed by data.
71 /// Contains the number of bytes written by the controller.
72 Write(usize),
73 /// Write followed by Read (Repeated Start): Controller wrote data, then issued a repeated
74 /// start and wants to read data. Contains the number of bytes written before the read.
75 WriteRead(usize),
76}
77
78/// Status after responding to a controller read request.
79#[derive(Debug, Copy, Clone, Eq, PartialEq)]
80#[cfg_attr(feature = "defmt", derive(defmt::Format))]
81pub enum ReadStatus {
82 /// Transaction completed successfully. The controller either NACKed the last byte
83 /// or sent a STOP condition.
84 Done,
85 /// Transaction incomplete, controller trying to read more bytes than were provided
86 NeedMoreBytes,
87 /// Transaction complete, but controller stopped reading bytes before we ran out
88 LeftoverBytes(u16),
89}
90
91/// I2C Target driver.
92// Use the same Instance, SclPin, SdaPin traits as the controller
93pub struct I2cTarget<'d, M: Mode> {
94 info: &'static Info,
95 state: &'static State,
96 scl: Option<Peri<'d, AnyPin>>,
97 sda: Option<Peri<'d, AnyPin>>,
98 config: i2c::Config,
99 target_config: i2c_target::Config,
100 _phantom: PhantomData<M>,
101}
102
103impl<'d> SetConfig for I2cTarget<'d, Async> {
104 type Config = (i2c::Config, i2c_target::Config);
105 type ConfigError = ConfigError;
106
107 fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
108 self.info.interrupt.disable();
109
110 if let Some(ref sda) = self.sda {
111 sda.update_pf(config.0.sda_pf());
112 }
113
114 if let Some(ref scl) = self.scl {
115 scl.update_pf(config.0.scl_pf());
116 }
117
118 self.config = config.0.clone();
119 self.target_config = config.1.clone();
120
121 self.reset()
122 }
123}
124
125impl<'d> SetConfig for I2cTarget<'d, Blocking> {
126 type Config = (i2c::Config, i2c_target::Config);
127 type ConfigError = ConfigError;
128
129 fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
130 if let Some(ref sda) = self.sda {
131 sda.update_pf(config.0.sda_pf());
132 }
133
134 if let Some(ref scl) = self.scl {
135 scl.update_pf(config.0.scl_pf());
136 }
137
138 self.config = config.0.clone();
139 self.target_config = config.1.clone();
140
141 self.reset()
142 }
143}
144
145impl<'d> I2cTarget<'d, Async> {
146 /// Create a new asynchronous I2C target driver using interrupts
147 /// The `config` reuses the i2c controller config to setup the clock while `target_config`
148 /// configures i2c target specific parameters.
149 pub fn new<T: Instance>(
150 peri: Peri<'d, T>,
151 scl: Peri<'d, impl SclPin<T>>,
152 sda: Peri<'d, impl SdaPin<T>>,
153 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
154 config: i2c::Config,
155 target_config: i2c_target::Config,
156 ) -> Result<Self, ConfigError> {
157 let mut this = Self::new_inner(
158 peri,
159 new_pin!(scl, config.scl_pf()),
160 new_pin!(sda, config.sda_pf()),
161 config,
162 target_config,
163 );
164 this.reset()?;
165 Ok(this)
166 }
167
168 /// Reset the i2c peripheral. If you cancel a respond_to_read, you may stall the bus.
169 /// You can recover the bus by calling this function, but doing so will almost certainly cause
170 /// an i/o error in the controller.
171 pub fn reset(&mut self) -> Result<(), ConfigError> {
172 self.init()?;
173 unsafe { self.info.interrupt.enable() };
174 Ok(())
175 }
176}
177
178impl<'d> I2cTarget<'d, Blocking> {
179 /// Create a new blocking I2C target driver.
180 /// The `config` reuses the i2c controller config to setup the clock while `target_config`
181 /// configures i2c target specific parameters.
182 pub fn new_blocking<T: Instance>(
183 peri: Peri<'d, T>,
184 scl: Peri<'d, impl SclPin<T>>,
185 sda: Peri<'d, impl SdaPin<T>>,
186 config: i2c::Config,
187 target_config: i2c_target::Config,
188 ) -> Result<Self, ConfigError> {
189 let mut this = Self::new_inner(
190 peri,
191 new_pin!(scl, config.scl_pf()),
192 new_pin!(sda, config.sda_pf()),
193 config,
194 target_config,
195 );
196 this.reset()?;
197 Ok(this)
198 }
199
200 /// Reset the i2c peripheral. If you cancel a respond_to_read, you may stall the bus.
201 /// You can recover the bus by calling this function, but doing so will almost certainly cause
202 /// an i/o error in the controller.
203 pub fn reset(&mut self) -> Result<(), ConfigError> {
204 self.init()?;
205 Ok(())
206 }
207}
208
209impl<'d, M: Mode> I2cTarget<'d, M> {
210 fn new_inner<T: Instance>(
211 _peri: Peri<'d, T>,
212 scl: Option<Peri<'d, AnyPin>>,
213 sda: Option<Peri<'d, AnyPin>>,
214 config: i2c::Config,
215 target_config: i2c_target::Config,
216 ) -> Self {
217 if let Some(ref scl) = scl {
218 let pincm = pac::IOMUX.pincm(scl._pin_cm() as usize);
219 pincm.modify(|w| {
220 w.set_hiz1(true);
221 });
222 }
223 if let Some(ref sda) = sda {
224 let pincm = pac::IOMUX.pincm(sda._pin_cm() as usize);
225 pincm.modify(|w| {
226 w.set_hiz1(true);
227 });
228 }
229
230 Self {
231 info: T::info(),
232 state: T::state(),
233 scl,
234 sda,
235 config,
236 target_config,
237 _phantom: PhantomData,
238 }
239 }
240
241 fn init(&mut self) -> Result<(), ConfigError> {
242 let mut config = self.config;
243 let target_config = self.target_config;
244 let regs = self.info.regs;
245
246 config.check_config()?;
247 // Target address must be 7-bit
248 if !(target_config.target_addr < 0x80) {
249 return Err(ConfigError::InvalidTargetAddress);
250 }
251
252 regs.target(0).tctr().modify(|w| {
253 w.set_active(false);
254 });
255
256 // Init power for I2C
257 regs.gprcm(0).rstctl().write(|w| {
258 w.set_resetstkyclr(true);
259 w.set_resetassert(true);
260 w.set_key(vals::ResetKey::KEY);
261 });
262
263 regs.gprcm(0).pwren().write(|w| {
264 w.set_enable(true);
265 w.set_key(vals::PwrenKey::KEY);
266 });
267
268 self.info.interrupt.disable();
269
270 // Init delay from the M0 examples by TI in CCStudio (16 cycles)
271 cortex_m::asm::delay(16);
272
273 // Select and configure the I2C clock using the CLKSEL and CLKDIV registers
274 regs.clksel().write(|w| match config.clock_source {
275 ClockSel::BusClk => {
276 w.set_mfclk_sel(false);
277 w.set_busclk_sel(true);
278 }
279 ClockSel::MfClk => {
280 w.set_mfclk_sel(true);
281 w.set_busclk_sel(false);
282 }
283 });
284 regs.clkdiv().write(|w| w.set_ratio(config.clock_div.into()));
285
286 // Configure at least one target address by writing the 7-bit address to I2Cx.SOAR register. The additional
287 // target address can be enabled and configured by using I2Cx.TOAR2 register.
288 regs.target(0).toar().modify(|w| {
289 w.set_oaren(true);
290 w.set_oar(target_config.target_addr as u16);
291 });
292
293 self.state
294 .clock
295 .store(config.calculate_clock_source(), Ordering::Relaxed);
296
297 regs.target(0).tctr().modify(|w| {
298 w.set_gencall(target_config.general_call);
299 w.set_tclkstretch(true);
300 // Disable target wakeup, follow TI example. (TI note: Workaround for errata I2C_ERR_04.)
301 w.set_twuen(false);
302 w.set_txempty_on_treq(true);
303 });
304
305 // Enable the I2C target mode by setting the ACTIVE bit in I2Cx.TCTR register.
306 regs.target(0).tctr().modify(|w| {
307 w.set_active(true);
308 });
309
310 Ok(())
311 }
312
313 #[inline(always)]
314 fn drain_fifo(&mut self, buffer: &mut [u8], offset: &mut usize) {
315 let regs = self.info.regs;
316
317 for b in &mut buffer[*offset..] {
318 if regs.target(0).tfifosr().read().rxfifocnt() == 0 {
319 break;
320 }
321
322 *b = regs.target(0).trxdata().read().value();
323 *offset += 1;
324 }
325 }
326
327 /// Blocking function to empty the tx fifo
328 ///
329 /// This function can be used to empty the transmit FIFO if data remains after handling a 'read' command (LeftoverBytes).
330 pub fn flush_tx_fifo(&mut self) {
331 self.info.regs.target(0).tfifoctl().modify(|w| {
332 w.set_txflush(true);
333 });
334 while self.info.regs.target(0).tfifosr().read().txfifocnt() as usize != self.info.fifo_size {}
335 self.info.regs.target(0).tfifoctl().modify(|w| {
336 w.set_txflush(false);
337 });
338 }
339}
340
341impl<'d> I2cTarget<'d, Async> {
342 /// Wait asynchronously for commands from an I2C controller.
343 /// `buffer` is provided in case controller does a 'write', 'write read', or 'general call' and is unused for 'read'.
344 pub async fn listen(&mut self, buffer: &mut [u8]) -> Result<Command, Error> {
345 let regs = self.info.regs;
346
347 let mut len = 0;
348
349 // Set the rx fifo interrupt to avoid a fifo overflow
350 regs.target(0).tfifoctl().modify(|r| {
351 r.set_rxtrig(vals::TfifoctlRxtrig::LEVEL_6);
352 });
353
354 self.wait_on(
355 |me| {
356 // Check if address matches the General Call address (0x00)
357 let is_gencall = regs.target(0).tsr().read().addrmatch() == 0;
358
359 if regs.target(0).tfifosr().read().rxfifocnt() > 0 {
360 me.drain_fifo(buffer, &mut len);
361 }
362
363 if buffer.len() == len && regs.target(0).tfifosr().read().rxfifocnt() > 0 {
364 if is_gencall {
365 return Poll::Ready(Err(Error::PartialGeneralCall(buffer.len())));
366 } else {
367 return Poll::Ready(Err(Error::PartialWrite(buffer.len())));
368 }
369 }
370
371 let iidx = regs.cpu_int(0).iidx().read().stat();
372 trace!("ls:{} len:{}", iidx as u8, len);
373 let result = match iidx {
374 CpuIntIidxStat::TTXEMPTY => match len {
375 0 => Poll::Ready(Ok(Command::Read)),
376 w => Poll::Ready(Ok(Command::WriteRead(w))),
377 },
378 CpuIntIidxStat::TSTOPFG => match (is_gencall, len) {
379 (_, 0) => Poll::Pending,
380 (true, w) => Poll::Ready(Ok(Command::GeneralCall(w))),
381 (false, w) => Poll::Ready(Ok(Command::Write(w))),
382 },
383 _ => Poll::Pending,
384 };
385 if !result.is_pending() {
386 regs.cpu_int(0).imask().write(|_| {});
387 }
388 result
389 },
390 |_me| {
391 regs.cpu_int(0).imask().write(|_| {});
392 regs.cpu_int(0).imask().modify(|w| {
393 w.set_tgencall(true);
394 w.set_trxfifotrg(true);
395 w.set_tstop(true);
396 w.set_ttxempty(true);
397 });
398 },
399 )
400 .await
401 }
402
403 /// Respond to an I2C controller 'read' command, asynchronously.
404 pub async fn respond_to_read(&mut self, buffer: &[u8]) -> Result<ReadStatus, Error> {
405 if buffer.is_empty() {
406 return Err(Error::InvalidResponseBufferLength);
407 }
408
409 let regs = self.info.regs;
410 let fifo_size = self.info.fifo_size;
411 let mut chunks = buffer.chunks(self.info.fifo_size);
412
413 self.wait_on(
414 |_me| {
415 if let Some(chunk) = chunks.next() {
416 for byte in chunk {
417 regs.target(0).ttxdata().write(|w| w.set_value(*byte));
418 }
419
420 return Poll::Pending;
421 }
422
423 let iidx = regs.cpu_int(0).iidx().read().stat();
424 let fifo_bytes = fifo_size - regs.target(0).tfifosr().read().txfifocnt() as usize;
425 trace!("rs:{}, fifo:{}", iidx as u8, fifo_bytes);
426
427 let result = match iidx {
428 CpuIntIidxStat::TTXEMPTY => Poll::Ready(Ok(ReadStatus::NeedMoreBytes)),
429 CpuIntIidxStat::TSTOPFG => match fifo_bytes {
430 0 => Poll::Ready(Ok(ReadStatus::Done)),
431 w => Poll::Ready(Ok(ReadStatus::LeftoverBytes(w as u16))),
432 },
433 _ => Poll::Pending,
434 };
435 if !result.is_pending() {
436 regs.cpu_int(0).imask().write(|_| {});
437 }
438 result
439 },
440 |_me| {
441 regs.cpu_int(0).imask().write(|_| {});
442 regs.cpu_int(0).imask().modify(|w| {
443 w.set_ttxempty(true);
444 w.set_tstop(true);
445 });
446 },
447 )
448 .await
449 }
450
451 /// Respond to reads with the fill byte until the controller stops asking
452 pub async fn respond_till_stop(&mut self, fill: u8) -> Result<(), Error> {
453 // The buffer size could be increased to reduce interrupt noise but has higher probability
454 // of LeftoverBytes
455 let buff = [fill];
456 loop {
457 match self.respond_to_read(&buff).await {
458 Ok(ReadStatus::NeedMoreBytes) => (),
459 Ok(_) => break Ok(()),
460 Err(e) => break Err(e),
461 }
462 }
463 }
464
465 /// Respond to a controller read, then fill any remaining read bytes with `fill`
466 pub async fn respond_and_fill(&mut self, buffer: &[u8], fill: u8) -> Result<ReadStatus, Error> {
467 let resp_stat = self.respond_to_read(buffer).await?;
468
469 if resp_stat == ReadStatus::NeedMoreBytes {
470 self.respond_till_stop(fill).await?;
471 Ok(ReadStatus::Done)
472 } else {
473 Ok(resp_stat)
474 }
475 }
476
477 /// Calls `f` to check if we are ready or not.
478 /// If not, `g` is called once(to eg enable the required interrupts).
479 /// The waker will always be registered prior to calling `f`.
480 #[inline(always)]
481 async fn wait_on<F, U, G>(&mut self, mut f: F, mut g: G) -> U
482 where
483 F: FnMut(&mut Self) -> Poll<U>,
484 G: FnMut(&mut Self),
485 {
486 poll_fn(|cx| {
487 // Register prior to checking the condition
488 self.state.waker.register(cx.waker());
489 let r = f(self);
490
491 if r.is_pending() {
492 g(self);
493 }
494
495 r
496 })
497 .await
498 }
499}
500
501impl<'d, M: Mode> Drop for I2cTarget<'d, M> {
502 fn drop(&mut self) {
503 // Ensure peripheral is disabled and pins are reset
504 self.info.regs.target(0).tctr().modify(|w| w.set_active(false));
505
506 self.scl.as_ref().map(|x| x.set_as_disconnected());
507 self.sda.as_ref().map(|x| x.set_as_disconnected());
508 }
509}
diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs
index 13f0ce662..7135dd9f0 100644
--- a/embassy-mspm0/src/lib.rs
+++ b/embassy-mspm0/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2// Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc 3// Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc
3#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))] 4#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))]
4#![cfg_attr( 5#![cfg_attr(
@@ -17,6 +18,7 @@ pub mod adc;
17pub mod dma; 18pub mod dma;
18pub mod gpio; 19pub mod gpio;
19pub mod i2c; 20pub mod i2c;
21pub mod i2c_target;
20pub mod timer; 22pub mod timer;
21pub mod uart; 23pub mod uart;
22pub mod wwdt; 24pub mod wwdt;
@@ -54,7 +56,7 @@ pub(crate) mod _generated {
54 56
55// Reexports 57// Reexports
56pub(crate) use _generated::gpio_pincm; 58pub(crate) use _generated::gpio_pincm;
57pub use _generated::{peripherals, Peripherals}; 59pub use _generated::{Peripherals, peripherals};
58pub use embassy_hal_internal::Peri; 60pub use embassy_hal_internal::Peri;
59#[cfg(feature = "unstable-pac")] 61#[cfg(feature = "unstable-pac")]
60pub use mspm0_metapac as pac; 62pub use mspm0_metapac as pac;
@@ -111,7 +113,7 @@ macro_rules! bind_interrupts {
111 113
112 $( 114 $(
113 #[allow(non_snake_case)] 115 #[allow(non_snake_case)]
114 #[no_mangle] 116 #[unsafe(no_mangle)]
115 $(#[cfg($cond_irq)])? 117 $(#[cfg($cond_irq)])?
116 unsafe extern "C" fn $irq() { 118 unsafe extern "C" fn $irq() {
117 unsafe { 119 unsafe {
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 @@
1use core::cell::{Cell, RefCell}; 1use core::cell::{Cell, RefCell};
2use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; 2use core::sync::atomic::{AtomicU32, Ordering, compiler_fence};
3use core::task::Waker; 3use core::task::Waker;
4 4
5use critical_section::{CriticalSection, Mutex}; 5use 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 @@
1use core::future::{poll_fn, Future}; 1use core::future::{Future, poll_fn};
2use core::marker::PhantomData; 2use core::marker::PhantomData;
3use core::slice; 3use core::slice;
4use core::sync::atomic::{AtomicU8, Ordering}; 4use core::sync::atomic::{AtomicU8, Ordering};
@@ -14,7 +14,7 @@ use crate::gpio::{AnyPin, SealedPin};
14use crate::interrupt::typelevel::Binding; 14use crate::interrupt::typelevel::Binding;
15use crate::pac::uart::Uart as Regs; 15use crate::pac::uart::Uart as Regs;
16use crate::uart::{Config, ConfigError, CtsPin, Error, Info, Instance, RtsPin, RxPin, State, TxPin}; 16use crate::uart::{Config, ConfigError, CtsPin, Error, Info, Instance, RtsPin, RxPin, State, TxPin};
17use crate::{interrupt, Peri}; 17use crate::{Peri, interrupt};
18 18
19/// Interrupt handler. 19/// Interrupt handler.
20pub struct BufferedInterruptHandler<T: Instance> { 20pub struct BufferedInterruptHandler<T: Instance> {
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 @@
3mod buffered; 3mod buffered;
4 4
5use core::marker::PhantomData; 5use core::marker::PhantomData;
6use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; 6use core::sync::atomic::{AtomicU32, Ordering, compiler_fence};
7 7
8pub use buffered::*; 8pub use buffered::*;
9use embassy_embedded_hal::SetConfig; 9use embassy_embedded_hal::SetConfig;
10use embassy_hal_internal::PeripheralType; 10use embassy_hal_internal::PeripheralType;
11 11
12use crate::Peri;
12use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; 13use crate::gpio::{AnyPin, PfType, Pull, SealedPin};
13use crate::interrupt::{Interrupt, InterruptExt}; 14use crate::interrupt::{Interrupt, InterruptExt};
14use crate::mode::{Blocking, Mode}; 15use crate::mode::{Blocking, Mode};
15use crate::pac::uart::{vals, Uart as Regs}; 16use crate::pac::uart::{Uart as Regs, vals};
16use crate::Peri;
17 17
18/// The clock source for the UART. 18/// The clock source for the UART.
19#[derive(Clone, Copy, PartialEq, Eq, Debug)] 19#[derive(Clone, Copy, PartialEq, Eq, Debug)]
@@ -931,8 +931,7 @@ fn set_baudrate_inner(regs: Regs, clock: u32, baudrate: u32) -> Result<(), Confi
931 let Some(min_clock) = baudrate.checked_mul(oversampling as u32) else { 931 let Some(min_clock) = baudrate.checked_mul(oversampling as u32) else {
932 trace!( 932 trace!(
933 "{}x oversampling would cause overflow for clock: {} Hz", 933 "{}x oversampling would cause overflow for clock: {} Hz",
934 oversampling, 934 oversampling, clock
935 clock
936 ); 935 );
937 continue; 936 continue;
938 }; 937 };
@@ -945,9 +944,7 @@ fn set_baudrate_inner(regs: Regs, clock: u32, baudrate: u32) -> Result<(), Confi
945 for &(div, div_value) in &DIVS { 944 for &(div, div_value) in &DIVS {
946 trace!( 945 trace!(
947 "Trying div: {}, oversampling {} for {} baud", 946 "Trying div: {}, oversampling {} for {} baud",
948 div, 947 div, oversampling, baudrate
949 oversampling,
950 baudrate
951 ); 948 );
952 949
953 let Some((ibrd, fbrd)) = calculate_brd(clock, div, baudrate, oversampling) else { 950 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 @@
6 6
7use embassy_hal_internal::PeripheralType; 7use embassy_hal_internal::PeripheralType;
8 8
9use crate::pac::wwdt::{vals, Wwdt as Regs};
10use crate::pac::{self};
11use crate::Peri; 9use crate::Peri;
10use crate::pac::wwdt::{Wwdt as Regs, vals};
11use crate::pac::{self};
12 12
13/// Possible watchdog timeout values. 13/// Possible watchdog timeout values.
14#[derive(Clone, Copy, PartialEq, Eq, Debug)] 14#[derive(Clone, Copy, PartialEq, Eq, Debug)]
diff --git a/embassy-net-adin1110/Cargo.toml b/embassy-net-adin1110/Cargo.toml
index 587c69eb7..a5655870f 100644
--- a/embassy-net-adin1110/Cargo.toml
+++ b/embassy-net-adin1110/Cargo.toml
@@ -5,7 +5,7 @@ description = "embassy-net driver for the ADIN1110 ethernet chip"
5keywords = ["embedded", "ADIN1110", "embassy-net", "embedded-hal-async", "ethernet"] 5keywords = ["embedded", "ADIN1110", "embassy-net", "embedded-hal-async", "ethernet"]
6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
7license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
8edition = "2021" 8edition = "2024"
9repository = "https://github.com/embassy-rs/embassy" 9repository = "https://github.com/embassy-rs/embassy"
10documentation = "https://docs.embassy.dev/embassy-net-adin1110" 10documentation = "https://docs.embassy.dev/embassy-net-adin1110"
11 11
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 {
23 23
24#[cfg(test)] 24#[cfg(test)]
25mod tests { 25mod tests {
26 use ::crc::{Crc, CRC_8_SMBUS}; 26 use ::crc::{CRC_8_SMBUS, Crc};
27 27
28 use super::crc8; 28 use super::crc8;
29 29
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;
17mod regs; 17mod regs;
18 18
19use ch::driver::LinkState; 19use ch::driver::LinkState;
20pub use crc32::ETH_FCS;
21use crc8::crc8; 20use crc8::crc8;
22use embassy_futures::select::{select, Either}; 21pub use crc32::ETH_FCS;
22use embassy_futures::select::{Either, select};
23use embassy_net_driver_channel as ch; 23use embassy_net_driver_channel as ch;
24use embassy_time::Timer; 24use embassy_time::Timer;
25use embedded_hal_1::digital::OutputPin; 25use embedded_hal_1::digital::OutputPin;
diff --git a/embassy-net-driver-channel/Cargo.toml b/embassy-net-driver-channel/Cargo.toml
index 1e40c2d87..116057d6e 100644
--- a/embassy-net-driver-channel/Cargo.toml
+++ b/embassy-net-driver-channel/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-net-driver-channel" 2name = "embassy-net-driver-channel"
3version = "0.3.2" 3version = "0.3.2"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "High-level channel-based driver for the `embassy-net` async TCP/IP network stack." 6description = "High-level channel-based driver for the `embassy-net` async TCP/IP network stack."
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
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};
11 11
12pub use embassy_net_driver as driver; 12pub use embassy_net_driver as driver;
13use embassy_net_driver::{Capabilities, LinkState}; 13use embassy_net_driver::{Capabilities, LinkState};
14use embassy_sync::blocking_mutex::raw::NoopRawMutex;
15use embassy_sync::blocking_mutex::Mutex; 14use embassy_sync::blocking_mutex::Mutex;
15use embassy_sync::blocking_mutex::raw::NoopRawMutex;
16use embassy_sync::waitqueue::WakerRegistration; 16use embassy_sync::waitqueue::WakerRegistration;
17use embassy_sync::zerocopy_channel; 17use embassy_sync::zerocopy_channel;
18 18
diff --git a/embassy-net-driver/Cargo.toml b/embassy-net-driver/Cargo.toml
index a36e412ad..948fb2667 100644
--- a/embassy-net-driver/Cargo.toml
+++ b/embassy-net-driver/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-net-driver" 2name = "embassy-net-driver"
3version = "0.2.0" 3version = "0.2.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Driver trait for the `embassy-net` async TCP/IP network stack." 6description = "Driver trait for the `embassy-net` async TCP/IP network stack."
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
diff --git a/embassy-net-driver/src/lib.rs b/embassy-net-driver/src/lib.rs
index 4c847718d..47babe34a 100644
--- a/embassy-net-driver/src/lib.rs
+++ b/embassy-net-driver/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2#![warn(missing_docs)] 3#![warn(missing_docs)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4 5
diff --git a/embassy-net-enc28j60/Cargo.toml b/embassy-net-enc28j60/Cargo.toml
index e7bad118b..7c3e05922 100644
--- a/embassy-net-enc28j60/Cargo.toml
+++ b/embassy-net-enc28j60/Cargo.toml
@@ -5,7 +5,7 @@ description = "embassy-net driver for the ENC28J60 ethernet chip"
5keywords = ["embedded", "enc28j60", "embassy-net", "embedded-hal-async", "ethernet"] 5keywords = ["embedded", "enc28j60", "embassy-net", "embedded-hal-async", "ethernet"]
6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
7license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
8edition = "2021" 8edition = "2024"
9repository = "https://github.com/embassy-rs/embassy" 9repository = "https://github.com/embassy-rs/embassy"
10documentation = "https://docs.embassy.dev/embassy-net-enc28j60" 10documentation = "https://docs.embassy.dev/embassy-net-enc28j60"
11 11
diff --git a/embassy-net-esp-hosted/Cargo.toml b/embassy-net-esp-hosted/Cargo.toml
index 149ff2bb2..f148f4762 100644
--- a/embassy-net-esp-hosted/Cargo.toml
+++ b/embassy-net-esp-hosted/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-net-esp-hosted" 2name = "embassy-net-esp-hosted"
3version = "0.2.1" 3version = "0.2.1"
4edition = "2021" 4edition = "2024"
5description = "embassy-net driver for ESP-Hosted" 5description = "embassy-net driver for ESP-Hosted"
6keywords = ["embedded", "esp-hosted", "embassy-net", "embedded-hal-async", "wifi"] 6keywords = ["embedded", "esp-hosted", "embassy-net", "embedded-hal-async", "wifi"]
7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
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 {
65 }; 65 };
66 $self.ioctl(&mut msg).await?; 66 $self.ioctl(&mut msg).await?;
67 #[allow(unused_mut)] 67 #[allow(unused_mut)]
68 let Some(proto::CtrlMsgPayload::$resp_variant(mut $resp)) = msg.payload 68 let Some(proto::CtrlMsgPayload::$resp_variant(mut $resp)) = msg.payload else {
69 else {
70 warn!("unexpected response variant"); 69 warn!("unexpected response variant");
71 return Err(Error::Internal); 70 return Err(Error::Internal);
72 }; 71 };
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 @@
1use core::cell::RefCell; 1use core::cell::RefCell;
2use core::future::{poll_fn, Future}; 2use core::future::{Future, poll_fn};
3use core::task::Poll; 3use core::task::Poll;
4 4
5use embassy_sync::waitqueue::WakerRegistration; 5use 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 @@
2#![doc = include_str!("../README.md")] 2#![doc = include_str!("../README.md")]
3#![warn(missing_docs)] 3#![warn(missing_docs)]
4 4
5use embassy_futures::select::{select4, Either4}; 5use embassy_futures::select::{Either4, select4};
6use embassy_net_driver_channel as ch; 6use embassy_net_driver_channel as ch;
7use embassy_net_driver_channel::driver::LinkState; 7use embassy_net_driver_channel::driver::LinkState;
8use embassy_time::{Duration, Instant, Timer}; 8use embassy_time::{Duration, Instant, Timer};
diff --git a/embassy-net-nrf91/Cargo.toml b/embassy-net-nrf91/Cargo.toml
index 35fbef3f6..ecb10246a 100644
--- a/embassy-net-nrf91/Cargo.toml
+++ b/embassy-net-nrf91/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-net-nrf91" 2name = "embassy-net-nrf91"
3version = "0.1.1" 3version = "0.1.1"
4edition = "2021" 4edition = "2024"
5description = "embassy-net driver for Nordic nRF91-series cellular modems" 5description = "embassy-net driver for Nordic nRF91-series cellular modems"
6keywords = ["embedded", "nrf91", "embassy-net", "cellular"] 6keywords = ["embedded", "nrf91", "embassy-net", "cellular"]
7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 7categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
diff --git a/embassy-net-nrf91/src/lib.rs b/embassy-net-nrf91/src/lib.rs
index 0bd9be0d9..dd4812aae 100644
--- a/embassy-net-nrf91/src/lib.rs
+++ b/embassy-net-nrf91/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2#![doc = include_str!("../README.md")] 3#![doc = include_str!("../README.md")]
3#![warn(missing_docs)] 4#![warn(missing_docs)]
4#![deny(unused_must_use)] 5#![deny(unused_must_use)]
@@ -9,12 +10,12 @@ mod fmt;
9pub mod context; 10pub mod context;
10 11
11use core::cell::RefCell; 12use core::cell::RefCell;
12use core::future::{poll_fn, Future}; 13use core::future::{Future, poll_fn};
13use core::marker::PhantomData; 14use core::marker::PhantomData;
14use core::mem::{self, MaybeUninit}; 15use core::mem::{self, MaybeUninit};
15use core::ptr::{self, addr_of, addr_of_mut, copy_nonoverlapping}; 16use core::ptr::{self, addr_of, addr_of_mut, copy_nonoverlapping};
16use core::slice; 17use core::slice;
17use core::sync::atomic::{compiler_fence, fence, Ordering}; 18use core::sync::atomic::{Ordering, compiler_fence, fence};
18use core::task::{Poll, Waker}; 19use core::task::{Poll, Waker};
19 20
20use cortex_m::peripheral::NVIC; 21use cortex_m::peripheral::NVIC;
@@ -139,9 +140,7 @@ async fn new_internal<'a>(
139 debug!("Setting IPC RAM as nonsecure..."); 140 debug!("Setting IPC RAM as nonsecure...");
140 trace!( 141 trace!(
141 " SPU_REGION_SIZE={}, shmem_ptr=0x{:08X}, shmem_len={}", 142 " SPU_REGION_SIZE={}, shmem_ptr=0x{:08X}, shmem_len={}",
142 SPU_REGION_SIZE, 143 SPU_REGION_SIZE, shmem_ptr as usize, shmem_len
143 shmem_ptr as usize,
144 shmem_len
145 ); 144 );
146 let region_start = (shmem_ptr as usize - 0x2000_0000) / SPU_REGION_SIZE; 145 let region_start = (shmem_ptr as usize - 0x2000_0000) / SPU_REGION_SIZE;
147 let region_end = region_start + shmem_len / SPU_REGION_SIZE; 146 let region_end = region_start + shmem_len / SPU_REGION_SIZE;
@@ -165,8 +164,7 @@ async fn new_internal<'a>(
165 }; 164 };
166 trace!( 165 trace!(
167 " Allocator: start=0x{:08X}, end=0x{:08X}", 166 " Allocator: start=0x{:08X}, end=0x{:08X}",
168 alloc.start as usize, 167 alloc.start as usize, alloc.end as usize
169 alloc.end as usize
170 ); 168 );
171 169
172 let cb: &mut ControlBlock = alloc.alloc().write(unsafe { mem::zeroed() }); 170 let cb: &mut ControlBlock = alloc.alloc().write(unsafe { mem::zeroed() });
diff --git a/embassy-net-ppp/Cargo.toml b/embassy-net-ppp/Cargo.toml
index 644f5b827..45ee2f6b5 100644
--- a/embassy-net-ppp/Cargo.toml
+++ b/embassy-net-ppp/Cargo.toml
@@ -5,7 +5,7 @@ description = "embassy-net driver for PPP over Serial"
5keywords = ["embedded", "ppp", "embassy-net", "embedded-hal-async", "async"] 5keywords = ["embedded", "ppp", "embassy-net", "embedded-hal-async", "async"]
6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
7license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
8edition = "2021" 8edition = "2024"
9repository = "https://github.com/embassy-rs/embassy" 9repository = "https://github.com/embassy-rs/embassy"
10documentation = "https://docs.embassy.dev/embassy-net-ppp" 10documentation = "https://docs.embassy.dev/embassy-net-ppp"
11 11
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;
8use core::convert::Infallible; 8use core::convert::Infallible;
9use core::mem::MaybeUninit; 9use core::mem::MaybeUninit;
10 10
11use embassy_futures::select::{select, Either}; 11use embassy_futures::select::{Either, select};
12use embassy_net_driver_channel as ch; 12use embassy_net_driver_channel as ch;
13use embassy_net_driver_channel::driver::LinkState; 13use embassy_net_driver_channel::driver::LinkState;
14use embedded_io_async::{BufRead, Write}; 14use embedded_io_async::{BufRead, Write};
diff --git a/embassy-net-tuntap/Cargo.toml b/embassy-net-tuntap/Cargo.toml
index 2cd0c0f7e..77668b445 100644
--- a/embassy-net-tuntap/Cargo.toml
+++ b/embassy-net-tuntap/Cargo.toml
@@ -5,7 +5,7 @@ description = "embassy-net driver for Linux TUN/TAP interfaces."
5keywords = ["embedded", "tuntap", "embassy-net", "ethernet", "async"] 5keywords = ["embedded", "tuntap", "embassy-net", "ethernet", "async"]
6categories = ["embedded", "hardware-support", "network-programming", "asynchronous"] 6categories = ["embedded", "hardware-support", "network-programming", "asynchronous"]
7license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
8edition = "2021" 8edition = "2024"
9repository = "https://github.com/embassy-rs/embassy" 9repository = "https://github.com/embassy-rs/embassy"
10documentation = "https://docs.embassy.dev/embassy-net-tuntap" 10documentation = "https://docs.embassy.dev/embassy-net-tuntap"
11 11
diff --git a/embassy-net-wiznet/Cargo.toml b/embassy-net-wiznet/Cargo.toml
index 6e6dccebd..069f46fc3 100644
--- a/embassy-net-wiznet/Cargo.toml
+++ b/embassy-net-wiznet/Cargo.toml
@@ -5,7 +5,7 @@ description = "embassy-net driver for WIZnet SPI Ethernet chips"
5keywords = ["embedded", "embassy-net", "embedded-hal-async", "ethernet", "async"] 5keywords = ["embedded", "embassy-net", "embedded-hal-async", "ethernet", "async"]
6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"] 6categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]
7license = "MIT OR Apache-2.0" 7license = "MIT OR Apache-2.0"
8edition = "2021" 8edition = "2024"
9repository = "https://github.com/embassy-rs/embassy" 9repository = "https://github.com/embassy-rs/embassy"
10documentation = "https://docs.embassy.dev/embassy-net-wiznet" 10documentation = "https://docs.embassy.dev/embassy-net-wiznet"
11 11
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 {
43 fn tx_addr(addr: u16) -> Self::Address; 43 fn tx_addr(addr: u16) -> Self::Address;
44 44
45 async fn bus_read<SPI: SpiDevice>(spi: &mut SPI, address: Self::Address, data: &mut [u8]) 45 async fn bus_read<SPI: SpiDevice>(spi: &mut SPI, address: Self::Address, data: &mut [u8])
46 -> Result<(), SPI::Error>; 46 -> Result<(), SPI::Error>;
47 async fn bus_write<SPI: SpiDevice>(spi: &mut SPI, address: Self::Address, data: &[u8]) -> Result<(), SPI::Error>; 47 async fn bus_write<SPI: SpiDevice>(spi: &mut SPI, address: Self::Address, data: &[u8]) -> Result<(), SPI::Error>;
48} 48}
49 49
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 @@
6pub mod chip; 6pub mod chip;
7mod device; 7mod device;
8 8
9use embassy_futures::select::{select3, Either3}; 9use embassy_futures::select::{Either3, select3};
10use embassy_net_driver_channel as ch; 10use embassy_net_driver_channel as ch;
11use embassy_net_driver_channel::driver::LinkState; 11use embassy_net_driver_channel::driver::LinkState;
12use embassy_time::{Duration, Ticker, Timer}; 12use embassy_time::{Duration, Ticker, Timer};
diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml
index 31ce7e9a6..4c8075c43 100644
--- a/embassy-net/Cargo.toml
+++ b/embassy-net/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-net" 2name = "embassy-net"
3version = "0.7.1" 3version = "0.7.1"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Async TCP/IP network stack for embedded systems" 6description = "Async TCP/IP network stack for embedded systems"
7repository = "https://github.com/embassy-rs/embassy" 7repository = "https://github.com/embassy-rs/embassy"
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 @@
1//! ICMP sockets. 1//! ICMP sockets.
2 2
3use core::future::{poll_fn, Future}; 3use core::future::{Future, poll_fn};
4use core::mem; 4use core::mem;
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs
index 3f0634849..a49955c96 100644
--- a/embassy-net/src/lib.rs
+++ b/embassy-net/src/lib.rs
@@ -1,5 +1,6 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![warn(missing_docs)] 4#![warn(missing_docs)]
4#![doc = include_str!("../README.md")] 5#![doc = include_str!("../README.md")]
5 6
@@ -26,7 +27,7 @@ mod time;
26pub mod udp; 27pub mod udp;
27 28
28use core::cell::RefCell; 29use core::cell::RefCell;
29use core::future::{poll_fn, Future}; 30use core::future::{Future, poll_fn};
30use core::mem::MaybeUninit; 31use core::mem::MaybeUninit;
31use core::pin::pin; 32use core::pin::pin;
32use core::task::{Context, Poll}; 33use 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 @@
1//! Raw sockets. 1//! Raw sockets.
2 2
3use core::future::{poll_fn, Future}; 3use core::future::{Future, poll_fn};
4use core::mem; 4use core::mem;
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
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 @@
8//! Incoming connections when no socket is listening are rejected. To accept many incoming 8//! Incoming connections when no socket is listening are rejected. To accept many incoming
9//! connections, create many sockets and put them all into listening mode. 9//! connections, create many sockets and put them all into listening mode.
10 10
11use core::future::{poll_fn, Future}; 11use core::future::{Future, poll_fn};
12use core::mem; 12use core::mem;
13use core::task::{Context, Poll}; 13use core::task::{Context, Poll};
14 14
@@ -18,8 +18,8 @@ use smoltcp::socket::tcp;
18pub use smoltcp::socket::tcp::State; 18pub use smoltcp::socket::tcp::State;
19use smoltcp::wire::{IpEndpoint, IpListenEndpoint}; 19use smoltcp::wire::{IpEndpoint, IpListenEndpoint};
20 20
21use crate::time::duration_to_smoltcp;
22use crate::Stack; 21use crate::Stack;
22use crate::time::duration_to_smoltcp;
23 23
24/// Error returned by TcpSocket read/write functions. 24/// Error returned by TcpSocket read/write functions.
25#[derive(PartialEq, Eq, Clone, Copy, Debug)] 25#[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 @@
1//! UDP sockets. 1//! UDP sockets.
2 2
3use core::future::{poll_fn, Future}; 3use core::future::{Future, poll_fn};
4use core::mem; 4use core::mem;
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
diff --git a/embassy-nrf/CHANGELOG.md b/embassy-nrf/CHANGELOG.md
index b3d4045fa..0280e2730 100644
--- a/embassy-nrf/CHANGELOG.md
+++ b/embassy-nrf/CHANGELOG.md
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8<!-- next-header --> 8<!-- next-header -->
9## Unreleased - ReleaseDate 9## Unreleased - ReleaseDate
10 10
11- added: Add basic RTC support for nRF54L
12- changed: apply trimming values from FICR.TRIMCNF on nrf53/54l
13- changed: do not panic on BufferedUarte overrun
14- added: allow direct access to the input pin of `gpiote::InputChannel`
15- bugfix: use DETECTMODE_SEC in GPIOTE in secure mode
16
11## 0.8.0 - 2025-09-30 17## 0.8.0 - 2025-09-30
12 18
13- changed: Remove `T: Instance` generic params in all drivers. 19- changed: Remove `T: Instance` generic params in all drivers.
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml
index 362fabcf7..28f137d5c 100644
--- a/embassy-nrf/Cargo.toml
+++ b/embassy-nrf/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-nrf" 2name = "embassy-nrf"
3version = "0.8.0" 3version = "0.8.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for nRF series microcontrollers" 6description = "Embassy Hardware Abstraction Layer (HAL) for nRF series microcontrollers"
7keywords = ["embedded", "async", "nordic", "nrf", "embedded-hal"] 7keywords = ["embedded", "async", "nordic", "nrf", "embedded-hal"]
@@ -80,6 +80,8 @@ unstable-pac = []
80gpiote = [] 80gpiote = []
81 81
82## Use RTC1 as the time driver for `embassy-time`, with a tick rate of 32.768khz 82## Use RTC1 as the time driver for `embassy-time`, with a tick rate of 32.768khz
83##
84## Note: For nRF54L, it's actually RTC30
83time-driver-rtc1 = ["_time-driver"] 85time-driver-rtc1 = ["_time-driver"]
84 86
85## Enable embassy-net 802.15.4 driver 87## Enable embassy-net 802.15.4 driver
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs
index 40c679190..b1eb5c81a 100644
--- a/embassy-nrf/src/buffered_uarte.rs
+++ b/embassy-nrf/src/buffered_uarte.rs
@@ -9,27 +9,27 @@
9//! Please also see [crate::uarte] to understand when [BufferedUarte] should be used. 9//! Please also see [crate::uarte] to understand when [BufferedUarte] should be used.
10 10
11use core::cmp::min; 11use core::cmp::min;
12use core::future::{poll_fn, Future}; 12use core::future::{Future, poll_fn};
13use core::marker::PhantomData; 13use core::marker::PhantomData;
14use core::slice; 14use core::slice;
15use core::sync::atomic::{compiler_fence, AtomicBool, AtomicU8, AtomicUsize, Ordering}; 15use core::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering, compiler_fence};
16use core::task::Poll; 16use core::task::Poll;
17 17
18use embassy_hal_internal::atomic_ring_buffer::RingBuffer;
19use embassy_hal_internal::Peri; 18use embassy_hal_internal::Peri;
19use embassy_hal_internal::atomic_ring_buffer::RingBuffer;
20use pac::uarte::vals; 20use pac::uarte::vals;
21// Re-export SVD variants to allow user to directly set values 21// Re-export SVD variants to allow user to directly set values
22pub use pac::uarte::vals::{Baudrate, ConfigParity as Parity}; 22pub use pac::uarte::vals::{Baudrate, ConfigParity as Parity};
23 23
24use crate::gpio::{AnyPin, Pin as GpioPin}; 24use crate::gpio::{AnyPin, Pin as GpioPin};
25use crate::interrupt::typelevel::Interrupt;
26use crate::interrupt::InterruptExt; 25use crate::interrupt::InterruptExt;
26use crate::interrupt::typelevel::Interrupt;
27use crate::ppi::{ 27use crate::ppi::{
28 self, AnyConfigurableChannel, AnyGroup, Channel, ConfigurableChannel, Event, Group, Ppi, PpiGroup, Task, 28 self, AnyConfigurableChannel, AnyGroup, Channel, ConfigurableChannel, Event, Group, Ppi, PpiGroup, Task,
29}; 29};
30use crate::timer::{Instance as TimerInstance, Timer}; 30use crate::timer::{Instance as TimerInstance, Timer};
31use crate::uarte::{configure, configure_rx_pins, configure_tx_pins, drop_tx_rx, Config, Instance as UarteInstance}; 31use crate::uarte::{Config, Instance as UarteInstance, configure, configure_rx_pins, configure_tx_pins, drop_tx_rx};
32use crate::{interrupt, pac, EASY_DMA_SIZE}; 32use crate::{EASY_DMA_SIZE, interrupt, pac};
33 33
34pub(crate) struct State { 34pub(crate) struct State {
35 tx_buf: RingBuffer, 35 tx_buf: RingBuffer,
@@ -40,6 +40,7 @@ pub(crate) struct State {
40 rx_started_count: AtomicU8, 40 rx_started_count: AtomicU8,
41 rx_ended_count: AtomicU8, 41 rx_ended_count: AtomicU8,
42 rx_ppi_ch: AtomicU8, 42 rx_ppi_ch: AtomicU8,
43 rx_overrun: AtomicBool,
43} 44}
44 45
45/// UART error. 46/// UART error.
@@ -47,7 +48,8 @@ pub(crate) struct State {
47#[cfg_attr(feature = "defmt", derive(defmt::Format))] 48#[cfg_attr(feature = "defmt", derive(defmt::Format))]
48#[non_exhaustive] 49#[non_exhaustive]
49pub enum Error { 50pub enum Error {
50 // No errors for now 51 /// Buffer Overrun
52 Overrun,
51} 53}
52 54
53impl State { 55impl State {
@@ -61,6 +63,7 @@ impl State {
61 rx_started_count: AtomicU8::new(0), 63 rx_started_count: AtomicU8::new(0),
62 rx_ended_count: AtomicU8::new(0), 64 rx_ended_count: AtomicU8::new(0),
63 rx_ppi_ch: AtomicU8::new(0), 65 rx_ppi_ch: AtomicU8::new(0),
66 rx_overrun: AtomicBool::new(false),
64 } 67 }
65 } 68 }
66} 69}
@@ -87,7 +90,8 @@ impl<U: UarteInstance> interrupt::typelevel::Handler<U::Interrupt> for Interrupt
87 r.errorsrc().write_value(errs); 90 r.errorsrc().write_value(errs);
88 91
89 if errs.overrun() { 92 if errs.overrun() {
90 panic!("BufferedUarte overrun"); 93 s.rx_overrun.store(true, Ordering::Release);
94 ss.rx_waker.wake();
91 } 95 }
92 } 96 }
93 97
@@ -689,6 +693,7 @@ impl<'d> BufferedUarteRx<'d> {
689 buffered_state.rx_started_count.store(0, Ordering::Relaxed); 693 buffered_state.rx_started_count.store(0, Ordering::Relaxed);
690 buffered_state.rx_ended_count.store(0, Ordering::Relaxed); 694 buffered_state.rx_ended_count.store(0, Ordering::Relaxed);
691 buffered_state.rx_started.store(false, Ordering::Relaxed); 695 buffered_state.rx_started.store(false, Ordering::Relaxed);
696 buffered_state.rx_overrun.store(false, Ordering::Relaxed);
692 let rx_len = rx_buffer.len().min(EASY_DMA_SIZE * 2); 697 let rx_len = rx_buffer.len().min(EASY_DMA_SIZE * 2);
693 unsafe { buffered_state.rx_buf.init(rx_buffer.as_mut_ptr(), rx_len) }; 698 unsafe { buffered_state.rx_buf.init(rx_buffer.as_mut_ptr(), rx_len) };
694 699
@@ -762,6 +767,10 @@ impl<'d> BufferedUarteRx<'d> {
762 compiler_fence(Ordering::SeqCst); 767 compiler_fence(Ordering::SeqCst);
763 //trace!("poll_read"); 768 //trace!("poll_read");
764 769
770 if s.rx_overrun.swap(false, Ordering::Acquire) {
771 return Poll::Ready(Err(Error::Overrun));
772 }
773
765 // Read the RXDRDY counter. 774 // Read the RXDRDY counter.
766 timer.cc(0).capture(); 775 timer.cc(0).capture();
767 let mut end = timer.cc(0).read() as usize; 776 let mut end = timer.cc(0).read() as usize;
@@ -820,6 +829,9 @@ impl<'d> BufferedUarteRx<'d> {
820 /// we are ready to read if there is data in the buffer 829 /// we are ready to read if there is data in the buffer
821 fn read_ready(&self) -> Result<bool, Error> { 830 fn read_ready(&self) -> Result<bool, Error> {
822 let state = self.buffered_state; 831 let state = self.buffered_state;
832 if state.rx_overrun.swap(false, Ordering::Acquire) {
833 return Err(Error::Overrun);
834 }
823 Ok(!state.rx_buf.is_empty()) 835 Ok(!state.rx_buf.is_empty())
824 } 836 }
825} 837}
@@ -854,7 +866,9 @@ mod _embedded_io {
854 866
855 impl embedded_io_async::Error for Error { 867 impl embedded_io_async::Error for Error {
856 fn kind(&self) -> embedded_io_async::ErrorKind { 868 fn kind(&self) -> embedded_io_async::ErrorKind {
857 match *self {} 869 match *self {
870 Error::Overrun => embedded_io_async::ErrorKind::OutOfMemory,
871 }
858 } 872 }
859 } 873 }
860 874
diff --git a/embassy-nrf/src/chips/nrf54l15_app.rs b/embassy-nrf/src/chips/nrf54l15_app.rs
index ff05bbec0..901c5e7fc 100644
--- a/embassy-nrf/src/chips/nrf54l15_app.rs
+++ b/embassy-nrf/src/chips/nrf54l15_app.rs
@@ -94,6 +94,7 @@ pub mod pac {
94 #[cfg(feature = "_s")] 94 #[cfg(feature = "_s")]
95 #[doc(no_inline)] 95 #[doc(no_inline)]
96 pub use nrf_pac::{ 96 pub use nrf_pac::{
97 FICR_NS as FICR,
97 SICR_S as SICR, 98 SICR_S as SICR,
98 ICACHEDATA_S as ICACHEDATA, 99 ICACHEDATA_S as ICACHEDATA,
99 ICACHEINFO_S as ICACHEINFO, 100 ICACHEINFO_S as ICACHEINFO,
@@ -248,6 +249,45 @@ embassy_hal_internal::peripherals! {
248 P2_09, 249 P2_09,
249 P2_10, 250 P2_10,
250 251
252 // RTC
253 RTC10,
254 RTC30,
255
256 // SERIAL
257 SERIAL00,
258 SERIAL20,
259 SERIAL21,
260 SERIAL22,
261 SERIAL30,
262
263 // SAADC
264 SAADC,
265
266 // RADIO
267 RADIO,
268
269 // TIMER
270 TIMER00,
271 TIMER10,
272 TIMER20,
273
274 // PPI BRIDGE
275 PPIB00,
276 PPIB01,
277 PPIB10,
278 PPIB11,
279 PPIB20,
280 PPIB21,
281 PPIB22,
282 PPIB30,
283
284 // GPIOTE
285 GPIOTE20,
286 GPIOTE30,
287
288 // CRACEN
289 CRACEN,
290
251 #[cfg(feature = "_s")] 291 #[cfg(feature = "_s")]
252 // RRAMC 292 // RRAMC
253 RRAMC, 293 RRAMC,
@@ -302,6 +342,9 @@ impl_pin!(P2_08, 2, 8);
302impl_pin!(P2_09, 2, 9); 342impl_pin!(P2_09, 2, 9);
303impl_pin!(P2_10, 2, 10); 343impl_pin!(P2_10, 2, 10);
304 344
345impl_rtc!(RTC10, RTC10, RTC10);
346impl_rtc!(RTC30, RTC30, RTC30);
347
305#[cfg(feature = "_ns")] 348#[cfg(feature = "_ns")]
306impl_wdt!(WDT, WDT31, WDT31, 0); 349impl_wdt!(WDT, WDT31, WDT31, 0);
307#[cfg(feature = "_s")] 350#[cfg(feature = "_s")]
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;
10use embassy_hal_internal::PeripheralType; 10use embassy_hal_internal::PeripheralType;
11 11
12use crate::ppi::{Event, Task}; 12use crate::ppi::{Event, Task};
13use crate::{interrupt, pac, Peri}; 13use crate::{Peri, interrupt, pac};
14 14
15/// An instance of the EGU. 15/// An instance of the EGU.
16pub struct Egu<'d> { 16pub 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 @@
1//! embassy-net IEEE 802.15.4 driver 1//! embassy-net IEEE 802.15.4 driver
2 2
3use embassy_futures::select::{select3, Either3}; 3use embassy_futures::select::{Either3, select3};
4use embassy_net_driver_channel::driver::LinkState; 4use embassy_net_driver_channel::driver::LinkState;
5use embassy_net_driver_channel::{self as ch}; 5use embassy_net_driver_channel::{self as ch};
6use embassy_time::{Duration, Ticker}; 6use embassy_time::{Duration, Ticker};
7 7
8use crate::radio::ieee802154::{Packet, Radio};
9use crate::radio::InterruptHandler; 8use crate::radio::InterruptHandler;
9use crate::radio::ieee802154::{Packet, Radio};
10use crate::{self as nrf, interrupt}; 10use crate::{self as nrf, interrupt};
11 11
12/// MTU for the nrf radio. 12/// 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;
5use core::hint::unreachable_unchecked; 5use core::hint::unreachable_unchecked;
6 6
7use cfg_if::cfg_if; 7use cfg_if::cfg_if;
8use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
9 9
10use crate::pac; 10use crate::pac;
11use crate::pac::common::{Reg, RW}; 11use crate::pac::common::{RW, Reg};
12use crate::pac::gpio; 12use crate::pac::gpio;
13use crate::pac::gpio::vals; 13use crate::pac::gpio::vals;
14#[cfg(not(feature = "_nrf51"))] 14#[cfg(not(feature = "_nrf51"))]
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs
index 43e43f0bf..3658657c0 100644
--- a/embassy-nrf/src/gpiote.rs
+++ b/embassy-nrf/src/gpiote.rs
@@ -1,10 +1,10 @@
1//! GPIO task/event (GPIOTE) driver. 1//! GPIO task/event (GPIOTE) driver.
2 2
3use core::convert::Infallible; 3use core::convert::Infallible;
4use core::future::{poll_fn, Future}; 4use core::future::{Future, poll_fn};
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
7use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 7use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
8use embassy_sync::waitqueue::AtomicWaker; 8use embassy_sync::waitqueue::AtomicWaker;
9 9
10use crate::gpio::{AnyPin, Flex, Input, Output, Pin as GpioPin, SealedPin as _}; 10use crate::gpio::{AnyPin, Flex, Input, Output, Pin as GpioPin, SealedPin as _};
@@ -77,6 +77,9 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) {
77 77
78 for &p in ports { 78 for &p in ports {
79 // Enable latched detection 79 // Enable latched detection
80 #[cfg(feature = "_s")]
81 p.detectmode_sec().write(|w| w.set_detectmode(Detectmode::LDETECT));
82 #[cfg(not(feature = "_s"))]
80 p.detectmode().write(|w| w.set_detectmode(Detectmode::LDETECT)); 83 p.detectmode().write(|w| w.set_detectmode(Detectmode::LDETECT));
81 // Clear latch 84 // Clear latch
82 p.latch().write(|w| w.0 = 0xFFFFFFFF) 85 p.latch().write(|w| w.0 = 0xFFFFFFFF)
@@ -259,6 +262,11 @@ impl<'d> InputChannel<'d> {
259 .await; 262 .await;
260 } 263 }
261 264
265 /// Get the associated input pin.
266 pub fn pin(&self) -> &Input<'_> {
267 &self.pin
268 }
269
262 /// Returns the IN event, for use with PPI. 270 /// Returns the IN event, for use with PPI.
263 pub fn event_in(&self) -> Event<'d> { 271 pub fn event_in(&self) -> Event<'d> {
264 let g = regs(); 272 let g = regs();
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;
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::mem::size_of; 7use core::mem::size_of;
8use core::ops::{Deref, DerefMut}; 8use core::ops::{Deref, DerefMut};
9use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; 9use core::sync::atomic::{AtomicBool, Ordering, compiler_fence};
10use core::task::Poll; 10use core::task::Poll;
11 11
12use embassy_hal_internal::drop::OnDrop; 12use embassy_hal_internal::drop::OnDrop;
@@ -17,7 +17,7 @@ use crate::gpio::{AnyPin, Pin as GpioPin, PselBits};
17use crate::interrupt::typelevel::Interrupt; 17use crate::interrupt::typelevel::Interrupt;
18use crate::pac::i2s::vals; 18use crate::pac::i2s::vals;
19use crate::util::slice_in_ram_or; 19use crate::util::slice_in_ram_or;
20use crate::{interrupt, pac, EASY_DMA_SIZE}; 20use crate::{EASY_DMA_SIZE, interrupt, pac};
21 21
22/// Type alias for `MultiBuffering` with 2 buffers. 22/// Type alias for `MultiBuffering` with 2 buffers.
23pub type DoubleBuffering<S, const NS: usize> = MultiBuffering<S, 2, NS>; 23pub type DoubleBuffering<S, const NS: usize> = MultiBuffering<S, 2, NS>;
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index 7c26a6184..705c77453 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -1,5 +1,6 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![cfg_attr( 4#![cfg_attr(
4 docsrs, 5 docsrs,
5 doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.embassy.dev/embassy-nrf'>browse the `embassy-nrf` documentation on the Embassy website</a> instead.</p><p>The documentation here on `docs.rs` is built for a single chip only (nRF52840 in particular), while on the Embassy website you can pick your exact chip from the top menu. Available peripherals and their APIs change depending on the chip.</p></div>\n\n" 6 doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.embassy.dev/embassy-nrf'>browse the `embassy-nrf` documentation on the Embassy website</a> instead.</p><p>The documentation here on `docs.rs` is built for a single chip only (nRF52840 in particular), while on the Embassy website you can pick your exact chip from the top menu. Available peripherals and their APIs change depending on the chip.</p></div>\n\n"
@@ -154,7 +155,6 @@ pub mod reset;
154#[cfg(not(feature = "_nrf54l"))] // TODO 155#[cfg(not(feature = "_nrf54l"))] // TODO
155#[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf91")))] 156#[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf91")))]
156pub mod rng; 157pub mod rng;
157#[cfg(not(feature = "_nrf54l"))] // TODO
158pub mod rtc; 158pub mod rtc;
159#[cfg(not(feature = "_nrf54l"))] // TODO 159#[cfg(not(feature = "_nrf54l"))] // TODO
160#[cfg(not(any(feature = "_nrf51", feature = "nrf52820", feature = "_nrf5340-net")))] 160#[cfg(not(any(feature = "_nrf51", feature = "nrf52820", feature = "_nrf5340-net")))]
@@ -252,7 +252,7 @@ macro_rules! bind_interrupts {
252 252
253 $( 253 $(
254 #[allow(non_snake_case)] 254 #[allow(non_snake_case)]
255 #[no_mangle] 255 #[unsafe(no_mangle)]
256 $(#[cfg($cond_irq)])? 256 $(#[cfg($cond_irq)])?
257 unsafe extern "C" fn $irq() { 257 unsafe extern "C" fn $irq() {
258 unsafe { 258 unsafe {
@@ -284,7 +284,7 @@ macro_rules! bind_interrupts {
284pub use chip::pac; 284pub use chip::pac;
285#[cfg(not(feature = "unstable-pac"))] 285#[cfg(not(feature = "unstable-pac"))]
286pub(crate) use chip::pac; 286pub(crate) use chip::pac;
287pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE}; 287pub use chip::{EASY_DMA_SIZE, Peripherals, peripherals};
288pub use embassy_hal_internal::{Peri, PeripheralType}; 288pub use embassy_hal_internal::{Peri, PeripheralType};
289 289
290pub use crate::chip::interrupt; 290pub use crate::chip::interrupt;
@@ -406,9 +406,10 @@ pub mod config {
406 /// Settings for the internal capacitors. 406 /// Settings for the internal capacitors.
407 #[cfg(feature = "nrf5340-app-s")] 407 #[cfg(feature = "nrf5340-app-s")]
408 pub struct InternalCapacitors { 408 pub struct InternalCapacitors {
409 /// Config for the internal capacitors on pins XC1 and XC2. 409 /// Config for the internal capacitors on pins XC1 and XC2. Pass `None` to not touch it.
410 pub hfxo: Option<HfxoCapacitance>, 410 pub hfxo: Option<HfxoCapacitance>,
411 /// Config for the internal capacitors between pins XL1 and XL2. 411 /// Config for the internal capacitors between pins XL1 and XL2. Pass `None` to not touch
412 /// it.
412 pub lfxo: Option<LfxoCapacitance>, 413 pub lfxo: Option<LfxoCapacitance>,
413 } 414 }
414 415
@@ -416,6 +417,8 @@ pub mod config {
416 #[cfg(feature = "nrf5340-app-s")] 417 #[cfg(feature = "nrf5340-app-s")]
417 #[derive(Copy, Clone)] 418 #[derive(Copy, Clone)]
418 pub enum HfxoCapacitance { 419 pub enum HfxoCapacitance {
420 /// Use external capacitors
421 External,
419 /// 7.0 pF 422 /// 7.0 pF
420 _7_0pF, 423 _7_0pF,
421 /// 7.5 pF 424 /// 7.5 pF
@@ -475,8 +478,9 @@ pub mod config {
475 #[cfg(feature = "nrf5340-app-s")] 478 #[cfg(feature = "nrf5340-app-s")]
476 impl HfxoCapacitance { 479 impl HfxoCapacitance {
477 /// The capacitance value times two. 480 /// The capacitance value times two.
478 pub(crate) const fn value2(self) -> i32 { 481 pub(crate) fn value2(self) -> i32 {
479 match self { 482 match self {
483 HfxoCapacitance::External => unreachable!(),
480 HfxoCapacitance::_7_0pF => 14, 484 HfxoCapacitance::_7_0pF => 14,
481 HfxoCapacitance::_7_5pF => 15, 485 HfxoCapacitance::_7_5pF => 15,
482 HfxoCapacitance::_8_0pF => 16, 486 HfxoCapacitance::_8_0pF => 16,
@@ -506,11 +510,17 @@ pub mod config {
506 HfxoCapacitance::_20_0pF => 40, 510 HfxoCapacitance::_20_0pF => 40,
507 } 511 }
508 } 512 }
513
514 pub(crate) fn external(self) -> bool {
515 matches!(self, Self::External)
516 }
509 } 517 }
510 518
511 /// Internal capacitance value for the LFXO. 519 /// Internal capacitance value for the LFXO.
512 #[cfg(feature = "nrf5340-app-s")] 520 #[cfg(feature = "nrf5340-app-s")]
513 pub enum LfxoCapacitance { 521 pub enum LfxoCapacitance {
522 /// Use external capacitors
523 External = 0,
514 /// 6 pF 524 /// 6 pF
515 _6pF = 1, 525 _6pF = 1,
516 /// 7 pF 526 /// 7 pF
@@ -523,6 +533,7 @@ pub mod config {
523 impl From<LfxoCapacitance> for super::pac::oscillators::vals::Intcap { 533 impl From<LfxoCapacitance> for super::pac::oscillators::vals::Intcap {
524 fn from(t: LfxoCapacitance) -> Self { 534 fn from(t: LfxoCapacitance) -> Self {
525 match t { 535 match t {
536 LfxoCapacitance::External => Self::EXTERNAL,
526 LfxoCapacitance::_6pF => Self::C6PF, 537 LfxoCapacitance::_6pF => Self::C6PF,
527 LfxoCapacitance::_7pF => Self::C7PF, 538 LfxoCapacitance::_7pF => Self::C7PF,
528 LfxoCapacitance::_9pF => Self::C9PF, 539 LfxoCapacitance::_9pF => Self::C9PF,
@@ -720,6 +731,29 @@ pub fn init(config: config::Config) -> Peripherals {
720 } 731 }
721 } 732 }
722 733
734 // Apply trimming values from the FICR.
735 #[cfg(any(
736 all(feature = "_nrf5340-app", feature = "_s"),
737 all(feature = "_nrf54l", feature = "_s"),
738 feature = "_nrf5340-net",
739 ))]
740 {
741 #[cfg(feature = "_nrf5340")]
742 let n = 32;
743 #[cfg(feature = "_nrf54l")]
744 let n = 64;
745 for i in 0..n {
746 let info = pac::FICR.trimcnf(i);
747 let addr = info.addr().read();
748 if addr == 0 || addr == 0xFFFF_FFFF {
749 break;
750 }
751 unsafe {
752 (addr as *mut u32).write_volatile(info.data().read());
753 }
754 }
755 }
756
723 // GLITCHDET is only accessible for secure code 757 // GLITCHDET is only accessible for secure code
724 #[cfg(all(feature = "_nrf54l", feature = "_s"))] 758 #[cfg(all(feature = "_nrf54l", feature = "_s"))]
725 { 759 {
@@ -953,17 +987,21 @@ pub fn init(config: config::Config) -> Peripherals {
953 #[cfg(feature = "nrf5340-app-s")] 987 #[cfg(feature = "nrf5340-app-s")]
954 { 988 {
955 if let Some(cap) = config.internal_capacitors.hfxo { 989 if let Some(cap) = config.internal_capacitors.hfxo {
956 let mut slope = pac::FICR.xosc32mtrim().read().slope() as i32; 990 if cap.external() {
957 let offset = pac::FICR.xosc32mtrim().read().offset() as i32; 991 pac::OSCILLATORS.xosc32mcaps().write(|w| w.set_enable(false));
958 // slope is a signed 5-bit integer 992 } else {
959 if slope >= 16 { 993 let mut slope = pac::FICR.xosc32mtrim().read().slope() as i32;
960 slope -= 32; 994 let offset = pac::FICR.xosc32mtrim().read().offset() as i32;
995 // slope is a signed 5-bit integer
996 if slope >= 16 {
997 slope -= 32;
998 }
999 let capvalue = (((slope + 56) * (cap.value2() - 14)) + ((offset - 8) << 4) + 32) >> 6;
1000 pac::OSCILLATORS.xosc32mcaps().write(|w| {
1001 w.set_capvalue(capvalue as u8);
1002 w.set_enable(true);
1003 });
961 } 1004 }
962 let capvalue = (((slope + 56) * (cap.value2() - 14)) + ((offset - 8) << 4) + 32) >> 6;
963 pac::OSCILLATORS.xosc32mcaps().write(|w| {
964 w.set_capvalue(capvalue as u8);
965 w.set_enable(true);
966 });
967 } 1005 }
968 if let Some(cap) = config.internal_capacitors.lfxo { 1006 if let Some(cap) = config.internal_capacitors.lfxo {
969 pac::OSCILLATORS.xosc32ki().intcap().write(|w| w.set_intcap(cap.into())); 1007 pac::OSCILLATORS.xosc32ki().intcap().write(|w| w.set_intcap(cap.into()));
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 @@
10#![macro_use] 10#![macro_use]
11 11
12use core::future::poll_fn; 12use core::future::poll_fn;
13use core::sync::atomic::{compiler_fence, Ordering}; 13use core::sync::atomic::{Ordering, compiler_fence};
14use core::task::Poll; 14use core::task::Poll;
15 15
16use embassy_sync::waitqueue::AtomicWaker; 16use embassy_sync::waitqueue::AtomicWaker;
17pub use vals::{Bitframesdd as SddPat, Discardmode as DiscardMode}; 17pub use vals::{Bitframesdd as SddPat, Discardmode as DiscardMode};
18 18
19use crate::interrupt::InterruptExt; 19use crate::interrupt::InterruptExt;
20use crate::pac::nfct::vals;
21use crate::pac::NFCT; 20use crate::pac::NFCT;
21use crate::pac::nfct::vals;
22use crate::peripherals::NFCT; 22use crate::peripherals::NFCT;
23use crate::util::slice_in_ram; 23use crate::util::slice_in_ram;
24use crate::{interrupt, pac, Peri}; 24use crate::{Peri, interrupt, pac};
25 25
26/// NFCID1 (aka UID) of different sizes. 26/// NFCID1 (aka UID) of different sizes.
27#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] 27#[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::{
8 8
9use crate::pac::nvmc::vals; 9use crate::pac::nvmc::vals;
10use crate::peripherals::NVMC; 10use crate::peripherals::NVMC;
11use crate::{pac, Peri}; 11use crate::{Peri, pac};
12 12
13#[cfg(not(feature = "_nrf5340-net"))] 13#[cfg(not(feature = "_nrf5340-net"))]
14/// Erase size of NVMC flash in bytes. 14/// 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 @@
4 4
5use core::future::poll_fn; 5use core::future::poll_fn;
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::sync::atomic::{compiler_fence, Ordering}; 7use core::sync::atomic::{Ordering, compiler_fence};
8use core::task::Poll; 8use core::task::Poll;
9 9
10use embassy_hal_internal::drop::OnDrop; 10use embassy_hal_internal::drop::OnDrop;
@@ -13,7 +13,7 @@ use embassy_sync::waitqueue::AtomicWaker;
13use fixed::types::I7F1; 13use fixed::types::I7F1;
14 14
15use crate::chip::EASY_DMA_SIZE; 15use crate::chip::EASY_DMA_SIZE;
16use crate::gpio::{AnyPin, Pin as GpioPin, SealedPin, DISCONNECTED}; 16use crate::gpio::{AnyPin, DISCONNECTED, Pin as GpioPin, SealedPin};
17use crate::interrupt::typelevel::Interrupt; 17use crate::interrupt::typelevel::Interrupt;
18use crate::pac::gpio::vals as gpiovals; 18use crate::pac::gpio::vals as gpiovals;
19use crate::pac::pdm::vals; 19use 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 @@
1use super::{Channel, ConfigurableChannel, Event, Ppi, Task}; 1use super::{Channel, ConfigurableChannel, Event, Ppi, Task};
2use crate::{pac, Peri}; 2use crate::{Peri, pac};
3 3
4const DPPI_ENABLE_BIT: u32 = 0x8000_0000; 4const DPPI_ENABLE_BIT: u32 = 0x8000_0000;
5const DPPI_CHANNEL_MASK: u32 = 0x0000_00FF; 5const 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 @@
18use core::marker::PhantomData; 18use core::marker::PhantomData;
19use core::ptr::NonNull; 19use core::ptr::NonNull;
20 20
21use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 21use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
22 22
23use crate::pac::common::{Reg, RW, W}; 23use crate::pac::common::{RW, Reg, W};
24use crate::peripherals; 24use crate::peripherals;
25 25
26#[cfg_attr(feature = "_dppi", path = "dppi.rs")] 26#[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 @@
1use super::{Channel, ConfigurableChannel, Event, Ppi, Task}; 1use super::{Channel, ConfigurableChannel, Event, Ppi, Task};
2use crate::{pac, Peri}; 2use crate::{Peri, pac};
3 3
4impl<'d> Task<'d> { 4impl<'d> Task<'d> {
5 fn reg_val(&self) -> u32 { 5 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 @@
2 2
3#![macro_use] 3#![macro_use]
4 4
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6 6
7use embassy_hal_internal::{Peri, PeripheralType}; 7use embassy_hal_internal::{Peri, PeripheralType};
8 8
9use crate::gpio::{convert_drive, AnyPin, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _, DISCONNECTED}; 9use crate::gpio::{AnyPin, DISCONNECTED, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _, convert_drive};
10use crate::pac::gpio::vals as gpiovals; 10use crate::pac::gpio::vals as gpiovals;
11use crate::pac::pwm::vals; 11use crate::pac::pwm::vals;
12use crate::ppi::{Event, Task}; 12use 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 @@
2 2
3#![macro_use] 3#![macro_use]
4 4
5use core::future::{poll_fn, Future}; 5use core::future::{Future, poll_fn};
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::ptr; 7use core::ptr;
8use core::task::Poll; 8use core::task::Poll;
diff --git a/embassy-nrf/src/radio/ieee802154.rs b/embassy-nrf/src/radio/ieee802154.rs
index 62af03a5a..54b463343 100644
--- a/embassy-nrf/src/radio/ieee802154.rs
+++ b/embassy-nrf/src/radio/ieee802154.rs
@@ -1,18 +1,18 @@
1//! IEEE 802.15.4 radio driver 1//! IEEE 802.15.4 radio driver
2 2
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::sync::atomic::{compiler_fence, Ordering}; 4use core::sync::atomic::{Ordering, compiler_fence};
5use core::task::Poll; 5use core::task::Poll;
6 6
7use embassy_hal_internal::drop::OnDrop; 7use embassy_hal_internal::drop::OnDrop;
8 8
9use super::{Error, InterruptHandler, TxPower}; 9use super::{Error, InterruptHandler, TxPower};
10use crate::Peri;
10use crate::interrupt::typelevel::Interrupt; 11use crate::interrupt::typelevel::Interrupt;
11use crate::interrupt::{self}; 12use crate::interrupt::{self};
12use crate::pac::radio::vals; 13use crate::pac::radio::vals;
13pub use crate::pac::radio::vals::State as RadioState; 14pub use crate::pac::radio::vals::State as RadioState;
14use crate::radio::Instance; 15use crate::radio::Instance;
15use crate::Peri;
16 16
17/// Default (IEEE compliant) Start of Frame Delimiter 17/// Default (IEEE compliant) Start of Frame Delimiter
18pub const DEFAULT_SFD: u8 = 0xA7; 18pub const DEFAULT_SFD: u8 = 0xA7;
@@ -52,6 +52,7 @@ impl<'d> Radio<'d> {
52 // Disable and enable to reset peripheral 52 // Disable and enable to reset peripheral
53 r.power().write(|w| w.set_power(false)); 53 r.power().write(|w| w.set_power(false));
54 r.power().write(|w| w.set_power(true)); 54 r.power().write(|w| w.set_power(true));
55 errata::post_power();
55 56
56 // Enable 802.15.4 mode 57 // Enable 802.15.4 mode
57 r.mode().write(|w| w.set_mode(vals::Mode::IEEE802154_250KBIT)); 58 r.mode().write(|w| w.set_mode(vals::Mode::IEEE802154_250KBIT));
@@ -541,3 +542,19 @@ fn dma_start_fence() {
541fn dma_end_fence() { 542fn dma_end_fence() {
542 compiler_fence(Ordering::Acquire); 543 compiler_fence(Ordering::Acquire);
543} 544}
545
546mod errata {
547 pub fn post_power() {
548 // Workaround for anomaly 158
549 #[cfg(feature = "_nrf5340-net")]
550 for i in 0..32 {
551 let info = crate::pac::FICR.trimcnf(i);
552 let addr = info.addr().read();
553 if addr & 0xFFFF_F000 == crate::pac::RADIO.as_ptr() as u32 {
554 unsafe {
555 (addr as *mut u32).write_volatile(info.data().read());
556 }
557 }
558 }
559 }
560}
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::{
7}; 7};
8 8
9use crate::peripherals::RRAMC; 9use crate::peripherals::RRAMC;
10use crate::{pac, Peri}; 10use crate::{Peri, pac};
11 11
12// 12//
13// Export Nvmc alias and page size for downstream compatibility 13// 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 @@
4 4
5use core::future::poll_fn; 5use core::future::poll_fn;
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::sync::atomic::{compiler_fence, Ordering}; 7use core::sync::atomic::{Ordering, compiler_fence};
8use core::task::Poll; 8use core::task::Poll;
9 9
10use embassy_hal_internal::drop::OnDrop; 10use embassy_hal_internal::drop::OnDrop;
11use embassy_hal_internal::{impl_peripheral, Peri}; 11use embassy_hal_internal::{Peri, impl_peripheral};
12use embassy_sync::waitqueue::AtomicWaker; 12use embassy_sync::waitqueue::AtomicWaker;
13pub(crate) use vals::Psel as InputChannel; 13pub(crate) use vals::Psel as InputChannel;
14 14
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;
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7#[cfg(feature = "_nrf52832_anomaly_109")] 7#[cfg(feature = "_nrf52832_anomaly_109")]
8use core::sync::atomic::AtomicU8; 8use core::sync::atomic::AtomicU8;
9use core::sync::atomic::{compiler_fence, Ordering}; 9use core::sync::atomic::{Ordering, compiler_fence};
10use core::task::Poll; 10use core::task::Poll;
11 11
12use embassy_embedded_hal::SetConfig; 12use embassy_embedded_hal::SetConfig;
13use embassy_hal_internal::{Peri, PeripheralType}; 13use embassy_hal_internal::{Peri, PeripheralType};
14use embassy_sync::waitqueue::AtomicWaker; 14use embassy_sync::waitqueue::AtomicWaker;
15pub use embedded_hal_02::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; 15pub use embedded_hal_02::spi::{MODE_0, MODE_1, MODE_2, MODE_3, Mode, Phase, Polarity};
16pub use pac::spim::vals::{Frequency, Order as BitOrder}; 16pub use pac::spim::vals::{Frequency, Order as BitOrder};
17 17
18use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; 18use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE};
19use crate::gpio::{self, convert_drive, AnyPin, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _}; 19use crate::gpio::{self, AnyPin, OutputDrive, Pin as GpioPin, PselBits, SealedPin as _, convert_drive};
20use crate::interrupt::typelevel::Interrupt; 20use crate::interrupt::typelevel::Interrupt;
21use crate::pac::gpio::vals as gpiovals; 21use crate::pac::gpio::vals as gpiovals;
22use crate::pac::spim::vals; 22use 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 @@
3#![macro_use] 3#![macro_use]
4use core::future::poll_fn; 4use core::future::poll_fn;
5use core::marker::PhantomData; 5use core::marker::PhantomData;
6use core::sync::atomic::{compiler_fence, Ordering}; 6use core::sync::atomic::{Ordering, compiler_fence};
7use core::task::Poll; 7use core::task::Poll;
8 8
9use embassy_embedded_hal::SetConfig; 9use embassy_embedded_hal::SetConfig;
10use embassy_hal_internal::{Peri, PeripheralType}; 10use embassy_hal_internal::{Peri, PeripheralType};
11use embassy_sync::waitqueue::AtomicWaker; 11use embassy_sync::waitqueue::AtomicWaker;
12pub use embedded_hal_02::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; 12pub use embedded_hal_02::spi::{MODE_0, MODE_1, MODE_2, MODE_3, Mode, Phase, Polarity};
13pub use pac::spis::vals::Order as BitOrder; 13pub use pac::spis::vals::Order as BitOrder;
14 14
15use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; 15use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE};
16use crate::gpio::{self, convert_drive, AnyPin, OutputDrive, Pin as GpioPin, SealedPin as _}; 16use crate::gpio::{self, AnyPin, OutputDrive, Pin as GpioPin, SealedPin as _, convert_drive};
17use crate::interrupt::typelevel::Interrupt; 17use crate::interrupt::typelevel::Interrupt;
18use crate::pac::gpio::vals as gpiovals; 18use crate::pac::gpio::vals as gpiovals;
19use crate::pac::spis::vals; 19use 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;
9 9
10use crate::interrupt::InterruptExt; 10use crate::interrupt::InterruptExt;
11use crate::peripherals::TEMP; 11use crate::peripherals::TEMP;
12use crate::{interrupt, pac, Peri}; 12use crate::{Peri, interrupt, pac};
13 13
14/// Interrupt handler. 14/// Interrupt handler.
15pub struct InterruptHandler { 15pub 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 @@
1use core::cell::{Cell, RefCell}; 1use core::cell::{Cell, RefCell};
2use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; 2use core::sync::atomic::{AtomicU32, Ordering, compiler_fence};
3 3
4use critical_section::CriticalSection; 4use critical_section::CriticalSection;
5use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
6use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex; 5use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex;
6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
7use embassy_time_driver::Driver; 7use embassy_time_driver::Driver;
8use embassy_time_queue_utils::Queue; 8use embassy_time_queue_utils::Queue;
9 9
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 @@
4 4
5use core::future::poll_fn; 5use core::future::poll_fn;
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::sync::atomic::compiler_fence;
8use core::sync::atomic::Ordering::SeqCst; 7use core::sync::atomic::Ordering::SeqCst;
8use core::sync::atomic::compiler_fence;
9use core::task::Poll; 9use core::task::Poll;
10 10
11use embassy_embedded_hal::SetConfig; 11use 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 @@
2 2
3#![macro_use] 3#![macro_use]
4 4
5use core::future::{poll_fn, Future}; 5use core::future::{Future, poll_fn};
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::sync::atomic::compiler_fence;
8use core::sync::atomic::Ordering::SeqCst; 7use core::sync::atomic::Ordering::SeqCst;
8use core::sync::atomic::compiler_fence;
9use core::task::Poll; 9use core::task::Poll;
10 10
11use embassy_hal_internal::{Peri, PeripheralType}; 11use 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 @@
15 15
16use core::future::poll_fn; 16use core::future::poll_fn;
17use core::marker::PhantomData; 17use core::marker::PhantomData;
18use core::sync::atomic::{compiler_fence, AtomicU8, Ordering}; 18use core::sync::atomic::{AtomicU8, Ordering, compiler_fence};
19use core::task::Poll; 19use core::task::Poll;
20 20
21use embassy_hal_internal::drop::OnDrop; 21use embassy_hal_internal::drop::OnDrop;
@@ -25,7 +25,7 @@ use embassy_sync::waitqueue::AtomicWaker;
25pub use pac::uarte::vals::{Baudrate, ConfigParity as Parity}; 25pub use pac::uarte::vals::{Baudrate, ConfigParity as Parity};
26 26
27use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; 27use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE};
28use crate::gpio::{self, AnyPin, Pin as GpioPin, PselBits, SealedPin as _, DISCONNECTED}; 28use crate::gpio::{self, AnyPin, DISCONNECTED, Pin as GpioPin, PselBits, SealedPin as _};
29use crate::interrupt::typelevel::Interrupt; 29use crate::interrupt::typelevel::Interrupt;
30use crate::pac::gpio::vals as gpiovals; 30use crate::pac::gpio::vals as gpiovals;
31use crate::pac::uarte::vals; 31use 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 @@
4 4
5pub mod vbus_detect; 5pub mod vbus_detect;
6 6
7use core::future::{poll_fn, Future}; 7use core::future::{Future, poll_fn};
8use core::marker::PhantomData; 8use core::marker::PhantomData;
9use core::mem::MaybeUninit; 9use core::mem::MaybeUninit;
10use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; 10use core::sync::atomic::{AtomicU32, Ordering, compiler_fence};
11use core::task::Poll; 11use core::task::Poll;
12 12
13use cortex_m::peripheral::NVIC; 13use cortex_m::peripheral::NVIC;
@@ -330,11 +330,7 @@ impl<'d, V: VbusDetect> driver::Bus for Bus<'d, V> {
330 let mut was_enabled = false; 330 let mut was_enabled = false;
331 regs.epinen().modify(|w| { 331 regs.epinen().modify(|w| {
332 was_enabled = (w.0 & mask) != 0; 332 was_enabled = (w.0 & mask) != 0;
333 if enabled { 333 if enabled { w.0 |= mask } else { w.0 &= !mask }
334 w.0 |= mask
335 } else {
336 w.0 &= !mask
337 }
338 }); 334 });
339 335
340 let ready_mask = In::mask(i); 336 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 @@
1//! Trait and implementations for performing VBUS detection. 1//! Trait and implementations for performing VBUS detection.
2 2
3use core::future::{poll_fn, Future}; 3use core::future::{Future, poll_fn};
4use core::sync::atomic::{AtomicBool, Ordering}; 4use core::sync::atomic::{AtomicBool, Ordering};
5use core::task::Poll; 5use core::task::Poll;
6 6
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<T>(slice: *const [T]) -> bool {
15 15
16/// Return an error if slice is not in RAM. Skips check if slice is zero-length. 16/// Return an error if slice is not in RAM. Skips check if slice is zero-length.
17pub(crate) fn slice_in_ram_or<T, E>(slice: *const [T], err: E) -> Result<(), E> { 17pub(crate) fn slice_in_ram_or<T, E>(slice: *const [T], err: E) -> Result<(), E> {
18 if slice_in_ram(slice) { 18 if slice_in_ram(slice) { Ok(()) } else { Err(err) }
19 Ok(())
20 } else {
21 Err(err)
22 }
23} 19}
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;
11 11
12use crate::pac::wdt::vals; 12use crate::pac::wdt::vals;
13pub use crate::pac::wdt::vals::{Halt as HaltConfig, Sleep as SleepConfig}; 13pub use crate::pac::wdt::vals::{Halt as HaltConfig, Sleep as SleepConfig};
14use crate::{interrupt, pac, peripherals, Peri}; 14use crate::{Peri, interrupt, pac, peripherals};
15 15
16const MIN_TICKS: u32 = 15; 16const MIN_TICKS: u32 = 15;
17 17
diff --git a/embassy-nxp/CHANGELOG.md b/embassy-nxp/CHANGELOG.md
index 0fb677cd8..ad8670854 100644
--- a/embassy-nxp/CHANGELOG.md
+++ b/embassy-nxp/CHANGELOG.md
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8<!-- next-header --> 8<!-- next-header -->
9## Unreleased - ReleaseDate 9## Unreleased - ReleaseDate
10- LPC55: Move ALT definitions for USART to TX/RX pin impls.
11- LPC55: Remove internal match_iocon macro
10- LPC55: DMA Controller and asynchronous version of USART 12- LPC55: DMA Controller and asynchronous version of USART
11- Moved NXP LPC55S69 from `lpc55-pac` to `nxp-pac` 13- Moved NXP LPC55S69 from `lpc55-pac` to `nxp-pac`
12- First release with changelog. 14- First release with changelog.
diff --git a/embassy-nxp/Cargo.toml b/embassy-nxp/Cargo.toml
index f3c828313..33f0f2dff 100644
--- a/embassy-nxp/Cargo.toml
+++ b/embassy-nxp/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-nxp" 2name = "embassy-nxp"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7publish = false 7publish = false
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 @@
1use core::cell::RefCell; 1use core::cell::RefCell;
2use core::future::Future; 2use core::future::Future;
3use core::pin::Pin; 3use core::pin::Pin;
4use core::sync::atomic::{compiler_fence, Ordering}; 4use core::sync::atomic::{Ordering, compiler_fence};
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
7use critical_section::Mutex; 7use critical_section::Mutex;
8use embassy_hal_internal::interrupt::InterruptExt; 8use embassy_hal_internal::interrupt::InterruptExt;
9use embassy_hal_internal::{impl_peripheral, PeripheralType}; 9use embassy_hal_internal::{PeripheralType, impl_peripheral};
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
11 11
12use crate::pac::{DMA0, SYSCON, *}; 12use crate::pac::{DMA0, SYSCON, *};
13use crate::{peripherals, Peri}; 13use crate::{Peri, peripherals};
14 14
15#[interrupt] 15#[interrupt]
16fn DMA0() { 16fn DMA0() {
diff --git a/embassy-nxp/src/gpio/lpc55.rs b/embassy-nxp/src/gpio/lpc55.rs
index 36ea99d21..6039d8ca8 100644
--- a/embassy-nxp/src/gpio/lpc55.rs
+++ b/embassy-nxp/src/gpio/lpc55.rs
@@ -1,8 +1,9 @@
1use embassy_hal_internal::{impl_peripheral, PeripheralType}; 1use embassy_hal_internal::{PeripheralType, impl_peripheral};
2 2
3use crate::pac::common::{RW, Reg};
3use crate::pac::iocon::vals::{PioDigimode, PioMode}; 4use crate::pac::iocon::vals::{PioDigimode, PioMode};
4use crate::pac::{GPIO, IOCON, SYSCON}; 5use crate::pac::{GPIO, IOCON, SYSCON, iocon};
5use crate::{peripherals, Peri}; 6use crate::{Peri, peripherals};
6 7
7pub(crate) fn init() { 8pub(crate) fn init() {
8 // Enable clocks for GPIO, PINT, and IOCON 9 // Enable clocks for GPIO, PINT, and IOCON
@@ -109,13 +110,7 @@ impl<'d> Input<'d> {
109 110
110 /// Set the pull configuration for the pin. To disable the pull, use [Pull::None]. 111 /// Set the pull configuration for the pin. To disable the pull, use [Pull::None].
111 pub fn set_pull(&mut self, pull: Pull) { 112 pub fn set_pull(&mut self, pull: Pull) {
112 match_iocon!(register, self.pin.pin_bank(), self.pin.pin_number(), { 113 self.pin.set_pull(pull);
113 register.modify(|w| match pull {
114 Pull::None => w.set_mode(PioMode::INACTIVE),
115 Pull::Up => w.set_mode(PioMode::PULL_UP),
116 Pull::Down => w.set_mode(PioMode::PULL_DOWN),
117 });
118 });
119 } 114 }
120 115
121 /// Get the current input level of the pin. 116 /// Get the current input level of the pin.
@@ -193,11 +188,20 @@ impl<'d> Flex<'d> {
193 1 << self.pin.pin_number() 188 1 << self.pin.pin_number()
194 } 189 }
195 190
191 /// Set the pull configuration for the pin. To disable the pull, use [Pull::None].
192 pub fn set_pull(&mut self, pull: Pull) {
193 self.pin.pio().modify(|w| match pull {
194 Pull::None => w.set_mode(PioMode::INACTIVE),
195 Pull::Up => w.set_mode(PioMode::PULL_UP),
196 Pull::Down => w.set_mode(PioMode::PULL_DOWN),
197 });
198 }
199
196 /// Set the pin to digital mode. This is required for using a pin as a GPIO pin. The default 200 /// Set the pin to digital mode. This is required for using a pin as a GPIO pin. The default
197 /// setting for pins is (usually) non-digital. 201 /// setting for pins is (usually) non-digital.
198 fn set_as_digital(&mut self) { 202 fn set_as_digital(&mut self) {
199 match_iocon!(register, self.pin_bank(), self.pin_number(), { 203 self.pin.pio().modify(|w| {
200 register.modify(|w| w.set_digimode(PioDigimode::DIGITAL)); 204 w.set_digimode(PioDigimode::DIGITAL);
201 }); 205 });
202 } 206 }
203 207
@@ -220,6 +224,14 @@ impl<'d> Flex<'d> {
220pub(crate) trait SealedPin: Sized { 224pub(crate) trait SealedPin: Sized {
221 fn pin_bank(&self) -> Bank; 225 fn pin_bank(&self) -> Bank;
222 fn pin_number(&self) -> u8; 226 fn pin_number(&self) -> u8;
227
228 #[inline]
229 fn pio(&self) -> Reg<iocon::regs::Pio, RW> {
230 match self.pin_bank() {
231 Bank::Bank0 => IOCON.pio0(self.pin_number() as usize),
232 Bank::Bank1 => IOCON.pio1(self.pin_number() as usize),
233 }
234 }
223} 235}
224 236
225/// Interface for a Pin that can be configured by an [Input] or [Output] driver, or converted to an 237/// Interface for a Pin that can be configured by an [Input] or [Output] driver, or converted to an
@@ -272,40 +284,6 @@ impl SealedPin for AnyPin {
272 } 284 }
273} 285}
274 286
275/// Match the pin bank and number of a pin to the corresponding IOCON register.
276///
277/// # Example
278/// ```
279/// use embassy_nxp::gpio::Bank;
280/// use embassy_nxp::pac_utils::{iocon_reg, match_iocon};
281///
282/// // Make pin PIO1_6 digital and set it to pull-down mode.
283/// match_iocon!(register, Bank::Bank1, 6, {
284/// register.modify(|w|{
285/// w.set_mode(PioMode::PULL_DOWN);
286/// w.set_digimode(PioDigimode::DIGITAL);
287///
288/// }
289/// });
290/// ```
291macro_rules! match_iocon {
292 ($register:ident, $pin_bank:expr, $pin_number:expr, $action:expr) => {
293 match $pin_bank {
294 Bank::Bank0 => {
295 let $register = IOCON.pio0($pin_number as usize);
296 $action;
297 }
298
299 Bank::Bank1 => {
300 let $register = IOCON.pio1($pin_number as usize);
301 $action;
302 }
303 }
304 };
305}
306
307pub(crate) use match_iocon;
308
309macro_rules! impl_pin { 287macro_rules! impl_pin {
310 ($name:ident, $bank:expr, $pin_num:expr) => { 288 ($name:ident, $bank:expr, $pin_num:expr) => {
311 impl Pin for peripherals::$name {} 289 impl Pin for peripherals::$name {}
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;
5use core::pin::Pin as FuturePin; 5use core::pin::Pin as FuturePin;
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10use nxp_pac::gpio::vals::Icr; 10use nxp_pac::gpio::vals::Icr;
11use nxp_pac::iomuxc::vals::Pus; 11use nxp_pac::iomuxc::vals::Pus;
12 12
13use crate::chip::{mux_address, pad_address}; 13use crate::chip::{mux_address, pad_address};
14use crate::pac::common::{Reg, RW}; 14use crate::pac::common::{RW, Reg};
15use crate::pac::gpio::Gpio; 15use crate::pac::gpio::Gpio;
16#[cfg(feature = "rt")] 16#[cfg(feature = "rt")]
17use crate::pac::interrupt; 17use crate::pac::interrupt;
diff --git a/embassy-nxp/src/lib.rs b/embassy-nxp/src/lib.rs
index f0f0afb6c..9576f02b1 100644
--- a/embassy-nxp/src/lib.rs
+++ b/embassy-nxp/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2 3
3// This mod MUST go first, so that the others see its macros. 4// This mod MUST go first, so that the others see its macros.
4pub(crate) mod fmt; 5pub(crate) mod fmt;
@@ -29,7 +30,7 @@ pub use chip::interrupt;
29pub use chip::pac; 30pub use chip::pac;
30#[cfg(not(feature = "unstable-pac"))] 31#[cfg(not(feature = "unstable-pac"))]
31pub(crate) use chip::pac; 32pub(crate) use chip::pac;
32pub use chip::{peripherals, Peripherals}; 33pub use chip::{Peripherals, peripherals};
33pub use embassy_hal_internal::{Peri, PeripheralType}; 34pub use embassy_hal_internal::{Peri, PeripheralType};
34 35
35/// Macro to bind interrupts to handlers. 36/// Macro to bind interrupts to handlers.
@@ -67,7 +68,7 @@ macro_rules! bind_interrupts {
67 68
68 $( 69 $(
69 #[allow(non_snake_case)] 70 #[allow(non_snake_case)]
70 #[no_mangle] 71 #[unsafe(no_mangle)]
71 $(#[cfg($cond_irq)])? 72 $(#[cfg($cond_irq)])?
72 unsafe extern "C" fn $irq() { 73 unsafe extern "C" fn $irq() {
73 unsafe { 74 unsafe {
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;
8use embassy_hal_internal::interrupt::InterruptExt; 8use embassy_hal_internal::interrupt::InterruptExt;
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::gpio::{self, AnyPin, Level, SealedPin};
12use crate::pac::{interrupt, INPUTMUX, PINT, SYSCON};
13use crate::Peri; 11use crate::Peri;
12use crate::gpio::{self, AnyPin, Level, SealedPin};
13use crate::pac::{INPUTMUX, PINT, SYSCON, interrupt};
14 14
15struct PinInterrupt { 15struct PinInterrupt {
16 assigned: bool, 16 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;
4use critical_section::CriticalSection; 4use critical_section::CriticalSection;
5use embassy_hal_internal::interrupt::{InterruptExt, Priority}; 5use embassy_hal_internal::interrupt::{InterruptExt, Priority};
6use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex; 6use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex;
7use embassy_time_driver::{time_driver_impl, Driver}; 7use embassy_time_driver::{Driver, time_driver_impl};
8use embassy_time_queue_utils::Queue; 8use embassy_time_queue_utils::Queue;
9 9
10use crate::pac::{interrupt, pmc, rtc, PMC, RTC, SYSCON}; 10use crate::pac::{PMC, RTC, SYSCON, interrupt, pmc, rtc};
11 11
12struct AlarmState { 12struct AlarmState {
13 timestamp: Cell<u64>, 13 timestamp: Cell<u64>,
diff --git a/embassy-nxp/src/usart/lpc55.rs b/embassy-nxp/src/usart/lpc55.rs
index 9034ed429..d54927b25 100644
--- a/embassy-nxp/src/usart/lpc55.rs
+++ b/embassy-nxp/src/usart/lpc55.rs
@@ -4,16 +4,16 @@ use core::marker::PhantomData;
4use core::sync::atomic::{AtomicBool, Ordering}; 4use core::sync::atomic::{AtomicBool, Ordering};
5use core::task::Poll; 5use core::task::Poll;
6 6
7use embassy_futures::select::{select, Either}; 7use embassy_futures::select::{Either, select};
8use embassy_hal_internal::interrupt::InterruptExt; 8use embassy_hal_internal::interrupt::InterruptExt;
9use embassy_hal_internal::{Peri, PeripheralType}; 9use embassy_hal_internal::{Peri, PeripheralType};
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
11use embedded_io::{self, ErrorKind}; 11use embedded_io::{self, ErrorKind};
12 12
13use crate::dma::{AnyChannel, Channel}; 13use crate::dma::{AnyChannel, Channel};
14use crate::gpio::{match_iocon, AnyPin, Bank, SealedPin}; 14use crate::gpio::{AnyPin, SealedPin};
15use crate::interrupt::typelevel::{Binding, Interrupt as _};
16use crate::interrupt::Interrupt; 15use crate::interrupt::Interrupt;
16use crate::interrupt::typelevel::{Binding, Interrupt as _};
17use crate::pac::flexcomm::Flexcomm as FlexcommReg; 17use crate::pac::flexcomm::Flexcomm as FlexcommReg;
18use crate::pac::iocon::vals::PioFunc; 18use crate::pac::iocon::vals::PioFunc;
19use crate::pac::usart::Usart as UsartReg; 19use crate::pac::usart::Usart as UsartReg;
@@ -146,7 +146,8 @@ impl<'d, M: Mode> UsartTx<'d, M> {
146 tx_dma: Peri<'d, impl Channel>, 146 tx_dma: Peri<'d, impl Channel>,
147 config: Config, 147 config: Config,
148 ) -> Self { 148 ) -> Self {
149 Usart::<M>::init::<T>(Some(tx.into()), None, config); 149 let tx_func = tx.pin_func();
150 Usart::<M>::init::<T>(Some((tx.into(), tx_func)), None, config);
150 Self::new_inner(T::info(), Some(tx_dma.into())) 151 Self::new_inner(T::info(), Some(tx_dma.into()))
151 } 152 }
152 153
@@ -179,7 +180,8 @@ impl<'d, M: Mode> UsartTx<'d, M> {
179 180
180impl<'d> UsartTx<'d, Blocking> { 181impl<'d> UsartTx<'d, Blocking> {
181 pub fn new_blocking<T: Instance>(_usart: Peri<'d, T>, tx: Peri<'d, impl TxPin<T>>, config: Config) -> Self { 182 pub fn new_blocking<T: Instance>(_usart: Peri<'d, T>, tx: Peri<'d, impl TxPin<T>>, config: Config) -> Self {
182 Usart::<Blocking>::init::<T>(Some(tx.into()), None, config); 183 let tx_func = tx.pin_func();
184 Usart::<Blocking>::init::<T>(Some((tx.into(), tx_func)), None, config);
183 Self::new_inner(T::info(), None) 185 Self::new_inner(T::info(), None)
184 } 186 }
185} 187}
@@ -208,7 +210,8 @@ impl<'d, M: Mode> UsartRx<'d, M> {
208 rx_dma: Peri<'d, impl Channel>, 210 rx_dma: Peri<'d, impl Channel>,
209 config: Config, 211 config: Config,
210 ) -> Self { 212 ) -> Self {
211 Usart::<M>::init::<T>(None, Some(rx.into()), config); 213 let rx_func = rx.pin_func();
214 Usart::<M>::init::<T>(None, Some((rx.into(), rx_func)), config);
212 Self::new_inner(T::info(), T::dma_state(), has_irq, Some(rx_dma.into())) 215 Self::new_inner(T::info(), T::dma_state(), has_irq, Some(rx_dma.into()))
213 } 216 }
214 217
@@ -280,7 +283,8 @@ impl<'d, M: Mode> UsartRx<'d, M> {
280 283
281impl<'d> UsartRx<'d, Blocking> { 284impl<'d> UsartRx<'d, Blocking> {
282 pub fn new_blocking<T: Instance>(_usart: Peri<'d, T>, rx: Peri<'d, impl RxPin<T>>, config: Config) -> Self { 285 pub fn new_blocking<T: Instance>(_usart: Peri<'d, T>, rx: Peri<'d, impl RxPin<T>>, config: Config) -> Self {
283 Usart::<Blocking>::init::<T>(None, Some(rx.into()), config); 286 let rx_func = rx.pin_func();
287 Usart::<Blocking>::init::<T>(None, Some((rx.into(), rx_func)), config);
284 Self::new_inner(T::info(), T::dma_state(), false, None) 288 Self::new_inner(T::info(), T::dma_state(), false, None)
285 } 289 }
286} 290}
@@ -405,7 +409,10 @@ impl<'d> Usart<'d, Blocking> {
405 rx: Peri<'d, impl RxPin<T>>, 409 rx: Peri<'d, impl RxPin<T>>,
406 config: Config, 410 config: Config,
407 ) -> Self { 411 ) -> Self {
408 Self::new_inner(usart, tx.into(), rx.into(), false, None, None, config) 412 let tx_func = tx.pin_func();
413 let rx_func = rx.pin_func();
414
415 Self::new_inner(usart, tx.into(), tx_func, rx.into(), rx_func, false, None, None, config)
409 } 416 }
410} 417}
411 418
@@ -419,10 +426,15 @@ impl<'d> Usart<'d, Async> {
419 rx_dma: Peri<'d, impl RxChannel<T>>, 426 rx_dma: Peri<'d, impl RxChannel<T>>,
420 config: Config, 427 config: Config,
421 ) -> Self { 428 ) -> Self {
429 let tx_func = tx.pin_func();
430 let rx_func = rx.pin_func();
431
422 Self::new_inner( 432 Self::new_inner(
423 uart, 433 uart,
424 tx.into(), 434 tx.into(),
435 tx_func,
425 rx.into(), 436 rx.into(),
437 rx_func,
426 true, 438 true,
427 Some(tx_dma.into()), 439 Some(tx_dma.into()),
428 Some(rx_dma.into()), 440 Some(rx_dma.into()),
@@ -435,20 +447,26 @@ impl<'d, M: Mode> Usart<'d, M> {
435 fn new_inner<T: Instance>( 447 fn new_inner<T: Instance>(
436 _usart: Peri<'d, T>, 448 _usart: Peri<'d, T>,
437 mut tx: Peri<'d, AnyPin>, 449 mut tx: Peri<'d, AnyPin>,
450 tx_func: PioFunc,
438 mut rx: Peri<'d, AnyPin>, 451 mut rx: Peri<'d, AnyPin>,
452 rx_func: PioFunc,
439 has_irq: bool, 453 has_irq: bool,
440 tx_dma: Option<Peri<'d, AnyChannel>>, 454 tx_dma: Option<Peri<'d, AnyChannel>>,
441 rx_dma: Option<Peri<'d, AnyChannel>>, 455 rx_dma: Option<Peri<'d, AnyChannel>>,
442 config: Config, 456 config: Config,
443 ) -> Self { 457 ) -> Self {
444 Self::init::<T>(Some(tx.reborrow()), Some(rx.reborrow()), config); 458 Self::init::<T>(Some((tx.reborrow(), tx_func)), Some((rx.reborrow(), rx_func)), config);
445 Self { 459 Self {
446 tx: UsartTx::new_inner(T::info(), tx_dma), 460 tx: UsartTx::new_inner(T::info(), tx_dma),
447 rx: UsartRx::new_inner(T::info(), T::dma_state(), has_irq, rx_dma), 461 rx: UsartRx::new_inner(T::info(), T::dma_state(), has_irq, rx_dma),
448 } 462 }
449 } 463 }
450 464
451 fn init<T: Instance>(tx: Option<Peri<'_, AnyPin>>, rx: Option<Peri<'_, AnyPin>>, config: Config) { 465 fn init<T: Instance>(
466 tx: Option<(Peri<'_, AnyPin>, PioFunc)>,
467 rx: Option<(Peri<'_, AnyPin>, PioFunc)>,
468 config: Config,
469 ) {
452 Self::configure_flexcomm(T::info().fc_reg, T::instance_number()); 470 Self::configure_flexcomm(T::info().fc_reg, T::instance_number());
453 Self::configure_clock::<T>(&config); 471 Self::configure_clock::<T>(&config);
454 Self::pin_config::<T>(tx, rx); 472 Self::pin_config::<T>(tx, rx);
@@ -553,31 +571,27 @@ impl<'d, M: Mode> Usart<'d, M> {
553 .modify(|w| w.set_brgval((brg_value - 1) as u16)); 571 .modify(|w| w.set_brgval((brg_value - 1) as u16));
554 } 572 }
555 573
556 fn pin_config<T: Instance>(tx: Option<Peri<'_, AnyPin>>, rx: Option<Peri<'_, AnyPin>>) { 574 fn pin_config<T: Instance>(tx: Option<(Peri<'_, AnyPin>, PioFunc)>, rx: Option<(Peri<'_, AnyPin>, PioFunc)>) {
557 if let Some(tx_pin) = tx { 575 if let Some((tx_pin, func)) = tx {
558 match_iocon!(register, tx_pin.pin_bank(), tx_pin.pin_number(), { 576 tx_pin.pio().modify(|w| {
559 register.modify(|w| { 577 w.set_func(func);
560 w.set_func(T::tx_pin_func()); 578 w.set_mode(iocon::vals::PioMode::INACTIVE);
561 w.set_mode(iocon::vals::PioMode::INACTIVE); 579 w.set_slew(iocon::vals::PioSlew::STANDARD);
562 w.set_slew(iocon::vals::PioSlew::STANDARD); 580 w.set_invert(false);
563 w.set_invert(false); 581 w.set_digimode(iocon::vals::PioDigimode::DIGITAL);
564 w.set_digimode(iocon::vals::PioDigimode::DIGITAL); 582 w.set_od(iocon::vals::PioOd::NORMAL);
565 w.set_od(iocon::vals::PioOd::NORMAL); 583 });
566 });
567 })
568 } 584 }
569 585
570 if let Some(rx_pin) = rx { 586 if let Some((rx_pin, func)) = rx {
571 match_iocon!(register, rx_pin.pin_bank(), rx_pin.pin_number(), { 587 rx_pin.pio().modify(|w| {
572 register.modify(|w| { 588 w.set_func(func);
573 w.set_func(T::rx_pin_func()); 589 w.set_mode(iocon::vals::PioMode::INACTIVE);
574 w.set_mode(iocon::vals::PioMode::INACTIVE); 590 w.set_slew(iocon::vals::PioSlew::STANDARD);
575 w.set_slew(iocon::vals::PioSlew::STANDARD); 591 w.set_invert(false);
576 w.set_invert(false); 592 w.set_digimode(iocon::vals::PioDigimode::DIGITAL);
577 w.set_digimode(iocon::vals::PioDigimode::DIGITAL); 593 w.set_od(iocon::vals::PioOd::NORMAL);
578 w.set_od(iocon::vals::PioOd::NORMAL); 594 });
579 });
580 })
581 }; 595 };
582 } 596 }
583 597
@@ -814,8 +828,6 @@ trait SealedInstance {
814 fn info() -> &'static Info; 828 fn info() -> &'static Info;
815 fn dma_state() -> &'static DmaState; 829 fn dma_state() -> &'static DmaState;
816 fn instance_number() -> usize; 830 fn instance_number() -> usize;
817 fn tx_pin_func() -> PioFunc;
818 fn rx_pin_func() -> PioFunc;
819} 831}
820 832
821/// UART instance. 833/// UART instance.
@@ -826,7 +838,7 @@ pub trait Instance: SealedInstance + PeripheralType {
826} 838}
827 839
828macro_rules! impl_instance { 840macro_rules! impl_instance {
829 ($inst:ident, $fc:ident, $tx_pin:ident, $rx_pin:ident, $fc_num:expr) => { 841 ($inst:ident, $fc:ident, $fc_num:expr) => {
830 impl $crate::usart::inner::SealedInstance for $crate::peripherals::$inst { 842 impl $crate::usart::inner::SealedInstance for $crate::peripherals::$inst {
831 fn info() -> &'static Info { 843 fn info() -> &'static Info {
832 static INFO: Info = Info { 844 static INFO: Info = Info {
@@ -848,14 +860,6 @@ macro_rules! impl_instance {
848 fn instance_number() -> usize { 860 fn instance_number() -> usize {
849 $fc_num 861 $fc_num
850 } 862 }
851 #[inline]
852 fn tx_pin_func() -> PioFunc {
853 PioFunc::$tx_pin
854 }
855 #[inline]
856 fn rx_pin_func() -> PioFunc {
857 PioFunc::$rx_pin
858 }
859 } 863 }
860 impl $crate::usart::Instance for $crate::peripherals::$inst { 864 impl $crate::usart::Instance for $crate::peripherals::$inst {
861 type Interrupt = crate::interrupt::typelevel::$fc; 865 type Interrupt = crate::interrupt::typelevel::$fc;
@@ -863,45 +867,72 @@ macro_rules! impl_instance {
863 }; 867 };
864} 868}
865 869
866impl_instance!(USART0, FLEXCOMM0, ALT1, ALT1, 0); 870impl_instance!(USART0, FLEXCOMM0, 0);
867impl_instance!(USART1, FLEXCOMM1, ALT2, ALT2, 1); 871impl_instance!(USART1, FLEXCOMM1, 1);
868impl_instance!(USART2, FLEXCOMM2, ALT1, ALT1, 2); 872impl_instance!(USART2, FLEXCOMM2, 2);
869impl_instance!(USART3, FLEXCOMM3, ALT1, ALT1, 3); 873impl_instance!(USART3, FLEXCOMM3, 3);
870impl_instance!(USART4, FLEXCOMM4, ALT1, ALT2, 4); 874impl_instance!(USART4, FLEXCOMM4, 4);
871impl_instance!(USART5, FLEXCOMM5, ALT3, ALT3, 5); 875impl_instance!(USART5, FLEXCOMM5, 5);
872impl_instance!(USART6, FLEXCOMM6, ALT2, ALT2, 6); 876impl_instance!(USART6, FLEXCOMM6, 6);
873impl_instance!(USART7, FLEXCOMM7, ALT7, ALT7, 7); 877impl_instance!(USART7, FLEXCOMM7, 7);
878
879pub(crate) trait SealedTxPin<T: Instance>: crate::gpio::Pin {
880 fn pin_func(&self) -> PioFunc;
881}
882
883pub(crate) trait SealedRxPin<T: Instance>: crate::gpio::Pin {
884 fn pin_func(&self) -> PioFunc;
885}
874 886
875/// Trait for TX pins. 887/// Trait for TX pins.
876pub trait TxPin<T: Instance>: crate::gpio::Pin {} 888#[allow(private_bounds)]
889pub trait TxPin<T: Instance>: SealedTxPin<T> + crate::gpio::Pin {}
890
877/// Trait for RX pins. 891/// Trait for RX pins.
878pub trait RxPin<T: Instance>: crate::gpio::Pin {} 892#[allow(private_bounds)]
893pub trait RxPin<T: Instance>: SealedRxPin<T> + crate::gpio::Pin {}
894
895macro_rules! impl_tx_pin {
896 ($pin:ident, $instance:ident, $func: ident) => {
897 impl SealedTxPin<crate::peripherals::$instance> for crate::peripherals::$pin {
898 fn pin_func(&self) -> PioFunc {
899 PioFunc::$func
900 }
901 }
879 902
880macro_rules! impl_pin {
881 ($pin:ident, $instance:ident, Tx) => {
882 impl TxPin<crate::peripherals::$instance> for crate::peripherals::$pin {} 903 impl TxPin<crate::peripherals::$instance> for crate::peripherals::$pin {}
883 }; 904 };
884 ($pin:ident, $instance:ident, Rx) => { 905}
906
907macro_rules! impl_rx_pin {
908 ($pin:ident, $instance:ident, $func: ident) => {
909 impl SealedRxPin<crate::peripherals::$instance> for crate::peripherals::$pin {
910 fn pin_func(&self) -> PioFunc {
911 PioFunc::$func
912 }
913 }
914
885 impl RxPin<crate::peripherals::$instance> for crate::peripherals::$pin {} 915 impl RxPin<crate::peripherals::$instance> for crate::peripherals::$pin {}
886 }; 916 };
887} 917}
888 918
889impl_pin!(PIO1_6, USART0, Tx); 919impl_tx_pin!(PIO1_6, USART0, ALT1);
890impl_pin!(PIO1_5, USART0, Rx); 920impl_tx_pin!(PIO1_11, USART1, ALT2);
891impl_pin!(PIO1_11, USART1, Tx); 921impl_tx_pin!(PIO0_27, USART2, ALT1);
892impl_pin!(PIO1_10, USART1, Rx); 922impl_tx_pin!(PIO0_2, USART3, ALT1);
893impl_pin!(PIO0_27, USART2, Tx); 923impl_tx_pin!(PIO0_16, USART4, ALT1);
894impl_pin!(PIO1_24, USART2, Rx); 924impl_tx_pin!(PIO0_9, USART5, ALT3);
895impl_pin!(PIO0_2, USART3, Tx); 925impl_tx_pin!(PIO1_16, USART6, ALT2);
896impl_pin!(PIO0_3, USART3, Rx); 926impl_tx_pin!(PIO0_19, USART7, ALT7);
897impl_pin!(PIO0_16, USART4, Tx); 927
898impl_pin!(PIO0_5, USART4, Rx); 928impl_rx_pin!(PIO1_5, USART0, ALT1);
899impl_pin!(PIO0_9, USART5, Tx); 929impl_rx_pin!(PIO1_10, USART1, ALT2);
900impl_pin!(PIO0_8, USART5, Rx); 930impl_rx_pin!(PIO1_24, USART2, ALT1);
901impl_pin!(PIO1_16, USART6, Tx); 931impl_rx_pin!(PIO0_3, USART3, ALT1);
902impl_pin!(PIO1_13, USART6, Rx); 932impl_rx_pin!(PIO0_5, USART4, ALT2);
903impl_pin!(PIO0_19, USART7, Tx); 933impl_rx_pin!(PIO0_8, USART5, ALT3);
904impl_pin!(PIO0_20, USART7, Rx); 934impl_rx_pin!(PIO1_13, USART6, ALT2);
935impl_rx_pin!(PIO0_20, USART7, ALT7);
905 936
906/// Trait for TX DMA channels. 937/// Trait for TX DMA channels.
907pub trait TxChannel<T: Instance>: crate::dma::Channel {} 938pub trait TxChannel<T: Instance>: crate::dma::Channel {}
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml
index f6b0900f2..9ad4b47a3 100644
--- a/embassy-rp/Cargo.toml
+++ b/embassy-rp/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-rp" 2name = "embassy-rp"
3version = "0.8.0" 3version = "0.8.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for the Raspberry Pi RP2040 or RP235x microcontroller" 6description = "Embassy Hardware Abstraction Layer (HAL) for the Raspberry Pi RP2040 or RP235x microcontroller"
7keywords = ["embedded", "async", "rp235x", "rp2040", "embedded-hal"] 7keywords = ["embedded", "async", "rp235x", "rp2040", "embedded-hal"]
@@ -104,7 +104,7 @@ boot2-w25x10cl = []
104## Have embassy-rp not provide the boot2 so you can use your own. 104## Have embassy-rp not provide the boot2 so you can use your own.
105## Place your own in the ".boot2" section like: 105## Place your own in the ".boot2" section like:
106## ``` 106## ```
107## #[link_section = ".boot2"] 107## #[unsafe(link_section = ".boot2")]
108## #[used] 108## #[used]
109## static BOOT2: [u8; 256] = [0; 256]; // Provide your own with e.g. include_bytes! 109## static BOOT2: [u8; 256] = [0; 256]; // Provide your own with e.g. include_bytes!
110## ``` 110## ```
@@ -127,7 +127,7 @@ imagedef-nonsecure-exe = []
127## ```ignore 127## ```ignore
128## use embassy_rp::block::ImageDef; 128## use embassy_rp::block::ImageDef;
129## 129##
130## #[link_section = ".start_block"] 130## #[unsafe(link_section = ".start_block")]
131## #[used] 131## #[used]
132## static IMAGE_DEF: ImageDef = ImageDef::secure_exe(); // Update this with your own implementation. 132## static IMAGE_DEF: ImageDef = ImageDef::secure_exe(); // Update this with your own implementation.
133## ``` 133## ```
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 @@
1//! ADC driver. 1//! ADC driver.
2use core::future::{poll_fn, Future}; 2use core::future::{Future, poll_fn};
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::mem; 4use core::mem;
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_sync::waitqueue::AtomicWaker; 8use embassy_sync::waitqueue::AtomicWaker;
9 9
10use crate::gpio::{self, AnyPin, Pull, SealedPin as GpioPin}; 10use crate::gpio::{self, AnyPin, Pull, SealedPin as GpioPin};
11use crate::interrupt::typelevel::Binding;
12use crate::interrupt::InterruptExt; 11use crate::interrupt::InterruptExt;
12use crate::interrupt::typelevel::Binding;
13use crate::pac::dma::vals::TreqSel; 13use crate::pac::dma::vals::TreqSel;
14use crate::peripherals::{ADC, ADC_TEMP_SENSOR}; 14use crate::peripherals::{ADC, ADC_TEMP_SENSOR};
15use crate::{dma, interrupt, pac, peripherals, Peri, RegExt}; 15use crate::{Peri, RegExt, dma, interrupt, pac, peripherals};
16 16
17static WAKER: AtomicWaker = AtomicWaker::new(); 17static WAKER: AtomicWaker = AtomicWaker::new();
18 18
diff --git a/embassy-rp/src/bootsel.rs b/embassy-rp/src/bootsel.rs
index 14f9e46aa..b24b98cd5 100644
--- a/embassy-rp/src/bootsel.rs
+++ b/embassy-rp/src/bootsel.rs
@@ -7,8 +7,8 @@
7//! 7//!
8//! This module provides functionality to poll BOOTSEL from an embassy application. 8//! This module provides functionality to poll BOOTSEL from an embassy application.
9 9
10use crate::flash::in_ram;
11use crate::Peri; 10use crate::Peri;
11use crate::flash::in_ram;
12 12
13/// Reads the BOOTSEL button. Returns true if the button is pressed. 13/// Reads the BOOTSEL button. Returns true if the button is pressed.
14/// 14///
@@ -36,7 +36,7 @@ mod ram_helpers {
36 /// This function must live in ram. It uses inline asm to avoid any 36 /// This function must live in ram. It uses inline asm to avoid any
37 /// potential calls to ABI functions that might be in flash. 37 /// potential calls to ABI functions that might be in flash.
38 #[inline(never)] 38 #[inline(never)]
39 #[link_section = ".data.ram_func"] 39 #[unsafe(link_section = ".data.ram_func")]
40 #[cfg(target_arch = "arm")] 40 #[cfg(target_arch = "arm")]
41 pub unsafe fn read_cs_status() -> GpioStatus { 41 pub unsafe fn read_cs_status() -> GpioStatus {
42 let result: u32; 42 let result: u32;
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};
72use pac::clocks::vals::*; 72use pac::clocks::vals::*;
73 73
74use crate::gpio::{AnyPin, SealedPin}; 74use crate::gpio::{AnyPin, SealedPin};
75use crate::pac::common::{Reg, RW}; 75use crate::pac::common::{RW, Reg};
76use crate::{pac, reset, Peri}; 76use crate::{Peri, pac, reset};
77 77
78// NOTE: all gpin handling is commented out for future reference. 78// NOTE: all gpin handling is commented out for future reference.
79// gpin is not usually safe to use during the boot init() call, so it won't 79// 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 @@
1//! Direct Memory Access (DMA) 1//! Direct Memory Access (DMA)
2use core::future::Future; 2use core::future::Future;
3use core::pin::Pin; 3use core::pin::Pin;
4use core::sync::atomic::{compiler_fence, Ordering}; 4use core::sync::atomic::{Ordering, compiler_fence};
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
7use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 7use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
8use embassy_sync::waitqueue::AtomicWaker; 8use embassy_sync::waitqueue::AtomicWaker;
9use pac::dma::vals::DataSize; 9use pac::dma::vals::DataSize;
10 10
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs
index 8c809090e..7cc8f0c1d 100644
--- a/embassy-rp/src/flash.rs
+++ b/embassy-rp/src/flash.rs
@@ -6,8 +6,8 @@ use core::task::{Context, Poll};
6 6
7use embassy_hal_internal::{Peri, PeripheralType}; 7use embassy_hal_internal::{Peri, PeripheralType};
8use embedded_storage::nor_flash::{ 8use embedded_storage::nor_flash::{
9 check_erase, check_read, check_write, ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, 9 ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash, check_erase, check_read,
10 ReadNorFlash, 10 check_write,
11}; 11};
12 12
13use crate::dma::{AnyChannel, Channel, Transfer}; 13use crate::dma::{AnyChannel, Channel, Transfer};
@@ -627,7 +627,7 @@ mod ram_helpers {
627 /// Length of data must be a multiple of 4096 627 /// Length of data must be a multiple of 4096
628 /// addr must be aligned to 4096 628 /// addr must be aligned to 4096
629 #[inline(never)] 629 #[inline(never)]
630 #[link_section = ".data.ram_func"] 630 #[unsafe(link_section = ".data.ram_func")]
631 #[cfg(feature = "rp2040")] 631 #[cfg(feature = "rp2040")]
632 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) { 632 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) {
633 #[cfg(target_arch = "arm")] 633 #[cfg(target_arch = "arm")]
@@ -692,7 +692,7 @@ mod ram_helpers {
692 /// Length of data must be a multiple of 4096 692 /// Length of data must be a multiple of 4096
693 /// addr must be aligned to 4096 693 /// addr must be aligned to 4096
694 #[inline(never)] 694 #[inline(never)]
695 #[link_section = ".data.ram_func"] 695 #[unsafe(link_section = ".data.ram_func")]
696 #[cfg(feature = "_rp235x")] 696 #[cfg(feature = "_rp235x")]
697 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) { 697 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) {
698 let data = data.map(|d| d.as_ptr()).unwrap_or(core::ptr::null()); 698 let data = data.map(|d| d.as_ptr()).unwrap_or(core::ptr::null());
@@ -811,7 +811,7 @@ mod ram_helpers {
811 /// 811 ///
812 /// Credit: taken from `rp2040-flash` (also licensed Apache+MIT) 812 /// Credit: taken from `rp2040-flash` (also licensed Apache+MIT)
813 #[inline(never)] 813 #[inline(never)]
814 #[link_section = ".data.ram_func"] 814 #[unsafe(link_section = ".data.ram_func")]
815 #[cfg(feature = "rp2040")] 815 #[cfg(feature = "rp2040")]
816 unsafe fn read_flash_inner(cmd: FlashCommand, ptrs: *const FlashFunctionPointers) { 816 unsafe fn read_flash_inner(cmd: FlashCommand, ptrs: *const FlashFunctionPointers) {
817 #[cfg(target_arch = "arm")] 817 #[cfg(target_arch = "arm")]
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 {
21} 21}
22 22
23fn le_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 { 23fn le_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 {
24 if a.is_nan() || b.is_nan() { 24 if a.is_nan() || b.is_nan() { 1 } else { a.rom_cmp(b) }
25 1
26 } else {
27 a.rom_cmp(b)
28 }
29} 25}
30 26
31fn ge_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 { 27fn ge_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 {
32 if a.is_nan() || b.is_nan() { 28 if a.is_nan() || b.is_nan() { -1 } else { a.rom_cmp(b) }
33 -1
34 } else {
35 a.rom_cmp(b)
36 }
37} 29}
38 30
39intrinsics! { 31intrinsics! {
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: Float + ROMFunctions>(f: F) -> F {
114} 114}
115 115
116fn ln<F: Float + ROMFunctions>(f: F) -> F { 116fn ln<F: Float + ROMFunctions>(f: F) -> F {
117 if is_negative_nonzero_or_nan(f) { 117 if is_negative_nonzero_or_nan(f) { F::NAN } else { f.ln() }
118 F::NAN
119 } else {
120 f.ln()
121 }
122} 118}
123 119
124fn exp<F: Float + ROMFunctions>(f: F) -> F { 120fn exp<F: Float + ROMFunctions>(f: F) -> F {
125 if f.is_nan() { 121 if f.is_nan() { F::NAN } else { f.exp() }
126 F::NAN
127 } else {
128 f.exp()
129 }
130} 122}
131 123
132fn sin<F: Float + ROMFunctions>(f: F) -> F { 124fn sin<F: Float + ROMFunctions>(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;
5use core::pin::Pin as FuturePin; 5use core::pin::Pin as FuturePin;
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::interrupt::InterruptExt; 11use crate::interrupt::InterruptExt;
12use crate::pac::common::{Reg, RW};
13use crate::pac::SIO; 12use crate::pac::SIO;
14use crate::{interrupt, pac, peripherals, RegExt}; 13use crate::pac::common::{RW, Reg};
14use crate::{RegExt, interrupt, pac, peripherals};
15 15
16#[cfg(any(feature = "rp2040", feature = "rp235xa"))] 16#[cfg(any(feature = "rp2040", feature = "rp235xa"))]
17pub(crate) const BANK0_PIN_COUNT: usize = 30; 17pub(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;
5 5
6use pac::i2c; 6use pac::i2c;
7 7
8use crate::i2c::{set_up_i2c_pin, AbortReason, Instance, InterruptHandler, SclPin, SdaPin, FIFO_SIZE}; 8use crate::i2c::{AbortReason, FIFO_SIZE, Instance, InterruptHandler, SclPin, SdaPin, set_up_i2c_pin};
9use crate::interrupt::typelevel::{Binding, Interrupt}; 9use crate::interrupt::typelevel::{Binding, Interrupt};
10use crate::{pac, Peri}; 10use crate::{Peri, pac};
11 11
12/// I2C error 12/// I2C error
13#[derive(Debug, PartialEq, Eq, Clone, Copy)] 13#[derive(Debug, PartialEq, Eq, Clone, Copy)]
diff --git a/embassy-rp/src/intrinsics.rs b/embassy-rp/src/intrinsics.rs
index 69d5d92de..aed8a3227 100644
--- a/embassy-rp/src/intrinsics.rs
+++ b/embassy-rp/src/intrinsics.rs
@@ -223,7 +223,7 @@ macro_rules! intrinsics {
223 223
224 #[cfg(all(target_arch = "arm", feature = "intrinsics"))] 224 #[cfg(all(target_arch = "arm", feature = "intrinsics"))]
225 mod $name { 225 mod $name {
226 #[no_mangle] 226 #[unsafe(no_mangle)]
227 $(#[$($attr)*])* 227 $(#[$($attr)*])*
228 pub extern $abi fn $name( $($argname: $ty),* ) -> $ret { 228 pub extern $abi fn $name( $($argname: $ty),* ) -> $ret {
229 super::$name($($argname),*) 229 super::$name($($argname),*)
@@ -257,7 +257,7 @@ macro_rules! intrinsics {
257 257
258 #[cfg(all(target_arch = "arm", feature = "intrinsics"))] 258 #[cfg(all(target_arch = "arm", feature = "intrinsics"))]
259 mod $name { 259 mod $name {
260 #[no_mangle] 260 #[unsafe(no_mangle)]
261 $(#[$($attr)*])* 261 $(#[$($attr)*])*
262 pub unsafe extern $abi fn $name( $($argname: $ty),* ) -> $ret { 262 pub unsafe extern $abi fn $name( $($argname: $ty),* ) -> $ret {
263 super::$name($($argname),*) 263 super::$name($($argname),*)
@@ -392,7 +392,7 @@ macro_rules! division_function {
392 ); 392 );
393 393
394 #[cfg(target_arch = "arm")] 394 #[cfg(target_arch = "arm")]
395 extern "aapcs" { 395 unsafe extern "aapcs" {
396 // Connect a local name to global symbol above through FFI. 396 // Connect a local name to global symbol above through FFI.
397 #[link_name = concat!("_erphal_", stringify!($name)) ] 397 #[link_name = concat!("_erphal_", stringify!($name)) ]
398 fn $name(n: $argty, d: $argty) -> u64; 398 fn $name(n: $argty, d: $argty) -> u64;
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index d03ba1fef..4cb1a0912 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -1,5 +1,7 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
4#![allow(unused_unsafe)]
3#![doc = include_str!("../README.md")] 5#![doc = include_str!("../README.md")]
4#![warn(missing_docs)] 6#![warn(missing_docs)]
5 7
@@ -190,7 +192,7 @@ macro_rules! bind_interrupts {
190 192
191 $( 193 $(
192 #[allow(non_snake_case)] 194 #[allow(non_snake_case)]
193 #[no_mangle] 195 #[unsafe(no_mangle)]
194 $(#[cfg($cond_irq)])? 196 $(#[cfg($cond_irq)])?
195 unsafe extern "C" fn $irq() { 197 unsafe extern "C" fn $irq() {
196 unsafe { 198 unsafe {
@@ -446,13 +448,13 @@ macro_rules! select_bootloader {
446 ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => { 448 ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => {
447 $( 449 $(
448 #[cfg(feature = $feature)] 450 #[cfg(feature = $feature)]
449 #[link_section = ".boot2"] 451 #[unsafe(link_section = ".boot2")]
450 #[used] 452 #[used]
451 static BOOT2: [u8; 256] = rp2040_boot2::$loader; 453 static BOOT2: [u8; 256] = rp2040_boot2::$loader;
452 )* 454 )*
453 455
454 #[cfg(not(any( $( feature = $feature),* )))] 456 #[cfg(not(any( $( feature = $feature),* )))]
455 #[link_section = ".boot2"] 457 #[unsafe(link_section = ".boot2")]
456 #[used] 458 #[used]
457 static BOOT2: [u8; 256] = rp2040_boot2::$default; 459 static BOOT2: [u8; 256] = rp2040_boot2::$default;
458 } 460 }
@@ -475,13 +477,13 @@ macro_rules! select_imagedef {
475 ( $( $feature:literal => $imagedef:ident, )+ default => $default:ident ) => { 477 ( $( $feature:literal => $imagedef:ident, )+ default => $default:ident ) => {
476 $( 478 $(
477 #[cfg(feature = $feature)] 479 #[cfg(feature = $feature)]
478 #[link_section = ".start_block"] 480 #[unsafe(link_section = ".start_block")]
479 #[used] 481 #[used]
480 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$imagedef(); 482 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$imagedef();
481 )* 483 )*
482 484
483 #[cfg(not(any( $( feature = $feature),* )))] 485 #[cfg(not(any( $( feature = $feature),* )))]
484 #[link_section = ".start_block"] 486 #[unsafe(link_section = ".start_block")]
485 #[used] 487 #[used]
486 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$default(); 488 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$default();
487 } 489 }
@@ -528,7 +530,7 @@ select_imagedef! {
528/// } 530/// }
529/// ``` 531/// ```
530pub fn install_core0_stack_guard() -> Result<(), ()> { 532pub fn install_core0_stack_guard() -> Result<(), ()> {
531 extern "C" { 533 unsafe extern "C" {
532 static mut _stack_end: usize; 534 static mut _stack_end: usize;
533 } 535 }
534 unsafe { install_stack_guard(core::ptr::addr_of_mut!(_stack_end)) } 536 unsafe { install_stack_guard(core::ptr::addr_of_mut!(_stack_end)) }
diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs
index adedc98ad..3b120e349 100644
--- a/embassy-rp/src/multicore.rs
+++ b/embassy-rp/src/multicore.rs
@@ -14,6 +14,7 @@
14//! use embassy_rp::multicore::Stack; 14//! use embassy_rp::multicore::Stack;
15//! use static_cell::StaticCell; 15//! use static_cell::StaticCell;
16//! use embassy_executor::Executor; 16//! use embassy_executor::Executor;
17//! use core::ptr::addr_of_mut;
17//! 18//!
18//! static mut CORE1_STACK: Stack<4096> = Stack::new(); 19//! static mut CORE1_STACK: Stack<4096> = Stack::new();
19//! static EXECUTOR0: StaticCell<Executor> = StaticCell::new(); 20//! static EXECUTOR0: StaticCell<Executor> = StaticCell::new();
@@ -36,7 +37,7 @@
36//! fn main() -> ! { 37//! fn main() -> ! {
37//! let p = embassy_rp::init(Default::default()); 38//! let p = embassy_rp::init(Default::default());
38//! 39//!
39//! embassy_rp::multicore::spawn_core1(p.CORE1, unsafe { &mut CORE1_STACK }, move || { 40//! embassy_rp::multicore::spawn_core1(p.CORE1, unsafe { &mut *addr_of_mut!(CORE1_STACK) }, move || {
40//! let executor1 = EXECUTOR1.init(Executor::new()); 41//! let executor1 = EXECUTOR1.init(Executor::new());
41//! executor1.run(|spawner| spawner.spawn(core1_task().unwrap())); 42//! executor1.run(|spawner| spawner.spawn(core1_task().unwrap()));
42//! }); 43//! });
@@ -47,11 +48,11 @@
47//! ``` 48//! ```
48 49
49use core::mem::ManuallyDrop; 50use core::mem::ManuallyDrop;
50use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; 51use core::sync::atomic::{AtomicBool, Ordering, compiler_fence};
51 52
52use crate::interrupt::InterruptExt; 53use crate::interrupt::InterruptExt;
53use crate::peripherals::CORE1; 54use crate::peripherals::CORE1;
54use crate::{gpio, install_stack_guard, interrupt, pac, Peri}; 55use crate::{Peri, gpio, install_stack_guard, interrupt, pac};
55 56
56const PAUSE_TOKEN: u32 = 0xDEADBEEF; 57const PAUSE_TOKEN: u32 = 0xDEADBEEF;
57const RESUME_TOKEN: u32 = !0xDEADBEEF; 58const RESUME_TOKEN: u32 = !0xDEADBEEF;
@@ -110,7 +111,6 @@ impl<const SIZE: usize> Stack<SIZE> {
110 111
111#[cfg(all(feature = "rt", feature = "rp2040"))] 112#[cfg(all(feature = "rt", feature = "rp2040"))]
112#[interrupt] 113#[interrupt]
113#[link_section = ".data.ram_func"]
114unsafe fn SIO_IRQ_PROC1() { 114unsafe fn SIO_IRQ_PROC1() {
115 let sio = pac::SIO; 115 let sio = pac::SIO;
116 // Clear IRQ 116 // Clear IRQ
@@ -135,7 +135,6 @@ unsafe fn SIO_IRQ_PROC1() {
135 135
136#[cfg(all(feature = "rt", feature = "_rp235x"))] 136#[cfg(all(feature = "rt", feature = "_rp235x"))]
137#[interrupt] 137#[interrupt]
138#[link_section = ".data.ram_func"]
139unsafe fn SIO_IRQ_FIFO() { 138unsafe fn SIO_IRQ_FIFO() {
140 let sio = pac::SIO; 139 let sio = pac::SIO;
141 // Clear IRQ 140 // Clear IRQ
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 @@
2use core::future::Future; 2use core::future::Future;
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::pin::Pin as FuturePin; 4use core::pin::Pin as FuturePin;
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use atomic_polyfill::{AtomicU64, AtomicU8}; 8use atomic_polyfill::{AtomicU8, AtomicU64};
9use embassy_hal_internal::{Peri, PeripheralType}; 9use embassy_hal_internal::{Peri, PeripheralType};
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
11use fixed::types::extra::U8;
12use fixed::FixedU32; 11use fixed::FixedU32;
12use fixed::types::extra::U8;
13use pio::{Program, SideSet, Wrap}; 13use pio::{Program, SideSet, Wrap};
14 14
15use crate::dma::{self, Channel, Transfer, Word}; 15use crate::dma::{self, Channel, Transfer, Word};
16use crate::gpio::{self, AnyPin, Drive, Level, Pull, SealedPin, SlewRate}; 16use crate::gpio::{self, AnyPin, Drive, Level, Pull, SealedPin, SlewRate};
17use crate::interrupt::typelevel::{Binding, Handler, Interrupt}; 17use crate::interrupt::typelevel::{Binding, Handler, Interrupt};
18use crate::relocate::RelocatedProgram; 18use crate::relocate::RelocatedProgram;
19use crate::{pac, peripherals, RegExt}; 19use crate::{RegExt, pac, peripherals};
20 20
21mod instr; 21mod instr;
22 22
@@ -984,11 +984,7 @@ impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> {
984 984
985 #[cfg(feature = "_rp235x")] 985 #[cfg(feature = "_rp235x")]
986 fn pin_base() -> u8 { 986 fn pin_base() -> u8 {
987 if PIO::PIO.gpiobase().read().gpiobase() { 987 if PIO::PIO.gpiobase().read().gpiobase() { 16 } else { 0 }
988 16
989 } else {
990 0
991 }
992 } 988 }
993 989
994 /// Sets pin directions. This pauses the current state machine to run `SET` commands 990 /// 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 @@
1//! [HD44780 display driver](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf) 1//! [HD44780 display driver](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf)
2 2
3use crate::Peri;
3use crate::dma::{AnyChannel, Channel}; 4use crate::dma::{AnyChannel, Channel};
4use crate::pio::{ 5use crate::pio::{
5 Common, Config, Direction, FifoJoin, Instance, Irq, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, 6 Common, Config, Direction, FifoJoin, Instance, Irq, LoadedProgram, PioPin, ShiftConfig, ShiftDirection,
6 StateMachine, 7 StateMachine,
7}; 8};
8use crate::pio_programs::clock_divider::calculate_pio_clock_divider; 9use crate::pio_programs::clock_divider::calculate_pio_clock_divider;
9use crate::Peri;
10 10
11/// This struct represents a HD44780 program that takes command words (<wait:24> <command:4> <0:4>) 11/// This struct represents a HD44780 program that takes command words (<wait:24> <command:4> <0:4>)
12pub struct PioHD44780CommandWordProgram<'a, PIO: Instance> { 12pub 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 @@
2 2
3use fixed::traits::ToFixed; 3use fixed::traits::ToFixed;
4 4
5use crate::Peri;
5use crate::dma::{AnyChannel, Channel, Transfer}; 6use crate::dma::{AnyChannel, Channel, Transfer};
6use crate::gpio::Pull; 7use crate::gpio::Pull;
7use crate::pio::{ 8use crate::pio::{
8 Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, 9 Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
9}; 10};
10use crate::Peri;
11 11
12/// This struct represents an i2s receiver & controller driver program 12/// This struct represents an i2s receiver & controller driver program
13pub struct PioI2sInProgram<'d, PIO: Instance> { 13pub 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 @@
1//! OneWire pio driver 1//! OneWire pio driver
2 2
3use crate::Peri;
3use crate::clocks::clk_sys_freq; 4use crate::clocks::clk_sys_freq;
4use crate::gpio::Level; 5use crate::gpio::Level;
5use crate::pio::{ 6use crate::pio::{
6 Common, Config, Direction, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, 7 Common, Config, Direction, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
7}; 8};
8use crate::Peri;
9 9
10/// This struct represents a onewire driver program 10/// This struct represents a onewire driver program
11pub struct PioOneWireProgram<'a, PIO: Instance> { 11pub struct PioOneWireProgram<'a, PIO: Instance> {
@@ -321,11 +321,7 @@ impl PioOneWireSearch {
321 321
322 /// Search for the next address on the bus 322 /// Search for the next address on the bus
323 pub async fn next<PIO: Instance, const SM: usize>(&mut self, pio: &mut PioOneWire<'_, PIO, SM>) -> Option<u64> { 323 pub async fn next<PIO: Instance, const SM: usize>(&mut self, pio: &mut PioOneWire<'_, PIO, SM>) -> Option<u64> {
324 if self.finished { 324 if self.finished { None } else { pio.search(self).await }
325 None
326 } else {
327 pio.search(self).await
328 }
329 } 325 }
330 326
331 /// Is finished when all devices have been found 327 /// 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;
6 6
7use crate::gpio::Level; 7use crate::gpio::Level;
8use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine}; 8use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine};
9use crate::{clocks, Peri}; 9use crate::{Peri, clocks};
10 10
11/// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time 11/// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time
12fn to_pio_cycles(duration: Duration) -> u32 { 12fn 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 @@
1//! PIO backed quadrature encoder 1//! PIO backed quadrature encoder
2 2
3use crate::Peri;
3use crate::gpio::Pull; 4use crate::gpio::Pull;
4use crate::pio::{ 5use crate::pio::{
5 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, 6 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine,
6}; 7};
7use crate::pio_programs::clock_divider::calculate_pio_clock_divider; 8use crate::pio_programs::clock_divider::calculate_pio_clock_divider;
8use crate::Peri;
9 9
10/// This struct represents an Encoder program loaded into pio instruction memory. 10/// This struct represents an Encoder program loaded into pio instruction memory.
11pub struct PioEncoderProgram<'a, PIO: Instance> { 11pub 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 @@
2 2
3use core::mem::{self, MaybeUninit}; 3use core::mem::{self, MaybeUninit};
4 4
5use crate::Peri;
5use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine}; 6use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine};
6use crate::pio_programs::clock_divider::calculate_pio_clock_divider; 7use crate::pio_programs::clock_divider::calculate_pio_clock_divider;
7use crate::Peri;
8 8
9/// This struct represents a Stepper driver program loaded into pio instruction memory. 9/// This struct represents a Stepper driver program loaded into pio instruction memory.
10pub struct PioStepperProgram<'a, PIO: Instance> { 10pub 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;
5use embedded_io_async::{ErrorType, Read, Write}; 5use embedded_io_async::{ErrorType, Read, Write};
6use fixed::traits::ToFixed; 6use fixed::traits::ToFixed;
7 7
8use crate::Peri;
8use crate::clocks::clk_sys_freq; 9use crate::clocks::clk_sys_freq;
9use crate::gpio::Level; 10use crate::gpio::Level;
10use crate::pio::{ 11use crate::pio::{
11 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, 12 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine,
12}; 13};
13use crate::Peri;
14 14
15/// This struct represents a uart tx program loaded into pio instruction memory. 15/// This struct represents a uart tx program loaded into pio instruction memory.
16pub struct PioUartTxProgram<'d, PIO: Instance> { 16pub 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;
4use fixed::types::U24F8; 4use fixed::types::U24F8;
5use smart_leds::{RGB8, RGBW}; 5use smart_leds::{RGB8, RGBW};
6 6
7use crate::Peri;
7use crate::clocks::clk_sys_freq; 8use crate::clocks::clk_sys_freq;
8use crate::dma::{AnyChannel, Channel}; 9use crate::dma::{AnyChannel, Channel};
9use crate::pio::{ 10use crate::pio::{
10 Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, 11 Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
11}; 12};
12use crate::Peri;
13 13
14const T1: u8 = 2; // start bit 14const T1: u8 = 2; // start bit
15const T2: u8 = 5; // data bit 15const T2: u8 = 5; // data bit
diff --git a/embassy-rp/src/psram.rs b/embassy-rp/src/psram.rs
index ae43dd5aa..25185ead2 100644
--- a/embassy-rp/src/psram.rs
+++ b/embassy-rp/src/psram.rs
@@ -10,7 +10,7 @@
10 10
11#![cfg(feature = "_rp235x")] 11#![cfg(feature = "_rp235x")]
12 12
13use critical_section::{acquire, release, CriticalSection, RestoreState}; 13use critical_section::{CriticalSection, RestoreState, acquire, release};
14 14
15use crate::pac; 15use crate::pac;
16use crate::qmi_cs1::QmiCs1; 16use crate::qmi_cs1::QmiCs1;
@@ -251,7 +251,7 @@ impl<'d> Psram<'d> {
251 } 251 }
252 252
253 /// Verify APS6404L PSRAM device matches expected configuration. 253 /// Verify APS6404L PSRAM device matches expected configuration.
254 #[link_section = ".data.ram_func"] 254 #[unsafe(link_section = ".data.ram_func")]
255 #[inline(never)] 255 #[inline(never)]
256 fn verify_aps6404l(qmi: &pac::qmi::Qmi, expected_size: usize) -> Result<(), Error> { 256 fn verify_aps6404l(qmi: &pac::qmi::Qmi, expected_size: usize) -> Result<(), Error> {
257 // APS6404L-specific constants 257 // APS6404L-specific constants
@@ -306,7 +306,7 @@ impl<'d> Psram<'d> {
306 Ok(()) 306 Ok(())
307 } 307 }
308 308
309 #[link_section = ".data.ram_func"] 309 #[unsafe(link_section = ".data.ram_func")]
310 #[inline(never)] 310 #[inline(never)]
311 unsafe fn read_aps6404l_kgd_eid(qmi: &pac::qmi::Qmi) -> (u32, u32) { 311 unsafe fn read_aps6404l_kgd_eid(qmi: &pac::qmi::Qmi) -> (u32, u32) {
312 const RESET_ENABLE_CMD: u8 = 0xf5; 312 const RESET_ENABLE_CMD: u8 = 0xf5;
@@ -435,7 +435,7 @@ impl<'d> Psram<'d> {
435 } 435 }
436 436
437 /// Initialize PSRAM with proper timing. 437 /// Initialize PSRAM with proper timing.
438 #[link_section = ".data.ram_func"] 438 #[unsafe(link_section = ".data.ram_func")]
439 #[inline(never)] 439 #[inline(never)]
440 fn init_psram(qmi: &pac::qmi::Qmi, xip_ctrl: &pac::xip_ctrl::XipCtrl, config: &Config) -> Result<(), Error> { 440 fn init_psram(qmi: &pac::qmi::Qmi, xip_ctrl: &pac::xip_ctrl::XipCtrl, config: &Config) -> Result<(), Error> {
441 // Set PSRAM timing for APS6404 441 // Set PSRAM timing for APS6404
@@ -610,7 +610,7 @@ impl<'d> Psram<'d> {
610 Ok(()) 610 Ok(())
611 } 611 }
612 612
613 #[link_section = ".data.ram_func"] 613 #[unsafe(link_section = ".data.ram_func")]
614 #[inline(never)] 614 #[inline(never)]
615 unsafe fn direct_csr_send_init_command(config: &Config, init_cmd: u8) { 615 unsafe fn direct_csr_send_init_command(config: &Config, init_cmd: u8) {
616 #[cfg(target_arch = "arm")] 616 #[cfg(target_arch = "arm")]
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 @@
3use embassy_hal_internal::{Peri, PeripheralType}; 3use embassy_hal_internal::{Peri, PeripheralType};
4pub use embedded_hal_1::pwm::SetDutyCycle; 4pub use embedded_hal_1::pwm::SetDutyCycle;
5use embedded_hal_1::pwm::{Error, ErrorKind, ErrorType}; 5use embedded_hal_1::pwm::{Error, ErrorKind, ErrorType};
6use fixed::traits::ToFixed;
7use fixed::FixedU16; 6use fixed::FixedU16;
7use fixed::traits::ToFixed;
8use pac::pwm::regs::{ChDiv, Intr}; 8use pac::pwm::regs::{ChDiv, Intr};
9use pac::pwm::vals::Divmode; 9use pac::pwm::vals::Divmode;
10 10
11use crate::gpio::{AnyPin, Pin as GpioPin, Pull, SealedPin as _}; 11use crate::gpio::{AnyPin, Pin as GpioPin, Pull, SealedPin as _};
12use crate::{pac, peripherals, RegExt}; 12use crate::{RegExt, pac, peripherals};
13 13
14/// The configuration of a PWM slice. 14/// The configuration of a PWM slice.
15/// Note the period in clock cycles of a slice can be computed as: 15/// 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 @@
2mod filter; 2mod filter;
3 3
4use core::future::poll_fn; 4use core::future::poll_fn;
5use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; 5use core::sync::atomic::{AtomicBool, Ordering, compiler_fence};
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_hal_internal::{Peri, PeripheralType}; 8use 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 @@
2use core::cell::{Cell, RefCell}; 2use core::cell::{Cell, RefCell};
3 3
4use critical_section::CriticalSection; 4use critical_section::CriticalSection;
5use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
6use embassy_sync::blocking_mutex::Mutex; 5use embassy_sync::blocking_mutex::Mutex;
6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
7use embassy_time_driver::Driver; 7use embassy_time_driver::Driver;
8use embassy_time_queue_utils::Queue; 8use embassy_time_queue_utils::Queue;
9#[cfg(feature = "rp2040")] 9#[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;
4use core::task::Poll; 4use core::task::Poll;
5 5
6use atomic_polyfill::{AtomicU16, Ordering}; 6use atomic_polyfill::{AtomicU16, Ordering};
7use embassy_futures::select::{select, Either}; 7use embassy_futures::select::{Either, select};
8use embassy_hal_internal::{Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10use embassy_time::{Delay, Timer}; 10use embassy_time::{Delay, Timer};
@@ -16,7 +16,7 @@ use crate::gpio::{AnyPin, SealedPin};
16use crate::interrupt::typelevel::{Binding, Interrupt as _}; 16use crate::interrupt::typelevel::{Binding, Interrupt as _};
17use crate::interrupt::{Interrupt, InterruptExt}; 17use crate::interrupt::{Interrupt, InterruptExt};
18use crate::pac::io::vals::{Inover, Outover}; 18use crate::pac::io::vals::{Inover, Outover};
19use crate::{interrupt, pac, peripherals, RegExt}; 19use crate::{RegExt, interrupt, pac, peripherals};
20 20
21mod buffered; 21mod buffered;
22pub use buffered::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, BufferedUartTx}; 22pub use buffered::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, BufferedUartTx};
@@ -863,11 +863,7 @@ impl<'d, M: Mode> Uart<'d, M> {
863 if let Some(pin) = &tx { 863 if let Some(pin) = &tx {
864 let funcsel = { 864 let funcsel = {
865 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8; 865 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8;
866 if (pin_number % 4) == 0 { 866 if (pin_number % 4) == 0 { 2 } else { 11 }
867 2
868 } else {
869 11
870 }
871 }; 867 };
872 pin.gpio().ctrl().write(|w| { 868 pin.gpio().ctrl().write(|w| {
873 w.set_funcsel(funcsel); 869 w.set_funcsel(funcsel);
@@ -886,11 +882,7 @@ impl<'d, M: Mode> Uart<'d, M> {
886 if let Some(pin) = &rx { 882 if let Some(pin) = &rx {
887 let funcsel = { 883 let funcsel = {
888 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8; 884 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8;
889 if ((pin_number - 1) % 4) == 0 { 885 if ((pin_number - 1) % 4) == 0 { 2 } else { 11 }
890 2
891 } else {
892 11
893 }
894 }; 886 };
895 pin.gpio().ctrl().write(|w| { 887 pin.gpio().ctrl().write(|w| {
896 w.set_funcsel(funcsel); 888 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 @@
2use core::future::poll_fn; 2use core::future::poll_fn;
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::slice; 4use core::slice;
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_hal_internal::PeripheralType; 8use embassy_hal_internal::PeripheralType;
@@ -13,7 +13,7 @@ use embassy_usb_driver::{
13}; 13};
14 14
15use crate::interrupt::typelevel::{Binding, Interrupt}; 15use crate::interrupt::typelevel::{Binding, Interrupt};
16use crate::{interrupt, pac, peripherals, Peri, RegExt}; 16use crate::{Peri, RegExt, interrupt, pac, peripherals};
17 17
18trait SealedInstance { 18trait SealedInstance {
19 fn regs() -> crate::pac::usb::Usb; 19 fn regs() -> crate::pac::usb::Usb;
@@ -545,11 +545,7 @@ impl<'d, T: Instance> driver::Endpoint for Endpoint<'d, T, In> {
545 poll_fn(|cx| { 545 poll_fn(|cx| {
546 EP_IN_WAKERS[index].register(cx.waker()); 546 EP_IN_WAKERS[index].register(cx.waker());
547 let val = T::dpram().ep_in_control(self.info.addr.index() - 1).read(); 547 let val = T::dpram().ep_in_control(self.info.addr.index() - 1).read();
548 if val.enable() { 548 if val.enable() { Poll::Ready(()) } else { Poll::Pending }
549 Poll::Ready(())
550 } else {
551 Poll::Pending
552 }
553 }) 549 })
554 .await; 550 .await;
555 trace!("wait_enabled IN OK"); 551 trace!("wait_enabled IN OK");
@@ -567,11 +563,7 @@ impl<'d, T: Instance> driver::Endpoint for Endpoint<'d, T, Out> {
567 poll_fn(|cx| { 563 poll_fn(|cx| {
568 EP_OUT_WAKERS[index].register(cx.waker()); 564 EP_OUT_WAKERS[index].register(cx.waker());
569 let val = T::dpram().ep_out_control(self.info.addr.index() - 1).read(); 565 let val = T::dpram().ep_out_control(self.info.addr.index() - 1).read();
570 if val.enable() { 566 if val.enable() { Poll::Ready(()) } else { Poll::Pending }
571 Poll::Ready(())
572 } else {
573 Poll::Pending
574 }
575 }) 567 })
576 .await; 568 .await;
577 trace!("wait_enabled OUT OK"); 569 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;
11use embassy_time::Duration; 11use embassy_time::Duration;
12 12
13use crate::peripherals::WATCHDOG; 13use crate::peripherals::WATCHDOG;
14use crate::{pac, Peri}; 14use crate::{Peri, pac};
15 15
16/// The reason for a system reset from the watchdog. 16/// The reason for a system reset from the watchdog.
17#[derive(Debug, Copy, Clone, PartialEq, Eq)] 17#[derive(Debug, Copy, Clone, PartialEq, Eq)]
diff --git a/embassy-stm32-wpan/Cargo.toml b/embassy-stm32-wpan/Cargo.toml
index d7c7a284c..0802b7328 100644
--- a/embassy-stm32-wpan/Cargo.toml
+++ b/embassy-stm32-wpan/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-stm32-wpan" 2name = "embassy-stm32-wpan"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Async STM32 WPAN stack for embedded devices in Rust." 6description = "Async STM32 WPAN stack for embedded devices in Rust."
7keywords = ["embedded", "async", "stm32", "ble", "wpan"] 7keywords = ["embedded", "async", "stm32", "ble", "wpan"]
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 @@
1use core::ptr; 1use core::ptr;
2 2
3use crate::consts::TlPacketType;
4use crate::PacketHeader; 3use crate::PacketHeader;
4use crate::consts::TlPacketType;
5 5
6#[derive(Copy, Clone)] 6#[derive(Copy, Clone)]
7#[repr(C, packed)] 7#[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 @@
1use crate::evt::CsEvt;
2use crate::PacketHeader; 1use crate::PacketHeader;
2use crate::evt::CsEvt;
3 3
4#[derive(Debug)] 4#[derive(Debug)]
5#[repr(C)] 5#[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 @@
1use core::ptr; 1use core::ptr;
2 2
3use crate::cmd::CmdPacket; 3use crate::cmd::CmdPacket;
4use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE}; 4use crate::consts::{TL_EVT_HEADER_SIZE, TlPacketType};
5use crate::evt::{CcEvt, EvtPacket, EvtSerial}; 5use crate::evt::{CcEvt, EvtPacket, EvtSerial};
6use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, WirelessFwInfoTable, TL_DEVICE_INFO_TABLE}; 6use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, TL_DEVICE_INFO_TABLE, WirelessFwInfoTable};
7 7
8const TL_BLEEVT_CC_OPCODE: u8 = 0x0e; 8const TL_BLEEVT_CC_OPCODE: u8 = 0x0e;
9const LHCI_OPCODE_C1_DEVICE_INF: u16 = 0xfd62; 9const LHCI_OPCODE_C1_DEVICE_INF: u16 = 0xfd62;
diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs
index 40ff14795..f6b1f6021 100644
--- a/embassy-stm32-wpan/src/lib.rs
+++ b/embassy-stm32-wpan/src/lib.rs
@@ -13,6 +13,7 @@
13 13
14#![no_std] 14#![no_std]
15#![allow(async_fn_in_trait)] 15#![allow(async_fn_in_trait)]
16#![allow(unsafe_op_in_unsafe_fn)]
16#![doc = include_str!("../README.md")] 17#![doc = include_str!("../README.md")]
17// #![warn(missing_docs)] 18// #![warn(missing_docs)]
18#![allow(static_mut_refs)] // TODO: Fix 19#![allow(static_mut_refs)] // TODO: Fix
@@ -21,7 +22,7 @@
21mod fmt; 22mod fmt;
22 23
23use core::mem::MaybeUninit; 24use core::mem::MaybeUninit;
24use core::sync::atomic::{compiler_fence, Ordering}; 25use core::sync::atomic::{Ordering, compiler_fence};
25 26
26use embassy_hal_internal::Peri; 27use embassy_hal_internal::Peri;
27use embassy_stm32::interrupt; 28use embassy_stm32::interrupt;
@@ -94,7 +95,7 @@ impl<'d> TlMbox<'d> {
94 pub fn init( 95 pub fn init(
95 ipcc: Peri<'d, IPCC>, 96 ipcc: Peri<'d, IPCC>,
96 _irqs: impl interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_RX, ReceiveInterruptHandler> 97 _irqs: impl interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_RX, ReceiveInterruptHandler>
97 + interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_TX, TransmitInterruptHandler>, 98 + interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_TX, TransmitInterruptHandler>,
98 config: Config, 99 config: Config,
99 ) -> Self { 100 ) -> Self {
100 // this is an inlined version of TL_Init from the STM32WB firmware as requested by AN5289. 101 // 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};
6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
7use embassy_sync::channel::Channel; 7use embassy_sync::channel::Channel;
8 8
9use crate::mac::MTU;
9use crate::mac::event::MacEvent; 10use crate::mac::event::MacEvent;
10use crate::mac::runner::Runner; 11use crate::mac::runner::Runner;
11use crate::mac::MTU;
12 12
13pub struct Driver<'d> { 13pub struct Driver<'d> {
14 runner: &'d Runner<'d>, 14 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;
7use embassy_sync::mutex::Mutex; 7use embassy_sync::mutex::Mutex;
8use embassy_sync::signal::Signal; 8use embassy_sync::signal::Signal;
9 9
10use crate::mac::MTU;
10use crate::mac::commands::DataRequest; 11use crate::mac::commands::DataRequest;
11use crate::mac::event::MacEvent; 12use crate::mac::event::MacEvent;
12use crate::mac::typedefs::{AddressMode, MacAddress, PanId, SecurityLevel}; 13use crate::mac::typedefs::{AddressMode, MacAddress, PanId, SecurityLevel};
13use crate::mac::MTU;
14use crate::sub::mac::Mac; 14use crate::sub::mac::Mac;
15 15
16type ZeroCopyPubSub<M, T> = blocking_mutex::Mutex<M, RefCell<Option<Signal<NoopRawMutex, T>>>>; 16type ZeroCopyPubSub<M, T> = blocking_mutex::Mutex<M, RefCell<Option<Signal<NoopRawMutex, T>>>>;
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;
4use hci::Opcode; 4use hci::Opcode;
5 5
6use crate::cmd::CmdPacket; 6use crate::cmd::CmdPacket;
7use crate::consts::{TlPacketType, TL_BLEEVT_CC_OPCODE, TL_BLEEVT_CS_OPCODE}; 7use crate::consts::{TL_BLEEVT_CC_OPCODE, TL_BLEEVT_CS_OPCODE, TlPacketType};
8use crate::evt::{EvtBox, EvtPacket, EvtStub}; 8use crate::evt::{EvtBox, EvtPacket, EvtStub};
9use crate::sub::mm; 9use crate::sub::mm;
10use crate::tables::{BleTable, BLE_CMD_BUFFER, CS_BUFFER, EVT_QUEUE, HCI_ACL_DATA_BUFFER, TL_BLE_TABLE}; 10use crate::tables::{BLE_CMD_BUFFER, BleTable, CS_BUFFER, EVT_QUEUE, HCI_ACL_DATA_BUFFER, TL_BLE_TABLE};
11use crate::unsafe_linked_list::LinkedListNode; 11use crate::unsafe_linked_list::LinkedListNode;
12use crate::{channels, evt}; 12use crate::{channels, evt};
13 13
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;
3use core::mem::MaybeUninit; 3use core::mem::MaybeUninit;
4use core::task::Poll; 4use core::task::Poll;
5 5
6use aligned::{Aligned, A4}; 6use aligned::{A4, Aligned};
7use cortex_m::interrupt; 7use cortex_m::interrupt;
8use embassy_stm32::ipcc::Ipcc; 8use embassy_stm32::ipcc::Ipcc;
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
@@ -12,7 +12,7 @@ use crate::consts::POOL_SIZE;
12use crate::evt::EvtPacket; 12use crate::evt::EvtPacket;
13#[cfg(feature = "ble")] 13#[cfg(feature = "ble")]
14use crate::tables::BLE_SPARE_EVT_BUF; 14use crate::tables::BLE_SPARE_EVT_BUF;
15use crate::tables::{MemManagerTable, EVT_POOL, FREE_BUF_QUEUE, SYS_SPARE_EVT_BUF, TL_MEM_MANAGER_TABLE}; 15use crate::tables::{EVT_POOL, FREE_BUF_QUEUE, MemManagerTable, SYS_SPARE_EVT_BUF, TL_MEM_MANAGER_TABLE};
16use crate::unsafe_linked_list::LinkedListNode; 16use crate::unsafe_linked_list::LinkedListNode;
17use crate::{channels, evt}; 17use crate::{channels, evt};
18 18
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};
8use crate::sub::mm; 8use crate::sub::mm;
9use crate::tables::{SysTable, WirelessFwInfoTable}; 9use crate::tables::{SysTable, WirelessFwInfoTable};
10use crate::unsafe_linked_list::LinkedListNode; 10use crate::unsafe_linked_list::LinkedListNode;
11use crate::{channels, Ipcc, SYSTEM_EVT_QUEUE, SYS_CMD_BUF, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE}; 11use crate::{Ipcc, SYS_CMD_BUF, SYSTEM_EVT_QUEUE, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE, channels};
12 12
13/// A guard that, once constructed, allows for sys commands to be sent to CPU2. 13/// A guard that, once constructed, allows for sys commands to be sent to CPU2.
14pub struct Sys { 14pub struct Sys {
@@ -35,11 +35,7 @@ impl Sys {
35 let info = unsafe { TL_DEVICE_INFO_TABLE.as_mut_ptr().read_volatile().wireless_fw_info_table }; 35 let info = unsafe { TL_DEVICE_INFO_TABLE.as_mut_ptr().read_volatile().wireless_fw_info_table };
36 36
37 // Zero version indicates that CPU2 wasn't active and didn't fill the information table 37 // Zero version indicates that CPU2 wasn't active and didn't fill the information table
38 if info.version != 0 { 38 if info.version != 0 { Some(info) } else { None }
39 Some(info)
40 } else {
41 None
42 }
43 } 39 }
44 40
45 pub async fn write(&self, opcode: ShciOpcode, payload: &[u8]) { 41 pub async fn write(&self, opcode: ShciOpcode, payload: &[u8]) {
@@ -66,8 +62,8 @@ impl Sys {
66 #[cfg(feature = "mac")] 62 #[cfg(feature = "mac")]
67 pub async fn shci_c2_mac_802_15_4_init(&self) -> Result<SchiCommandStatus, ()> { 63 pub async fn shci_c2_mac_802_15_4_init(&self) -> Result<SchiCommandStatus, ()> {
68 use crate::tables::{ 64 use crate::tables::{
69 Mac802_15_4Table, TracesTable, MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, 65 MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, Mac802_15_4Table, TL_MAC_802_15_4_TABLE,
70 TL_MAC_802_15_4_TABLE, TL_TRACES_TABLE, TRACES_EVT_QUEUE, 66 TL_TRACES_TABLE, TRACES_EVT_QUEUE, TracesTable,
71 }; 67 };
72 68
73 unsafe { 69 unsafe {
diff --git a/embassy-stm32-wpan/src/tables.rs b/embassy-stm32-wpan/src/tables.rs
index fe6fc47a3..1dafed159 100644
--- a/embassy-stm32-wpan/src/tables.rs
+++ b/embassy-stm32-wpan/src/tables.rs
@@ -1,6 +1,6 @@
1use core::mem::MaybeUninit; 1use core::mem::MaybeUninit;
2 2
3use aligned::{Aligned, A4}; 3use aligned::{A4, Aligned};
4use bit_field::BitField; 4use bit_field::BitField;
5 5
6use crate::cmd::{AclDataPacket, CmdPacket}; 6use crate::cmd::{AclDataPacket, CmdPacket};
@@ -190,94 +190,94 @@ pub struct RefTable {
190} 190}
191 191
192// --------------------- ref table --------------------- 192// --------------------- ref table ---------------------
193#[link_section = "TL_REF_TABLE"] 193#[unsafe(link_section = "TL_REF_TABLE")]
194pub static mut TL_REF_TABLE: MaybeUninit<RefTable> = MaybeUninit::uninit(); 194pub static mut TL_REF_TABLE: MaybeUninit<RefTable> = MaybeUninit::uninit();
195 195
196#[link_section = "MB_MEM1"] 196#[unsafe(link_section = "MB_MEM1")]
197pub static mut TL_DEVICE_INFO_TABLE: Aligned<A4, MaybeUninit<DeviceInfoTable>> = Aligned(MaybeUninit::uninit()); 197pub static mut TL_DEVICE_INFO_TABLE: Aligned<A4, MaybeUninit<DeviceInfoTable>> = Aligned(MaybeUninit::uninit());
198 198
199#[link_section = "MB_MEM1"] 199#[unsafe(link_section = "MB_MEM1")]
200pub static mut TL_BLE_TABLE: Aligned<A4, MaybeUninit<BleTable>> = Aligned(MaybeUninit::uninit()); 200pub static mut TL_BLE_TABLE: Aligned<A4, MaybeUninit<BleTable>> = Aligned(MaybeUninit::uninit());
201 201
202#[link_section = "MB_MEM1"] 202#[unsafe(link_section = "MB_MEM1")]
203pub static mut TL_THREAD_TABLE: Aligned<A4, MaybeUninit<ThreadTable>> = Aligned(MaybeUninit::uninit()); 203pub static mut TL_THREAD_TABLE: Aligned<A4, MaybeUninit<ThreadTable>> = Aligned(MaybeUninit::uninit());
204 204
205#[link_section = "MB_MEM1"] 205#[unsafe(link_section = "MB_MEM1")]
206pub static mut TL_LLD_TESTS_TABLE: Aligned<A4, MaybeUninit<LldTestsTable>> = Aligned(MaybeUninit::uninit()); 206pub static mut TL_LLD_TESTS_TABLE: Aligned<A4, MaybeUninit<LldTestsTable>> = Aligned(MaybeUninit::uninit());
207 207
208#[link_section = "MB_MEM1"] 208#[unsafe(link_section = "MB_MEM1")]
209pub static mut TL_BLE_LLD_TABLE: Aligned<A4, MaybeUninit<BleLldTable>> = Aligned(MaybeUninit::uninit()); 209pub static mut TL_BLE_LLD_TABLE: Aligned<A4, MaybeUninit<BleLldTable>> = Aligned(MaybeUninit::uninit());
210 210
211#[link_section = "MB_MEM1"] 211#[unsafe(link_section = "MB_MEM1")]
212pub static mut TL_SYS_TABLE: Aligned<A4, MaybeUninit<SysTable>> = Aligned(MaybeUninit::uninit()); 212pub static mut TL_SYS_TABLE: Aligned<A4, MaybeUninit<SysTable>> = Aligned(MaybeUninit::uninit());
213 213
214#[link_section = "MB_MEM1"] 214#[unsafe(link_section = "MB_MEM1")]
215pub static mut TL_MEM_MANAGER_TABLE: Aligned<A4, MaybeUninit<MemManagerTable>> = Aligned(MaybeUninit::uninit()); 215pub static mut TL_MEM_MANAGER_TABLE: Aligned<A4, MaybeUninit<MemManagerTable>> = Aligned(MaybeUninit::uninit());
216 216
217#[link_section = "MB_MEM1"] 217#[unsafe(link_section = "MB_MEM1")]
218pub static mut TL_TRACES_TABLE: Aligned<A4, MaybeUninit<TracesTable>> = Aligned(MaybeUninit::uninit()); 218pub static mut TL_TRACES_TABLE: Aligned<A4, MaybeUninit<TracesTable>> = Aligned(MaybeUninit::uninit());
219 219
220#[link_section = "MB_MEM1"] 220#[unsafe(link_section = "MB_MEM1")]
221pub static mut TL_MAC_802_15_4_TABLE: Aligned<A4, MaybeUninit<Mac802_15_4Table>> = Aligned(MaybeUninit::uninit()); 221pub static mut TL_MAC_802_15_4_TABLE: Aligned<A4, MaybeUninit<Mac802_15_4Table>> = Aligned(MaybeUninit::uninit());
222 222
223#[link_section = "MB_MEM1"] 223#[unsafe(link_section = "MB_MEM1")]
224pub static mut TL_ZIGBEE_TABLE: Aligned<A4, MaybeUninit<ZigbeeTable>> = Aligned(MaybeUninit::uninit()); 224pub static mut TL_ZIGBEE_TABLE: Aligned<A4, MaybeUninit<ZigbeeTable>> = Aligned(MaybeUninit::uninit());
225 225
226// --------------------- tables --------------------- 226// --------------------- tables ---------------------
227#[link_section = "MB_MEM1"] 227#[unsafe(link_section = "MB_MEM1")]
228pub static mut FREE_BUF_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit()); 228pub static mut FREE_BUF_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit());
229 229
230#[allow(dead_code)] 230#[allow(dead_code)]
231#[link_section = "MB_MEM1"] 231#[unsafe(link_section = "MB_MEM1")]
232pub static mut TRACES_EVT_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit()); 232pub static mut TRACES_EVT_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit());
233 233
234#[link_section = "MB_MEM2"] 234#[unsafe(link_section = "MB_MEM2")]
235pub static mut CS_BUFFER: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + TL_CS_EVT_SIZE]>> = 235pub static mut CS_BUFFER: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + TL_CS_EVT_SIZE]>> =
236 Aligned(MaybeUninit::uninit()); 236 Aligned(MaybeUninit::uninit());
237 237
238#[link_section = "MB_MEM2"] 238#[unsafe(link_section = "MB_MEM2")]
239pub static mut EVT_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit()); 239pub static mut EVT_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit());
240 240
241#[link_section = "MB_MEM2"] 241#[unsafe(link_section = "MB_MEM2")]
242pub static mut SYSTEM_EVT_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit()); 242pub static mut SYSTEM_EVT_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit());
243 243
244// --------------------- app tables --------------------- 244// --------------------- app tables ---------------------
245#[cfg(feature = "mac")] 245#[cfg(feature = "mac")]
246#[link_section = "MB_MEM2"] 246#[unsafe(link_section = "MB_MEM2")]
247pub static mut MAC_802_15_4_CMD_BUFFER: Aligned<A4, MaybeUninit<CmdPacket>> = Aligned(MaybeUninit::uninit()); 247pub static mut MAC_802_15_4_CMD_BUFFER: Aligned<A4, MaybeUninit<CmdPacket>> = Aligned(MaybeUninit::uninit());
248 248
249#[cfg(feature = "mac")] 249#[cfg(feature = "mac")]
250#[link_section = "MB_MEM2"] 250#[unsafe(link_section = "MB_MEM2")]
251pub static mut MAC_802_15_4_NOTIF_RSP_EVT_BUFFER: MaybeUninit< 251pub static mut MAC_802_15_4_NOTIF_RSP_EVT_BUFFER: MaybeUninit<
252 Aligned<A4, [u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>, 252 Aligned<A4, [u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>,
253> = MaybeUninit::uninit(); 253> = MaybeUninit::uninit();
254 254
255#[link_section = "MB_MEM2"] 255#[unsafe(link_section = "MB_MEM2")]
256pub static mut EVT_POOL: Aligned<A4, MaybeUninit<[u8; POOL_SIZE]>> = Aligned(MaybeUninit::uninit()); 256pub static mut EVT_POOL: Aligned<A4, MaybeUninit<[u8; POOL_SIZE]>> = Aligned(MaybeUninit::uninit());
257 257
258#[link_section = "MB_MEM2"] 258#[unsafe(link_section = "MB_MEM2")]
259pub static mut SYS_CMD_BUF: Aligned<A4, MaybeUninit<CmdPacket>> = Aligned(MaybeUninit::uninit()); 259pub static mut SYS_CMD_BUF: Aligned<A4, MaybeUninit<CmdPacket>> = Aligned(MaybeUninit::uninit());
260 260
261#[link_section = "MB_MEM2"] 261#[unsafe(link_section = "MB_MEM2")]
262pub static mut SYS_SPARE_EVT_BUF: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>> = 262pub static mut SYS_SPARE_EVT_BUF: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>> =
263 Aligned(MaybeUninit::uninit()); 263 Aligned(MaybeUninit::uninit());
264 264
265#[cfg(feature = "mac")] 265#[cfg(feature = "mac")]
266#[link_section = "MB_MEM2"] 266#[unsafe(link_section = "MB_MEM2")]
267pub static mut MAC_802_15_4_CNFINDNOT: Aligned<A4, MaybeUninit<[u8; C_SIZE_CMD_STRING]>> = 267pub static mut MAC_802_15_4_CNFINDNOT: Aligned<A4, MaybeUninit<[u8; C_SIZE_CMD_STRING]>> =
268 Aligned(MaybeUninit::uninit()); 268 Aligned(MaybeUninit::uninit());
269 269
270#[cfg(feature = "ble")] 270#[cfg(feature = "ble")]
271#[link_section = "MB_MEM1"] 271#[unsafe(link_section = "MB_MEM1")]
272pub static mut BLE_CMD_BUFFER: Aligned<A4, MaybeUninit<CmdPacket>> = Aligned(MaybeUninit::uninit()); 272pub static mut BLE_CMD_BUFFER: Aligned<A4, MaybeUninit<CmdPacket>> = Aligned(MaybeUninit::uninit());
273 273
274#[cfg(feature = "ble")] 274#[cfg(feature = "ble")]
275#[link_section = "MB_MEM2"] 275#[unsafe(link_section = "MB_MEM2")]
276pub static mut BLE_SPARE_EVT_BUF: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>> = 276pub static mut BLE_SPARE_EVT_BUF: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>> =
277 Aligned(MaybeUninit::uninit()); 277 Aligned(MaybeUninit::uninit());
278 278
279#[cfg(feature = "ble")] 279#[cfg(feature = "ble")]
280#[link_section = "MB_MEM2"] 280#[unsafe(link_section = "MB_MEM2")]
281// fuck these "magic" numbers from ST ---v---v 281// fuck these "magic" numbers from ST ---v---v
282pub static mut HCI_ACL_DATA_BUFFER: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + 5 + 251]>> = 282pub static mut HCI_ACL_DATA_BUFFER: Aligned<A4, MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + 5 + 251]>> =
283 Aligned(MaybeUninit::uninit()); 283 Aligned(MaybeUninit::uninit());
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md
index a6ee5c4b8..9848daf49 100644
--- a/embassy-stm32/CHANGELOG.md
+++ b/embassy-stm32/CHANGELOG.md
@@ -6,8 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 7
8<!-- next-header --> 8<!-- next-header -->
9### [Unreleased]
10
11* **Fix(stm32h5):** Prevent a HardFault crash on STM32H5 devices by changing `uid()` to return `[u8; 12]` by value instead of a reference. (Fixes #2696)
9## Unreleased - ReleaseDate 12## Unreleased - ReleaseDate
10 13
14- fix flash erase on L4 & L5
11- fix: Fixed STM32H5 builds requiring time feature 15- fix: Fixed STM32H5 builds requiring time feature
12- feat: Derive Clone, Copy for QSPI Config 16- feat: Derive Clone, Copy for QSPI Config
13- fix: stm32/i2c in master mode (blocking): subsequent transmissions failed after a NACK was received 17- fix: stm32/i2c in master mode (blocking): subsequent transmissions failed after a NACK was received
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 82bc73708..7c243b350 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-stm32" 2name = "embassy-stm32"
3version = "0.4.0" 3version = "0.4.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for ST STM32 series microcontrollers" 6description = "Embassy Hardware Abstraction Layer (HAL) for ST STM32 series microcontrollers"
7keywords = ["embedded", "async", "stm32", "hal", "embedded-hal"] 7keywords = ["embedded", "async", "stm32", "hal", "embedded-hal"]
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};
9use quote::{format_ident, quote}; 9use quote::{format_ident, quote};
10use stm32_metapac::metadata::ir::BitOffset; 10use stm32_metapac::metadata::ir::BitOffset;
11use stm32_metapac::metadata::{ 11use stm32_metapac::metadata::{
12 MemoryRegion, MemoryRegionKind, PeripheralRccKernelClock, PeripheralRccRegister, PeripheralRegisters, StopMode, 12 ALL_CHIPS, ALL_PERIPHERAL_VERSIONS, METADATA, MemoryRegion, MemoryRegionKind, PeripheralRccKernelClock,
13 ALL_CHIPS, ALL_PERIPHERAL_VERSIONS, METADATA, 13 PeripheralRccRegister, PeripheralRegisters, StopMode,
14}; 14};
15 15
16#[path = "./build_common.rs"] 16#[path = "./build_common.rs"]
@@ -105,7 +105,9 @@ fn main() {
105 } 105 }
106 (false, false) => { 106 (false, false) => {
107 if METADATA.memory.len() != 1 { 107 if METADATA.memory.len() != 1 {
108 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") 108 panic!(
109 "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"
110 )
109 } 111 }
110 METADATA.memory[0] 112 METADATA.memory[0]
111 } 113 }
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
4#[cfg(stm32wba)] 4#[cfg(stm32wba)]
5use pac::adc::vals::{Chselrmod, Cont, Dmacfg, Exten, OversamplingRatio, Ovss, Smpsel}; 5use pac::adc::vals::{Chselrmod, Cont, Dmacfg, Exten, OversamplingRatio, Ovss, Smpsel};
6 6
7use super::{blocking_delay_us, AdcChannel, AnyAdcChannel, RxDma4, SealedAdcChannel}; 7use super::{AdcChannel, AnyAdcChannel, RxDma4, SealedAdcChannel, blocking_delay_us};
8use crate::dma::Transfer; 8use crate::dma::Transfer;
9#[cfg(stm32u5)] 9#[cfg(stm32u5)]
10pub use crate::pac::adc::regs::Adc4Chselrmod0 as Chselr; 10pub 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
15#[cfg(stm32wba)] 15#[cfg(stm32wba)]
16pub use crate::pac::adc::vals::{Presc, Res as Resolution, SampleTime}; 16pub use crate::pac::adc::vals::{Presc, Res as Resolution, SampleTime};
17use crate::time::Hertz; 17use crate::time::Hertz;
18use crate::{pac, rcc, Peri}; 18use crate::{Peri, pac, rcc};
19 19
20const MAX_ADC_CLK_FREQ: Hertz = Hertz::mhz(55); 20const MAX_ADC_CLK_FREQ: Hertz = Hertz::mhz(55);
21 21
@@ -208,7 +208,10 @@ impl<'d, T: Instance> Adc4<'d, T> {
208 info!("ADC4 frequency set to {}", frequency); 208 info!("ADC4 frequency set to {}", frequency);
209 209
210 if frequency > MAX_ADC_CLK_FREQ { 210 if frequency > MAX_ADC_CLK_FREQ {
211 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 ); 211 panic!(
212 "Maximal allowed frequency for ADC4 is {} MHz and it varies with different packages, refer to ST docs for more information.",
213 MAX_ADC_CLK_FREQ.0 / 1_000_000
214 );
212 } 215 }
213 216
214 let mut s = Self { adc }; 217 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};
4use pac::adccommon::vals::Presc; 4use pac::adccommon::vals::Presc;
5 5
6use super::{ 6use super::{
7 blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, 7 Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, blocking_delay_us,
8}; 8};
9use crate::dma::Transfer; 9use crate::dma::Transfer;
10use crate::time::Hertz; 10use crate::time::Hertz;
11use crate::{pac, rcc, Peri}; 11use crate::{Peri, pac, rcc};
12 12
13/// Default VREF voltage used for sample conversion to millivolts. 13/// Default VREF voltage used for sample conversion to millivolts.
14pub const VREF_DEFAULT_MV: u32 = 3300; 14pub const VREF_DEFAULT_MV: u32 = 3300;
@@ -168,7 +168,10 @@ impl<'d, T: Instance> Adc<'d, T> {
168 debug!("ADC frequency set to {}", frequency); 168 debug!("ADC frequency set to {}", frequency);
169 169
170 if frequency > MAX_ADC_CLK_FREQ { 170 if frequency > MAX_ADC_CLK_FREQ {
171 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 ); 171 panic!(
172 "Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.",
173 MAX_ADC_CLK_FREQ.0 / 1_000_000
174 );
172 } 175 }
173 176
174 let mut s = Self { 177 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};
7use crate::interrupt::typelevel::Interrupt; 7use crate::interrupt::typelevel::Interrupt;
8use crate::interrupt::{self}; 8use crate::interrupt::{self};
9use crate::time::Hertz; 9use crate::time::Hertz;
10use crate::{rcc, Peri}; 10use crate::{Peri, rcc};
11 11
12pub const VDDA_CALIB_MV: u32 = 3300; 12pub const VDDA_CALIB_MV: u32 = 3300;
13pub const ADC_MAX: u32 = (1 << 12) - 1; 13pub 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;
6use crate::adc::{Adc, AdcChannel, Instance, SampleTime}; 6use crate::adc::{Adc, AdcChannel, Instance, SampleTime};
7use crate::interrupt::typelevel::Interrupt; 7use crate::interrupt::typelevel::Interrupt;
8use crate::time::Hertz; 8use crate::time::Hertz;
9use crate::{interrupt, rcc, Peri}; 9use crate::{Peri, interrupt, rcc};
10 10
11pub const VDDA_CALIB_MV: u32 = 3300; 11pub const VDDA_CALIB_MV: u32 = 3300;
12pub const ADC_MAX: u32 = (1 << 12) - 1; 12pub 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;
9use crate::adc::{Adc, AdcChannel, Instance, SampleTime}; 9use crate::adc::{Adc, AdcChannel, Instance, SampleTime};
10use crate::interrupt::typelevel::Interrupt; 10use crate::interrupt::typelevel::Interrupt;
11use crate::time::Hertz; 11use crate::time::Hertz;
12use crate::{interrupt, rcc, Peri}; 12use crate::{Peri, interrupt, rcc};
13 13
14const ADC_FREQ: Hertz = crate::rcc::HSI_FREQ; 14const ADC_FREQ: Hertz = crate::rcc::HSI_FREQ;
15 15
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};
7use pac::adccommon::vals::Presc; 7use pac::adccommon::vals::Presc;
8use stm32_metapac::adc::vals::{Adstp, Dmacfg, Dmaen}; 8use stm32_metapac::adc::vals::{Adstp, Dmacfg, Dmaen};
9 9
10use super::{blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime}; 10use super::{Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, blocking_delay_us};
11use crate::adc::SealedAdcChannel; 11use crate::adc::SealedAdcChannel;
12use crate::dma::Transfer; 12use crate::dma::Transfer;
13use crate::time::Hertz; 13use crate::time::Hertz;
14use crate::{pac, rcc, Peri}; 14use crate::{Peri, pac, rcc};
15 15
16/// Default VREF voltage used for sample conversion to millivolts. 16/// Default VREF voltage used for sample conversion to millivolts.
17pub const VREF_DEFAULT_MV: u32 = 3300; 17pub const VREF_DEFAULT_MV: u32 = 3300;
@@ -133,7 +133,10 @@ impl<'d, T: Instance> Adc<'d, T> {
133 trace!("ADC frequency set to {}", frequency); 133 trace!("ADC frequency set to {}", frequency);
134 134
135 if frequency > MAX_ADC_CLK_FREQ { 135 if frequency > MAX_ADC_CLK_FREQ {
136 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 ); 136 panic!(
137 "Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.",
138 MAX_ADC_CLK_FREQ.0 / 1_000_000
139 );
137 } 140 }
138 141
139 let mut s = Self { 142 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;
22#[allow(unused)] 22#[allow(unused)]
23#[cfg(not(any(adc_f3v3, adc_wba)))] 23#[cfg(not(any(adc_f3v3, adc_wba)))]
24pub use _version::*; 24pub use _version::*;
25use embassy_hal_internal::{impl_peripheral, PeripheralType}; 25use embassy_hal_internal::{PeripheralType, impl_peripheral};
26#[cfg(any(adc_f1, adc_f3v1, adc_v1, adc_l0, adc_f3v2))] 26#[cfg(any(adc_f1, adc_f3v1, adc_v1, adc_l0, adc_f3v2))]
27use embassy_sync::waitqueue::AtomicWaker; 27use embassy_sync::waitqueue::AtomicWaker;
28 28
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 @@
1use core::marker::PhantomData; 1use core::marker::PhantomData;
2use core::mem; 2use core::mem;
3use core::sync::atomic::{compiler_fence, Ordering}; 3use core::sync::atomic::{Ordering, compiler_fence};
4 4
5use stm32_metapac::adc::vals::SampleTime; 5use stm32_metapac::adc::vals::SampleTime;
6 6
7use crate::adc::{Adc, AdcChannel, Instance, RxDma}; 7use crate::adc::{Adc, AdcChannel, Instance, RxDma};
8use crate::dma::{Priority, ReadableRingBuffer, TransferOptions}; 8use crate::dma::{Priority, ReadableRingBuffer, TransferOptions};
9use crate::pac::adc::vals; 9use crate::pac::adc::vals;
10use crate::{rcc, Peri}; 10use crate::{Peri, rcc};
11 11
12#[cfg_attr(feature = "defmt", derive(defmt::Format))] 12#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13pub struct OverrunError; 13pub 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;
9use crate::adc::{Adc, AdcChannel, Instance, Resolution, SampleTime}; 9use crate::adc::{Adc, AdcChannel, Instance, Resolution, SampleTime};
10use crate::interrupt::typelevel::Interrupt; 10use crate::interrupt::typelevel::Interrupt;
11use crate::peripherals::ADC1; 11use crate::peripherals::ADC1;
12use crate::{interrupt, rcc, Peri}; 12use crate::{Peri, interrupt, rcc};
13 13
14mod watchdog_v1; 14mod watchdog_v1;
15pub use watchdog_v1::WatchdogChannels; 15pub use watchdog_v1::WatchdogChannels;
@@ -66,11 +66,7 @@ pub struct Temperature;
66impl AdcChannel<ADC1> for Temperature {} 66impl AdcChannel<ADC1> for Temperature {}
67impl super::SealedAdcChannel<ADC1> for Temperature { 67impl super::SealedAdcChannel<ADC1> for Temperature {
68 fn channel(&self) -> u8 { 68 fn channel(&self) -> u8 {
69 if cfg!(adc_l0) { 69 if cfg!(adc_l0) { 18 } else { 16 }
70 18
71 } else {
72 16
73 }
74 } 70 }
75} 71}
76 72
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;
2use crate::adc::{Adc, AdcChannel, Instance, Resolution, SampleTime}; 2use crate::adc::{Adc, AdcChannel, Instance, Resolution, SampleTime};
3use crate::peripherals::ADC1; 3use crate::peripherals::ADC1;
4use crate::time::Hertz; 4use crate::time::Hertz;
5use crate::{rcc, Peri}; 5use crate::{Peri, rcc};
6 6
7mod ringbuffered_v2; 7mod ringbuffered_v2;
8pub use ringbuffered_v2::{RingBufferedAdc, Sequence}; 8pub 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};
10pub use pac::adc::vals::{Ovsr, Ovss, Presc}; 10pub use pac::adc::vals::{Ovsr, Ovss, Presc};
11 11
12use super::{ 12use super::{
13 blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, 13 Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, blocking_delay_us,
14}; 14};
15use crate::dma::Transfer; 15use crate::dma::Transfer;
16use crate::{pac, rcc, Peri}; 16use crate::{Peri, pac, rcc};
17 17
18/// Default VREF voltage used for sample conversion to millivolts. 18/// Default VREF voltage used for sample conversion to millivolts.
19pub const VREF_DEFAULT_MV: u32 = 3300; 19pub 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};
5use pac::adccommon::vals::Presc; 5use pac::adccommon::vals::Presc;
6 6
7use super::{ 7use super::{
8 blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, 8 Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel, blocking_delay_us,
9}; 9};
10use crate::dma::Transfer; 10use crate::dma::Transfer;
11use crate::time::Hertz; 11use crate::time::Hertz;
12use crate::{pac, rcc, Peri}; 12use crate::{Peri, pac, rcc};
13 13
14/// Default VREF voltage used for sample conversion to millivolts. 14/// Default VREF voltage used for sample conversion to millivolts.
15pub const VREF_DEFAULT_MV: u32 = 3300; 15pub const VREF_DEFAULT_MV: u32 = 3300;
@@ -171,7 +171,10 @@ impl<'d, T: Instance> Adc<'d, T> {
171 info!("ADC frequency set to {}", frequency); 171 info!("ADC frequency set to {}", frequency);
172 172
173 if frequency > MAX_ADC_CLK_FREQ { 173 if frequency > MAX_ADC_CLK_FREQ {
174 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 ); 174 panic!(
175 "Maximal allowed frequency for the ADC is {} MHz and it varies with different packages, refer to ST docs for more information.",
176 MAX_ADC_CLK_FREQ.0 / 1_000_000
177 );
175 } 178 }
176 179
177 #[cfg(stm32h7)] 180 #[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;
5use core::marker::PhantomData; 5use core::marker::PhantomData;
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_hal_internal::interrupt::InterruptExt;
9use embassy_hal_internal::PeripheralType; 8use embassy_hal_internal::PeripheralType;
9use embassy_hal_internal::interrupt::InterruptExt;
10use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 10use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
11use embassy_sync::channel::Channel; 11use embassy_sync::channel::Channel;
12use embassy_sync::waitqueue::AtomicWaker; 12use embassy_sync::waitqueue::AtomicWaker;
@@ -22,7 +22,7 @@ use crate::can::enums::{BusError, RefCountOp, TryReadError};
22use crate::gpio::{AfType, OutputType, Pull, Speed}; 22use crate::gpio::{AfType, OutputType, Pull, Speed};
23use crate::interrupt::typelevel::Interrupt; 23use crate::interrupt::typelevel::Interrupt;
24use crate::rcc::{self, RccPeripheral}; 24use crate::rcc::{self, RccPeripheral};
25use crate::{interrupt, peripherals, Peri}; 25use crate::{Peri, interrupt, peripherals};
26 26
27/// Interrupt handler. 27/// Interrupt handler.
28pub struct TxInterruptHandler<T: Instance> { 28pub struct TxInterruptHandler<T: Instance> {
@@ -186,10 +186,10 @@ impl<'d> Can<'d> {
186 rx: Peri<'d, if_afio!(impl RxPin<T, A>)>, 186 rx: Peri<'d, if_afio!(impl RxPin<T, A>)>,
187 tx: Peri<'d, if_afio!(impl TxPin<T, A>)>, 187 tx: Peri<'d, if_afio!(impl TxPin<T, A>)>,
188 _irqs: impl interrupt::typelevel::Binding<T::TXInterrupt, TxInterruptHandler<T>> 188 _irqs: impl interrupt::typelevel::Binding<T::TXInterrupt, TxInterruptHandler<T>>
189 + interrupt::typelevel::Binding<T::RX0Interrupt, Rx0InterruptHandler<T>> 189 + interrupt::typelevel::Binding<T::RX0Interrupt, Rx0InterruptHandler<T>>
190 + interrupt::typelevel::Binding<T::RX1Interrupt, Rx1InterruptHandler<T>> 190 + interrupt::typelevel::Binding<T::RX1Interrupt, Rx1InterruptHandler<T>>
191 + interrupt::typelevel::Binding<T::SCEInterrupt, SceInterruptHandler<T>> 191 + interrupt::typelevel::Binding<T::SCEInterrupt, SceInterruptHandler<T>>
192 + 'd, 192 + 'd,
193 ) -> Self { 193 ) -> Self {
194 let info = T::info(); 194 let info = T::info();
195 let regs = &T::info().regs; 195 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 @@
1//! Configuration for FDCAN Module 1//! Configuration for FDCAN Module
2// Note: This file is copied and modified from fdcan crate by Richard Meadows 2// Note: This file is copied and modified from fdcan crate by Richard Meadows
3 3
4use core::num::{NonZeroU16, NonZeroU8}; 4use core::num::{NonZeroU8, NonZeroU16};
5 5
6/// Configures the bit timings. 6/// Configures the bit timings.
7/// 7///
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;
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::task::Poll; 4use core::task::Poll;
5 5
6use embassy_hal_internal::interrupt::InterruptExt;
7use embassy_hal_internal::PeripheralType; 6use embassy_hal_internal::PeripheralType;
7use embassy_hal_internal::interrupt::InterruptExt;
8use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 8use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
9use embassy_sync::channel::Channel; 9use embassy_sync::channel::Channel;
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
@@ -13,7 +13,7 @@ use crate::can::fd::peripheral::Registers;
13use crate::gpio::{AfType, OutputType, Pull, SealedPin as _, Speed}; 13use crate::gpio::{AfType, OutputType, Pull, SealedPin as _, Speed};
14use crate::interrupt::typelevel::Interrupt; 14use crate::interrupt::typelevel::Interrupt;
15use crate::rcc::{self, RccPeripheral}; 15use crate::rcc::{self, RccPeripheral};
16use crate::{interrupt, peripherals, Peri}; 16use crate::{Peri, interrupt, peripherals};
17 17
18pub(crate) mod fd; 18pub(crate) mod fd;
19 19
@@ -182,8 +182,8 @@ impl<'d> CanConfigurator<'d> {
182 rx: Peri<'d, impl RxPin<T>>, 182 rx: Peri<'d, impl RxPin<T>>,
183 tx: Peri<'d, impl TxPin<T>>, 183 tx: Peri<'d, impl TxPin<T>>,
184 _irqs: impl interrupt::typelevel::Binding<T::IT0Interrupt, IT0InterruptHandler<T>> 184 _irqs: impl interrupt::typelevel::Binding<T::IT0Interrupt, IT0InterruptHandler<T>>
185 + interrupt::typelevel::Binding<T::IT1Interrupt, IT1InterruptHandler<T>> 185 + interrupt::typelevel::Binding<T::IT1Interrupt, IT1InterruptHandler<T>>
186 + 'd, 186 + 'd,
187 ) -> CanConfigurator<'d> { 187 ) -> CanConfigurator<'d> {
188 set_as_af!(rx, AfType::input(Pull::None)); 188 set_as_af!(rx, AfType::input(Pull::None));
189 set_as_af!(tx, AfType::output(OutputType::PushPull, Speed::VeryHigh)); 189 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,
459 pub async fn write(&mut self, frame: Frame) { 459 pub async fn write(&mut self, frame: Frame) {
460 self.tx_buf.send(frame).await; 460 self.tx_buf.send(frame).await;
461 self.info.interrupt0.pend(); // Wake for Tx 461 self.info.interrupt0.pend(); // Wake for Tx
462 //T::IT0Interrupt::pend(); // Wake for Tx 462 //T::IT0Interrupt::pend(); // Wake for Tx
463 } 463 }
464 464
465 /// Async read frame from RX buffer. 465 /// Async read frame from RX buffer.
@@ -548,7 +548,7 @@ impl<'c, 'd, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> BufferedCanFd<'
548 pub async fn write(&mut self, frame: FdFrame) { 548 pub async fn write(&mut self, frame: FdFrame) {
549 self.tx_buf.send(frame).await; 549 self.tx_buf.send(frame).await;
550 self.info.interrupt0.pend(); // Wake for Tx 550 self.info.interrupt0.pend(); // Wake for Tx
551 //T::IT0Interrupt::pend(); // Wake for Tx 551 //T::IT0Interrupt::pend(); // Wake for Tx
552 } 552 }
553 553
554 /// Async read frame from RX buffer. 554 /// 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 @@
1//! Utility functions shared between CAN controller types. 1//! Utility functions shared between CAN controller types.
2 2
3use core::num::{NonZeroU16, NonZeroU8}; 3use core::num::{NonZeroU8, NonZeroU16};
4 4
5/// Shared struct to represent bit timings used by calc_can_timings. 5/// Shared struct to represent bit timings used by calc_can_timings.
6#[derive(Clone, Copy, Debug)] 6#[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 @@
1use crate::pac::CRC as PAC_CRC; 1use crate::pac::CRC as PAC_CRC;
2use crate::peripherals::CRC; 2use crate::peripherals::CRC;
3use crate::{rcc, Peri}; 3use crate::{Peri, rcc};
4 4
5/// CRC driver. 5/// CRC driver.
6pub struct Crc<'d> { 6pub 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 @@
1use crate::pac::crc::vals;
2use crate::pac::CRC as PAC_CRC; 1use crate::pac::CRC as PAC_CRC;
2use crate::pac::crc::vals;
3use crate::peripherals::CRC; 3use crate::peripherals::CRC;
4use crate::{rcc, Peri}; 4use crate::{Peri, rcc};
5 5
6/// CRC driver. 6/// CRC driver.
7pub struct Crc<'d> { 7pub 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> {
1236 } 1236 }
1237 if C::REQUIRES_PADDING { 1237 if C::REQUIRES_PADDING {
1238 if last_block_remainder != 0 { 1238 if last_block_remainder != 0 {
1239 panic!("Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.", C::BLOCK_SIZE); 1239 panic!(
1240 "Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.",
1241 C::BLOCK_SIZE
1242 );
1240 } 1243 }
1241 } 1244 }
1242 if last_block { 1245 if last_block {
@@ -1703,7 +1706,10 @@ impl<'d, T: Instance> Cryp<'d, T, Async> {
1703 } 1706 }
1704 if C::REQUIRES_PADDING { 1707 if C::REQUIRES_PADDING {
1705 if last_block_remainder != 0 { 1708 if last_block_remainder != 0 {
1706 panic!("Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.", C::BLOCK_SIZE); 1709 panic!(
1710 "Input must be a multiple of {} bytes in ECB and CBC modes. Consider padding or ciphertext stealing.",
1711 C::BLOCK_SIZE
1712 );
1707 } 1713 }
1708 } 1714 }
1709 if last_block { 1715 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};
8#[cfg(any(dac_v3, dac_v4, dac_v5, dac_v6, dac_v7))] 8#[cfg(any(dac_v3, dac_v4, dac_v5, dac_v6, dac_v7))]
9use crate::pac::dac; 9use crate::pac::dac;
10use crate::rcc::{self, RccPeripheral}; 10use crate::rcc::{self, RccPeripheral};
11use crate::{peripherals, Peri}; 11use crate::{Peri, peripherals};
12 12
13mod tsel; 13mod tsel;
14use embassy_hal_internal::PeripheralType; 14use 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;
9use crate::dma::Transfer; 9use crate::dma::Transfer;
10use crate::gpio::{AfType, Pull}; 10use crate::gpio::{AfType, Pull};
11use crate::interrupt::typelevel::Interrupt; 11use crate::interrupt::typelevel::Interrupt;
12use crate::{interrupt, rcc, Peri}; 12use crate::{Peri, interrupt, rcc};
13 13
14/// Interrupt handler. 14/// Interrupt handler.
15pub struct InterruptHandler<T: Instance> { 15pub struct InterruptHandler<T: Instance> {
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 @@
1use core::future::{poll_fn, Future}; 1use core::future::{Future, poll_fn};
2use core::pin::Pin; 2use core::pin::Pin;
3use core::sync::atomic::{fence, AtomicUsize, Ordering}; 3use core::sync::atomic::{AtomicUsize, Ordering, fence};
4use core::task::{Context, Poll, Waker}; 4use core::task::{Context, Poll, Waker};
5 5
6use embassy_hal_internal::Peri; 6use 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 @@
2 2
3use core::future::Future; 3use core::future::Future;
4use core::pin::Pin; 4use core::pin::Pin;
5use core::sync::atomic::{fence, AtomicUsize, Ordering}; 5use core::sync::atomic::{AtomicUsize, Ordering, fence};
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::Peri; 8use 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 @@
3//! FIXME: Add request_pause functionality? 3//! FIXME: Add request_pause functionality?
4//! FIXME: Stop the DMA, if a user does not queue new transfers (chain of linked-list items ends automatically). 4//! FIXME: Stop the DMA, if a user does not queue new transfers (chain of linked-list items ends automatically).
5use core::future::poll_fn; 5use core::future::poll_fn;
6use core::sync::atomic::{fence, Ordering}; 6use core::sync::atomic::{Ordering, fence};
7use core::task::Waker; 7use core::task::Waker;
8 8
9use embassy_hal_internal::Peri; 9use embassy_hal_internal::Peri;
10 10
11use super::{AnyChannel, TransferOptions, STATE}; 11use super::{AnyChannel, STATE, TransferOptions};
12use crate::dma::gpdma::linked_list::{RunMode, Table}; 12use crate::dma::gpdma::linked_list::{RunMode, Table};
13use crate::dma::ringbuffer::{DmaCtrl, Error, ReadableDmaRingBuffer, WritableDmaRingBuffer}; 13use crate::dma::ringbuffer::{DmaCtrl, Error, ReadableDmaRingBuffer, WritableDmaRingBuffer};
14use crate::dma::word::Word; 14use 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::*;
24pub(crate) mod ringbuffer; 24pub(crate) mod ringbuffer;
25pub mod word; 25pub mod word;
26 26
27use embassy_hal_internal::{impl_peripheral, PeripheralType}; 27use embassy_hal_internal::{PeripheralType, impl_peripheral};
28 28
29use crate::interrupt; 29use crate::interrupt;
30 30
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;
2 2
3use proptest::prop_oneof; 3use proptest::prop_oneof;
4use proptest::strategy::{self, BoxedStrategy, Strategy as _}; 4use proptest::strategy::{self, BoxedStrategy, Strategy as _};
5use proptest_state_machine::{prop_state_machine, ReferenceStateMachine, StateMachineTest}; 5use proptest_state_machine::{ReferenceStateMachine, StateMachineTest, prop_state_machine};
6 6
7use super::*; 7use super::*;
8 8
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;
7//use crate::gpio::{AnyPin, SealedPin}; 7//use crate::gpio::{AnyPin, SealedPin};
8use crate::gpio::{AfType, AnyPin, OutputType, Speed}; 8use crate::gpio::{AfType, AnyPin, OutputType, Speed};
9use crate::rcc::{self, RccPeripheral}; 9use crate::rcc::{self, RccPeripheral};
10use crate::{peripherals, Peri}; 10use crate::{Peri, peripherals};
11 11
12/// Performs a busy-wait delay for a specified number of microseconds. 12/// Performs a busy-wait delay for a specified number of microseconds.
13pub fn blocking_delay_ms(ms: u32) { 13pub 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 @@
1//! Digital Temperature Sensor (DTS) 1//! Digital Temperature Sensor (DTS)
2 2
3use core::future::poll_fn; 3use core::future::poll_fn;
4use core::sync::atomic::{compiler_fence, Ordering}; 4use core::sync::atomic::{Ordering, compiler_fence};
5use core::task::Poll; 5use core::task::Poll;
6 6
7use embassy_hal_internal::Peri; 7use 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;
4mod tx_desc; 4mod tx_desc;
5 5
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::sync::atomic::{fence, Ordering}; 7use core::sync::atomic::{Ordering, fence};
8 8
9use embassy_hal_internal::Peri; 9use embassy_hal_internal::Peri;
10use stm32_metapac::eth::vals::{Apcs, Cr, Dm, DmaomrSr, Fes, Ftf, Ifg, MbProgress, Mw, Pbl, Rsf, St, Tsf}; 10use 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> {
190 w.set_apcs(Apcs::STRIP); // automatic padding and crc stripping 190 w.set_apcs(Apcs::STRIP); // automatic padding and crc stripping
191 w.set_fes(Fes::FES100); // fast ethernet speed 191 w.set_fes(Fes::FES100); // fast ethernet speed
192 w.set_dm(Dm::FULL_DUPLEX); // full duplex 192 w.set_dm(Dm::FULL_DUPLEX); // full duplex
193 // TODO: Carrier sense ? ECRSFD 193 // TODO: Carrier sense ? ECRSFD
194 }); 194 });
195 195
196 // Set the mac to pass all multicast packets 196 // Set the mac to pass all multicast packets
@@ -350,7 +350,9 @@ impl<'d, T: Instance, P: Phy> Ethernet<'d, T, P> {
350 } 350 }
351 351
352 #[cfg(any(eth_v1b, eth_v1c))] 352 #[cfg(any(eth_v1b, eth_v1c))]
353 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); 353 config_pins!(
354 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
355 );
354 356
355 let pins = Pins::Mii([ 357 let pins = Pins::Mii([
356 rx_clk.into(), 358 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 @@
1use core::sync::atomic::{compiler_fence, fence, Ordering}; 1use core::sync::atomic::{Ordering, compiler_fence, fence};
2 2
3use stm32_metapac::eth::vals::{Rpd, Rps}; 3use stm32_metapac::eth::vals::{Rpd, Rps};
4use vcell::VolatileCell; 4use 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 @@
1use core::sync::atomic::{compiler_fence, fence, Ordering}; 1use core::sync::atomic::{Ordering, compiler_fence, fence};
2 2
3use vcell::VolatileCell; 3use vcell::VolatileCell;
4 4
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 @@
1use core::sync::atomic::{fence, Ordering}; 1use core::sync::atomic::{Ordering, fence};
2 2
3use vcell::VolatileCell; 3use vcell::VolatileCell;
4 4
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 @@
1mod descriptors; 1mod descriptors;
2 2
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::sync::atomic::{fence, Ordering}; 4use core::sync::atomic::{Ordering, fence};
5 5
6use embassy_hal_internal::Peri; 6use embassy_hal_internal::Peri;
7use stm32_metapac::syscfg::vals::EthSelPhy; 7use stm32_metapac::syscfg::vals::EthSelPhy;
@@ -144,7 +144,9 @@ impl<'d, T: Instance, P: Phy> Ethernet<'d, T, P> {
144 .modify(|w| w.set_eth_sel_phy(EthSelPhy::MII_GMII)); 144 .modify(|w| w.set_eth_sel_phy(EthSelPhy::MII_GMII));
145 }); 145 });
146 146
147 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); 147 config_pins!(
148 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
149 );
148 150
149 let pins = Pins::Mii([ 151 let pins = Pins::Mii([
150 rx_clk.into(), 152 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;
5use core::pin::Pin; 5use core::pin::Pin;
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::{impl_peripheral, PeripheralType}; 8use embassy_hal_internal::{PeripheralType, impl_peripheral};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::gpio::{AnyPin, Input, Level, Pin as GpioPin, Pull}; 11use crate::gpio::{AnyPin, Input, Level, Pin as GpioPin, Pull};
12use crate::pac::exti::regs::Lines;
13use crate::pac::EXTI; 12use crate::pac::EXTI;
14use crate::{interrupt, pac, peripherals, Peri}; 13use crate::pac::exti::regs::Lines;
14use crate::{Peri, interrupt, pac, peripherals};
15 15
16const EXTI_COUNT: usize = 16; 16const EXTI_COUNT: usize = 16;
17static EXTI_WAKERS: [AtomicWaker; EXTI_COUNT] = [const { AtomicWaker::new() }; EXTI_COUNT]; 17static 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 @@
1use core::marker::PhantomData; 1use core::marker::PhantomData;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use embassy_hal_internal::drop::OnDrop; 4use embassy_hal_internal::drop::OnDrop;
5use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 5use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
6use embassy_sync::mutex::Mutex; 6use embassy_sync::mutex::Mutex;
7 7
8use super::{ 8use super::{
9 blocking_read, ensure_sector_aligned, family, get_flash_regions, get_sector, Async, Error, Flash, FlashLayout, 9 Async, Error, FLASH_BASE, FLASH_SIZE, Flash, FlashLayout, WRITE_SIZE, blocking_read, ensure_sector_aligned, family,
10 FLASH_BASE, FLASH_SIZE, WRITE_SIZE, 10 get_flash_regions, get_sector,
11}; 11};
12use crate::interrupt::InterruptExt; 12use crate::interrupt::InterruptExt;
13use crate::peripherals::FLASH; 13use crate::peripherals::FLASH;
14use crate::{interrupt, Peri}; 14use crate::{Peri, interrupt};
15 15
16pub(super) static REGION_ACCESS: Mutex<CriticalSectionRawMutex, ()> = Mutex::new(()); 16pub(super) static REGION_ACCESS: Mutex<CriticalSectionRawMutex, ()> = Mutex::new(());
17 17
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 @@
1use core::marker::PhantomData; 1use core::marker::PhantomData;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use embassy_hal_internal::drop::OnDrop; 4use embassy_hal_internal::drop::OnDrop;
5 5
6use super::{ 6use super::{
7 family, get_flash_regions, Async, Blocking, Error, FlashBank, FlashLayout, FlashRegion, FlashSector, FLASH_SIZE, 7 Async, Blocking, Error, FLASH_SIZE, FlashBank, FlashLayout, FlashRegion, FlashSector, MAX_ERASE_SIZE, READ_SIZE,
8 MAX_ERASE_SIZE, READ_SIZE, WRITE_SIZE, 8 WRITE_SIZE, family, get_flash_regions,
9}; 9};
10use crate::Peri;
11use crate::_generated::FLASH_BASE; 10use crate::_generated::FLASH_BASE;
11use crate::Peri;
12use crate::peripherals::FLASH; 12use crate::peripherals::FLASH;
13 13
14/// Internal flash memory driver. 14/// 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 @@
1use embassy_hal_internal::drop::OnDrop; 1use embassy_hal_internal::drop::OnDrop;
2 2
3use super::{family, Blocking, Error, Flash, EEPROM_BASE, EEPROM_SIZE}; 3use super::{Blocking, EEPROM_BASE, EEPROM_SIZE, Error, Flash, family};
4 4
5#[cfg(eeprom)] 5#[cfg(eeprom)]
6impl<'d> Flash<'d, Blocking> { 6impl<'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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use super::{FlashSector, WRITE_SIZE}; 4use super::{FlashSector, WRITE_SIZE};
5use crate::flash::Error; 5use 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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use super::{FlashSector, WRITE_SIZE}; 4use super::{FlashSector, WRITE_SIZE};
5use crate::flash::Error; 5use 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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, AtomicBool, Ordering}; 2use core::sync::atomic::{AtomicBool, Ordering, fence};
3 3
4use pac::flash::regs::Sr; 4use pac::flash::regs::Sr;
5 5
6use super::{get_flash_regions, FlashBank, FlashSector, WRITE_SIZE}; 6use super::{FlashBank, FlashSector, WRITE_SIZE, get_flash_regions};
7use crate::flash::Error; 7use crate::flash::Error;
8use crate::pac; 8use crate::pac;
9 9
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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, AtomicBool, Ordering}; 2use core::sync::atomic::{AtomicBool, Ordering, fence};
3 3
4use embassy_sync::waitqueue::AtomicWaker; 4use embassy_sync::waitqueue::AtomicWaker;
5use pac::flash::regs::Sr; 5use pac::flash::regs::Sr;
6 6
7use super::{get_flash_regions, FlashBank, FlashSector, WRITE_SIZE}; 7use super::{FlashBank, FlashSector, WRITE_SIZE, get_flash_regions};
8use crate::_generated::FLASH_SIZE; 8use crate::_generated::FLASH_SIZE;
9use crate::flash::Error; 9use crate::flash::Error;
10use crate::pac; 10use crate::pac;
@@ -246,7 +246,9 @@ pub(crate) fn assert_not_corrupted_read(end_address: u32) {
246 feature = "stm32f439zi", 246 feature = "stm32f439zi",
247 ))] 247 ))]
248 if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() { 248 if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() {
249 panic!("Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11"); 249 panic!(
250 "Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11"
251 );
250 } 252 }
251 253
252 #[cfg(any( 254 #[cfg(any(
@@ -270,14 +272,16 @@ pub(crate) fn assert_not_corrupted_read(end_address: u32) {
270 feature = "stm32f439zg", 272 feature = "stm32f439zg",
271 ))] 273 ))]
272 if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() { 274 if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() {
273 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"); 275 panic!(
276 "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"
277 );
274 } 278 }
275} 279}
276 280
277#[allow(unused)] 281#[allow(unused)]
278fn pa12_is_output_pull_low() -> bool { 282fn pa12_is_output_pull_low() -> bool {
279 use pac::gpio::vals;
280 use pac::GPIOA; 283 use pac::GPIOA;
284 use pac::gpio::vals;
281 const PIN: usize = 12; 285 const PIN: usize = 12;
282 GPIOA.moder().read().moder(PIN) == vals::Moder::OUTPUT 286 GPIOA.moder().read().moder(PIN) == vals::Moder::OUTPUT
283 && GPIOA.pupdr().read().pupdr(PIN) == vals::Pupdr::PULL_DOWN 287 && GPIOA.pupdr().read().pupdr(PIN) == vals::Pupdr::PULL_DOWN
@@ -287,7 +291,7 @@ fn pa12_is_output_pull_low() -> bool {
287#[cfg(test)] 291#[cfg(test)]
288mod tests { 292mod tests {
289 use super::*; 293 use super::*;
290 use crate::flash::{get_sector, FlashBank}; 294 use crate::flash::{FlashBank, get_sector};
291 295
292 #[test] 296 #[test]
293 #[cfg(stm32f429)] 297 #[cfg(stm32f429)]
@@ -370,9 +374,13 @@ mod tests {
370#[cfg(all(bank_setup_configurable))] 374#[cfg(all(bank_setup_configurable))]
371pub(crate) fn check_bank_setup() { 375pub(crate) fn check_bank_setup() {
372 if cfg!(feature = "single-bank") && pac::FLASH.optcr().read().db1m() { 376 if cfg!(feature = "single-bank") && pac::FLASH.optcr().read().db1m() {
373 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"); 377 panic!(
378 "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"
379 );
374 } 380 }
375 if cfg!(feature = "dual-bank") && !pac::FLASH.optcr().read().db1m() { 381 if cfg!(feature = "dual-bank") && !pac::FLASH.optcr().read().db1m() {
376 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"); 382 panic!(
383 "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"
384 );
377 } 385 }
378} 386}
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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use super::{FlashSector, WRITE_SIZE}; 4use super::{FlashSector, WRITE_SIZE};
5use crate::flash::Error; 5use crate::flash::Error;
@@ -99,7 +99,7 @@ unsafe fn blocking_wait_ready() -> Result<(), Error> {
99#[cfg(test)] 99#[cfg(test)]
100mod tests { 100mod tests {
101 use super::*; 101 use super::*;
102 use crate::flash::{get_sector, FlashBank}; 102 use crate::flash::{FlashBank, get_sector};
103 103
104 #[test] 104 #[test]
105 #[cfg(stm32f732)] 105 #[cfg(stm32f732)]
@@ -218,9 +218,13 @@ mod tests {
218#[cfg(all(bank_setup_configurable))] 218#[cfg(all(bank_setup_configurable))]
219pub(crate) fn check_bank_setup() { 219pub(crate) fn check_bank_setup() {
220 if cfg!(feature = "single-bank") && !pac::FLASH.optcr().read().n_dbank() { 220 if cfg!(feature = "single-bank") && !pac::FLASH.optcr().read().n_dbank() {
221 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"); 221 panic!(
222 "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"
223 );
222 } 224 }
223 if cfg!(feature = "dual-bank") && pac::FLASH.optcr().read().n_dbank() { 225 if cfg!(feature = "dual-bank") && pac::FLASH.optcr().read().n_dbank() {
224 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"); 226 panic!(
227 "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"
228 );
225 } 229 }
226} 230}
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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use cortex_m::interrupt; 4use cortex_m::interrupt;
5 5
@@ -105,19 +105,27 @@ fn wait_busy() {
105#[cfg(all(bank_setup_configurable, any(flash_g4c2, flash_g4c3, flash_g4c4)))] 105#[cfg(all(bank_setup_configurable, any(flash_g4c2, flash_g4c3, flash_g4c4)))]
106pub(crate) fn check_bank_setup() { 106pub(crate) fn check_bank_setup() {
107 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() { 107 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() {
108 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"); 108 panic!(
109 "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"
110 );
109 } 111 }
110 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() { 112 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() {
111 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"); 113 panic!(
114 "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"
115 );
112 } 116 }
113} 117}
114 118
115#[cfg(all(bank_setup_configurable, flash_g0x1))] 119#[cfg(all(bank_setup_configurable, flash_g0x1))]
116pub(crate) fn check_bank_setup() { 120pub(crate) fn check_bank_setup() {
117 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dual_bank() { 121 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dual_bank() {
118 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"); 122 panic!(
123 "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"
124 );
119 } 125 }
120 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dual_bank() { 126 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dual_bank() {
121 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"); 127 panic!(
128 "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"
129 );
122 } 130 }
123} 131}
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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use super::{FlashSector, WRITE_SIZE}; 4use super::{FlashSector, WRITE_SIZE};
5use crate::flash::Error; 5use 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 @@
1/// STM32H50 series flash impl. See RM0492 1/// STM32H50 series flash impl. See RM0492
2use core::{ 2use core::{
3 ptr::write_volatile, 3 ptr::write_volatile,
4 sync::atomic::{fence, Ordering}, 4 sync::atomic::{Ordering, fence},
5}; 5};
6 6
7use cortex_m::interrupt; 7use 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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use super::{FlashSector, BANK1_REGION, FLASH_REGIONS, WRITE_SIZE}; 4use super::{BANK1_REGION, FLASH_REGIONS, FlashSector, WRITE_SIZE};
5use crate::flash::Error; 5use crate::flash::Error;
6use crate::pac; 6use crate::pac;
7 7
diff --git a/embassy-stm32/src/flash/l.rs b/embassy-stm32/src/flash/l.rs
index 1b82704ec..b3281f2d5 100644
--- a/embassy-stm32/src/flash/l.rs
+++ b/embassy-stm32/src/flash/l.rs
@@ -1,5 +1,5 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use super::{FlashSector, WRITE_SIZE}; 4use super::{FlashSector, WRITE_SIZE};
5use crate::flash::Error; 5use crate::flash::Error;
@@ -96,14 +96,20 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E
96 #[cfg(any(flash_wl, flash_wb, flash_l4, flash_l5))] 96 #[cfg(any(flash_wl, flash_wb, flash_l4, flash_l5))]
97 { 97 {
98 let idx = (sector.start - super::FLASH_BASE as u32) / super::BANK1_REGION.erase_size as u32; 98 let idx = (sector.start - super::FLASH_BASE as u32) / super::BANK1_REGION.erase_size as u32;
99 #[cfg(any(flash_l4, flash_l5))]
100 let pgn = super::BANK1_REGION.size as u32 / super::BANK1_REGION.erase_size as u32;
99 101
100 #[cfg(flash_l4)] 102 #[cfg(flash_l4)]
101 let (idx, bank) = if idx > 255 { (idx - 256, true) } else { (idx, false) }; 103 let (idx, bank) = if idx > (pgn - 1) {
104 (idx - pgn, true)
105 } else {
106 (idx, false)
107 };
102 108
103 #[cfg(flash_l5)] 109 #[cfg(flash_l5)]
104 let (idx, bank) = if pac::FLASH.optr().read().dbank() { 110 let (idx, bank) = if pac::FLASH.optr().read().dbank() {
105 if idx > 255 { 111 if idx > (pgn - 1) {
106 (idx - 256, Some(true)) 112 (idx - pgn, Some(true))
107 } else { 113 } else {
108 (idx, Some(false)) 114 (idx, Some(false))
109 } 115 }
@@ -234,19 +240,27 @@ pub(crate) unsafe fn wait_ready_blocking() -> Result<(), Error> {
234#[cfg(all(bank_setup_configurable, flash_l5))] 240#[cfg(all(bank_setup_configurable, flash_l5))]
235pub(crate) fn check_bank_setup() { 241pub(crate) fn check_bank_setup() {
236 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() { 242 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() {
237 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"); 243 panic!(
244 "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"
245 );
238 } 246 }
239 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() { 247 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() {
240 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"); 248 panic!(
249 "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"
250 );
241 } 251 }
242} 252}
243 253
244#[cfg(all(bank_setup_configurable, flash_l4))] 254#[cfg(all(bank_setup_configurable, flash_l4))]
245pub(crate) fn check_bank_setup() { 255pub(crate) fn check_bank_setup() {
246 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dualbank() { 256 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dualbank() {
247 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"); 257 panic!(
258 "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"
259 );
248 } 260 }
249 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dualbank() { 261 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dualbank() {
250 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"); 262 panic!(
263 "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"
264 );
251 } 265 }
252} 266}
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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use cortex_m::interrupt; 4use cortex_m::interrupt;
5 5
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 @@
1use core::ptr::write_volatile; 1use core::ptr::write_volatile;
2use core::sync::atomic::{fence, Ordering}; 2use core::sync::atomic::{Ordering, fence};
3 3
4use super::{FlashBank, FlashSector, WRITE_SIZE}; 4use super::{FlashBank, FlashSector, WRITE_SIZE};
5use crate::flash::Error; 5use 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;
4use embassy_hal_internal::PeripheralType; 4use embassy_hal_internal::PeripheralType;
5 5
6use crate::gpio::{AfType, OutputType, Pull, Speed}; 6use crate::gpio::{AfType, OutputType, Pull, Speed};
7use crate::{rcc, Peri}; 7use crate::{Peri, rcc};
8 8
9/// FMC driver 9/// FMC driver
10pub struct Fmc<'d, T: Instance> { 10pub 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 @@
4use core::convert::Infallible; 4use core::convert::Infallible;
5 5
6use critical_section::CriticalSection; 6use critical_section::CriticalSection;
7use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 7use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
8 8
9use crate::pac::gpio::{self, vals}; 9use crate::pac::gpio::{self, vals};
10use crate::peripherals; 10use 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;
19use crate::mode::Async; 19use crate::mode::Async;
20use crate::mode::{Blocking, Mode}; 20use crate::mode::{Blocking, Mode};
21use crate::peripherals::HASH; 21use crate::peripherals::HASH;
22use crate::{interrupt, pac, peripherals, rcc, Peri}; 22use crate::{Peri, interrupt, pac, peripherals, rcc};
23 23
24#[cfg(hash_v1)] 24#[cfg(hash_v1)]
25const NUM_CONTEXT_REGS: usize = 51; 25const NUM_CONTEXT_REGS: usize = 51;
@@ -514,11 +514,7 @@ impl<'d, T: Instance> Hash<'d, T, Async> {
514 T::regs().imr().modify(|reg| reg.set_dcie(true)); 514 T::regs().imr().modify(|reg| reg.set_dcie(true));
515 // Check for completion. 515 // Check for completion.
516 let bits = T::regs().sr().read(); 516 let bits = T::regs().sr().read();
517 if bits.dcis() { 517 if bits.dcis() { Poll::Ready(()) } else { Poll::Pending }
518 Poll::Ready(())
519 } else {
520 Poll::Pending
521 }
522 }) 518 })
523 .await; 519 .await;
524 520
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 @@
2 2
3use embassy_hal_internal::PeripheralType; 3use embassy_hal_internal::PeripheralType;
4 4
5use crate::pac;
6use crate::rcc::{self, RccPeripheral};
7// TODO: This code works for all HSEM implemenations except for the STM32WBA52/4/5xx MCUs. 5// TODO: This code works for all HSEM implemenations except for the STM32WBA52/4/5xx MCUs.
8// Those MCUs have a different HSEM implementation (Secure semaphore lock support, 6// Those MCUs have a different HSEM implementation (Secure semaphore lock support,
9// Privileged / unprivileged semaphore lock support, Semaphore lock protection via semaphore attribute), 7// Privileged / unprivileged semaphore lock support, Semaphore lock protection via semaphore attribute),
10// which is not yet supported by this code. 8// which is not yet supported by this code.
11use crate::Peri; 9use crate::Peri;
10use crate::pac;
11use crate::rcc::{self, RccPeripheral};
12 12
13/// HSEM error. 13/// HSEM error.
14#[derive(Debug)] 14#[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};
16use embassy_hal_internal::{Peri, PeripheralType}; 16use embassy_hal_internal::{Peri, PeripheralType};
17pub use enums::*; 17pub use enums::*;
18 18
19use crate::dma::{word, ChannelAndRequest}; 19use crate::dma::{ChannelAndRequest, word};
20use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; 20use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed};
21use crate::mode::{Async, Blocking, Mode as PeriMode}; 21use crate::mode::{Async, Blocking, Mode as PeriMode};
22use crate::pac::hspi::Hspi as Regs; 22use 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> {
154 scl: Peri<'d, if_afio!(impl SclPin<T, A>)>, 154 scl: Peri<'d, if_afio!(impl SclPin<T, A>)>,
155 sda: Peri<'d, if_afio!(impl SdaPin<T, A>)>, 155 sda: Peri<'d, if_afio!(impl SdaPin<T, A>)>,
156 _irq: impl interrupt::typelevel::Binding<T::EventInterrupt, EventInterruptHandler<T>> 156 _irq: impl interrupt::typelevel::Binding<T::EventInterrupt, EventInterruptHandler<T>>
157 + interrupt::typelevel::Binding<T::ErrorInterrupt, ErrorInterruptHandler<T>> 157 + interrupt::typelevel::Binding<T::ErrorInterrupt, ErrorInterruptHandler<T>>
158 + 'd, 158 + 'd,
159 tx_dma: Peri<'d, impl TxDma<T>>, 159 tx_dma: Peri<'d, impl TxDma<T>>,
160 rx_dma: Peri<'d, impl RxDma<T>>, 160 rx_dma: Peri<'d, impl RxDma<T>>,
161 config: Config, 161 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;
8use core::task::Poll; 8use core::task::Poll;
9 9
10use embassy_embedded_hal::SetConfig; 10use embassy_embedded_hal::SetConfig;
11use embassy_futures::select::{select, Either}; 11use embassy_futures::select::{Either, select};
12use embassy_hal_internal::drop::OnDrop; 12use embassy_hal_internal::drop::OnDrop;
13use embedded_hal_1::i2c::Operation; 13use embedded_hal_1::i2c::Operation;
14use mode::Master; 14use mode::Master;
@@ -762,11 +762,7 @@ impl Timings {
762 mode = Mode::Standard; 762 mode = Mode::Standard;
763 ccr = { 763 ccr = {
764 let ccr = clock / (frequency * 2); 764 let ccr = clock / (frequency * 2);
765 if ccr < 4 { 765 if ccr < 4 { 4 } else { ccr }
766 4
767 } else {
768 ccr
769 }
770 }; 766 };
771 } else { 767 } else {
772 const DUTYCYCLE: u8 = 0; 768 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;
2use core::future::poll_fn; 2use core::future::poll_fn;
3use core::task::Poll; 3use core::task::Poll;
4 4
5use config::{Address, OwnAddresses, OA2}; 5use config::{Address, OA2, OwnAddresses};
6use embassy_embedded_hal::SetConfig; 6use embassy_embedded_hal::SetConfig;
7use embassy_hal_internal::drop::OnDrop; 7use embassy_hal_internal::drop::OnDrop;
8use embedded_hal_1::i2c::Operation; 8use 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 @@
3use embassy_futures::join::join; 3use embassy_futures::join::join;
4use stm32_metapac::spi::vals; 4use stm32_metapac::spi::vals;
5 5
6use crate::dma::{ringbuffer, ChannelAndRequest, ReadableRingBuffer, TransferOptions, WritableRingBuffer}; 6use crate::Peri;
7use crate::dma::{ChannelAndRequest, ReadableRingBuffer, TransferOptions, WritableRingBuffer, ringbuffer};
7use crate::gpio::{AfType, AnyPin, OutputType, SealedPin, Speed}; 8use crate::gpio::{AfType, AnyPin, OutputType, SealedPin, Speed};
8use crate::mode::Async; 9use crate::mode::Async;
9use crate::spi::{Config as SpiConfig, RegsExt as _, *}; 10use crate::spi::{Config as SpiConfig, RegsExt as _, *};
10use crate::time::Hertz; 11use crate::time::Hertz;
11use crate::Peri;
12 12
13/// I2S mode 13/// I2S mode
14#[derive(Copy, Clone)] 14#[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 @@
1//! Inter-Process Communication Controller (IPCC) 1//! Inter-Process Communication Controller (IPCC)
2 2
3use core::future::poll_fn; 3use core::future::poll_fn;
4use core::sync::atomic::{compiler_fence, Ordering}; 4use core::sync::atomic::{Ordering, compiler_fence};
5use core::task::Poll; 5use core::task::Poll;
6 6
7use embassy_sync::waitqueue::AtomicWaker; 7use embassy_sync::waitqueue::AtomicWaker;
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
index 7e0f7884e..dbf0fe620 100644
--- a/embassy-stm32/src/lib.rs
+++ b/embassy-stm32/src/lib.rs
@@ -1,5 +1,6 @@
1#![cfg_attr(not(test), no_std)] 1#![cfg_attr(not(test), no_std)]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![cfg_attr( 4#![cfg_attr(
4 docsrs, 5 docsrs,
5 doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.embassy.dev/embassy-stm32'>browse the `embassy-stm32` documentation on the Embassy website</a> instead.</p><p>The documentation here on `docs.rs` is built for a single chip only (stm32h7, stm32h7rs55 in particular), while on the Embassy website you can pick your exact chip from the top menu. Available peripherals and their APIs change depending on the chip.</p></div>\n\n" 6 doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.embassy.dev/embassy-stm32'>browse the `embassy-stm32` documentation on the Embassy website</a> instead.</p><p>The documentation here on `docs.rs` is built for a single chip only (stm32h7, stm32h7rs55 in particular), while on the Embassy website you can pick your exact chip from the top menu. Available peripherals and their APIs change depending on the chip.</p></div>\n\n"
@@ -194,7 +195,7 @@ macro_rules! bind_interrupts {
194 195
195 $( 196 $(
196 #[allow(non_snake_case)] 197 #[allow(non_snake_case)]
197 #[no_mangle] 198 #[unsafe(no_mangle)]
198 $(#[cfg($cond_irq)])? 199 $(#[cfg($cond_irq)])?
199 $(#[doc = $doc])* 200 $(#[doc = $doc])*
200 unsafe extern "C" fn $irq() { 201 unsafe extern "C" fn $irq() {
@@ -222,7 +223,7 @@ macro_rules! bind_interrupts {
222} 223}
223 224
224// Reexports 225// Reexports
225pub use _generated::{peripherals, Peripherals}; 226pub use _generated::{Peripherals, peripherals};
226pub use embassy_hal_internal::{Peri, PeripheralType}; 227pub use embassy_hal_internal::{Peri, PeripheralType};
227#[cfg(feature = "unstable-pac")] 228#[cfg(feature = "unstable-pac")]
228pub use stm32_metapac as pac; 229pub use stm32_metapac as pac;
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 @@
56 56
57use core::arch::asm; 57use core::arch::asm;
58use core::marker::PhantomData; 58use core::marker::PhantomData;
59use core::sync::atomic::{compiler_fence, Ordering}; 59use core::sync::atomic::{Ordering, compiler_fence};
60 60
61use cortex_m::peripheral::SCB; 61use cortex_m::peripheral::SCB;
62use embassy_executor::*; 62use embassy_executor::*;
63 63
64use crate::interrupt; 64use crate::interrupt;
65use crate::time_driver::{get_driver, RtcDriver}; 65use crate::time_driver::{RtcDriver, get_driver};
66 66
67const THREAD_PENDER: usize = usize::MAX; 67const THREAD_PENDER: usize = usize::MAX;
68 68
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;
4 4
5use embassy_hal_internal::Peri; 5use embassy_hal_internal::Peri;
6 6
7use super::timer::Timer;
8#[cfg(not(any(lptim_v2a, lptim_v2b)))] 7#[cfg(not(any(lptim_v2a, lptim_v2b)))]
9use super::OutputPin; 8use super::OutputPin;
10#[cfg(any(lptim_v2a, lptim_v2b))] 9use super::timer::Timer;
11use super::{channel::Channel, timer::ChannelDirection, Channel1Pin, Channel2Pin};
12use super::{BasicInstance, Instance}; 10use super::{BasicInstance, Instance};
11#[cfg(any(lptim_v2a, lptim_v2b))]
12use super::{Channel1Pin, Channel2Pin, channel::Channel, timer::ChannelDirection};
13#[cfg(gpio_v2)] 13#[cfg(gpio_v2)]
14use crate::gpio::Pull; 14use crate::gpio::Pull;
15use crate::gpio::{AfType, AnyPin, OutputType, Speed}; 15use 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};
14use crate::gpio::{AfType, OutputType, Speed}; 14use crate::gpio::{AfType, OutputType, Speed};
15use crate::interrupt::typelevel::Interrupt; 15use crate::interrupt::typelevel::Interrupt;
16use crate::interrupt::{self}; 16use crate::interrupt::{self};
17use crate::{peripherals, rcc, Peri}; 17use crate::{Peri, peripherals, rcc};
18 18
19static LTDC_WAKER: AtomicWaker = AtomicWaker::new(); 19static LTDC_WAKER: AtomicWaker = AtomicWaker::new();
20 20
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 @@
3 3
4use embassy_hal_internal::PeripheralType; 4use embassy_hal_internal::PeripheralType;
5 5
6use crate::Peri;
6use crate::pac::opamp::vals::*; 7use crate::pac::opamp::vals::*;
7#[cfg(not(any(stm32g4, stm32f3)))] 8#[cfg(not(any(stm32g4, stm32f3)))]
8use crate::rcc::RccInfo; 9use crate::rcc::RccInfo;
9use crate::Peri;
10 10
11/// Performs a busy-wait delay for a specified number of microseconds. 11/// Performs a busy-wait delay for a specified number of microseconds.
12#[cfg(opamp_v5)] 12#[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;
12pub use enums::*; 12pub use enums::*;
13use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits}; 13use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits};
14 14
15use crate::dma::{word, ChannelAndRequest}; 15use crate::dma::{ChannelAndRequest, word};
16use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; 16use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed};
17use crate::mode::{Async, Blocking, Mode as PeriMode}; 17use crate::mode::{Async, Blocking, Mode as PeriMode};
18use crate::pac::octospi::{vals, Octospi as Regs}; 18use crate::pac::octospi::{Octospi as Regs, vals};
19#[cfg(octospim_v1)] 19#[cfg(octospim_v1)]
20use crate::pac::octospim::Octospim; 20use crate::pac::octospim::Octospim;
21use crate::rcc::{self, RccPeripheral}; 21use crate::rcc::{self, RccPeripheral};
22use crate::{peripherals, Peri}; 22use crate::{Peri, peripherals};
23 23
24/// OPSI driver config. 24/// OPSI driver config.
25#[derive(Clone, Copy)] 25#[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};
14use crate::mode::{Async, Blocking, Mode as PeriMode}; 14use crate::mode::{Async, Blocking, Mode as PeriMode};
15use crate::pac::quadspi::Quadspi as Regs; 15use crate::pac::quadspi::Quadspi as Regs;
16use crate::rcc::{self, RccPeripheral}; 16use crate::rcc::{self, RccPeripheral};
17use crate::{peripherals, Peri}; 17use crate::{Peri, peripherals};
18 18
19/// QSPI transfer configuration. 19/// QSPI transfer configuration.
20#[derive(Clone, Copy)] 20#[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 @@
1use core::sync::atomic::{compiler_fence, Ordering}; 1use core::sync::atomic::{Ordering, compiler_fence};
2 2
3use crate::pac::common::{Reg, RW}; 3use crate::pac::common::{RW, Reg};
4pub use crate::pac::rcc::vals::Rtcsel as RtcClockSource; 4pub use crate::pac::rcc::vals::Rtcsel as RtcClockSource;
5use crate::time::Hertz; 5use crate::time::Hertz;
6 6
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 @@
1use stm32_metapac::flash::vals::Latency; 1use stm32_metapac::flash::vals::Latency;
2 2
3#[cfg(any(stm32f4, stm32f7))]
4use crate::pac::PWR;
3#[cfg(any(stm32f413, stm32f423, stm32f412))] 5#[cfg(any(stm32f413, stm32f423, stm32f412))]
4pub use crate::pac::rcc::vals::Plli2ssrc as Plli2sSource; 6pub use crate::pac::rcc::vals::Plli2ssrc as Plli2sSource;
5pub use crate::pac::rcc::vals::{ 7pub use crate::pac::rcc::vals::{
6 Hpre as AHBPrescaler, Pllm as PllPreDiv, Plln as PllMul, Pllp as PllPDiv, Pllq as PllQDiv, Pllr as PllRDiv, 8 Hpre as AHBPrescaler, Pllm as PllPreDiv, Plln as PllMul, Pllp as PllPDiv, Pllq as PllQDiv, Pllr as PllRDiv,
7 Pllsrc as PllSource, Ppre as APBPrescaler, Sw as Sysclk, 9 Pllsrc as PllSource, Ppre as APBPrescaler, Sw as Sysclk,
8}; 10};
9#[cfg(any(stm32f4, stm32f7))]
10use crate::pac::PWR;
11use crate::pac::{FLASH, RCC}; 11use crate::pac::{FLASH, RCC};
12use crate::time::Hertz; 12use crate::time::Hertz;
13 13
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) {
597 Hertz(24_000_000) => Usbrefcksel::MHZ24, 597 Hertz(24_000_000) => Usbrefcksel::MHZ24,
598 Hertz(26_000_000) => Usbrefcksel::MHZ26, 598 Hertz(26_000_000) => Usbrefcksel::MHZ26,
599 Hertz(32_000_000) => Usbrefcksel::MHZ32, 599 Hertz(32_000_000) => Usbrefcksel::MHZ32,
600 _ => panic!("cannot select USBPHYC reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz", clk_val), 600 _ => panic!(
601 "cannot select USBPHYC reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz",
602 clk_val
603 ),
601 }, 604 },
602 None => Usbrefcksel::MHZ24, 605 None => Usbrefcksel::MHZ24,
603 }; 606 };
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::*;
499 499
500#[cfg(any(stm32l0, stm32l1))] 500#[cfg(any(stm32l0, stm32l1))]
501mod pll { 501mod pll {
502 use super::{pll_enable, PllInstance}; 502 use super::{PllInstance, pll_enable};
503 pub use crate::pac::rcc::vals::{Plldiv as PllDiv, Pllmul as PllMul, Pllsrc as PllSource};
504 use crate::pac::RCC; 503 use crate::pac::RCC;
504 pub use crate::pac::rcc::vals::{Plldiv as PllDiv, Pllmul as PllMul, Pllsrc as PllSource};
505 use crate::time::Hertz; 505 use crate::time::Hertz;
506 506
507 #[derive(Clone, Copy)] 507 #[derive(Clone, Copy)]
@@ -563,11 +563,11 @@ mod pll {
563 563
564#[cfg(any(stm32l4, stm32l5, stm32wb, stm32wl, stm32u0))] 564#[cfg(any(stm32l4, stm32l5, stm32wb, stm32wl, stm32u0))]
565mod pll { 565mod pll {
566 use super::{pll_enable, PllInstance}; 566 use super::{PllInstance, pll_enable};
567 use crate::pac::RCC;
567 pub use crate::pac::rcc::vals::{ 568 pub use crate::pac::rcc::vals::{
568 Pllm as PllPreDiv, Plln as PllMul, Pllp as PllPDiv, Pllq as PllQDiv, Pllr as PllRDiv, Pllsrc as PllSource, 569 Pllm as PllPreDiv, Plln as PllMul, Pllp as PllPDiv, Pllq as PllQDiv, Pllr as PllRDiv, Pllsrc as PllSource,
569 }; 570 };
570 use crate::pac::RCC;
571 use crate::time::Hertz; 571 use crate::time::Hertz;
572 572
573 #[derive(Clone, Copy)] 573 #[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;
3use embassy_hal_internal::PeripheralType; 3use embassy_hal_internal::PeripheralType;
4 4
5use crate::gpio::{AfType, OutputType, Speed}; 5use crate::gpio::{AfType, OutputType, Speed};
6use crate::pac::RCC;
6#[cfg(not(any(stm32f1, rcc_f0v1, rcc_f3v1, rcc_f37)))] 7#[cfg(not(any(stm32f1, rcc_f0v1, rcc_f3v1, rcc_f37)))]
7pub use crate::pac::rcc::vals::Mcopre as McoPrescaler; 8pub use crate::pac::rcc::vals::Mcopre as McoPrescaler;
8#[cfg(not(any( 9#[cfg(not(any(
@@ -31,8 +32,7 @@ pub use crate::pac::rcc::vals::Mcosel as McoSource;
31 rcc_h7rs 32 rcc_h7rs
32))] 33))]
33pub use crate::pac::rcc::vals::{Mco1sel as Mco1Source, Mco2sel as Mco2Source}; 34pub use crate::pac::rcc::vals::{Mco1sel as Mco1Source, Mco2sel as Mco2Source};
34use crate::pac::RCC; 35use crate::{Peri, peripherals};
35use crate::{peripherals, Peri};
36 36
37#[cfg(any(stm32f1, rcc_f0v1, rcc_f3v1, rcc_f37))] 37#[cfg(any(stm32f1, rcc_f0v1, rcc_f3v1, rcc_f37))]
38#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] 38#[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;
33pub use _version::*; 33pub use _version::*;
34use stm32_metapac::RCC; 34use stm32_metapac::RCC;
35 35
36pub use crate::_generated::{mux, Clocks}; 36pub use crate::_generated::{Clocks, mux};
37use crate::time::Hertz; 37use crate::time::Hertz;
38 38
39#[cfg(feature = "low-power")] 39#[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::{
6 Pllsrc as PllSource, Ppre as APBPrescaler, Sw as Sysclk, 6 Pllsrc as PllSource, Ppre as APBPrescaler, Sw as Sysclk,
7}; 7};
8use crate::pac::rcc::vals::{Hseext, Msipllfast, Msipllsel, Msirgsel, Pllmboost, Pllrge}; 8use crate::pac::rcc::vals::{Hseext, Msipllfast, Msipllsel, Msirgsel, Pllmboost, Pllrge};
9#[cfg(all(peri_usb_otg_hs))]
10pub use crate::pac::{syscfg::vals::Usbrefcksel, SYSCFG};
11use crate::pac::{FLASH, PWR, RCC}; 9use crate::pac::{FLASH, PWR, RCC};
10#[cfg(all(peri_usb_otg_hs))]
11pub use crate::pac::{SYSCFG, syscfg::vals::Usbrefcksel};
12use crate::rcc::LSI_FREQ; 12use crate::rcc::LSI_FREQ;
13use crate::time::Hertz; 13use crate::time::Hertz;
14 14
@@ -442,7 +442,10 @@ pub(crate) unsafe fn init(config: Config) {
442 Hertz(24_000_000) => Usbrefcksel::MHZ24, 442 Hertz(24_000_000) => Usbrefcksel::MHZ24,
443 Hertz(26_000_000) => Usbrefcksel::MHZ26, 443 Hertz(26_000_000) => Usbrefcksel::MHZ26,
444 Hertz(32_000_000) => Usbrefcksel::MHZ32, 444 Hertz(32_000_000) => Usbrefcksel::MHZ32,
445 _ => 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), 445 _ => panic!(
446 "cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz",
447 clk_val
448 ),
446 }, 449 },
447 None => Usbrefcksel::MHZ24, 450 None => Usbrefcksel::MHZ24,
448 }; 451 };
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::{
7 Hdiv5, Hpre as AHBPrescaler, Hpre5 as AHB5Prescaler, Hsepre as HsePrescaler, Plldiv as PllDiv, Pllm as PllPreDiv, 7 Hdiv5, Hpre as AHBPrescaler, Hpre5 as AHB5Prescaler, Hsepre as HsePrescaler, Plldiv as PllDiv, Pllm as PllPreDiv,
8 Plln as PllMul, Pllsrc as PllSource, Ppre as APBPrescaler, Sai1sel, Sw as Sysclk, 8 Plln as PllMul, Pllsrc as PllSource, Ppre as APBPrescaler, Sai1sel, Sw as Sysclk,
9}; 9};
10#[cfg(all(peri_usb_otg_hs))]
11pub use crate::pac::{syscfg::vals::Usbrefcksel, SYSCFG};
12use crate::pac::{FLASH, RCC}; 10use crate::pac::{FLASH, RCC};
11#[cfg(all(peri_usb_otg_hs))]
12pub use crate::pac::{SYSCFG, syscfg::vals::Usbrefcksel};
13use crate::rcc::LSI_FREQ; 13use crate::rcc::LSI_FREQ;
14use crate::time::Hertz; 14use crate::time::Hertz;
15 15
@@ -245,7 +245,10 @@ pub(crate) unsafe fn init(config: Config) {
245 Hertz(24_000_000) => Usbrefcksel::MHZ24, 245 Hertz(24_000_000) => Usbrefcksel::MHZ24,
246 Hertz(26_000_000) => Usbrefcksel::MHZ26, 246 Hertz(26_000_000) => Usbrefcksel::MHZ26,
247 Hertz(32_000_000) => Usbrefcksel::MHZ32, 247 Hertz(32_000_000) => Usbrefcksel::MHZ32,
248 _ => 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), 248 _ => panic!(
249 "cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz",
250 clk_val
251 ),
249 }, 252 },
250 None => Usbrefcksel::MHZ24, 253 None => Usbrefcksel::MHZ24,
251 }; 254 };
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;
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::interrupt::typelevel::Interrupt; 11use crate::interrupt::typelevel::Interrupt;
12use crate::{interrupt, pac, peripherals, rcc, Peri}; 12use crate::{Peri, interrupt, pac, peripherals, rcc};
13 13
14static RNG_WAKER: AtomicWaker = AtomicWaker::new(); 14static RNG_WAKER: AtomicWaker = AtomicWaker::new();
15 15
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 @@
1#[cfg(feature = "time")] 1#[cfg(feature = "time")]
2use embassy_time::{Duration, TICK_HZ}; 2use embassy_time::{Duration, TICK_HZ};
3 3
4use super::{bcd2_to_byte, DateTimeError, Rtc, RtcError}; 4use super::{DateTimeError, Rtc, RtcError, bcd2_to_byte};
5use crate::interrupt::typelevel::Interrupt; 5use crate::interrupt::typelevel::Interrupt;
6use crate::peripherals::RTC; 6use crate::peripherals::RTC;
7use crate::rtc::SealedInstance; 7use 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
@@ -8,12 +8,12 @@ mod low_power;
8use core::cell::Cell; 8use core::cell::Cell;
9 9
10#[cfg(feature = "low-power")] 10#[cfg(feature = "low-power")]
11use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
12#[cfg(feature = "low-power")]
13use embassy_sync::blocking_mutex::Mutex; 11use embassy_sync::blocking_mutex::Mutex;
12#[cfg(feature = "low-power")]
13use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
14 14
15use self::datetime::{day_of_week_from_u8, day_of_week_to_u8};
16pub use self::datetime::{DateTime, DayOfWeek, Error as DateTimeError}; 15pub use self::datetime::{DateTime, DayOfWeek, Error as DateTimeError};
16use self::datetime::{day_of_week_from_u8, day_of_week_to_u8};
17use crate::pac::rtc::regs::{Dr, Tr}; 17use crate::pac::rtc::regs::{Dr, Tr};
18use crate::time::Hertz; 18use crate::time::Hertz;
19 19
@@ -25,8 +25,8 @@ mod _version;
25#[allow(unused_imports)] 25#[allow(unused_imports)]
26pub use _version::*; 26pub use _version::*;
27 27
28use crate::peripherals::RTC;
29use crate::Peri; 28use crate::Peri;
29use crate::peripherals::RTC;
30 30
31/// Errors that can occur on methods on [RtcClock] 31/// Errors that can occur on methods on [RtcClock]
32#[non_exhaustive] 32#[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 @@
1use stm32_metapac::rtc::vals::{Calp, Calw16, Calw8, Fmt, Key, Osel, Pol, TampalrmType}; 1use stm32_metapac::rtc::vals::{Calp, Calw8, Calw16, Fmt, Key, Osel, Pol, TampalrmType};
2 2
3use super::RtcCalibrationCyclePeriod; 3use super::RtcCalibrationCyclePeriod;
4use crate::pac::rtc::Rtc; 4use 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;
6use embassy_hal_internal::PeripheralType; 6use embassy_hal_internal::PeripheralType;
7 7
8pub use crate::dma::word; 8pub use crate::dma::word;
9use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer}; 9use crate::dma::{Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer, ringbuffer};
10use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; 10use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed};
11pub use crate::pac::sai::vals::Mckdiv as MasterClockDivider; 11pub use crate::pac::sai::vals::Mckdiv as MasterClockDivider;
12use crate::pac::sai::{vals, Sai as Regs}; 12use crate::pac::sai::{Sai as Regs, vals};
13use crate::rcc::{self, RccPeripheral}; 13use crate::rcc::{self, RccPeripheral};
14use crate::{peripherals, Peri}; 14use crate::{Peri, peripherals};
15 15
16/// SAI error 16/// SAI error
17#[derive(Debug, PartialEq, Eq, Clone, Copy)] 17#[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;
11use embassy_hal_internal::{Peri, PeripheralType}; 11use embassy_hal_internal::{Peri, PeripheralType};
12use embassy_sync::waitqueue::AtomicWaker; 12use embassy_sync::waitqueue::AtomicWaker;
13use sdio_host::common_cmd::{self, Resp, ResponseLen}; 13use sdio_host::common_cmd::{self, Resp, ResponseLen};
14use sdio_host::emmc::{ExtCSD, EMMC}; 14use sdio_host::emmc::{EMMC, ExtCSD};
15use sdio_host::sd::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatus, CIC, CID, CSD, OCR, RCA, SCR, SD}; 15use sdio_host::sd::{BusWidth, CIC, CID, CSD, CardCapacity, CardStatus, CurrentState, OCR, RCA, SCR, SD, SDStatus};
16use sdio_host::{emmc_cmd, sd_cmd, Cmd}; 16use sdio_host::{Cmd, emmc_cmd, sd_cmd};
17 17
18#[cfg(sdmmc_v1)] 18#[cfg(sdmmc_v1)]
19use crate::dma::ChannelAndRequest; 19use 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 _};
13use crate::interrupt::typelevel::Interrupt; 13use crate::interrupt::typelevel::Interrupt;
14use crate::pac::spdifrx::Spdifrx as Regs; 14use crate::pac::spdifrx::Spdifrx as Regs;
15use crate::rcc::{RccInfo, SealedRccPeripheral}; 15use crate::rcc::{RccInfo, SealedRccPeripheral};
16use crate::{interrupt, peripherals, Peri}; 16use crate::{Peri, interrupt, peripherals};
17 17
18/// Possible S/PDIF preamble types. 18/// Possible S/PDIF preamble types.
19#[allow(dead_code)] 19#[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;
6 6
7use embassy_embedded_hal::SetConfig; 7use embassy_embedded_hal::SetConfig;
8use embassy_futures::join::join; 8use embassy_futures::join::join;
9pub use embedded_hal_02::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; 9pub use embedded_hal_02::spi::{MODE_0, MODE_1, MODE_2, MODE_3, Mode, Phase, Polarity};
10 10
11use crate::dma::{word, ChannelAndRequest}; 11use crate::Peri;
12use crate::dma::{ChannelAndRequest, word};
12use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; 13use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed};
13use crate::mode::{Async, Blocking, Mode as PeriMode}; 14use crate::mode::{Async, Blocking, Mode as PeriMode};
14use crate::pac::spi::{regs, vals, Spi as Regs}; 15use crate::pac::spi::{Spi as Regs, regs, vals};
15use crate::rcc::{RccInfo, SealedRccPeripheral}; 16use crate::rcc::{RccInfo, SealedRccPeripheral};
16use crate::time::Hertz; 17use crate::time::Hertz;
17use crate::Peri;
18 18
19/// SPI error. 19/// SPI error.
20#[derive(Debug, PartialEq, Eq, Clone, Copy)] 20#[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 @@
1#![allow(non_snake_case)] 1#![allow(non_snake_case)]
2 2
3use core::cell::{Cell, RefCell}; 3use core::cell::{Cell, RefCell};
4use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; 4use core::sync::atomic::{AtomicU32, Ordering, compiler_fence};
5 5
6use critical_section::CriticalSection; 6use critical_section::CriticalSection;
7use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
8use embassy_sync::blocking_mutex::Mutex; 7use embassy_sync::blocking_mutex::Mutex;
8use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
9use embassy_time_driver::{Driver, TICK_HZ}; 9use embassy_time_driver::{Driver, TICK_HZ};
10use embassy_time_queue_utils::Queue; 10use embassy_time_queue_utils::Queue;
11use stm32_metapac::timer::{regs, TimGp16}; 11use stm32_metapac::timer::{TimGp16, regs};
12 12
13use crate::interrupt::typelevel::Interrupt; 13use crate::interrupt::typelevel::Interrupt;
14use crate::pac::timer::vals; 14use 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};
7use super::low_level::{CountingMode, OutputPolarity, Timer}; 7use super::low_level::{CountingMode, OutputPolarity, Timer};
8use super::simple_pwm::PwmPin; 8use super::simple_pwm::PwmPin;
9use super::{AdvancedInstance4Channel, Ch1, Ch2, Ch3, Ch4, Channel, TimerComplementaryPin}; 9use super::{AdvancedInstance4Channel, Ch1, Ch2, Ch3, Ch4, Channel, TimerComplementaryPin};
10use crate::Peri;
10use crate::gpio::{AnyPin, OutputType}; 11use crate::gpio::{AnyPin, OutputType};
11use crate::time::Hertz; 12use crate::time::Hertz;
12use crate::timer::low_level::OutputCompareMode;
13use crate::timer::TimerChannel; 13use crate::timer::TimerChannel;
14use crate::Peri; 14use crate::timer::low_level::OutputCompareMode;
15 15
16/// Complementary PWM pin wrapper. 16/// Complementary PWM pin wrapper.
17/// 17///
@@ -388,7 +388,7 @@ fn compute_dead_time_value(value: u16) -> (Ckd, u8) {
388 388
389#[cfg(test)] 389#[cfg(test)]
390mod tests { 390mod tests {
391 use super::{compute_dead_time_value, Ckd}; 391 use super::{Ckd, compute_dead_time_value};
392 392
393 #[test] 393 #[test]
394 fn test_compute_dead_time_value() { 394 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};
8use super::low_level::{CountingMode, FilterValue, InputCaptureMode, InputTISelection, Timer}; 8use super::low_level::{CountingMode, FilterValue, InputCaptureMode, InputTISelection, Timer};
9use super::{CaptureCompareInterruptHandler, Channel, GeneralInstance4Channel, TimerPin}; 9use super::{CaptureCompareInterruptHandler, Channel, GeneralInstance4Channel, TimerPin};
10pub use super::{Ch1, Ch2, Ch3, Ch4}; 10pub use super::{Ch1, Ch2, Ch3, Ch4};
11use crate::Peri;
11use crate::gpio::{AfType, AnyPin, Pull}; 12use crate::gpio::{AfType, AnyPin, Pull};
12use crate::interrupt::typelevel::{Binding, Interrupt}; 13use crate::interrupt::typelevel::{Binding, Interrupt};
13use crate::time::Hertz; 14use crate::time::Hertz;
14use crate::timer::TimerChannel; 15use crate::timer::TimerChannel;
15use crate::Peri;
16 16
17/// Capture pin wrapper. 17/// Capture pin wrapper.
18/// 18///
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::{
11}; 11};
12use super::{CaptureCompareInterruptHandler, Channel, ExternalTriggerPin, GeneralInstance4Channel, TimerPin}; 12use super::{CaptureCompareInterruptHandler, Channel, ExternalTriggerPin, GeneralInstance4Channel, TimerPin};
13pub use super::{Ch1, Ch2}; 13pub use super::{Ch1, Ch2};
14use crate::Peri;
14use crate::gpio::{AfType, AnyPin, Pull}; 15use crate::gpio::{AfType, AnyPin, Pull};
15use crate::interrupt::typelevel::{Binding, Interrupt}; 16use crate::interrupt::typelevel::{Binding, Interrupt};
16use crate::pac::timer::vals::Etp; 17use crate::pac::timer::vals::Etp;
17use crate::time::Hertz; 18use crate::time::Hertz;
18use crate::timer::TimerChannel; 19use crate::timer::TimerChannel;
19use crate::Peri;
20 20
21/// External input marker type. 21/// External input marker type.
22pub enum Ext {} 22pub 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 @@
2 2
3use super::low_level::{CountingMode, InputCaptureMode, InputTISelection, SlaveMode, Timer, TriggerSource}; 3use super::low_level::{CountingMode, InputCaptureMode, InputTISelection, SlaveMode, Timer, TriggerSource};
4use super::{Ch1, Ch2, Channel, GeneralInstance4Channel, TimerPin}; 4use super::{Ch1, Ch2, Channel, GeneralInstance4Channel, TimerPin};
5use crate::Peri;
5use crate::gpio::{AfType, Pull}; 6use crate::gpio::{AfType, Pull};
6use crate::time::Hertz; 7use crate::time::Hertz;
7use crate::Peri;
8 8
9/// PWM Input driver. 9/// PWM Input driver.
10/// 10///
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};
5use super::low_level::Timer; 5use super::low_level::Timer;
6pub use super::{Ch1, Ch2}; 6pub use super::{Ch1, Ch2};
7use super::{GeneralInstance4Channel, TimerPin}; 7use super::{GeneralInstance4Channel, TimerPin};
8use crate::Peri;
8use crate::gpio::{AfType, AnyPin, Pull}; 9use crate::gpio::{AfType, AnyPin, Pull};
9use crate::timer::TimerChannel; 10use crate::timer::TimerChannel;
10use crate::Peri;
11 11
12/// Qei driver config. 12/// Qei driver config.
13#[cfg_attr(feature = "defmt", derive(defmt::Format))] 13#[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;
5 5
6use super::low_level::{CountingMode, OutputCompareMode, OutputPolarity, Timer}; 6use super::low_level::{CountingMode, OutputCompareMode, OutputPolarity, Timer};
7use super::{Ch1, Ch2, Ch3, Ch4, Channel, GeneralInstance4Channel, TimerBits, TimerChannel, TimerPin}; 7use super::{Ch1, Ch2, Ch3, Ch4, Channel, GeneralInstance4Channel, TimerBits, TimerChannel, TimerPin};
8use crate::Peri;
8#[cfg(gpio_v2)] 9#[cfg(gpio_v2)]
9use crate::gpio::Pull; 10use crate::gpio::Pull;
10use crate::gpio::{AfType, AnyPin, OutputType, Speed}; 11use crate::gpio::{AfType, AnyPin, OutputType, Speed};
11use crate::time::Hertz; 12use crate::time::Hertz;
12use crate::Peri;
13 13
14/// PWM pin wrapper. 14/// PWM pin wrapper.
15/// 15///
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 @@
1use super::TSC_NUM_GROUPS;
1use super::io_pin::*; 2use super::io_pin::*;
2#[cfg(any(tsc_v2, tsc_v3))] 3#[cfg(any(tsc_v2, tsc_v3))]
3use super::pin_groups::G7; 4use super::pin_groups::G7;
4#[cfg(tsc_v3)] 5#[cfg(tsc_v3)]
5use super::pin_groups::G8; 6use super::pin_groups::G8;
6use super::pin_groups::{pin_roles, G1, G2, G3, G4, G5, G6}; 7use super::pin_groups::{G1, G2, G3, G4, G5, G6, pin_roles};
7use super::types::{Group, GroupStatus}; 8use super::types::{Group, GroupStatus};
8use super::TSC_NUM_GROUPS;
9 9
10/// Represents a collection of TSC (Touch Sensing Controller) pins for an acquisition bank. 10/// Represents a collection of TSC (Touch Sensing Controller) pins for an acquisition bank.
11/// 11///
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 @@
1use core::marker::PhantomData; 1use core::marker::PhantomData;
2use core::ops::BitOr; 2use core::ops::BitOr;
3 3
4use super::Instance;
4use super::errors::GroupError; 5use super::errors::GroupError;
5use super::io_pin::*; 6use super::io_pin::*;
6use super::Instance;
7use crate::gpio::{AfType, AnyPin, OutputType, Speed};
8use crate::Peri; 7use crate::Peri;
8use crate::gpio::{AfType, AnyPin, OutputType, Speed};
9 9
10/// Pin type definition to control IO parameters 10/// Pin type definition to control IO parameters
11#[derive(PartialEq, Clone, Copy)] 11#[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;
19use core::sync::atomic::{AtomicBool, Ordering}; 19use core::sync::atomic::{AtomicBool, Ordering};
20use core::task::Poll; 20use core::task::Poll;
21 21
22use embassy_hal_internal::drop::OnDrop;
23use embassy_hal_internal::PeripheralType; 22use embassy_hal_internal::PeripheralType;
23use embassy_hal_internal::drop::OnDrop;
24use embassy_sync::waitqueue::AtomicWaker; 24use embassy_sync::waitqueue::AtomicWaker;
25 25
26use crate::dma::{ChannelAndRequest, TransferOptions}; 26use crate::dma::{ChannelAndRequest, TransferOptions};
@@ -28,7 +28,7 @@ use crate::interrupt::typelevel::Interrupt;
28use crate::pac::ucpd::vals::{Anamode, Ccenable, PscUsbpdclk, Txmode}; 28use crate::pac::ucpd::vals::{Anamode, Ccenable, PscUsbpdclk, Txmode};
29pub use crate::pac::ucpd::vals::{Phyccsel as CcSel, Rxordset, TypecVstateCc as CcVState}; 29pub use crate::pac::ucpd::vals::{Phyccsel as CcSel, Rxordset, TypecVstateCc as CcVState};
30use crate::rcc::{self, RccPeripheral}; 30use crate::rcc::{self, RccPeripheral};
31use crate::{interrupt, Peri}; 31use crate::{Peri, interrupt};
32 32
33pub(crate) fn init( 33pub(crate) fn init(
34 _cs: critical_section::CriticalSection, 34 _cs: critical_section::CriticalSection,
diff --git a/embassy-stm32/src/uid.rs b/embassy-stm32/src/uid.rs
index 5e38532bd..2d3e2b972 100644
--- a/embassy-stm32/src/uid.rs
+++ b/embassy-stm32/src/uid.rs
@@ -1,8 +1,8 @@
1//! Unique ID (UID) 1//! Unique ID (UID)
2 2
3/// Get this device's unique 96-bit ID. 3/// Get this device's unique 96-bit ID.
4pub fn uid() -> &'static [u8; 12] { 4pub fn uid() -> [u8; 12] {
5 unsafe { &*crate::pac::UID.uid(0).as_ptr().cast::<[u8; 12]>() } 5 unsafe { *crate::pac::UID.uid(0).as_ptr().cast::<[u8; 12]>() }
6} 6}
7 7
8/// Get this device's unique 96-bit ID, encoded into a string of 24 hexadecimal ASCII digits. 8/// Get this device's unique 96-bit ID, encoded into a string of 24 hexadecimal ASCII digits.
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};
5use core::task::Poll; 5use core::task::Poll;
6 6
7use embassy_embedded_hal::SetConfig; 7use embassy_embedded_hal::SetConfig;
8use embassy_hal_internal::atomic_ring_buffer::RingBuffer;
9use embassy_hal_internal::Peri; 8use embassy_hal_internal::Peri;
9use embassy_hal_internal::atomic_ring_buffer::RingBuffer;
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
11 11
12#[cfg(not(any(usart_v1, usart_v2)))] 12#[cfg(not(any(usart_v1, usart_v2)))]
13use super::DePin; 13use super::DePin;
14use super::{ 14use super::{
15 Config, ConfigError, CtsPin, Duplex, Error, HalfDuplexReadback, Info, Instance, Regs, RtsPin, RxPin, TxPin,
15 clear_interrupt_flags, configure, half_duplex_set_rx_tx_before_write, rdr, reconfigure, send_break, set_baudrate, 16 clear_interrupt_flags, configure, half_duplex_set_rx_tx_before_write, rdr, reconfigure, send_break, set_baudrate,
16 sr, tdr, Config, ConfigError, CtsPin, Duplex, Error, HalfDuplexReadback, Info, Instance, Regs, RtsPin, RxPin, 17 sr, tdr,
17 TxPin,
18}; 18};
19use crate::gpio::{AfType, AnyPin, Pull, SealedPin as _}; 19use crate::gpio::{AfType, AnyPin, Pull, SealedPin as _};
20use crate::interrupt::{self, InterruptExt}; 20use 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 @@
4 4
5use core::future::poll_fn; 5use core::future::poll_fn;
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::sync::atomic::{compiler_fence, AtomicU8, AtomicUsize, Ordering}; 7use core::sync::atomic::{AtomicU8, AtomicUsize, Ordering, compiler_fence};
8use core::task::Poll; 8use core::task::Poll;
9 9
10use embassy_embedded_hal::SetConfig; 10use embassy_embedded_hal::SetConfig;
11use embassy_hal_internal::drop::OnDrop;
12use embassy_hal_internal::PeripheralType; 11use embassy_hal_internal::PeripheralType;
12use embassy_hal_internal::drop::OnDrop;
13use embassy_sync::waitqueue::AtomicWaker; 13use embassy_sync::waitqueue::AtomicWaker;
14use futures_util::future::{select, Either}; 14use futures_util::future::{Either, select};
15 15
16use crate::Peri;
16use crate::dma::ChannelAndRequest; 17use crate::dma::ChannelAndRequest;
17use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; 18use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed};
18use crate::interrupt::typelevel::Interrupt as _; 19use crate::interrupt::typelevel::Interrupt as _;
@@ -25,7 +26,6 @@ use crate::pac::usart::Usart as Regs;
25use crate::pac::usart::{regs, vals}; 26use crate::pac::usart::{regs, vals};
26use crate::rcc::{RccInfo, SealedRccPeripheral}; 27use crate::rcc::{RccInfo, SealedRccPeripheral};
27use crate::time::Hertz; 28use crate::time::Hertz;
28use crate::Peri;
29 29
30/// Interrupt handler. 30/// Interrupt handler.
31pub struct InterruptHandler<T: Instance> { 31pub struct InterruptHandler<T: Instance> {
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 @@
1use core::future::poll_fn; 1use core::future::poll_fn;
2use core::mem; 2use core::mem;
3use core::sync::atomic::{compiler_fence, Ordering}; 3use core::sync::atomic::{Ordering, compiler_fence};
4use core::task::Poll; 4use core::task::Poll;
5 5
6use embassy_embedded_hal::SetConfig; 6use embassy_embedded_hal::SetConfig;
7use embedded_io_async::ReadReady; 7use embedded_io_async::ReadReady;
8use futures_util::future::{select, Either}; 8use futures_util::future::{Either, select};
9 9
10use super::{rdr, reconfigure, set_baudrate, sr, Config, ConfigError, Error, Info, State, UartRx}; 10use super::{Config, ConfigError, Error, Info, State, UartRx, rdr, reconfigure, set_baudrate, sr};
11use crate::Peri;
11use crate::dma::ReadableRingBuffer; 12use crate::dma::ReadableRingBuffer;
12use crate::gpio::{AnyPin, SealedPin as _}; 13use crate::gpio::{AnyPin, SealedPin as _};
13use crate::mode::Async; 14use crate::mode::Async;
14use crate::time::Hertz; 15use crate::time::Hertz;
15use crate::usart::Regs; 16use crate::usart::Regs;
16use crate::Peri;
17 17
18/// Rx-only Ring-buffered UART Driver 18/// Rx-only Ring-buffered UART Driver
19/// 19///
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;
2 2
3use embassy_hal_internal::PeripheralType; 3use embassy_hal_internal::PeripheralType;
4use embassy_usb_driver::{EndpointAddress, EndpointAllocError, EndpointType, Event, Unsupported}; 4use embassy_usb_driver::{EndpointAddress, EndpointAllocError, EndpointType, Event, Unsupported};
5use embassy_usb_synopsys_otg::otg_v1::vals::Dspd;
6use embassy_usb_synopsys_otg::otg_v1::Otg;
7pub use embassy_usb_synopsys_otg::Config; 5pub use embassy_usb_synopsys_otg::Config;
6use embassy_usb_synopsys_otg::otg_v1::Otg;
7use embassy_usb_synopsys_otg::otg_v1::vals::Dspd;
8use embassy_usb_synopsys_otg::{ 8use embassy_usb_synopsys_otg::{
9 on_interrupt as on_interrupt_impl, Bus as OtgBus, ControlPipe, Driver as OtgDriver, Endpoint, In, OtgInstance, Out, 9 Bus as OtgBus, ControlPipe, Driver as OtgDriver, Endpoint, In, OtgInstance, Out, PhyType, State,
10 PhyType, State, 10 on_interrupt as on_interrupt_impl,
11}; 11};
12 12
13use crate::gpio::{AfType, OutputType, Speed}; 13use crate::gpio::{AfType, OutputType, Speed};
14use crate::interrupt::typelevel::Interrupt; 14use crate::interrupt::typelevel::Interrupt;
15use crate::rcc::{self, RccPeripheral}; 15use crate::rcc::{self, RccPeripheral};
16use crate::{interrupt, Peri}; 16use crate::{Peri, interrupt};
17 17
18const MAX_EP_COUNT: usize = 9; 18const MAX_EP_COUNT: usize = 9;
19 19
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::{
12 Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointInfo, EndpointType, Event, Unsupported, 12 Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointInfo, EndpointType, Event, Unsupported,
13}; 13};
14 14
15use crate::pac::USBRAM;
15use crate::pac::usb::regs; 16use crate::pac::usb::regs;
16use crate::pac::usb::vals::{EpType, Stat}; 17use crate::pac::usb::vals::{EpType, Stat};
17use crate::pac::USBRAM;
18use crate::rcc::RccPeripheral; 18use crate::rcc::RccPeripheral;
19use crate::{interrupt, Peri}; 19use crate::{Peri, interrupt};
20 20
21/// Interrupt handler. 21/// Interrupt handler.
22pub struct InterruptHandler<T: Instance> { 22pub struct InterruptHandler<T: Instance> {
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> {
62 } 62 }
63 trace!( 63 trace!(
64 "Vrefbuf configured with voltage scale {} and impedance mode {}", 64 "Vrefbuf configured with voltage scale {} and impedance mode {}",
65 voltage_scale as u8, 65 voltage_scale as u8, impedance_mode as u8,
66 impedance_mode as u8,
67 ); 66 );
68 VoltageReferenceBuffer { vrefbuf: PhantomData } 67 VoltageReferenceBuffer { vrefbuf: PhantomData }
69 } 68 }
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;
4use embassy_hal_internal::PeripheralType; 4use embassy_hal_internal::PeripheralType;
5use stm32_metapac::iwdg::vals::{Key, Pr}; 5use stm32_metapac::iwdg::vals::{Key, Pr};
6 6
7use crate::rcc::LSI_FREQ;
8use crate::Peri; 7use crate::Peri;
8use crate::rcc::LSI_FREQ;
9 9
10/// Independent watchdog (IWDG) driver. 10/// Independent watchdog (IWDG) driver.
11pub struct IndependentWatchdog<'d, T: Instance> { 11pub 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};
11use embassy_hal_internal::PeripheralType; 11use embassy_hal_internal::PeripheralType;
12pub use enums::*; 12pub use enums::*;
13 13
14use crate::dma::{word, ChannelAndRequest}; 14use crate::dma::{ChannelAndRequest, word};
15use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; 15use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed};
16use crate::mode::{Async, Blocking, Mode as PeriMode}; 16use crate::mode::{Async, Blocking, Mode as PeriMode};
17use crate::pac::xspi::vals::*;
18use crate::pac::xspi::Xspi as Regs; 17use crate::pac::xspi::Xspi as Regs;
18use crate::pac::xspi::vals::*;
19#[cfg(xspim_v1)] 19#[cfg(xspim_v1)]
20use crate::pac::xspim::Xspim; 20use crate::pac::xspim::Xspim;
21use crate::rcc::{self, RccPeripheral}; 21use crate::rcc::{self, RccPeripheral};
22use crate::{peripherals, Peri}; 22use crate::{Peri, peripherals};
23 23
24/// XPSI driver config. 24/// XPSI driver config.
25#[derive(Clone, Copy)] 25#[derive(Clone, Copy)]
diff --git a/embassy-sync/Cargo.toml b/embassy-sync/Cargo.toml
index 64d76baba..0c28cec7d 100644
--- a/embassy-sync/Cargo.toml
+++ b/embassy-sync/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-sync" 2name = "embassy-sync"
3version = "0.7.2" 3version = "0.7.2"
4edition = "2021" 4edition = "2024"
5description = "no-std, no-alloc synchronization primitives with async support" 5description = "no-std, no-alloc synchronization primitives with async support"
6repository = "https://github.com/embassy-rs/embassy" 6repository = "https://github.com/embassy-rs/embassy"
7documentation = "https://docs.embassy.dev/embassy-sync" 7documentation = "https://docs.embassy.dev/embassy-sync"
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};
50 50
51use heapless::Deque; 51use heapless::Deque;
52 52
53use crate::blocking_mutex::raw::RawMutex;
54use crate::blocking_mutex::Mutex; 53use crate::blocking_mutex::Mutex;
54use crate::blocking_mutex::raw::RawMutex;
55use crate::waitqueue::WakerRegistration; 55use crate::waitqueue::WakerRegistration;
56 56
57/// Send-only access to a [`Channel`]. 57/// Send-only access to a [`Channel`].
@@ -1112,11 +1112,13 @@ mod tests {
1112 static CHANNEL: StaticCell<Channel<CriticalSectionRawMutex, u32, 3>> = StaticCell::new(); 1112 static CHANNEL: StaticCell<Channel<CriticalSectionRawMutex, u32, 3>> = StaticCell::new();
1113 let c = &*CHANNEL.init(Channel::new()); 1113 let c = &*CHANNEL.init(Channel::new());
1114 let c2 = c; 1114 let c2 = c;
1115 assert!(executor 1115 assert!(
1116 .spawn(async move { 1116 executor
1117 assert!(c2.try_send(1).is_ok()); 1117 .spawn(async move {
1118 }) 1118 assert!(c2.try_send(1).is_ok());
1119 .is_ok()); 1119 })
1120 .is_ok()
1121 );
1120 assert_eq!(c.receive().await, 1); 1122 assert_eq!(c.receive().await, 1);
1121 } 1123 }
1122 1124
@@ -1143,13 +1145,15 @@ mod tests {
1143 // However, I've used the debugger to observe that the send does indeed wait. 1145 // However, I've used the debugger to observe that the send does indeed wait.
1144 Delay::new(Duration::from_millis(500)).await; 1146 Delay::new(Duration::from_millis(500)).await;
1145 assert_eq!(c.receive().await, 1); 1147 assert_eq!(c.receive().await, 1);
1146 assert!(executor 1148 assert!(
1147 .spawn(async move { 1149 executor
1148 loop { 1150 .spawn(async move {
1149 c.receive().await; 1151 loop {
1150 } 1152 c.receive().await;
1151 }) 1153 }
1152 .is_ok()); 1154 })
1155 .is_ok()
1156 );
1153 send_task_1.unwrap().await; 1157 send_task_1.unwrap().await;
1154 send_task_2.unwrap().await; 1158 send_task_2.unwrap().await;
1155 } 1159 }
diff --git a/embassy-sync/src/lib.rs b/embassy-sync/src/lib.rs
index 5d91b4d9c..1cfde8b10 100644
--- a/embassy-sync/src/lib.rs
+++ b/embassy-sync/src/lib.rs
@@ -1,6 +1,7 @@
1#![cfg_attr(not(feature = "std"), no_std)] 1#![cfg_attr(not(feature = "std"), no_std)]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(clippy::new_without_default)] 3#![allow(clippy::new_without_default)]
4#![allow(unsafe_op_in_unsafe_fn)]
4#![doc = include_str!("../README.md")] 5#![doc = include_str!("../README.md")]
5#![warn(missing_docs)] 6#![warn(missing_docs)]
6 7
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 @@
2//! 2//!
3//! This module provides a mutex that can be used to synchronize data between asynchronous tasks. 3//! This module provides a mutex that can be used to synchronize data between asynchronous tasks.
4use core::cell::{RefCell, UnsafeCell}; 4use core::cell::{RefCell, UnsafeCell};
5use core::future::{poll_fn, Future}; 5use core::future::{Future, poll_fn};
6use core::ops::{Deref, DerefMut}; 6use core::ops::{Deref, DerefMut};
7use core::task::Poll; 7use core::task::Poll;
8use core::{fmt, mem}; 8use core::{fmt, mem};
9 9
10use crate::blocking_mutex::raw::RawMutex;
11use crate::blocking_mutex::Mutex as BlockingMutex; 10use crate::blocking_mutex::Mutex as BlockingMutex;
11use crate::blocking_mutex::raw::RawMutex;
12use crate::waitqueue::WakerRegistration; 12use crate::waitqueue::WakerRegistration;
13 13
14/// Error returned by [`Mutex::try_lock`] 14/// 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 @@
2 2
3use core::cell::Cell; 3use core::cell::Cell;
4use core::fmt::{Debug, Formatter}; 4use core::fmt::{Debug, Formatter};
5use core::future::{poll_fn, Future}; 5use core::future::{Future, poll_fn};
6use core::mem::MaybeUninit; 6use core::mem::MaybeUninit;
7use core::sync::atomic::{AtomicBool, Ordering}; 7use core::sync::atomic::{AtomicBool, Ordering};
8use core::task::Poll; 8use 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;
7use core::pin::Pin; 7use core::pin::Pin;
8use core::task::{Context, Poll}; 8use core::task::{Context, Poll};
9 9
10use crate::blocking_mutex::raw::RawMutex;
11use crate::blocking_mutex::Mutex; 10use crate::blocking_mutex::Mutex;
11use crate::blocking_mutex::raw::RawMutex;
12use crate::ring_buffer::RingBuffer; 12use crate::ring_buffer::RingBuffer;
13use crate::waitqueue::WakerRegistration; 13use crate::waitqueue::WakerRegistration;
14 14
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;
8use core::pin::Pin; 8use core::pin::Pin;
9use core::task::{Context, Poll}; 9use core::task::{Context, Poll};
10 10
11pub use heapless::binary_heap::{Kind, Max, Min};
12use heapless::BinaryHeap; 11use heapless::BinaryHeap;
12pub use heapless::binary_heap::{Kind, Max, Min};
13 13
14use crate::blocking_mutex::raw::RawMutex;
15use crate::blocking_mutex::Mutex; 14use crate::blocking_mutex::Mutex;
15use crate::blocking_mutex::raw::RawMutex;
16use crate::channel::{DynamicChannel, DynamicReceiver, DynamicSender, TryReceiveError, TrySendError}; 16use crate::channel::{DynamicChannel, DynamicReceiver, DynamicSender, TryReceiveError, TrySendError};
17use crate::waitqueue::WakerRegistration; 17use crate::waitqueue::WakerRegistration;
18 18
@@ -799,11 +799,13 @@ mod tests {
799 static CHANNEL: StaticCell<PriorityChannel<CriticalSectionRawMutex, u32, Max, 3>> = StaticCell::new(); 799 static CHANNEL: StaticCell<PriorityChannel<CriticalSectionRawMutex, u32, Max, 3>> = StaticCell::new();
800 let c = &*CHANNEL.init(PriorityChannel::new()); 800 let c = &*CHANNEL.init(PriorityChannel::new());
801 let c2 = c; 801 let c2 = c;
802 assert!(executor 802 assert!(
803 .spawn(async move { 803 executor
804 assert!(c2.try_send(1).is_ok()); 804 .spawn(async move {
805 }) 805 assert!(c2.try_send(1).is_ok());
806 .is_ok()); 806 })
807 .is_ok()
808 );
807 assert_eq!(c.receive().await, 1); 809 assert_eq!(c.receive().await, 1);
808 } 810 }
809 811
@@ -830,13 +832,15 @@ mod tests {
830 // However, I've used the debugger to observe that the send does indeed wait. 832 // However, I've used the debugger to observe that the send does indeed wait.
831 Delay::new(Duration::from_millis(500)).await; 833 Delay::new(Duration::from_millis(500)).await;
832 assert_eq!(c.receive().await, 1); 834 assert_eq!(c.receive().await, 1);
833 assert!(executor 835 assert!(
834 .spawn(async move { 836 executor
835 loop { 837 .spawn(async move {
836 c.receive().await; 838 loop {
837 } 839 c.receive().await;
838 }) 840 }
839 .is_ok()); 841 })
842 .is_ok()
843 );
840 send_task_1.unwrap().await; 844 send_task_1.unwrap().await;
841 send_task_2.unwrap().await; 845 send_task_2.unwrap().await;
842 } 846 }
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;
10 10
11use self::publisher::{ImmediatePub, Pub}; 11use self::publisher::{ImmediatePub, Pub};
12use self::subscriber::Sub; 12use self::subscriber::Sub;
13use crate::blocking_mutex::raw::RawMutex;
14use crate::blocking_mutex::Mutex; 13use crate::blocking_mutex::Mutex;
14use crate::blocking_mutex::raw::RawMutex;
15use crate::waitqueue::MultiWakerRegistration; 15use crate::waitqueue::MultiWakerRegistration;
16 16
17pub mod publisher; 17pub 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<const N: usize> RingBuffer<N> {
95 95
96 fn wrap(&self, n: usize) -> usize { 96 fn wrap(&self, n: usize) -> usize {
97 assert!(n <= N); 97 assert!(n <= N);
98 if n == N { 98 if n == N { 0 } else { n }
99 0
100 } else {
101 n
102 }
103 } 99 }
104} 100}
105 101
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 @@
3//! This module provides a read-write lock that can be used to synchronize data between asynchronous tasks. 3//! This module provides a read-write lock that can be used to synchronize data between asynchronous tasks.
4use core::cell::{RefCell, UnsafeCell}; 4use core::cell::{RefCell, UnsafeCell};
5use core::fmt; 5use core::fmt;
6use core::future::{poll_fn, Future}; 6use core::future::{Future, poll_fn};
7use core::ops::{Deref, DerefMut}; 7use core::ops::{Deref, DerefMut};
8use core::task::Poll; 8use core::task::Poll;
9 9
10use crate::blocking_mutex::raw::RawMutex;
11use crate::blocking_mutex::Mutex as BlockingMutex; 10use crate::blocking_mutex::Mutex as BlockingMutex;
11use crate::blocking_mutex::raw::RawMutex;
12use crate::waitqueue::WakerRegistration; 12use crate::waitqueue::WakerRegistration;
13 13
14/// Error returned by [`RwLock::try_read`] and [`RwLock::try_write`] when the lock is already held. 14/// 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 @@
1//! A synchronization primitive for controlling access to a pool of resources. 1//! A synchronization primitive for controlling access to a pool of resources.
2use core::cell::{Cell, RefCell}; 2use core::cell::{Cell, RefCell};
3use core::convert::Infallible; 3use core::convert::Infallible;
4use core::future::{poll_fn, Future}; 4use core::future::{Future, poll_fn};
5use core::task::{Poll, Waker}; 5use core::task::{Poll, Waker};
6 6
7use heapless::Deque; 7use heapless::Deque;
8 8
9use crate::blocking_mutex::raw::RawMutex;
10use crate::blocking_mutex::Mutex; 9use crate::blocking_mutex::Mutex;
10use crate::blocking_mutex::raw::RawMutex;
11use crate::waitqueue::WakerRegistration; 11use crate::waitqueue::WakerRegistration;
12 12
13/// An asynchronous semaphore. 13/// 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 @@
1//! A synchronization primitive for passing the latest value to a task. 1//! A synchronization primitive for passing the latest value to a task.
2use core::cell::Cell; 2use core::cell::Cell;
3use core::future::{poll_fn, Future}; 3use core::future::{Future, poll_fn};
4use core::task::{Context, Poll, Waker}; 4use core::task::{Context, Poll, Waker};
5 5
6use crate::blocking_mutex::raw::RawMutex;
7use crate::blocking_mutex::Mutex; 6use crate::blocking_mutex::Mutex;
7use crate::blocking_mutex::raw::RawMutex;
8 8
9/// Single-slot signaling primitive for a _single_ consumer. 9/// Single-slot signaling primitive for a _single_ consumer.
10/// 10///
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 @@
1use core::cell::Cell; 1use core::cell::Cell;
2use core::task::Waker; 2use core::task::Waker;
3 3
4use crate::blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex};
5use crate::blocking_mutex::Mutex; 4use crate::blocking_mutex::Mutex;
5use crate::blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex};
6 6
7/// Utility struct to register and wake a waker. 7/// Utility struct to register and wake a waker.
8/// If a waker is registered, registering another waker will replace the previous one without waking it. 8/// 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 @@
1//! A synchronization primitive for passing the latest value to **multiple** receivers. 1//! A synchronization primitive for passing the latest value to **multiple** receivers.
2 2
3use core::cell::RefCell; 3use core::cell::RefCell;
4use core::future::{poll_fn, Future}; 4use core::future::{Future, poll_fn};
5use core::marker::PhantomData; 5use core::marker::PhantomData;
6use core::ops::{Deref, DerefMut}; 6use core::ops::{Deref, DerefMut};
7use core::task::{Context, Poll}; 7use core::task::{Context, Poll};
8 8
9use crate::blocking_mutex::raw::RawMutex;
10use crate::blocking_mutex::Mutex; 9use crate::blocking_mutex::Mutex;
10use crate::blocking_mutex::raw::RawMutex;
11use crate::waitqueue::MultiWakerRegistration; 11use crate::waitqueue::MultiWakerRegistration;
12 12
13/// The `Watch` is a single-slot signaling primitive that allows _multiple_ (`N`) receivers to concurrently await 13/// 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 @@
15//! another message will result in an error being returned. 15//! another message will result in an error being returned.
16 16
17use core::cell::RefCell; 17use core::cell::RefCell;
18use core::future::{poll_fn, Future}; 18use core::future::{Future, poll_fn};
19use core::marker::PhantomData; 19use core::marker::PhantomData;
20use core::task::{Context, Poll}; 20use core::task::{Context, Poll};
21 21
22use crate::blocking_mutex::raw::RawMutex;
23use crate::blocking_mutex::Mutex; 22use crate::blocking_mutex::Mutex;
23use crate::blocking_mutex::raw::RawMutex;
24use crate::waitqueue::WakerRegistration; 24use crate::waitqueue::WakerRegistration;
25 25
26/// A bounded zero-copy channel for communicating between asynchronous tasks 26/// A bounded zero-copy channel for communicating between asynchronous tasks
@@ -296,11 +296,7 @@ struct State {
296 296
297impl State { 297impl State {
298 fn increment(&self, i: usize) -> usize { 298 fn increment(&self, i: usize) -> usize {
299 if i + 1 == self.capacity { 299 if i + 1 == self.capacity { 0 } else { i + 1 }
300 0
301 } else {
302 i + 1
303 }
304 } 300 }
305 301
306 fn clear(&mut self) { 302 fn clear(&mut self) {
diff --git a/embassy-time-driver/Cargo.toml b/embassy-time-driver/Cargo.toml
index 56ef3d15f..a52e82433 100644
--- a/embassy-time-driver/Cargo.toml
+++ b/embassy-time-driver/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-time-driver" 2name = "embassy-time-driver"
3version = "0.2.1" 3version = "0.2.1"
4edition = "2021" 4edition = "2024"
5description = "Driver trait for embassy-time" 5description = "Driver trait for embassy-time"
6repository = "https://github.com/embassy-rs/embassy" 6repository = "https://github.com/embassy-rs/embassy"
7documentation = "https://docs.embassy.dev/embassy-time-driver" 7documentation = "https://docs.embassy.dev/embassy-time-driver"
diff --git a/embassy-time-driver/src/lib.rs b/embassy-time-driver/src/lib.rs
index 44d9a156a..f3e8e0153 100644
--- a/embassy-time-driver/src/lib.rs
+++ b/embassy-time-driver/src/lib.rs
@@ -89,7 +89,7 @@
89//! Instead of the usual "trait + generic params" approach, calls from embassy to the driver are done via `extern` functions. 89//! Instead of the usual "trait + generic params" approach, calls from embassy to the driver are done via `extern` functions.
90//! 90//!
91//! `embassy` internally defines the driver function as `extern "Rust" { fn _embassy_time_now() -> u64; }` and calls it. 91//! `embassy` internally defines the driver function as `extern "Rust" { fn _embassy_time_now() -> u64; }` and calls it.
92//! The driver crate defines the function as `#[no_mangle] fn _embassy_time_now() -> u64`. The linker will resolve the 92//! The driver crate defines the function as `#[unsafe(no_mangle)] fn _embassy_time_now() -> u64`. The linker will resolve the
93//! calls from the `embassy` crate to call into the driver crate. 93//! calls from the `embassy` crate to call into the driver crate.
94//! 94//!
95//! If there is none or multiple drivers in the crate tree, linking will fail. 95//! If there is none or multiple drivers in the crate tree, linking will fail.
@@ -133,7 +133,7 @@ pub trait Driver: Send + Sync + 'static {
133 fn schedule_wake(&self, at: u64, waker: &Waker); 133 fn schedule_wake(&self, at: u64, waker: &Waker);
134} 134}
135 135
136extern "Rust" { 136unsafe extern "Rust" {
137 fn _embassy_time_now() -> u64; 137 fn _embassy_time_now() -> u64;
138 fn _embassy_time_schedule_wake(at: u64, waker: &Waker); 138 fn _embassy_time_schedule_wake(at: u64, waker: &Waker);
139} 139}
@@ -158,13 +158,13 @@ macro_rules! time_driver_impl {
158 (static $name:ident: $t: ty = $val:expr) => { 158 (static $name:ident: $t: ty = $val:expr) => {
159 static $name: $t = $val; 159 static $name: $t = $val;
160 160
161 #[no_mangle] 161 #[unsafe(no_mangle)]
162 #[inline] 162 #[inline]
163 fn _embassy_time_now() -> u64 { 163 fn _embassy_time_now() -> u64 {
164 <$t as $crate::Driver>::now(&$name) 164 <$t as $crate::Driver>::now(&$name)
165 } 165 }
166 166
167 #[no_mangle] 167 #[unsafe(no_mangle)]
168 #[inline] 168 #[inline]
169 fn _embassy_time_schedule_wake(at: u64, waker: &core::task::Waker) { 169 fn _embassy_time_schedule_wake(at: u64, waker: &core::task::Waker) {
170 <$t as $crate::Driver>::schedule_wake(&$name, at, waker); 170 <$t as $crate::Driver>::schedule_wake(&$name, at, waker);
diff --git a/embassy-time-queue-utils/Cargo.toml b/embassy-time-queue-utils/Cargo.toml
index 13da62874..8da30c544 100644
--- a/embassy-time-queue-utils/Cargo.toml
+++ b/embassy-time-queue-utils/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-time-queue-utils" 2name = "embassy-time-queue-utils"
3version = "0.3.0" 3version = "0.3.0"
4edition = "2021" 4edition = "2024"
5description = "Timer queue driver trait for embassy-time" 5description = "Timer queue driver trait for embassy-time"
6repository = "https://github.com/embassy-rs/embassy" 6repository = "https://github.com/embassy-rs/embassy"
7documentation = "https://docs.embassy.dev/embassy-time-queue-utils" 7documentation = "https://docs.embassy.dev/embassy-time-queue-utils"
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 @@
2//! 2//!
3//! Time queue drivers may use this to simplify their implementation. 3//! Time queue drivers may use this to simplify their implementation.
4 4
5use core::cmp::{min, Ordering}; 5use core::cmp::{Ordering, min};
6use core::task::Waker; 6use core::task::Waker;
7 7
8use heapless::Vec; 8use heapless::Vec;
diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml
index bad6ecf97..05614dbf5 100644
--- a/embassy-time/Cargo.toml
+++ b/embassy-time/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-time" 2name = "embassy-time"
3version = "0.5.0" 3version = "0.5.0"
4edition = "2021" 4edition = "2024"
5description = "Instant and Duration for embedded no-std systems, with async timer support" 5description = "Instant and Duration for embedded no-std systems, with async timer support"
6repository = "https://github.com/embassy-rs/embassy" 6repository = "https://github.com/embassy-rs/embassy"
7documentation = "https://docs.embassy.dev/embassy-time" 7documentation = "https://docs.embassy.dev/embassy-time"
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 {
175 /// NOTE: Giving this function a hz >= the TICK_HZ of your platform will clamp the Duration to 1 175 /// NOTE: Giving this function a hz >= the TICK_HZ of your platform will clamp the Duration to 1
176 /// tick. Doing so will not deadlock, but will certainly not produce the desired output. 176 /// tick. Doing so will not deadlock, but will certainly not produce the desired output.
177 pub const fn from_hz(hz: u64) -> Duration { 177 pub const fn from_hz(hz: u64) -> Duration {
178 let ticks = { 178 let ticks = { if hz >= TICK_HZ { 1 } else { (TICK_HZ + hz / 2) / hz } };
179 if hz >= TICK_HZ {
180 1
181 } else {
182 (TICK_HZ + hz / 2) / hz
183 }
184 };
185 Duration { ticks } 179 Duration { ticks }
186 } 180 }
187 181
diff --git a/embassy-time/src/lib.rs b/embassy-time/src/lib.rs
index 77f4b344d..e375fe93e 100644
--- a/embassy-time/src/lib.rs
+++ b/embassy-time/src/lib.rs
@@ -1,5 +1,6 @@
1#![cfg_attr(not(any(feature = "std", feature = "wasm", test)), no_std)] 1#![cfg_attr(not(any(feature = "std", feature = "wasm", test)), no_std)]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4#![allow(clippy::new_without_default)] 5#![allow(clippy::new_without_default)]
5#![warn(missing_docs)] 6#![warn(missing_docs)]
@@ -27,18 +28,14 @@ mod driver_std;
27#[cfg(feature = "wasm")] 28#[cfg(feature = "wasm")]
28mod driver_wasm; 29mod driver_wasm;
29 30
30pub use delay::{block_for, Delay}; 31pub use delay::{Delay, block_for};
31pub use duration::Duration; 32pub use duration::Duration;
32pub use embassy_time_driver::TICK_HZ; 33pub use embassy_time_driver::TICK_HZ;
33pub use instant::Instant; 34pub use instant::Instant;
34pub use timer::{with_deadline, with_timeout, Ticker, TimeoutError, Timer, WithTimeout}; 35pub use timer::{Ticker, TimeoutError, Timer, WithTimeout, with_deadline, with_timeout};
35 36
36const fn gcd(a: u64, b: u64) -> u64 { 37const fn gcd(a: u64, b: u64) -> u64 {
37 if b == 0 { 38 if b == 0 { a } else { gcd(b, a % b) }
38 a
39 } else {
40 gcd(b, a % b)
41 }
42} 39}
43 40
44pub(crate) const GCD_1K: u64 = gcd(TICK_HZ, 1_000); 41pub(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 @@
1use core::future::{poll_fn, Future}; 1use core::future::{Future, poll_fn};
2use core::pin::Pin; 2use core::pin::Pin;
3use core::task::{Context, Poll}; 3use core::task::{Context, Poll};
4 4
5use futures_core::stream::FusedStream;
6use futures_core::Stream; 5use futures_core::Stream;
6use futures_core::stream::FusedStream;
7 7
8use crate::{Duration, Instant}; 8use crate::{Duration, Instant};
9 9
diff --git a/embassy-usb-dfu/Cargo.toml b/embassy-usb-dfu/Cargo.toml
index e70ab970e..8b32582c0 100644
--- a/embassy-usb-dfu/Cargo.toml
+++ b/embassy-usb-dfu/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-usb-dfu" 3name = "embassy-usb-dfu"
4version = "0.2.0" 4version = "0.2.0"
5description = "An implementation of the USB DFU 1.1 protocol, using embassy-boot" 5description = "An implementation of the USB DFU 1.1 protocol, using embassy-boot"
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;
6use embassy_usb::{Builder, FunctionBuilder, Handler}; 6use embassy_usb::{Builder, FunctionBuilder, Handler};
7use embedded_storage::nor_flash::NorFlash; 7use embedded_storage::nor_flash::NorFlash;
8 8
9use crate::Reset;
9use crate::consts::{ 10use crate::consts::{
10 DfuAttributes, Request, State, Status, APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_RT, 11 APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_RT, DfuAttributes, Request, State, Status,
11 USB_CLASS_APPN_SPEC, 12 USB_CLASS_APPN_SPEC,
12}; 13};
13use crate::Reset;
14 14
15/// Generic interface for a system that can signal to the bootloader that USB DFU mode is needed on the next boot. 15/// Generic interface for a system that can signal to the bootloader that USB DFU mode is needed on the next boot.
16/// 16///
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;
5use embassy_usb::{Builder, FunctionBuilder, Handler}; 5use embassy_usb::{Builder, FunctionBuilder, Handler};
6use embedded_storage::nor_flash::{NorFlash, NorFlashErrorKind}; 6use embedded_storage::nor_flash::{NorFlash, NorFlashErrorKind};
7 7
8use crate::Reset;
8use crate::consts::{ 9use crate::consts::{
9 DfuAttributes, Request, State, Status, APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_DFU, 10 APPN_SPEC_SUBCLASS_DFU, DESC_DFU_FUNCTIONAL, DFU_PROTOCOL_DFU, DfuAttributes, Request, State, Status,
10 USB_CLASS_APPN_SPEC, 11 USB_CLASS_APPN_SPEC,
11}; 12};
12use crate::Reset;
13 13
14/// Internal state for USB DFU 14/// Internal state for USB DFU
15pub struct Control<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> { 15pub struct Control<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> {
diff --git a/embassy-usb-driver/Cargo.toml b/embassy-usb-driver/Cargo.toml
index 6e4c31273..3f43f60a3 100644
--- a/embassy-usb-driver/Cargo.toml
+++ b/embassy-usb-driver/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-usb-driver" 2name = "embassy-usb-driver"
3version = "0.2.0" 3version = "0.2.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Driver trait for `embassy-usb`, an async USB device stack for embedded devices." 6description = "Driver trait for `embassy-usb`, an async USB device stack for embedded devices."
7keywords = ["embedded", "async", "usb", "hal", "embedded-hal"] 7keywords = ["embedded", "async", "usb", "hal", "embedded-hal"]
diff --git a/embassy-usb-driver/src/lib.rs b/embassy-usb-driver/src/lib.rs
index 59845a268..f19e0a401 100644
--- a/embassy-usb-driver/src/lib.rs
+++ b/embassy-usb-driver/src/lib.rs
@@ -1,5 +1,6 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4#![warn(missing_docs)] 5#![warn(missing_docs)]
5 6
diff --git a/embassy-usb-logger/Cargo.toml b/embassy-usb-logger/Cargo.toml
index 6d13653bf..683821759 100644
--- a/embassy-usb-logger/Cargo.toml
+++ b/embassy-usb-logger/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-usb-logger" 2name = "embassy-usb-logger"
3version = "0.5.1" 3version = "0.5.1"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "`log` implementation for USB serial using `embassy-usb`." 6description = "`log` implementation for USB serial using `embassy-usb`."
7keywords = ["embedded", "log", "usb", "hal", "serial"] 7keywords = ["embedded", "log", "usb", "hal", "serial"]
diff --git a/embassy-usb-synopsys-otg/Cargo.toml b/embassy-usb-synopsys-otg/Cargo.toml
index 61b14a215..eca68095d 100644
--- a/embassy-usb-synopsys-otg/Cargo.toml
+++ b/embassy-usb-synopsys-otg/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-usb-synopsys-otg" 2name = "embassy-usb-synopsys-otg"
3version = "0.3.1" 3version = "0.3.1"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "`embassy-usb-driver` implementation for Synopsys OTG USB controllers" 6description = "`embassy-usb-driver` implementation for Synopsys OTG USB controllers"
7keywords = ["embedded", "async", "usb", "hal", "embedded-hal"] 7keywords = ["embedded", "async", "usb", "hal", "embedded-hal"]
diff --git a/embassy-usb-synopsys-otg/src/lib.rs b/embassy-usb-synopsys-otg/src/lib.rs
index 6b4a87bdf..d94209f45 100644
--- a/embassy-usb-synopsys-otg/src/lib.rs
+++ b/embassy-usb-synopsys-otg/src/lib.rs
@@ -1,5 +1,6 @@
1#![cfg_attr(not(test), no_std)] 1#![cfg_attr(not(test), no_std)]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4#![warn(missing_docs)] 5#![warn(missing_docs)]
5 6
@@ -22,7 +23,7 @@ use crate::fmt::Bytes;
22 23
23pub mod otg_v1; 24pub mod otg_v1;
24 25
25use otg_v1::{regs, vals, Otg}; 26use otg_v1::{Otg, regs, vals};
26 27
27/// Handle interrupts. 28/// Handle interrupts.
28pub unsafe fn on_interrupt<const MAX_EP_COUNT: usize>(r: Otg, state: &State<MAX_EP_COUNT>, ep_count: usize) { 29pub unsafe fn on_interrupt<const MAX_EP_COUNT: usize>(r: Otg, state: &State<MAX_EP_COUNT>, ep_count: usize) {
@@ -679,9 +680,7 @@ impl<'d, const MAX_EP_COUNT: usize> Bus<'d, MAX_EP_COUNT> {
679 if let Some(ep) = self.ep_in[i] { 680 if let Some(ep) = self.ep_in[i] {
680 trace!( 681 trace!(
681 "configuring tx fifo ep={}, offset={}, size={}", 682 "configuring tx fifo ep={}, offset={}, size={}",
682 i, 683 i, fifo_top, ep.fifo_size_words
683 fifo_top,
684 ep.fifo_size_words
685 ); 684 );
686 685
687 let dieptxf = if i == 0 { regs.dieptxf0() } else { regs.dieptxf(i - 1) }; 686 let dieptxf = if i == 0 { regs.dieptxf0() } else { regs.dieptxf(i - 1) };
@@ -1158,9 +1157,7 @@ impl<'d> embassy_usb_driver::EndpointIn for Endpoint<'d, In> {
1158 let dtxfsts = self.regs.dtxfsts(index).read(); 1157 let dtxfsts = self.regs.dtxfsts(index).read();
1159 trace!( 1158 trace!(
1160 "write ep={:?}: diepctl {:08x} ftxfsts {:08x}", 1159 "write ep={:?}: diepctl {:08x} ftxfsts {:08x}",
1161 self.info.addr, 1160 self.info.addr, diepctl.0, dtxfsts.0
1162 diepctl.0,
1163 dtxfsts.0
1164 ); 1161 );
1165 if !diepctl.usbaep() { 1162 if !diepctl.usbaep() {
1166 trace!("write ep={:?} wait for prev: error disabled", self.info.addr); 1163 trace!("write ep={:?} wait for prev: error disabled", self.info.addr);
@@ -1375,11 +1372,7 @@ fn ep_irq_mask(eps: &[Option<EndpointData>]) -> u16 {
1375 eps.iter().enumerate().fold( 1372 eps.iter().enumerate().fold(
1376 0, 1373 0,
1377 |mask, (index, ep)| { 1374 |mask, (index, ep)| {
1378 if ep.is_some() { 1375 if ep.is_some() { mask | (1 << index) } else { mask }
1379 mask | (1 << index)
1380 } else {
1381 mask
1382 }
1383 }, 1376 },
1384 ) 1377 )
1385} 1378}
diff --git a/embassy-usb/Cargo.toml b/embassy-usb/Cargo.toml
index bff48c4a6..aeb7392f1 100644
--- a/embassy-usb/Cargo.toml
+++ b/embassy-usb/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-usb" 2name = "embassy-usb"
3version = "0.5.1" 3version = "0.5.1"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Async USB device stack for embedded devices in Rust." 6description = "Async USB device stack for embedded devices in Rust."
7keywords = ["embedded", "async", "usb", "hal", "embedded-hal"] 7keywords = ["embedded", "async", "usb", "hal", "embedded-hal"]
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
5use crate::driver::{Driver, Endpoint, EndpointAddress, EndpointInfo, EndpointType}; 5use crate::driver::{Driver, Endpoint, EndpointAddress, EndpointInfo, EndpointType};
6use crate::msos::{DeviceLevelDescriptor, FunctionLevelDescriptor, MsOsDescriptorWriter}; 6use crate::msos::{DeviceLevelDescriptor, FunctionLevelDescriptor, MsOsDescriptorWriter};
7use crate::types::{InterfaceNumber, StringIndex}; 7use crate::types::{InterfaceNumber, StringIndex};
8use crate::{Handler, Interface, UsbDevice, MAX_INTERFACE_COUNT, STRING_INDEX_CUSTOM_START}; 8use crate::{Handler, Interface, MAX_INTERFACE_COUNT, STRING_INDEX_CUSTOM_START, UsbDevice};
9 9
10#[derive(Debug, Copy, Clone)] 10#[derive(Debug, Copy, Clone)]
11#[cfg_attr(feature = "defmt", derive(defmt::Format))] 11#[cfg_attr(feature = "defmt", derive(defmt::Format))]
@@ -176,7 +176,9 @@ impl<'d, D: Driver<'d>> Builder<'d, D> {
176 if config.composite_with_iads 176 if config.composite_with_iads
177 && (config.device_class != 0xEF || config.device_sub_class != 0x02 || config.device_protocol != 0x01) 177 && (config.device_class != 0xEF || config.device_sub_class != 0x02 || config.device_protocol != 0x01)
178 { 178 {
179 panic!("if composite_with_iads is set, you must set device_class = 0xEF, device_sub_class = 0x02, device_protocol = 0x01"); 179 panic!(
180 "if composite_with_iads is set, you must set device_class = 0xEF, device_sub_class = 0x02, device_protocol = 0x01"
181 );
180 } 182 }
181 183
182 assert!( 184 assert!(
@@ -337,7 +339,8 @@ impl<'a, 'd, D: Driver<'d>> FunctionBuilder<'a, 'd, D> {
337 num_alt_settings: 0, 339 num_alt_settings: 0,
338 }; 340 };
339 341
340 assert!(self.builder.interfaces.push(iface).is_ok(), 342 assert!(
343 self.builder.interfaces.push(iface).is_ok(),
341 "embassy-usb: interface list full. Increase the `max_interface_count` compile-time setting. Current value: {}", 344 "embassy-usb: interface list full. Increase the `max_interface_count` compile-time setting. Current value: {}",
342 MAX_INTERFACE_COUNT 345 MAX_INTERFACE_COUNT
343 ); 346 );
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 @@
1//! CDC-ACM class implementation, aka Serial over USB. 1//! CDC-ACM class implementation, aka Serial over USB.
2 2
3use core::cell::{Cell, RefCell}; 3use core::cell::{Cell, RefCell};
4use core::future::{poll_fn, Future}; 4use core::future::{Future, poll_fn};
5use core::mem::{self, MaybeUninit}; 5use core::mem::{self, MaybeUninit};
6use core::sync::atomic::{AtomicBool, Ordering}; 6use core::sync::atomic::{AtomicBool, Ordering};
7use core::task::Poll; 7use 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 @@
1//! [`embassy-net`](https://crates.io/crates/embassy-net) driver for the CDC-NCM class. 1//! [`embassy-net`](https://crates.io/crates/embassy-net) driver for the CDC-NCM class.
2 2
3use embassy_futures::select::{select, Either}; 3use embassy_futures::select::{Either, select};
4use embassy_net_driver_channel as ch; 4use embassy_net_driver_channel as ch;
5use embassy_net_driver_channel::driver::LinkState; 5use embassy_net_driver_channel::driver::LinkState;
6use embassy_usb_driver::Driver; 6use 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 @@
14//! This is due to regex spaghetti: <https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-mainline-12.0.0_r84/core/res/res/values/config.xml#417> 14//! This is due to regex spaghetti: <https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-mainline-12.0.0_r84/core/res/res/values/config.xml#417>
15//! and this nonsense in the linux kernel: <https://github.com/torvalds/linux/blob/c00c5e1d157bec0ef0b0b59aa5482eb8dc7e8e49/drivers/net/usb/usbnet.c#L1751-L1757> 15//! and this nonsense in the linux kernel: <https://github.com/torvalds/linux/blob/c00c5e1d157bec0ef0b0b59aa5482eb8dc7e8e49/drivers/net/usb/usbnet.c#L1751-L1757>
16 16
17use core::mem::{size_of, MaybeUninit}; 17use core::mem::{MaybeUninit, size_of};
18use core::ptr::{addr_of, copy_nonoverlapping}; 18use core::ptr::{addr_of, copy_nonoverlapping};
19 19
20use crate::control::{self, InResponse, OutResponse, Recipient, Request, RequestType}; 20use 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;
4 4
5use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; 5use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
6use crate::types::StringIndex; 6use crate::types::StringIndex;
7use crate::{msos, Builder, Handler}; 7use crate::{Builder, Handler, msos};
8 8
9/// State for the CMSIS-DAP v2 USB class. 9/// State for the CMSIS-DAP v2 USB class.
10pub struct State { 10pub 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 @@
1//! MIDI class implementation. 1//! MIDI class implementation.
2 2
3use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
4use crate::Builder; 3use crate::Builder;
4use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
5 5
6/// This should be used as `device_class` when building the `UsbDevice`. 6/// This should be used as `device_class` when building the `UsbDevice`.
7pub const USB_AUDIO_CLASS: u8 = 0x01; 7pub 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 @@
11//! The class provides volume and mute controls for each channel. 11//! The class provides volume and mute controls for each channel.
12 12
13use core::cell::{Cell, RefCell}; 13use core::cell::{Cell, RefCell};
14use core::future::{poll_fn, Future}; 14use core::future::{Future, poll_fn};
15use core::marker::PhantomData; 15use core::marker::PhantomData;
16use core::sync::atomic::{AtomicBool, AtomicU32, Ordering}; 16use core::sync::atomic::{AtomicBool, AtomicU32, Ordering};
17use core::task::Poll; 17use core::task::Poll;
@@ -22,7 +22,7 @@ use heapless::Vec;
22 22
23use super::class_codes::*; 23use super::class_codes::*;
24use super::terminal_type::TerminalType; 24use super::terminal_type::TerminalType;
25use super::{Channel, ChannelConfig, FeedbackRefresh, SampleWidth, MAX_AUDIO_CHANNEL_COUNT, MAX_AUDIO_CHANNEL_INDEX}; 25use super::{Channel, ChannelConfig, FeedbackRefresh, MAX_AUDIO_CHANNEL_COUNT, MAX_AUDIO_CHANNEL_INDEX, SampleWidth};
26use crate::control::{self, InResponse, OutResponse, Recipient, Request, RequestType}; 26use crate::control::{self, InResponse, OutResponse, Recipient, Request, RequestType};
27use crate::descriptor::{SynchronizationType, UsageType}; 27use crate::descriptor::{SynchronizationType, UsageType};
28use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut, EndpointType}; 28use 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 @@
1//! Utilities for writing USB descriptors. 1//! Utilities for writing USB descriptors.
2use embassy_usb_driver::EndpointType; 2use embassy_usb_driver::EndpointType;
3 3
4use crate::CONFIGURATION_VALUE;
4use crate::builder::Config; 5use crate::builder::Config;
5use crate::driver::EndpointInfo; 6use crate::driver::EndpointInfo;
6use crate::types::{InterfaceNumber, StringIndex}; 7use crate::types::{InterfaceNumber, StringIndex};
7use crate::CONFIGURATION_VALUE;
8 8
9/// Standard descriptor types 9/// Standard descriptor types
10#[allow(missing_docs)] 10#[allow(missing_docs)]
diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs
index 0638fd0a2..0c10c08df 100644
--- a/embassy-usb/src/lib.rs
+++ b/embassy-usb/src/lib.rs
@@ -1,4 +1,5 @@
1#![no_std] 1#![no_std]
2#![allow(unsafe_op_in_unsafe_fn)]
2#![doc = include_str!("../README.md")] 3#![doc = include_str!("../README.md")]
3#![warn(missing_docs)] 4#![warn(missing_docs)]
4 5
@@ -20,7 +21,7 @@ mod config {
20 include!(concat!(env!("OUT_DIR"), "/config.rs")); 21 include!(concat!(env!("OUT_DIR"), "/config.rs"));
21} 22}
22 23
23use embassy_futures::select::{select, Either}; 24use embassy_futures::select::{Either, select};
24use heapless::Vec; 25use heapless::Vec;
25 26
26pub use crate::builder::{Builder, Config, FunctionBuilder, InterfaceAltBuilder, InterfaceBuilder, UsbVersion}; 27pub 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 @@
4 4
5use core::mem::size_of; 5use core::mem::size_of;
6 6
7use crate::descriptor::{capability_type, BosWriter}; 7use crate::descriptor::{BosWriter, capability_type};
8use crate::types::InterfaceNumber; 8use crate::types::InterfaceNumber;
9 9
10/// A serialized Microsoft OS 2.0 Descriptor set. 10/// A serialized Microsoft OS 2.0 Descriptor set.
diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml
index f5f89ecb5..55053bc33 100644
--- a/examples/boot/application/nrf/Cargo.toml
+++ b/examples/boot/application/nrf/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-nrf-examples" 3name = "embassy-boot-nrf-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/rp/Cargo.toml b/examples/boot/application/rp/Cargo.toml
index d86386b00..70a2c28c3 100644
--- a/examples/boot/application/rp/Cargo.toml
+++ b/examples/boot/application/rp/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-rp-examples" 3name = "embassy-boot-rp-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/stm32f3/Cargo.toml b/examples/boot/application/stm32f3/Cargo.toml
index cd5f422fc..2dc75d939 100644
--- a/examples/boot/application/stm32f3/Cargo.toml
+++ b/examples/boot/application/stm32f3/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32f3-examples" 3name = "embassy-boot-stm32f3-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml
index c3921a166..5c372fb19 100644
--- a/examples/boot/application/stm32f7/Cargo.toml
+++ b/examples/boot/application/stm32f7/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32f7-examples" 3name = "embassy-boot-stm32f7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/stm32h7/Cargo.toml b/examples/boot/application/stm32h7/Cargo.toml
index ca186d4d9..641a2ba96 100644
--- a/examples/boot/application/stm32h7/Cargo.toml
+++ b/examples/boot/application/stm32h7/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32h7-examples" 3name = "embassy-boot-stm32h7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/stm32l0/Cargo.toml b/examples/boot/application/stm32l0/Cargo.toml
index be08956f1..4a168be15 100644
--- a/examples/boot/application/stm32l0/Cargo.toml
+++ b/examples/boot/application/stm32l0/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32l0-examples" 3name = "embassy-boot-stm32l0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/stm32l1/Cargo.toml b/examples/boot/application/stm32l1/Cargo.toml
index 207eed733..af2cb3881 100644
--- a/examples/boot/application/stm32l1/Cargo.toml
+++ b/examples/boot/application/stm32l1/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32l1-examples" 3name = "embassy-boot-stm32l1-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/stm32l4/Cargo.toml b/examples/boot/application/stm32l4/Cargo.toml
index 22b9642d8..032e934aa 100644
--- a/examples/boot/application/stm32l4/Cargo.toml
+++ b/examples/boot/application/stm32l4/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32l4-examples" 3name = "embassy-boot-stm32l4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/boot/application/stm32wb-dfu/Cargo.toml b/examples/boot/application/stm32wb-dfu/Cargo.toml
index e2be4f470..ea4c26681 100644
--- a/examples/boot/application/stm32wb-dfu/Cargo.toml
+++ b/examples/boot/application/stm32wb-dfu/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32wb-dfu-examples" 3name = "embassy-boot-stm32wb-dfu-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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};
13use embassy_stm32::{bind_interrupts, peripherals}; 13use embassy_stm32::{bind_interrupts, peripherals};
14use embassy_sync::blocking_mutex::Mutex; 14use embassy_sync::blocking_mutex::Mutex;
15use embassy_time::Duration; 15use embassy_time::Duration;
16use embassy_usb::{msos, Builder}; 16use embassy_usb::{Builder, msos};
17use embassy_usb_dfu::consts::DfuAttributes; 17use embassy_usb_dfu::consts::DfuAttributes;
18use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; 18use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu};
19use panic_reset as _; 19use panic_reset as _;
20 20
21bind_interrupts!(struct Irqs { 21bind_interrupts!(struct Irqs {
diff --git a/examples/boot/application/stm32wba-dfu/Cargo.toml b/examples/boot/application/stm32wba-dfu/Cargo.toml
index 6f4213b2c..d6f7dc3b6 100644
--- a/examples/boot/application/stm32wba-dfu/Cargo.toml
+++ b/examples/boot/application/stm32wba-dfu/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32wba-dfu-examples" 3name = "embassy-boot-stm32wba-dfu-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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};
12use embassy_stm32::{bind_interrupts, peripherals}; 12use embassy_stm32::{bind_interrupts, peripherals};
13use embassy_sync::blocking_mutex::Mutex; 13use embassy_sync::blocking_mutex::Mutex;
14use embassy_time::Duration; 14use embassy_time::Duration;
15use embassy_usb::{msos, Builder}; 15use embassy_usb::{Builder, msos};
16use embassy_usb_dfu::consts::DfuAttributes; 16use embassy_usb_dfu::consts::DfuAttributes;
17use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; 17use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu};
18use panic_reset as _; 18use panic_reset as _;
19 19
20bind_interrupts!(struct Irqs { 20bind_interrupts!(struct Irqs {
diff --git a/examples/boot/application/stm32wl/Cargo.toml b/examples/boot/application/stm32wl/Cargo.toml
index 8d1446ba9..c7fa811c9 100644
--- a/examples/boot/application/stm32wl/Cargo.toml
+++ b/examples/boot/application/stm32wl/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot-stm32wl-examples" 3name = "embassy-boot-stm32wl-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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::*;
8use embassy_boot_stm32::{AlignedBuffer, FirmwareUpdater, FirmwareUpdaterConfig}; 8use embassy_boot_stm32::{AlignedBuffer, FirmwareUpdater, FirmwareUpdaterConfig};
9use embassy_embedded_hal::adapter::BlockingAsync; 9use embassy_embedded_hal::adapter::BlockingAsync;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_stm32::SharedData;
11use embassy_stm32::exti::ExtiInput; 12use embassy_stm32::exti::ExtiInput;
12use embassy_stm32::flash::{Flash, WRITE_SIZE}; 13use embassy_stm32::flash::{Flash, WRITE_SIZE};
13use embassy_stm32::gpio::{Level, Output, Pull, Speed}; 14use embassy_stm32::gpio::{Level, Output, Pull, Speed};
14use embassy_stm32::SharedData;
15use embassy_sync::mutex::Mutex; 15use embassy_sync::mutex::Mutex;
16use panic_reset as _; 16use panic_reset as _;
17 17
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;
6#[cfg(feature = "defmt")] 6#[cfg(feature = "defmt")]
7use defmt_rtt::*; 7use defmt_rtt::*;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_stm32::gpio::{Level, Output, Speed};
10use embassy_stm32::SharedData; 9use embassy_stm32::SharedData;
10use embassy_stm32::gpio::{Level, Output, Speed};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use panic_reset as _; 12use panic_reset as _;
13 13
diff --git a/examples/boot/bootloader/nrf/Cargo.toml b/examples/boot/bootloader/nrf/Cargo.toml
index 72b7114d4..1fea2b7d7 100644
--- a/examples/boot/bootloader/nrf/Cargo.toml
+++ b/examples/boot/bootloader/nrf/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "nrf-bootloader-example" 3name = "nrf-bootloader-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Bootloader for nRF chips" 5description = "Bootloader for nRF chips"
diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs
index b849a0df3..76c4c1048 100644
--- a/examples/boot/bootloader/nrf/src/main.rs
+++ b/examples/boot/bootloader/nrf/src/main.rs
@@ -38,8 +38,8 @@ fn main() -> ! {
38 unsafe { bl.load(active_offset) } 38 unsafe { bl.load(active_offset) }
39} 39}
40 40
41#[no_mangle] 41#[unsafe(no_mangle)]
42#[cfg_attr(target_os = "none", link_section = ".HardFault.user")] 42#[cfg_attr(target_os = "none", unsafe(link_section = ".HardFault.user"))]
43unsafe extern "C" fn HardFault() { 43unsafe extern "C" fn HardFault() {
44 cortex_m::peripheral::SCB::sys_reset(); 44 cortex_m::peripheral::SCB::sys_reset();
45} 45}
@@ -47,7 +47,7 @@ unsafe extern "C" fn HardFault() {
47#[exception] 47#[exception]
48unsafe fn DefaultHandler(_: i16) -> ! { 48unsafe fn DefaultHandler(_: i16) -> ! {
49 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; 49 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32;
50 let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; 50 let irqn = unsafe { core::ptr::read_volatile(SCB_ICSR) } as u8 as i16 - 16;
51 51
52 panic!("DefaultHandler #{:?}", irqn); 52 panic!("DefaultHandler #{:?}", irqn);
53} 53}
diff --git a/examples/boot/bootloader/rp/Cargo.toml b/examples/boot/bootloader/rp/Cargo.toml
index 93a1c4edf..188bcab36 100644
--- a/examples/boot/bootloader/rp/Cargo.toml
+++ b/examples/boot/bootloader/rp/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "rp-bootloader-example" 3name = "rp-bootloader-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Example bootloader for RP2040 chips" 5description = "Example bootloader for RP2040 chips"
diff --git a/examples/boot/bootloader/rp/src/main.rs b/examples/boot/bootloader/rp/src/main.rs
index 25b1657b8..7ebefd374 100644
--- a/examples/boot/bootloader/rp/src/main.rs
+++ b/examples/boot/bootloader/rp/src/main.rs
@@ -34,8 +34,8 @@ fn main() -> ! {
34 unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) } 34 unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) }
35} 35}
36 36
37#[no_mangle] 37#[unsafe(no_mangle)]
38#[cfg_attr(target_os = "none", link_section = ".HardFault.user")] 38#[cfg_attr(target_os = "none", unsafe(link_section = ".HardFault.user"))]
39unsafe extern "C" fn HardFault() { 39unsafe extern "C" fn HardFault() {
40 cortex_m::peripheral::SCB::sys_reset(); 40 cortex_m::peripheral::SCB::sys_reset();
41} 41}
@@ -43,7 +43,7 @@ unsafe extern "C" fn HardFault() {
43#[exception] 43#[exception]
44unsafe fn DefaultHandler(_: i16) -> ! { 44unsafe fn DefaultHandler(_: i16) -> ! {
45 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; 45 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32;
46 let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; 46 let irqn = unsafe { core::ptr::read_volatile(SCB_ICSR) } as u8 as i16 - 16;
47 47
48 panic!("DefaultHandler #{:?}", irqn); 48 panic!("DefaultHandler #{:?}", irqn);
49} 49}
diff --git a/examples/boot/bootloader/stm32-dual-bank/Cargo.toml b/examples/boot/bootloader/stm32-dual-bank/Cargo.toml
index 95ca20a59..cf68921dc 100644
--- a/examples/boot/bootloader/stm32-dual-bank/Cargo.toml
+++ b/examples/boot/bootloader/stm32-dual-bank/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "stm32-bootloader-dual-bank-flash-example" 3name = "stm32-bootloader-dual-bank-flash-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Example bootloader for dual-bank flash STM32 chips" 5description = "Example bootloader for dual-bank flash STM32 chips"
diff --git a/examples/boot/bootloader/stm32-dual-bank/src/main.rs b/examples/boot/bootloader/stm32-dual-bank/src/main.rs
index 4d2e82d26..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};
7#[cfg(feature = "defmt")] 7#[cfg(feature = "defmt")]
8use defmt_rtt as _; 8use defmt_rtt as _;
9use embassy_boot_stm32::*; 9use embassy_boot_stm32::*;
10use embassy_stm32::flash::{Flash, BANK1_REGION}; 10use embassy_stm32::flash::{BANK1_REGION, Flash};
11use embassy_sync::blocking_mutex::Mutex; 11use embassy_sync::blocking_mutex::Mutex;
12 12
13#[entry] 13#[entry]
@@ -33,8 +33,8 @@ fn main() -> ! {
33 unsafe { bl.load(BANK1_REGION.base + active_offset) } 33 unsafe { bl.load(BANK1_REGION.base + active_offset) }
34} 34}
35 35
36#[no_mangle] 36#[unsafe(no_mangle)]
37#[cfg_attr(target_os = "none", link_section = ".HardFault.user")] 37#[cfg_attr(target_os = "none", unsafe(link_section = ".HardFault.user"))]
38unsafe extern "C" fn HardFault() { 38unsafe extern "C" fn HardFault() {
39 cortex_m::peripheral::SCB::sys_reset(); 39 cortex_m::peripheral::SCB::sys_reset();
40} 40}
@@ -42,7 +42,7 @@ unsafe extern "C" fn HardFault() {
42#[exception] 42#[exception]
43unsafe fn DefaultHandler(_: i16) -> ! { 43unsafe fn DefaultHandler(_: i16) -> ! {
44 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; 44 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32;
45 let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; 45 let irqn = unsafe { core::ptr::read_volatile(SCB_ICSR) } as u8 as i16 - 16;
46 46
47 panic!("DefaultHandler #{:?}", irqn); 47 panic!("DefaultHandler #{:?}", irqn);
48} 48}
diff --git a/examples/boot/bootloader/stm32/Cargo.toml b/examples/boot/bootloader/stm32/Cargo.toml
index 526637f37..e457310b9 100644
--- a/examples/boot/bootloader/stm32/Cargo.toml
+++ b/examples/boot/bootloader/stm32/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "stm32-bootloader-example" 3name = "stm32-bootloader-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Example bootloader for STM32 chips" 5description = "Example bootloader for STM32 chips"
diff --git a/examples/boot/bootloader/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs
index 99a7a6a6b..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};
7#[cfg(feature = "defmt")] 7#[cfg(feature = "defmt")]
8use defmt_rtt as _; 8use defmt_rtt as _;
9use embassy_boot_stm32::*; 9use embassy_boot_stm32::*;
10use embassy_stm32::flash::{Flash, BANK1_REGION}; 10use embassy_stm32::flash::{BANK1_REGION, Flash};
11use embassy_sync::blocking_mutex::Mutex; 11use embassy_sync::blocking_mutex::Mutex;
12 12
13#[entry] 13#[entry]
@@ -32,8 +32,8 @@ fn main() -> ! {
32 unsafe { bl.load(BANK1_REGION.base + active_offset) } 32 unsafe { bl.load(BANK1_REGION.base + active_offset) }
33} 33}
34 34
35#[no_mangle] 35#[unsafe(no_mangle)]
36#[cfg_attr(target_os = "none", link_section = ".HardFault.user")] 36#[cfg_attr(target_os = "none", unsafe(link_section = ".HardFault.user"))]
37unsafe extern "C" fn HardFault() { 37unsafe extern "C" fn HardFault() {
38 cortex_m::peripheral::SCB::sys_reset(); 38 cortex_m::peripheral::SCB::sys_reset();
39} 39}
@@ -41,7 +41,7 @@ unsafe extern "C" fn HardFault() {
41#[exception] 41#[exception]
42unsafe fn DefaultHandler(_: i16) -> ! { 42unsafe fn DefaultHandler(_: i16) -> ! {
43 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; 43 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32;
44 let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; 44 let irqn = unsafe { core::ptr::read_volatile(SCB_ICSR) } as u8 as i16 - 16;
45 45
46 panic!("DefaultHandler #{:?}", irqn); 46 panic!("DefaultHandler #{:?}", irqn);
47} 47}
diff --git a/examples/boot/bootloader/stm32wb-dfu/Cargo.toml b/examples/boot/bootloader/stm32wb-dfu/Cargo.toml
index ef10aeabf..75b7081df 100644
--- a/examples/boot/bootloader/stm32wb-dfu/Cargo.toml
+++ b/examples/boot/bootloader/stm32wb-dfu/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "stm32wb-dfu-bootloader-example" 3name = "stm32wb-dfu-bootloader-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Example USB DFUbootloader for the STM32WB series of chips" 5description = "Example USB DFUbootloader for the STM32WB series of chips"
diff --git a/examples/boot/bootloader/stm32wb-dfu/src/main.rs b/examples/boot/bootloader/stm32wb-dfu/src/main.rs
index 107f243fd..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};
7#[cfg(feature = "defmt")] 7#[cfg(feature = "defmt")]
8use defmt_rtt as _; 8use defmt_rtt as _;
9use embassy_boot_stm32::*; 9use embassy_boot_stm32::*;
10use embassy_stm32::flash::{Flash, BANK1_REGION, WRITE_SIZE}; 10use embassy_stm32::flash::{BANK1_REGION, Flash, WRITE_SIZE};
11use embassy_stm32::rcc::WPAN_DEFAULT; 11use embassy_stm32::rcc::WPAN_DEFAULT;
12use embassy_stm32::usb::Driver; 12use embassy_stm32::usb::Driver;
13use embassy_stm32::{bind_interrupts, peripherals, usb}; 13use embassy_stm32::{bind_interrupts, peripherals, usb};
14use embassy_sync::blocking_mutex::Mutex; 14use embassy_sync::blocking_mutex::Mutex;
15use embassy_usb::{msos, Builder}; 15use embassy_usb::{Builder, msos};
16use embassy_usb_dfu::consts::DfuAttributes; 16use embassy_usb_dfu::consts::DfuAttributes;
17use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; 17use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu};
18 18
19bind_interrupts!(struct Irqs { 19bind_interrupts!(struct Irqs {
20 USB_LP => usb::InterruptHandler<peripherals::USB>; 20 USB_LP => usb::InterruptHandler<peripherals::USB>;
@@ -109,8 +109,8 @@ fn main() -> ! {
109 unsafe { bl.load(BANK1_REGION.base + active_offset) } 109 unsafe { bl.load(BANK1_REGION.base + active_offset) }
110} 110}
111 111
112#[no_mangle] 112#[unsafe(no_mangle)]
113#[cfg_attr(target_os = "none", link_section = ".HardFault.user")] 113#[cfg_attr(target_os = "none", unsafe(link_section = ".HardFault.user"))]
114unsafe extern "C" fn HardFault() { 114unsafe extern "C" fn HardFault() {
115 cortex_m::peripheral::SCB::sys_reset(); 115 cortex_m::peripheral::SCB::sys_reset();
116} 116}
@@ -118,7 +118,7 @@ unsafe extern "C" fn HardFault() {
118#[exception] 118#[exception]
119unsafe fn DefaultHandler(_: i16) -> ! { 119unsafe fn DefaultHandler(_: i16) -> ! {
120 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; 120 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32;
121 let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; 121 let irqn = unsafe { core::ptr::read_volatile(SCB_ICSR) } as u8 as i16 - 16;
122 122
123 panic!("DefaultHandler #{:?}", irqn); 123 panic!("DefaultHandler #{:?}", irqn);
124} 124}
diff --git a/examples/boot/bootloader/stm32wba-dfu/Cargo.toml b/examples/boot/bootloader/stm32wba-dfu/Cargo.toml
index 16de7684e..eee2b2f71 100644
--- a/examples/boot/bootloader/stm32wba-dfu/Cargo.toml
+++ b/examples/boot/bootloader/stm32wba-dfu/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "stm32wba6-dfu-bootloader-example" 3name = "stm32wba6-dfu-bootloader-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Example USB DFUbootloader for the STM32WBA series of chips" 5description = "Example USB DFUbootloader for the STM32WBA series of chips"
diff --git a/examples/boot/bootloader/stm32wba-dfu/src/main.rs b/examples/boot/bootloader/stm32wba-dfu/src/main.rs
index 75d8d4199..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};
7#[cfg(feature = "defmt")] 7#[cfg(feature = "defmt")]
8use defmt_rtt as _; 8use defmt_rtt as _;
9use embassy_boot_stm32::*; 9use embassy_boot_stm32::*;
10use embassy_stm32::flash::{Flash, BANK1_REGION, WRITE_SIZE}; 10use embassy_stm32::flash::{BANK1_REGION, Flash, WRITE_SIZE};
11use embassy_stm32::usb::Driver; 11use embassy_stm32::usb::Driver;
12use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 12use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
13use embassy_sync::blocking_mutex::Mutex; 13use embassy_sync::blocking_mutex::Mutex;
14use embassy_usb::{msos, Builder}; 14use embassy_usb::{Builder, msos};
15use embassy_usb_dfu::consts::DfuAttributes; 15use embassy_usb_dfu::consts::DfuAttributes;
16use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate}; 16use embassy_usb_dfu::{Control, ResetImmediate, usb_dfu};
17 17
18bind_interrupts!(struct Irqs { 18bind_interrupts!(struct Irqs {
19 USB_OTG_HS => usb::InterruptHandler<peripherals::USB_OTG_HS>; 19 USB_OTG_HS => usb::InterruptHandler<peripherals::USB_OTG_HS>;
@@ -138,8 +138,8 @@ fn main() -> ! {
138 unsafe { bl.load(BANK1_REGION.base + active_offset) } 138 unsafe { bl.load(BANK1_REGION.base + active_offset) }
139} 139}
140 140
141#[no_mangle] 141#[unsafe(no_mangle)]
142#[cfg_attr(target_os = "none", link_section = ".HardFault.user")] 142#[cfg_attr(target_os = "none", unsafe(link_section = ".HardFault.user"))]
143unsafe extern "C" fn HardFault() { 143unsafe extern "C" fn HardFault() {
144 cortex_m::peripheral::SCB::sys_reset(); 144 cortex_m::peripheral::SCB::sys_reset();
145} 145}
@@ -147,7 +147,7 @@ unsafe extern "C" fn HardFault() {
147#[exception] 147#[exception]
148unsafe fn DefaultHandler(_: i16) -> ! { 148unsafe fn DefaultHandler(_: i16) -> ! {
149 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; 149 const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32;
150 let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; 150 let irqn = unsafe { core::ptr::read_volatile(SCB_ICSR) } as u8 as i16 - 16;
151 151
152 panic!("DefaultHandler #{:?}", irqn); 152 panic!("DefaultHandler #{:?}", irqn);
153} 153}
diff --git a/examples/lpc55s69/Cargo.toml b/examples/lpc55s69/Cargo.toml
index 579748595..94903b3f8 100644
--- a/examples/lpc55s69/Cargo.toml
+++ b/examples/lpc55s69/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nxp-lpc55s69-examples" 3name = "embassy-nxp-lpc55s69-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/mimxrt1011/Cargo.toml b/examples/mimxrt1011/Cargo.toml
index 3038f5d4d..d784ce729 100644
--- a/examples/mimxrt1011/Cargo.toml
+++ b/examples/mimxrt1011/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-imxrt1011-examples" 2name = "embassy-imxrt1011-examples"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false 6publish = false
7 7
diff --git a/examples/mimxrt1011/src/lib.rs b/examples/mimxrt1011/src/lib.rs
index f0391ef57..36d3e2fb3 100644
--- a/examples/mimxrt1011/src/lib.rs
+++ b/examples/mimxrt1011/src/lib.rs
@@ -71,5 +71,5 @@ pub const SERIAL_NOR_CONFIGURATION_BLOCK: nor::ConfigurationBlock =
71 .ip_cmd_serial_clk_freq(nor::SerialClockFrequency::MHz30); 71 .ip_cmd_serial_clk_freq(nor::SerialClockFrequency::MHz30);
72 72
73#[unsafe(no_mangle)] 73#[unsafe(no_mangle)]
74#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".fcb")] 74#[cfg_attr(all(target_arch = "arm", target_os = "none"), unsafe(link_section = ".fcb"))]
75pub static FLEXSPI_CONFIGURATION_BLOCK: nor::ConfigurationBlock = SERIAL_NOR_CONFIGURATION_BLOCK; 75pub static FLEXSPI_CONFIGURATION_BLOCK: nor::ConfigurationBlock = SERIAL_NOR_CONFIGURATION_BLOCK;
diff --git a/examples/mimxrt1062-evk/Cargo.toml b/examples/mimxrt1062-evk/Cargo.toml
index 82a24490d..29a80db12 100644
--- a/examples/mimxrt1062-evk/Cargo.toml
+++ b/examples/mimxrt1062-evk/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-imxrt1062-evk-examples" 2name = "embassy-imxrt1062-evk-examples"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false 6publish = false
7 7
diff --git a/examples/mimxrt1062-evk/src/lib.rs b/examples/mimxrt1062-evk/src/lib.rs
index 3f99f9db3..e952b91ec 100644
--- a/examples/mimxrt1062-evk/src/lib.rs
+++ b/examples/mimxrt1062-evk/src/lib.rs
@@ -55,6 +55,6 @@ pub const SERIAL_NOR_CONFIGURATION_BLOCK: nor::ConfigurationBlock =
55 .sector_size(4096) 55 .sector_size(4096)
56 .ip_cmd_serial_clk_freq(nor::SerialClockFrequency::MHz30); 56 .ip_cmd_serial_clk_freq(nor::SerialClockFrequency::MHz30);
57 57
58#[no_mangle] 58#[unsafe(no_mangle)]
59#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".fcb")] 59#[cfg_attr(all(target_arch = "arm", target_os = "none"), unsafe(link_section = ".fcb"))]
60pub static FLEXSPI_CONFIGURATION_BLOCK: nor::ConfigurationBlock = SERIAL_NOR_CONFIGURATION_BLOCK; 60pub static FLEXSPI_CONFIGURATION_BLOCK: nor::ConfigurationBlock = SERIAL_NOR_CONFIGURATION_BLOCK;
diff --git a/examples/mimxrt6/Cargo.toml b/examples/mimxrt6/Cargo.toml
index 3f7ad8485..dc09e97e7 100644
--- a/examples/mimxrt6/Cargo.toml
+++ b/examples/mimxrt6/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-imxrt-examples" 2name = "embassy-imxrt-examples"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false 6publish = false
7 7
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 @@
3 3
4use defmt::info; 4use defmt::info;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_futures::select::{select, Either}; 6use embassy_futures::select::{Either, select};
7use embassy_imxrt::gpio; 7use embassy_imxrt::gpio;
8use {defmt_rtt as _, embassy_imxrt_examples as _, panic_probe as _}; 8use {defmt_rtt as _, embassy_imxrt_examples as _, panic_probe as _};
9 9
diff --git a/examples/mspm0c1104/Cargo.toml b/examples/mspm0c1104/Cargo.toml
index 21434106a..74301bc9c 100644
--- a/examples/mspm0c1104/Cargo.toml
+++ b/examples/mspm0c1104/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-mspm0-c1104-examples" 3name = "embassy-mspm0-c1104-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Level, Output};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Level, Output};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_halt as _}; 9use {defmt_rtt as _, panic_halt as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Input, Level, Output, Pull};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Input, Level, Output, Pull};
8use {defmt_rtt as _, panic_halt as _}; 8use {defmt_rtt as _, panic_halt as _};
9 9
10#[embassy_executor::main] 10#[embassy_executor::main]
diff --git a/examples/mspm0g3507/Cargo.toml b/examples/mspm0g3507/Cargo.toml
index 616b82adb..8c230f038 100644
--- a/examples/mspm0g3507/Cargo.toml
+++ b/examples/mspm0g3507/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-mspm0-g3507-examples" 3name = "embassy-mspm0-g3507-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::adc::{self, Adc, Vrsel}; 6use embassy_mspm0::adc::{self, Adc, Vrsel};
7use embassy_mspm0::{bind_interrupts, peripherals, Config}; 7use embassy_mspm0::{Config, bind_interrupts, peripherals};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_halt as _}; 9use {defmt_rtt as _, panic_halt as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Level, Output};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Level, Output};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_halt as _}; 9use {defmt_rtt as _, panic_halt as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Input, Level, Output, Pull};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Input, Level, Output, Pull};
8use {defmt_rtt as _, panic_halt as _}; 8use {defmt_rtt as _, panic_halt as _};
9 9
10#[embassy_executor::main] 10#[embassy_executor::main]
diff --git a/examples/mspm0g3507/src/bin/i2c_target.rs b/examples/mspm0g3507/src/bin/i2c_target.rs
new file mode 100644
index 000000000..5dd718eaf
--- /dev/null
+++ b/examples/mspm0g3507/src/bin/i2c_target.rs
@@ -0,0 +1,63 @@
1//! Example of using async I2C target
2//!
3//! This uses the virtual COM port provided on the LP-MSPM0G3507 board.
4
5#![no_std]
6#![no_main]
7
8use defmt::*;
9use embassy_executor::Spawner;
10use embassy_mspm0::i2c::Config;
11use embassy_mspm0::i2c_target::{Command, Config as TargetConfig, I2cTarget, ReadStatus};
12use embassy_mspm0::peripherals::I2C1;
13use embassy_mspm0::{bind_interrupts, i2c};
14use {defmt_rtt as _, panic_halt as _};
15
16bind_interrupts!(struct Irqs {
17 I2C1 => i2c::InterruptHandler<I2C1>;
18});
19
20#[embassy_executor::main]
21async fn main(_spawner: Spawner) -> ! {
22 let p = embassy_mspm0::init(Default::default());
23
24 let instance = p.I2C1;
25 let scl = p.PB2;
26 let sda = p.PB3;
27
28 let config = Config::default();
29 let mut target_config = TargetConfig::default();
30 target_config.target_addr = 0x48;
31 target_config.general_call = true;
32 let mut i2c = I2cTarget::new(instance, scl, sda, Irqs, config, target_config).unwrap();
33
34 let mut read = [0u8; 8];
35 let data = [8u8; 2];
36 let data_wr = [9u8; 2];
37
38 loop {
39 match i2c.listen(&mut read).await {
40 Ok(Command::GeneralCall(_)) => info!("General call received"),
41 Ok(Command::Read) => {
42 info!("Read command received");
43 match i2c.respond_to_read(&data).await.unwrap() {
44 ReadStatus::Done => info!("Finished reading"),
45 ReadStatus::NeedMoreBytes => {
46 info!("Read needs more bytes - will reset");
47 i2c.reset().unwrap();
48 }
49 ReadStatus::LeftoverBytes(_) => {
50 info!("Leftover bytes received");
51 i2c.flush_tx_fifo();
52 }
53 }
54 }
55 Ok(Command::Write(_)) => info!("Write command received"),
56 Ok(Command::WriteRead(_)) => {
57 info!("Write-Read command received");
58 i2c.respond_and_fill(&data_wr, 0xFE).await.unwrap();
59 }
60 Err(e) => info!("Got error {}", e),
61 }
62 }
63}
diff --git a/examples/mspm0g3519/Cargo.toml b/examples/mspm0g3519/Cargo.toml
index ae699d6f4..0f5e58343 100644
--- a/examples/mspm0g3519/Cargo.toml
+++ b/examples/mspm0g3519/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-mspm0-g3519-examples" 3name = "embassy-mspm0-g3519-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Level, Output};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Level, Output};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_halt as _}; 9use {defmt_rtt as _, panic_halt as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Input, Level, Output, Pull};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Input, Level, Output, Pull};
8use {defmt_rtt as _, panic_halt as _}; 8use {defmt_rtt as _, panic_halt as _};
9 9
10#[embassy_executor::main] 10#[embassy_executor::main]
diff --git a/examples/mspm0l1306/Cargo.toml b/examples/mspm0l1306/Cargo.toml
index 8100e11da..d5b5e9d3e 100644
--- a/examples/mspm0l1306/Cargo.toml
+++ b/examples/mspm0l1306/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-mspm0-l1306-examples" 3name = "embassy-mspm0-l1306-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::adc::{self, Adc, Vrsel}; 6use embassy_mspm0::adc::{self, Adc, Vrsel};
7use embassy_mspm0::{bind_interrupts, peripherals, Config}; 7use embassy_mspm0::{Config, bind_interrupts, peripherals};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_halt as _}; 9use {defmt_rtt as _, panic_halt as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Level, Output};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Level, Output};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_halt as _}; 9use {defmt_rtt as _, panic_halt as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Input, Level, Output, Pull};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Input, Level, Output, Pull};
8use {defmt_rtt as _, panic_halt as _}; 8use {defmt_rtt as _, panic_halt as _};
9 9
10#[embassy_executor::main] 10#[embassy_executor::main]
diff --git a/examples/mspm0l1306/src/bin/i2c_target.rs b/examples/mspm0l1306/src/bin/i2c_target.rs
new file mode 100644
index 000000000..4d147d08b
--- /dev/null
+++ b/examples/mspm0l1306/src/bin/i2c_target.rs
@@ -0,0 +1,63 @@
1//! Example of using async I2C target
2//!
3//! This uses the virtual COM port provided on the LP-MSPM0L1306 board.
4
5#![no_std]
6#![no_main]
7
8use defmt::*;
9use embassy_executor::Spawner;
10use embassy_mspm0::i2c::Config;
11use embassy_mspm0::i2c_target::{Command, Config as TargetConfig, I2cTarget, ReadStatus};
12use embassy_mspm0::peripherals::I2C0;
13use embassy_mspm0::{bind_interrupts, i2c};
14use {defmt_rtt as _, panic_halt as _};
15
16bind_interrupts!(struct Irqs {
17 I2C0 => i2c::InterruptHandler<I2C0>;
18});
19
20#[embassy_executor::main]
21async fn main(_spawner: Spawner) -> ! {
22 let p = embassy_mspm0::init(Default::default());
23
24 let instance = p.I2C0;
25 let scl = p.PA1;
26 let sda = p.PA0;
27
28 let config = Config::default();
29 let mut target_config = TargetConfig::default();
30 target_config.target_addr = 0x48;
31 target_config.general_call = true;
32 let mut i2c = I2cTarget::new(instance, scl, sda, Irqs, config, target_config).unwrap();
33
34 let mut read = [0u8; 8];
35 let data = [8u8; 2];
36 let data_wr = [9u8; 2];
37
38 loop {
39 match i2c.listen(&mut read).await {
40 Ok(Command::GeneralCall(_)) => info!("General call received"),
41 Ok(Command::Read) => {
42 info!("Read command received");
43 match i2c.respond_to_read(&data).await.unwrap() {
44 ReadStatus::Done => info!("Finished reading"),
45 ReadStatus::NeedMoreBytes => {
46 info!("Read needs more bytes - will reset");
47 i2c.reset().unwrap();
48 }
49 ReadStatus::LeftoverBytes(_) => {
50 info!("Leftover bytes received");
51 i2c.flush_tx_fifo();
52 }
53 }
54 }
55 Ok(Command::Write(_)) => info!("Write command received"),
56 Ok(Command::WriteRead(_)) => {
57 info!("Write-Read command received");
58 i2c.respond_and_fill(&data_wr, 0xFE).await.unwrap();
59 }
60 Err(e) => info!("Got error {}", e),
61 }
62 }
63}
diff --git a/examples/mspm0l2228/Cargo.toml b/examples/mspm0l2228/Cargo.toml
index 3add7b8e8..1d27ae64a 100644
--- a/examples/mspm0l2228/Cargo.toml
+++ b/examples/mspm0l2228/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-mspm0-l2228-examples" 3name = "embassy-mspm0-l2228-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Level, Output};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Level, Output};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_halt as _}; 9use {defmt_rtt as _, panic_halt as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_mspm0::gpio::{Input, Level, Output, Pull};
7use embassy_mspm0::Config; 6use embassy_mspm0::Config;
7use embassy_mspm0::gpio::{Input, Level, Output, Pull};
8use {defmt_rtt as _, panic_halt as _}; 8use {defmt_rtt as _, panic_halt as _};
9 9
10#[embassy_executor::main] 10#[embassy_executor::main]
diff --git a/examples/nrf-rtos-trace/Cargo.toml b/examples/nrf-rtos-trace/Cargo.toml
index d2d0ae093..5caabf228 100644
--- a/examples/nrf-rtos-trace/Cargo.toml
+++ b/examples/nrf-rtos-trace/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf-rtos-trace-examples" 3name = "embassy-nrf-rtos-trace-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/nrf51/Cargo.toml b/examples/nrf51/Cargo.toml
index 082d85e5b..c7492f562 100644
--- a/examples/nrf51/Cargo.toml
+++ b/examples/nrf51/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf51-examples" 3name = "embassy-nrf51-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/nrf52810/Cargo.toml b/examples/nrf52810/Cargo.toml
index 7835320e5..1711a3d8d 100644
--- a/examples/nrf52810/Cargo.toml
+++ b/examples/nrf52810/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf52810-examples" 3name = "embassy-nrf52810-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/nrf52840-edf/Cargo.toml b/examples/nrf52840-edf/Cargo.toml
index 67a624d6d..8b1db4652 100644
--- a/examples/nrf52840-edf/Cargo.toml
+++ b/examples/nrf52840-edf/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf52840-edf-examples" 3name = "embassy-nrf52840-edf-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
12#![no_std] 12#![no_std]
13#![no_main] 13#![no_main]
14 14
15use core::sync::atomic::{compiler_fence, Ordering}; 15use core::sync::atomic::{Ordering, compiler_fence};
16 16
17use defmt::unwrap; 17use defmt::unwrap;
18use embassy_executor::Spawner; 18use embassy_executor::Spawner;
diff --git a/examples/nrf52840-rtic/Cargo.toml b/examples/nrf52840-rtic/Cargo.toml
index d860626a1..26b21598f 100644
--- a/examples/nrf52840-rtic/Cargo.toml
+++ b/examples/nrf52840-rtic/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf52840-rtic-examples" 3name = "embassy-nrf52840-rtic-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 _};
7mod app { 7mod app {
8 use defmt::info; 8 use defmt::info;
9 use embassy_nrf::gpio::{Level, Output, OutputDrive}; 9 use embassy_nrf::gpio::{Level, Output, OutputDrive};
10 use embassy_nrf::{peripherals, Peri}; 10 use embassy_nrf::{Peri, peripherals};
11 use embassy_time::Timer; 11 use embassy_time::Timer;
12 12
13 #[shared] 13 #[shared]
diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml
index 5b3e176c0..a026d6352 100644
--- a/examples/nrf52840/Cargo.toml
+++ b/examples/nrf52840/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf52840-examples" 3name = "embassy-nrf52840-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::unwrap; 4use defmt::unwrap;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive};
7use embassy_nrf::Peri; 6use embassy_nrf::Peri;
7use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive};
8use embassy_sync::blocking_mutex::raw::NoopRawMutex; 8use embassy_sync::blocking_mutex::raw::NoopRawMutex;
9use embassy_sync::channel::{Channel, Receiver, Sender}; 9use embassy_sync::channel::{Channel, Receiver, Sender};
10use embassy_time::Timer; 10use 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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_net::tcp::TcpSocket;
7use embassy_net::StackResources; 6use embassy_net::StackResources;
7use embassy_net::tcp::TcpSocket;
8use embassy_net_enc28j60::Enc28j60; 8use embassy_net_enc28j60::Enc28j60;
9use embassy_nrf::gpio::{Level, Output, OutputDrive}; 9use embassy_nrf::gpio::{Level, Output, OutputDrive};
10use embassy_nrf::rng::Rng; 10use 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;
5 5
6use defmt::{error, info}; 6use defmt::{error, info};
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_nrf::i2s::{self, Channels, Config, MasterClock, MultiBuffering, Sample as _, SampleWidth, I2S}; 8use embassy_nrf::i2s::{self, Channels, Config, I2S, MasterClock, MultiBuffering, Sample as _, SampleWidth};
9use embassy_nrf::{bind_interrupts, peripherals}; 9use embassy_nrf::{bind_interrupts, peripherals};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
@@ -102,11 +102,7 @@ impl SineOsc {
102 102
103#[inline] 103#[inline]
104fn abs(value: f32) -> f32 { 104fn abs(value: f32) -> f32 {
105 if value < 0.0 { 105 if value < 0.0 { -value } else { value }
106 -value
107 } else {
108 value
109 }
110} 106}
111 107
112#[inline] 108#[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 @@
3 3
4use defmt::{debug, error, info}; 4use defmt::{debug, error, info};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, MasterClock, Sample as _, SampleWidth, I2S}; 6use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, I2S, MasterClock, Sample as _, SampleWidth};
7use embassy_nrf::pwm::{Prescaler, SimplePwm}; 7use embassy_nrf::pwm::{Prescaler, SimplePwm};
8use embassy_nrf::{bind_interrupts, peripherals}; 8use embassy_nrf::{bind_interrupts, peripherals};
9use {defmt_rtt as _, panic_probe as _}; 9use {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;
5 5
6use defmt::{error, info}; 6use defmt::{error, info};
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, MasterClock, Sample as _, SampleWidth, I2S}; 8use embassy_nrf::i2s::{self, Channels, Config, DoubleBuffering, I2S, MasterClock, Sample as _, SampleWidth};
9use embassy_nrf::{bind_interrupts, peripherals}; 9use embassy_nrf::{bind_interrupts, peripherals};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
@@ -140,11 +140,7 @@ impl SineOsc {
140 140
141#[inline] 141#[inline]
142fn abs(value: f32) -> f32 { 142fn abs(value: f32) -> f32 {
143 if value < 0.0 { 143 if value < 0.0 { -value } else { value }
144 -value
145 } else {
146 value
147 }
148} 144}
149 145
150#[inline] 146#[inline]
diff --git a/examples/nrf52840/src/bin/multiprio.rs b/examples/nrf52840/src/bin/multiprio.rs
index 4d9b986d4..dc566adee 100644
--- a/examples/nrf52840/src/bin/multiprio.rs
+++ b/examples/nrf52840/src/bin/multiprio.rs
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn EGU1_SWI1() { 115unsafe fn EGU1_SWI1() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn EGU0_SWI0() { 120unsafe fn EGU0_SWI0() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
diff --git a/examples/nrf52840/src/bin/raw_spawn.rs b/examples/nrf52840/src/bin/raw_spawn.rs
index b80954408..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;
5 5
6use cortex_m_rt::entry; 6use cortex_m_rt::entry;
7use defmt::{info, unwrap}; 7use defmt::{info, unwrap};
8use embassy_executor::raw::TaskStorage;
9use embassy_executor::Executor; 8use embassy_executor::Executor;
9use embassy_executor::raw::TaskStorage;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use static_cell::StaticCell; 11use static_cell::StaticCell;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
@@ -48,5 +48,5 @@ fn main() -> ! {
48} 48}
49 49
50unsafe fn make_static<T>(t: &T) -> &'static T { 50unsafe fn make_static<T>(t: &T) -> &'static T {
51 mem::transmute(t) 51 unsafe { mem::transmute(t) }
52} 52}
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;
7use embassy_nrf::gpio::{Level, Output, OutputDrive}; 7use embassy_nrf::gpio::{Level, Output, OutputDrive};
8use embassy_nrf::interrupt; 8use embassy_nrf::interrupt;
9use embassy_nrf::rtc::Rtc; 9use embassy_nrf::rtc::Rtc;
10use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
11use embassy_sync::blocking_mutex::Mutex; 10use embassy_sync::blocking_mutex::Mutex;
11use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
12use portable_atomic::AtomicU64; 12use portable_atomic::AtomicU64;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_net::tcp::TcpSocket;
7use embassy_net::StackResources; 6use embassy_net::StackResources;
7use embassy_net::tcp::TcpSocket;
8use embassy_nrf::rng::Rng; 8use embassy_nrf::rng::Rng;
9use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
10use embassy_nrf::usb::Driver; 9use embassy_nrf::usb::Driver;
10use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
11use embassy_nrf::{bind_interrupts, pac, peripherals, rng, usb}; 11use embassy_nrf::{bind_interrupts, pac, peripherals, rng, usb};
12use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; 12use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState};
13use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; 13use 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 540580c31..7b7303526 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, AtomicU8, Ordering};
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_futures::join::join; 8use embassy_futures::join::join;
9use embassy_futures::select::{select, Either}; 9use embassy_futures::select::{Either, select};
10use embassy_nrf::gpio::{Input, Pull}; 10use embassy_nrf::gpio::{Input, Pull};
11use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
12use embassy_nrf::usb::Driver; 11use embassy_nrf::usb::Driver;
12use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
13use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; 13use embassy_nrf::{bind_interrupts, pac, peripherals, usb};
14use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 14use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
15use embassy_sync::signal::Signal; 15use embassy_sync::signal::Signal;
@@ -244,7 +244,9 @@ impl Handler for MyDeviceHandler {
244 244
245 fn suspended(&mut self, suspended: bool) { 245 fn suspended(&mut self, suspended: bool) {
246 if suspended { 246 if suspended {
247 info!("Device suspended, the Vbus current limit is 500µA (or 2.5mA for high-power devices with remote wakeup enabled)."); 247 info!(
248 "Device suspended, the Vbus current limit is 500µA (or 2.5mA for high-power devices with remote wakeup enabled)."
249 );
248 SUSPENDED.store(true, Ordering::Release); 250 SUSPENDED.store(true, Ordering::Release);
249 } else { 251 } else {
250 SUSPENDED.store(false, Ordering::Release); 252 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 efc28203c..6bee4546b 100644
--- a/examples/nrf52840/src/bin/usb_hid_mouse.rs
+++ b/examples/nrf52840/src/bin/usb_hid_mouse.rs
@@ -6,8 +6,8 @@ use core::sync::atomic::{AtomicU8, Ordering};
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_futures::join::join; 8use embassy_futures::join::join;
9use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
10use embassy_nrf::usb::Driver; 9use embassy_nrf::usb::Driver;
10use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
11use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; 11use embassy_nrf::{bind_interrupts, pac, peripherals, usb};
12use embassy_time::Timer; 12use embassy_time::Timer;
13use embassy_usb::class::hid::{ 13use embassy_usb::class::hid::{
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 @@
4use defmt::{info, panic}; 4use defmt::{info, panic};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect};
8use embassy_nrf::usb::Driver; 7use embassy_nrf::usb::Driver;
8use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect};
9use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; 9use embassy_nrf::{bind_interrupts, pac, peripherals, usb};
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 11use 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 @@
3 3
4use defmt::{info, panic, unwrap}; 4use defmt::{info, panic, unwrap};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
7use embassy_nrf::usb::Driver; 6use embassy_nrf::usb::Driver;
7use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
8use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; 8use embassy_nrf::{bind_interrupts, pac, peripherals, usb};
9use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 9use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
10use embassy_usb::driver::EndpointError; 10use 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 @@
4use defmt::{info, panic}; 4use defmt::{info, panic};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect};
8use embassy_nrf::usb::Driver; 7use embassy_nrf::usb::Driver;
8use embassy_nrf::usb::vbus_detect::{HardwareVbusDetect, VbusDetect};
9use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; 9use embassy_nrf::{bind_interrupts, pac, peripherals, usb};
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 11use 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 @@
3 3
4use defmt::{info, unwrap, warn}; 4use defmt::{info, unwrap, warn};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_net::tcp::TcpSocket;
7use embassy_net::StackResources; 6use embassy_net::StackResources;
7use embassy_net::tcp::TcpSocket;
8use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; 8use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull};
9use embassy_nrf::rng::Rng; 9use embassy_nrf::rng::Rng;
10use embassy_nrf::spim::{self, Spim}; 10use embassy_nrf::spim::{self, Spim};
diff --git a/examples/nrf5340/Cargo.toml b/examples/nrf5340/Cargo.toml
index 256fee08d..4dcbdd715 100644
--- a/examples/nrf5340/Cargo.toml
+++ b/examples/nrf5340/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf5340-examples" 3name = "embassy-nrf5340-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs b/examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs
new file mode 100644
index 000000000..0b1fb852e
--- /dev/null
+++ b/examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs
@@ -0,0 +1,30 @@
1#![no_std]
2#![no_main]
3
4use defmt::info;
5use embassy_executor::Spawner;
6use embassy_nrf::config::{Config, HfclkSource, LfclkSource, LfxoCapacitance};
7use embassy_nrf::pac;
8use {defmt_rtt as _, panic_probe as _};
9
10fn print_xosc32mcaps() {
11 let value = pac::OSCILLATORS.xosc32mcaps().read();
12 info!("XOSC32MCAPS.ENABLE = {}", value.enable());
13 info!("XOSC32MCAPS.CAPVALUE = {}", value.capvalue());
14}
15
16#[embassy_executor::main]
17async fn main(_spawner: Spawner) {
18 info!("Before init:");
19 print_xosc32mcaps();
20
21 let mut config = Config::default();
22 config.hfclk_source = HfclkSource::Internal;
23 config.lfclk_source = LfclkSource::ExternalXtal;
24 config.internal_capacitors.hfxo = None; // keep the value from the FICR
25 config.internal_capacitors.lfxo = Some(LfxoCapacitance::_7pF);
26 let _p = embassy_nrf::init(config);
27
28 info!("After init:");
29 print_xosc32mcaps();
30}
diff --git a/examples/nrf54l15/Cargo.toml b/examples/nrf54l15/Cargo.toml
index 9c24cdab4..541e79fcb 100644
--- a/examples/nrf54l15/Cargo.toml
+++ b/examples/nrf54l15/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf54l15-examples" 3name = "embassy-nrf54l15-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
@@ -8,6 +8,7 @@ publish = false
8[dependencies] 8[dependencies]
9embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 9embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] }
10embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 10embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
11embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt"] }
11embassy-nrf = { version = "0.8.0", path = "../../embassy-nrf", features = ["defmt", "nrf54l15-app-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 12embassy-nrf = { version = "0.8.0", path = "../../embassy-nrf", features = ["defmt", "nrf54l15-app-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] }
12 13
13defmt = "1.0.1" 14defmt = "1.0.1"
@@ -18,6 +19,7 @@ cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-sing
18cortex-m-rt = "0.7.0" 19cortex-m-rt = "0.7.0"
19 20
20embedded-storage = "0.3.1" 21embedded-storage = "0.3.1"
22portable-atomic = "1"
21 23
22[profile.release] 24[profile.release]
23debug = 2 25debug = 2
diff --git a/examples/nrf54l15/src/bin/rtc.rs b/examples/nrf54l15/src/bin/rtc.rs
new file mode 100644
index 000000000..a45aaca52
--- /dev/null
+++ b/examples/nrf54l15/src/bin/rtc.rs
@@ -0,0 +1,56 @@
1#![no_std]
2#![no_main]
3
4use core::cell::RefCell;
5
6use embassy_executor::Spawner;
7use embassy_nrf::gpio::{Level, Output, OutputDrive};
8use embassy_nrf::interrupt;
9use embassy_nrf::rtc::Rtc;
10use embassy_sync::blocking_mutex::Mutex;
11use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
12use portable_atomic::AtomicU64;
13use {defmt_rtt as _, panic_probe as _};
14
15// 64 bit counter which will never overflow.
16static TICK_COUNTER: AtomicU64 = AtomicU64::new(0);
17static RTC: Mutex<CriticalSectionRawMutex, RefCell<Option<Rtc<'static>>>> = Mutex::new(RefCell::new(None));
18
19#[embassy_executor::main]
20async fn main(_spawner: Spawner) {
21 defmt::println!("nRF54L15 RTC example");
22 let p = embassy_nrf::init(Default::default());
23 let mut led = Output::new(p.P2_09, Level::High, OutputDrive::Standard);
24 // Counter resolution is 125 ms.
25 let mut rtc = Rtc::new(p.RTC10, (1 << 12) - 1).unwrap();
26 rtc.enable_interrupt(embassy_nrf::rtc::Interrupt::Tick, true);
27 rtc.enable_event(embassy_nrf::rtc::Interrupt::Tick);
28 rtc.enable();
29 RTC.lock(|r| {
30 let mut rtc_borrow = r.borrow_mut();
31 *rtc_borrow = Some(rtc);
32 });
33
34 let mut last_counter_val = 0;
35 loop {
36 let current = TICK_COUNTER.load(core::sync::atomic::Ordering::Relaxed);
37 if current != last_counter_val {
38 led.toggle();
39 last_counter_val = current;
40 }
41 }
42}
43
44#[interrupt]
45fn RTC10() {
46 // For 64-bit, we do not need to worry about overflowing, at least not for realistic program
47 // lifetimes.
48 TICK_COUNTER.fetch_add(1, core::sync::atomic::Ordering::Relaxed);
49 RTC.lock(|r| {
50 let mut rtc_borrow = r.borrow_mut();
51 rtc_borrow
52 .as_mut()
53 .unwrap()
54 .reset_event(embassy_nrf::rtc::Interrupt::Tick);
55 });
56}
diff --git a/examples/nrf9151/ns/Cargo.toml b/examples/nrf9151/ns/Cargo.toml
index 89a6c7c94..7f1f5239a 100644
--- a/examples/nrf9151/ns/Cargo.toml
+++ b/examples/nrf9151/ns/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf9151-non-secure-examples" 3name = "embassy-nrf9151-non-secure-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/nrf9151/s/Cargo.toml b/examples/nrf9151/s/Cargo.toml
index 870311c5d..ce71cc456 100644
--- a/examples/nrf9151/s/Cargo.toml
+++ b/examples/nrf9151/s/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf9151-secure-examples" 3name = "embassy-nrf9151-secure-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/nrf9160/Cargo.toml b/examples/nrf9160/Cargo.toml
index 274e26dd6..ae3b2eeb1 100644
--- a/examples/nrf9160/Cargo.toml
+++ b/examples/nrf9160/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf9160-examples" 3name = "embassy-nrf9160-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/nrf9160/src/bin/modem_tcp_client.rs b/examples/nrf9160/src/bin/modem_tcp_client.rs
index 460a4cfae..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};
11use embassy_executor::Spawner; 11use embassy_executor::Spawner;
12use embassy_net::{Ipv4Cidr, Stack, StackResources}; 12use embassy_net::{Ipv4Cidr, Stack, StackResources};
13use embassy_net_nrf91::context::Status; 13use embassy_net_nrf91::context::Status;
14use embassy_net_nrf91::{context, Runner, State, TraceBuffer, TraceReader}; 14use embassy_net_nrf91::{Runner, State, TraceBuffer, TraceReader, context};
15use embassy_nrf::buffered_uarte::{self, BufferedUarteTx}; 15use embassy_nrf::buffered_uarte::{self, BufferedUarteTx};
16use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive}; 16use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive};
17use embassy_nrf::uarte::Baudrate; 17use embassy_nrf::uarte::Baudrate;
18use embassy_nrf::{bind_interrupts, interrupt, peripherals, uarte, Peri}; 18use embassy_nrf::{Peri, bind_interrupts, interrupt, peripherals, uarte};
19use embassy_time::{Duration, Timer}; 19use embassy_time::{Duration, Timer};
20use embedded_io_async::Write; 20use embedded_io_async::Write;
21use heapless::Vec; 21use heapless::Vec;
@@ -101,7 +101,7 @@ async fn blink_task(pin: Peri<'static, AnyPin>) {
101 } 101 }
102} 102}
103 103
104extern "C" { 104unsafe extern "C" {
105 static __start_ipc: u8; 105 static __start_ipc: u8;
106 static __end_ipc: u8; 106 static __end_ipc: u8;
107} 107}
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 97e019cdf..640addb28 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-rp-examples" 3name = "embassy-rp-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
14use assign_resources::assign_resources; 14use assign_resources::assign_resources;
15use defmt::*; 15use defmt::*;
16use embassy_executor::Spawner; 16use embassy_executor::Spawner;
17use embassy_rp::Peri;
17use embassy_rp::gpio::{Level, Output}; 18use embassy_rp::gpio::{Level, Output};
18use embassy_rp::peripherals::{self, PIN_20, PIN_21}; 19use embassy_rp::peripherals::{self, PIN_20, PIN_21};
19use embassy_rp::Peri;
20use embassy_time::Timer; 20use embassy_time::Timer;
21use {defmt_rtt as _, panic_probe as _}; 21use {defmt_rtt as _, panic_probe as _};
22 22
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 @@
7use defmt::info; 7use defmt::info;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_rp::gpio::{Input, Level, Pull}; 9use embassy_rp::gpio::{Input, Level, Pull};
10use embassy_time::{with_deadline, Duration, Instant, Timer}; 10use embassy_time::{Duration, Instant, Timer, with_deadline};
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13pub struct Debouncer<'a> { 13pub 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;
12use defmt::*; 12use defmt::*;
13use embassy_executor::Spawner; 13use embassy_executor::Spawner;
14use embassy_futures::yield_now; 14use embassy_futures::yield_now;
15use embassy_net::icmp::ping::{PingManager, PingParams};
16use embassy_net::icmp::PacketMetadata; 15use embassy_net::icmp::PacketMetadata;
16use embassy_net::icmp::ping::{PingManager, PingParams};
17use embassy_net::{Ipv4Cidr, Stack, StackResources}; 17use embassy_net::{Ipv4Cidr, Stack, StackResources};
18use embassy_net_wiznet::chip::W5500; 18use embassy_net_wiznet::chip::W5500;
19use embassy_net_wiznet::*; 19use embassy_net_wiznet::*;
@@ -99,7 +99,7 @@ async fn main(spawner: Spawner) {
99 // Create the ping manager instance 99 // Create the ping manager instance
100 let mut ping_manager = PingManager::new(stack, &mut rx_meta, &mut rx_buffer, &mut tx_meta, &mut tx_buffer); 100 let mut ping_manager = PingManager::new(stack, &mut rx_meta, &mut rx_buffer, &mut tx_meta, &mut tx_buffer);
101 let addr = "192.168.8.1"; // Address to ping to 101 let addr = "192.168.8.1"; // Address to ping to
102 // Create the PingParams with the target address 102 // Create the PingParams with the target address
103 let mut ping_params = PingParams::new(Ipv4Addr::from_str(addr).unwrap()); 103 let mut ping_params = PingParams::new(Ipv4Addr::from_str(addr).unwrap());
104 // (optional) Set custom properties of the ping 104 // (optional) Set custom properties of the ping
105 ping_params.set_payload(b"Hello, Ping!"); // custom payload 105 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) {
65 // Construct an SPI driver backed by a PIO state machine 65 // Construct an SPI driver backed by a PIO state machine
66 let mut spi_cfg = SpiConfig::default(); 66 let mut spi_cfg = SpiConfig::default();
67 spi_cfg.frequency = 12_500_000; // The PIO SPI program is much less stable than the actual SPI 67 spi_cfg.frequency = 12_500_000; // The PIO SPI program is much less stable than the actual SPI
68 // peripheral, use higher speeds at your peril 68 // peripheral, use higher speeds at your peril
69 let spi = Spi::new(&mut common, sm0, clk, mosi, miso, p.DMA_CH0, p.DMA_CH1, spi_cfg); 69 let spi = Spi::new(&mut common, sm0, clk, mosi, miso, p.DMA_CH0, p.DMA_CH1, spi_cfg);
70 70
71 // Further control pins 71 // 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};
16use embassy_rp::gpio::Pull; 16use embassy_rp::gpio::Pull;
17use embassy_rp::interrupt; 17use embassy_rp::interrupt;
18use embassy_rp::pwm::{Config, Pwm}; 18use embassy_rp::pwm::{Config, Pwm};
19use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
20use embassy_sync::blocking_mutex::Mutex; 19use embassy_sync::blocking_mutex::Mutex;
20use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
21use embassy_sync::channel::Channel; 21use embassy_sync::channel::Channel;
22use embassy_time::{Duration, Ticker}; 22use embassy_time::{Duration, Ticker};
23use portable_atomic::{AtomicU32, Ordering}; 23use 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 @@
8use defmt::*; 8use defmt::*;
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_rp::gpio::{Level, Output}; 10use embassy_rp::gpio::{Level, Output};
11use embassy_rp::multicore::{spawn_core1, Stack}; 11use embassy_rp::multicore::{Stack, spawn_core1};
12use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 12use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
13use embassy_sync::channel::Channel; 13use embassy_sync::channel::Channel;
14use embassy_time::Timer; 14use embassy_time::Timer;
diff --git a/examples/rp/src/bin/multiprio.rs b/examples/rp/src/bin/multiprio.rs
index 96cdf8fb1..310047505 100644
--- a/examples/rp/src/bin/multiprio.rs
+++ b/examples/rp/src/bin/multiprio.rs
@@ -61,7 +61,7 @@ use defmt::{info, unwrap};
61use embassy_executor::{Executor, InterruptExecutor}; 61use embassy_executor::{Executor, InterruptExecutor};
62use embassy_rp::interrupt; 62use embassy_rp::interrupt;
63use embassy_rp::interrupt::{InterruptExt, Priority}; 63use embassy_rp::interrupt::{InterruptExt, Priority};
64use embassy_time::{Instant, Timer, TICK_HZ}; 64use embassy_time::{Instant, TICK_HZ, Timer};
65use static_cell::StaticCell; 65use static_cell::StaticCell;
66use {defmt_rtt as _, panic_probe as _}; 66use {defmt_rtt as _, panic_probe as _};
67 67
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn SWI_IRQ_1() { 115unsafe fn SWI_IRQ_1() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn SWI_IRQ_0() { 120unsafe fn SWI_IRQ_0() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
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 @@
20use assign_resources::assign_resources; 20use assign_resources::assign_resources;
21use defmt::*; 21use defmt::*;
22use embassy_executor::Spawner; 22use embassy_executor::Spawner;
23use embassy_futures::select::{select, Either}; 23use embassy_futures::select::{Either, select};
24use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler}; 24use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler};
25use embassy_rp::clocks::RoscRng; 25use embassy_rp::clocks::RoscRng;
26use embassy_rp::gpio::{Input, Pull}; 26use embassy_rp::gpio::{Input, Pull};
27use embassy_rp::{bind_interrupts, peripherals, Peri}; 27use embassy_rp::{Peri, bind_interrupts, peripherals};
28use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 28use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
29use embassy_sync::mutex::Mutex; 29use embassy_sync::mutex::Mutex;
30use embassy_sync::{channel, signal}; 30use 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 @@
7 7
8use defmt::*; 8use defmt::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig}; 10use embassy_rp::clocks::{ClockConfig, clk_sys_freq, core_voltage};
11use embassy_rp::config::Config; 11use embassy_rp::config::Config;
12use embassy_rp::gpio::{Level, Output}; 12use embassy_rp::gpio::{Level, Output};
13use embassy_time::{Duration, Instant, Timer}; 13use 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 @@
7 7
8use defmt::*; 8use defmt::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage, PllConfig}; 10use embassy_rp::clocks::{ClockConfig, CoreVoltage, PllConfig, clk_sys_freq, core_voltage};
11use embassy_rp::config::Config; 11use embassy_rp::config::Config;
12use embassy_rp::gpio::{Level, Output}; 12use embassy_rp::gpio::{Level, Output};
13use embassy_time::{Duration, Instant, Timer}; 13use 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;
7use embassy_rp::peripherals::PIO0; 7use embassy_rp::peripherals::PIO0;
8use embassy_rp::pio::program::pio_asm; 8use embassy_rp::pio::program::pio_asm;
9use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; 9use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine};
10use embassy_rp::{bind_interrupts, Peri}; 10use embassy_rp::{Peri, bind_interrupts};
11use fixed::traits::ToFixed; 11use fixed::traits::ToFixed;
12use fixed_macro::types::U56F8; 12use fixed_macro::types::U56F8;
13use {defmt_rtt as _, panic_probe as _}; 13use {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;
10use embassy_rp::peripherals::PIO0; 10use embassy_rp::peripherals::PIO0;
11use embassy_rp::pio::{InterruptHandler, Pio}; 11use embassy_rp::pio::{InterruptHandler, Pio};
12use embassy_rp::pio_programs::stepper::{PioStepper, PioStepperProgram}; 12use embassy_rp::pio_programs::stepper::{PioStepper, PioStepperProgram};
13use embassy_time::{with_timeout, Duration, Timer}; 13use embassy_time::{Duration, Timer, with_timeout};
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
16bind_interrupts!(struct Irqs { 16bind_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 @@
9 9
10use defmt::*; 10use defmt::*;
11use embassy_executor::Spawner; 11use embassy_executor::Spawner;
12use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4};
13use embassy_rp::pwm::{Config, Pwm, SetDutyCycle};
14use embassy_rp::Peri; 12use embassy_rp::Peri;
13use embassy_rp::peripherals::{PIN_4, PIN_25, PWM_SLICE2, PWM_SLICE4};
14use embassy_rp::pwm::{Config, Pwm, SetDutyCycle};
15use embassy_time::Timer; 15use embassy_time::Timer;
16use {defmt_rtt as _, panic_probe as _}; 16use {defmt_rtt as _, panic_probe as _};
17 17
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 @@
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_futures::select::{select, Either}; 8use embassy_futures::select::{Either, select};
9use embassy_rp::bind_interrupts; 9use embassy_rp::bind_interrupts;
10use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc}; 10use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc};
11use embassy_time::Timer; 11use embassy_time::Timer;
diff --git a/examples/rp/src/bin/sharing.rs b/examples/rp/src/bin/sharing.rs
index d4c89946b..618ab9117 100644
--- a/examples/rp/src/bin/sharing.rs
+++ b/examples/rp/src/bin/sharing.rs
@@ -52,7 +52,7 @@ bind_interrupts!(struct Irqs {
52 52
53#[interrupt] 53#[interrupt]
54unsafe fn SWI_IRQ_0() { 54unsafe fn SWI_IRQ_0() {
55 EXECUTOR_HI.on_interrupt() 55 unsafe { EXECUTOR_HI.on_interrupt() }
56} 56}
57 57
58#[entry] 58#[entry]
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;
15use embassy_rp::gpio::{Level, Output}; 15use embassy_rp::gpio::{Level, Output};
16use embassy_rp::spi; 16use embassy_rp::spi;
17use embassy_rp::spi::Spi; 17use embassy_rp::spi::Spi;
18use embassy_sync::blocking_mutex::raw::NoopRawMutex;
19use embassy_sync::blocking_mutex::Mutex; 18use embassy_sync::blocking_mutex::Mutex;
19use embassy_sync::blocking_mutex::raw::NoopRawMutex;
20use embassy_time::Delay; 20use embassy_time::Delay;
21use embedded_graphics::image::{Image, ImageRawLE}; 21use embedded_graphics::image::{Image, ImageRawLE};
22use embedded_graphics::mono_font::ascii::FONT_10X20;
23use embedded_graphics::mono_font::MonoTextStyle; 22use embedded_graphics::mono_font::MonoTextStyle;
23use embedded_graphics::mono_font::ascii::FONT_10X20;
24use embedded_graphics::pixelcolor::Rgb565; 24use embedded_graphics::pixelcolor::Rgb565;
25use embedded_graphics::prelude::*; 25use embedded_graphics::prelude::*;
26use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle}; 26use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle};
27use embedded_graphics::text::Text; 27use embedded_graphics::text::Text;
28use mipidsi::Builder;
28use mipidsi::models::ST7789; 29use mipidsi::models::ST7789;
29use mipidsi::options::{Orientation, Rotation}; 30use mipidsi::options::{Orientation, Rotation};
30use mipidsi::Builder;
31use {defmt_rtt as _, panic_probe as _}; 31use {defmt_rtt as _, panic_probe as _};
32 32
33use crate::touch::Touch; 33use crate::touch::Touch;
@@ -167,11 +167,7 @@ mod touch {
167 167
168 let x = ((x - cal.x1) * cal.sx / (cal.x2 - cal.x1)).clamp(0, cal.sx); 168 let x = ((x - cal.x1) * cal.sx / (cal.x2 - cal.x1)).clamp(0, cal.sx);
169 let y = ((y - cal.y1) * cal.sy / (cal.y2 - cal.y1)).clamp(0, cal.sy); 169 let y = ((y - cal.y1) * cal.sy / (cal.y2 - cal.y1)).clamp(0, cal.sy);
170 if x == 0 && y == 0 { 170 if x == 0 && y == 0 { None } else { Some((x, y)) }
171 None
172 } else {
173 Some((x, y))
174 }
175 } 171 }
176 } 172 }
177} 173}
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;
16use embassy_rp::gpio::{Level, Output}; 16use embassy_rp::gpio::{Level, Output};
17use embassy_rp::spi; 17use embassy_rp::spi;
18use embassy_rp::spi::{Blocking, Spi}; 18use embassy_rp::spi::{Blocking, Spi};
19use embassy_sync::blocking_mutex::raw::NoopRawMutex;
20use embassy_sync::blocking_mutex::Mutex; 19use embassy_sync::blocking_mutex::Mutex;
20use embassy_sync::blocking_mutex::raw::NoopRawMutex;
21use embassy_time::{Delay, Duration, Timer}; 21use embassy_time::{Delay, Duration, Timer};
22use embedded_graphics::image::{Image, ImageRawLE}; 22use embedded_graphics::image::{Image, ImageRawLE};
23use embedded_graphics::pixelcolor::Rgb565; 23use embedded_graphics::pixelcolor::Rgb565;
24use embedded_graphics::prelude::*; 24use embedded_graphics::prelude::*;
25use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle}; 25use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle};
26use mipidsi::Builder;
26use mipidsi::models::GC9A01; 27use mipidsi::models::GC9A01;
27use mipidsi::options::{ColorInversion, ColorOrder}; 28use mipidsi::options::{ColorInversion, ColorOrder};
28use mipidsi::Builder;
29use {defmt_rtt as _, panic_probe as _}; 29use {defmt_rtt as _, panic_probe as _};
30 30
31const DISPLAY_FREQ: u32 = 64_000_000; 31const 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;
6use embassy_rp::bind_interrupts; 6use embassy_rp::bind_interrupts;
7use embassy_rp::peripherals::UART0; 7use embassy_rp::peripherals::UART0;
8use embassy_rp::uart::{Config, DataBits, InterruptHandler as UARTInterruptHandler, Parity, StopBits, Uart}; 8use embassy_rp::uart::{Config, DataBits, InterruptHandler as UARTInterruptHandler, Parity, StopBits, Uart};
9use embassy_time::{with_timeout, Duration, Timer}; 9use embassy_time::{Duration, Timer, with_timeout};
10use heapless::Vec; 10use heapless::Vec;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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 @@
7 7
8use defmt::*; 8use defmt::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_net::tcp::TcpSocket;
11use embassy_net::StackResources; 10use embassy_net::StackResources;
11use embassy_net::tcp::TcpSocket;
12use embassy_rp::clocks::RoscRng; 12use embassy_rp::clocks::RoscRng;
13use embassy_rp::peripherals::USB; 13use embassy_rp::peripherals::USB;
14use embassy_rp::usb::{Driver, InterruptHandler}; 14use 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;
10use embassy_rp::bind_interrupts; 10use embassy_rp::bind_interrupts;
11use embassy_rp::peripherals::USB; 11use embassy_rp::peripherals::USB;
12use embassy_rp::usb::{Driver, Instance, InterruptHandler}; 12use embassy_rp::usb::{Driver, Instance, InterruptHandler};
13use embassy_usb::UsbDevice;
13use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 14use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
14use embassy_usb::driver::EndpointError; 15use embassy_usb::driver::EndpointError;
15use embassy_usb::UsbDevice;
16use static_cell::StaticCell; 16use static_cell::StaticCell;
17use {defmt_rtt as _, panic_probe as _}; 17use {defmt_rtt as _, panic_probe as _};
18 18
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 @@
7 7
8use core::str::from_utf8; 8use core::str::from_utf8;
9 9
10use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; 10use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
11use defmt::*; 11use defmt::*;
12use embassy_executor::Spawner; 12use embassy_executor::Spawner;
13use embassy_net::tcp::TcpSocket; 13use 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 @@
5#![no_std] 5#![no_std]
6#![no_main] 6#![no_main]
7 7
8use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; 8use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
9use defmt::*; 9use defmt::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_rp::bind_interrupts; 11use 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 @@
7 7
8use core::str; 8use core::str;
9 9
10use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; 10use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
11use defmt::*; 11use defmt::*;
12use embassy_executor::Spawner; 12use embassy_executor::Spawner;
13use embassy_rp::bind_interrupts; 13use 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 @@
8use core::str::from_utf8; 8use core::str::from_utf8;
9 9
10use cyw43::JoinOptions; 10use cyw43::JoinOptions;
11use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; 11use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
12use defmt::*; 12use defmt::*;
13use embassy_executor::Spawner; 13use embassy_executor::Spawner;
14use embassy_net::tcp::TcpSocket; 14use 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 @@
8use core::str::from_utf8; 8use core::str::from_utf8;
9 9
10use cyw43::JoinOptions; 10use cyw43::JoinOptions;
11use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; 11use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
12use defmt::*; 12use defmt::*;
13use embassy_executor::Spawner; 13use embassy_executor::Spawner;
14use embassy_net::dns::DnsSocket; 14use 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;
11use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; 11use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler};
12use embassy_rp::gpio::Pull; 12use embassy_rp::gpio::Pull;
13use embassy_rp::peripherals::DMA_CH0; 13use embassy_rp::peripherals::DMA_CH0;
14use embassy_rp::{bind_interrupts, Peri}; 14use embassy_rp::{Peri, bind_interrupts};
15use embassy_sync::blocking_mutex::raw::NoopRawMutex; 15use embassy_sync::blocking_mutex::raw::NoopRawMutex;
16use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; 16use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender};
17use embassy_time::{Duration, Ticker, Timer}; 17use embassy_time::{Duration, Ticker, Timer};
diff --git a/examples/rp235x/Cargo.toml b/examples/rp235x/Cargo.toml
index 40fbb5798..39a4f421a 100644
--- a/examples/rp235x/Cargo.toml
+++ b/examples/rp235x/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-rp2350-examples" 3name = "embassy-rp2350-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
14use assign_resources::assign_resources; 14use assign_resources::assign_resources;
15use defmt::*; 15use defmt::*;
16use embassy_executor::Spawner; 16use embassy_executor::Spawner;
17use embassy_rp::Peri;
17use embassy_rp::gpio::{Level, Output}; 18use embassy_rp::gpio::{Level, Output};
18use embassy_rp::peripherals::{self, PIN_20, PIN_21}; 19use embassy_rp::peripherals::{self, PIN_20, PIN_21};
19use embassy_rp::Peri;
20use embassy_time::Timer; 20use embassy_time::Timer;
21use {defmt_rtt as _, panic_probe as _}; 21use {defmt_rtt as _, panic_probe as _};
22 22
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 @@
7use defmt::info; 7use defmt::info;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_rp::gpio::{Input, Level, Pull}; 9use embassy_rp::gpio::{Input, Level, Pull};
10use embassy_time::{with_deadline, Duration, Instant, Timer}; 10use embassy_time::{Duration, Instant, Timer, with_deadline};
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13pub struct Debouncer<'a> { 13pub 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;
12use defmt::*; 12use defmt::*;
13use embassy_executor::Spawner; 13use embassy_executor::Spawner;
14use embassy_futures::yield_now; 14use embassy_futures::yield_now;
15use embassy_net::icmp::ping::{PingManager, PingParams};
16use embassy_net::icmp::PacketMetadata; 15use embassy_net::icmp::PacketMetadata;
16use embassy_net::icmp::ping::{PingManager, PingParams};
17use embassy_net::{Ipv4Cidr, Stack, StackResources}; 17use embassy_net::{Ipv4Cidr, Stack, StackResources};
18use embassy_net_wiznet::chip::W5500; 18use embassy_net_wiznet::chip::W5500;
19use embassy_net_wiznet::*; 19use embassy_net_wiznet::*;
@@ -99,7 +99,7 @@ async fn main(spawner: Spawner) {
99 // Create the ping manager instance 99 // Create the ping manager instance
100 let mut ping_manager = PingManager::new(stack, &mut rx_meta, &mut rx_buffer, &mut tx_meta, &mut tx_buffer); 100 let mut ping_manager = PingManager::new(stack, &mut rx_meta, &mut rx_buffer, &mut tx_meta, &mut tx_buffer);
101 let addr = "192.168.8.1"; // Address to ping to 101 let addr = "192.168.8.1"; // Address to ping to
102 // Create the PingParams with the target address 102 // Create the PingParams with the target address
103 let mut ping_params = PingParams::new(Ipv4Addr::from_str(addr).unwrap()); 103 let mut ping_params = PingParams::new(Ipv4Addr::from_str(addr).unwrap());
104 // (optional) Set custom properties of the ping 104 // (optional) Set custom properties of the ping
105 ping_params.set_payload(b"Hello, Ping!"); // custom payload 105 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};
16use embassy_rp::gpio::Pull; 16use embassy_rp::gpio::Pull;
17use embassy_rp::interrupt; 17use embassy_rp::interrupt;
18use embassy_rp::pwm::{Config, Pwm}; 18use embassy_rp::pwm::{Config, Pwm};
19use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
20use embassy_sync::blocking_mutex::Mutex; 19use embassy_sync::blocking_mutex::Mutex;
20use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
21use embassy_sync::channel::Channel; 21use embassy_sync::channel::Channel;
22use embassy_time::{Duration, Ticker}; 22use embassy_time::{Duration, Ticker};
23use portable_atomic::{AtomicU32, Ordering}; 23use 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 @@
8use defmt::*; 8use defmt::*;
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_rp::gpio::{Level, Output}; 10use embassy_rp::gpio::{Level, Output};
11use embassy_rp::multicore::{spawn_core1, Stack}; 11use embassy_rp::multicore::{Stack, spawn_core1};
12use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 12use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
13use embassy_sync::channel::Channel; 13use embassy_sync::channel::Channel;
14use embassy_time::Timer; 14use 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 @@
6use defmt::*; 6use defmt::*;
7use embassy_executor::Executor; 7use embassy_executor::Executor;
8use embassy_rp::gpio::{Level, Output}; 8use embassy_rp::gpio::{Level, Output};
9use embassy_rp::multicore::{spawn_core1, Stack}; 9use embassy_rp::multicore::{Stack, spawn_core1};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use static_cell::StaticCell; 11use static_cell::StaticCell;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/rp235x/src/bin/multiprio.rs b/examples/rp235x/src/bin/multiprio.rs
index 96cdf8fb1..310047505 100644
--- a/examples/rp235x/src/bin/multiprio.rs
+++ b/examples/rp235x/src/bin/multiprio.rs
@@ -61,7 +61,7 @@ use defmt::{info, unwrap};
61use embassy_executor::{Executor, InterruptExecutor}; 61use embassy_executor::{Executor, InterruptExecutor};
62use embassy_rp::interrupt; 62use embassy_rp::interrupt;
63use embassy_rp::interrupt::{InterruptExt, Priority}; 63use embassy_rp::interrupt::{InterruptExt, Priority};
64use embassy_time::{Instant, Timer, TICK_HZ}; 64use embassy_time::{Instant, TICK_HZ, Timer};
65use static_cell::StaticCell; 65use static_cell::StaticCell;
66use {defmt_rtt as _, panic_probe as _}; 66use {defmt_rtt as _, panic_probe as _};
67 67
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn SWI_IRQ_1() { 115unsafe fn SWI_IRQ_1() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn SWI_IRQ_0() { 120unsafe fn SWI_IRQ_0() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
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 @@
12 12
13use defmt::*; 13use defmt::*;
14use embassy_executor::Spawner; 14use embassy_executor::Spawner;
15use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage}; 15use embassy_rp::clocks::{ClockConfig, CoreVoltage, clk_sys_freq, core_voltage};
16use embassy_rp::config::Config; 16use embassy_rp::config::Config;
17use embassy_rp::gpio::{Level, Output}; 17use embassy_rp::gpio::{Level, Output};
18use embassy_time::{Duration, Instant, Timer}; 18use 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;
7use embassy_rp::peripherals::PIO0; 7use embassy_rp::peripherals::PIO0;
8use embassy_rp::pio::program::pio_asm; 8use embassy_rp::pio::program::pio_asm;
9use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; 9use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine};
10use embassy_rp::{bind_interrupts, Peri}; 10use embassy_rp::{Peri, bind_interrupts};
11use fixed::traits::ToFixed; 11use fixed::traits::ToFixed;
12use fixed_macro::types::U56F8; 12use fixed_macro::types::U56F8;
13use {defmt_rtt as _, panic_probe as _}; 13use {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;
34const BIT_DEPTH: u32 = 16; 34const BIT_DEPTH: u32 = 16;
35const CHANNELS: u32 = 2; 35const CHANNELS: u32 = 2;
36const USE_ONBOARD_PULLDOWN: bool = false; // whether or not to use the onboard pull-down resistor, 36const USE_ONBOARD_PULLDOWN: bool = false; // whether or not to use the onboard pull-down resistor,
37 // which has documented issues on many RP235x boards 37// which has documented issues on many RP235x boards
38#[embassy_executor::main] 38#[embassy_executor::main]
39async fn main(_spawner: Spawner) { 39async fn main(_spawner: Spawner) {
40 let p = embassy_rp::init(Default::default()); 40 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;
9use embassy_rp::gpio::Pull; 9use embassy_rp::gpio::Pull;
10use embassy_rp::peripherals::PIO0; 10use embassy_rp::peripherals::PIO0;
11use embassy_rp::pio::program::pio_asm; 11use embassy_rp::pio::program::pio_asm;
12use embassy_rp::{bind_interrupts, pio, Peri}; 12use embassy_rp::{Peri, bind_interrupts, pio};
13use embassy_time::Timer; 13use embassy_time::Timer;
14use fixed::traits::ToFixed; 14use fixed::traits::ToFixed;
15use pio::{Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftDirection, StateMachine}; 15use 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;
10use embassy_rp::peripherals::PIO0; 10use embassy_rp::peripherals::PIO0;
11use embassy_rp::pio::{InterruptHandler, Pio}; 11use embassy_rp::pio::{InterruptHandler, Pio};
12use embassy_rp::pio_programs::stepper::{PioStepper, PioStepperProgram}; 12use embassy_rp::pio_programs::stepper::{PioStepper, PioStepperProgram};
13use embassy_time::{with_timeout, Duration, Timer}; 13use embassy_time::{Duration, Timer, with_timeout};
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
16bind_interrupts!(struct Irqs { 16bind_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 @@
9 9
10use defmt::*; 10use defmt::*;
11use embassy_executor::Spawner; 11use embassy_executor::Spawner;
12use embassy_rp::peripherals::{PIN_25, PIN_4, PWM_SLICE2, PWM_SLICE4};
13use embassy_rp::pwm::{Config, Pwm, SetDutyCycle};
14use embassy_rp::Peri; 12use embassy_rp::Peri;
13use embassy_rp::peripherals::{PIN_4, PIN_25, PWM_SLICE2, PWM_SLICE4};
14use embassy_rp::pwm::{Config, Pwm, SetDutyCycle};
15use embassy_time::Timer; 15use embassy_time::Timer;
16use {defmt_rtt as _, panic_probe as _}; 16use {defmt_rtt as _, panic_probe as _};
17 17
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::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_rp::config::Config; 11use embassy_rp::config::Config;
12use embassy_rp::gpio::Output; 12use embassy_rp::gpio::Output;
13use embassy_rp::{gpio, peripherals, pwm, Peri}; 13use embassy_rp::{Peri, gpio, peripherals, pwm};
14use embassy_time::{Duration, Timer}; 14use embassy_time::{Duration, Timer};
15use tb6612fng::{DriveCommand, Motor, Tb6612fng}; 15use tb6612fng::{DriveCommand, Motor, Tb6612fng};
16use {defmt_rtt as _, panic_probe as _}; 16use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/rp235x/src/bin/sharing.rs b/examples/rp235x/src/bin/sharing.rs
index d4c89946b..618ab9117 100644
--- a/examples/rp235x/src/bin/sharing.rs
+++ b/examples/rp235x/src/bin/sharing.rs
@@ -52,7 +52,7 @@ bind_interrupts!(struct Irqs {
52 52
53#[interrupt] 53#[interrupt]
54unsafe fn SWI_IRQ_0() { 54unsafe fn SWI_IRQ_0() {
55 EXECUTOR_HI.on_interrupt() 55 unsafe { EXECUTOR_HI.on_interrupt() }
56} 56}
57 57
58#[entry] 58#[entry]
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;
15use embassy_rp::gpio::{Level, Output}; 15use embassy_rp::gpio::{Level, Output};
16use embassy_rp::spi; 16use embassy_rp::spi;
17use embassy_rp::spi::{Blocking, Spi}; 17use embassy_rp::spi::{Blocking, Spi};
18use embassy_sync::blocking_mutex::raw::NoopRawMutex;
19use embassy_sync::blocking_mutex::Mutex; 18use embassy_sync::blocking_mutex::Mutex;
19use embassy_sync::blocking_mutex::raw::NoopRawMutex;
20use embassy_time::Delay; 20use embassy_time::Delay;
21use embedded_graphics::image::{Image, ImageRawLE}; 21use embedded_graphics::image::{Image, ImageRawLE};
22use embedded_graphics::mono_font::ascii::FONT_10X20;
23use embedded_graphics::mono_font::MonoTextStyle; 22use embedded_graphics::mono_font::MonoTextStyle;
23use embedded_graphics::mono_font::ascii::FONT_10X20;
24use embedded_graphics::pixelcolor::Rgb565; 24use embedded_graphics::pixelcolor::Rgb565;
25use embedded_graphics::prelude::*; 25use embedded_graphics::prelude::*;
26use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle}; 26use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle};
27use embedded_graphics::text::Text; 27use embedded_graphics::text::Text;
28use mipidsi::Builder;
28use mipidsi::models::ST7789; 29use mipidsi::models::ST7789;
29use mipidsi::options::{Orientation, Rotation}; 30use mipidsi::options::{Orientation, Rotation};
30use mipidsi::Builder;
31use {defmt_rtt as _, panic_probe as _}; 31use {defmt_rtt as _, panic_probe as _};
32 32
33use crate::touch::Touch; 33use crate::touch::Touch;
@@ -167,11 +167,7 @@ mod touch {
167 167
168 let x = ((x - cal.x1) * cal.sx / (cal.x2 - cal.x1)).clamp(0, cal.sx); 168 let x = ((x - cal.x1) * cal.sx / (cal.x2 - cal.x1)).clamp(0, cal.sx);
169 let y = ((y - cal.y1) * cal.sy / (cal.y2 - cal.y1)).clamp(0, cal.sy); 169 let y = ((y - cal.y1) * cal.sy / (cal.y2 - cal.y1)).clamp(0, cal.sy);
170 if x == 0 && y == 0 { 170 if x == 0 && y == 0 { None } else { Some((x, y)) }
171 None
172 } else {
173 Some((x, y))
174 }
175 } 171 }
176 } 172 }
177} 173}
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;
6use embassy_rp::bind_interrupts; 6use embassy_rp::bind_interrupts;
7use embassy_rp::peripherals::UART0; 7use embassy_rp::peripherals::UART0;
8use embassy_rp::uart::{Config, DataBits, InterruptHandler as UARTInterruptHandler, Parity, StopBits, Uart}; 8use embassy_rp::uart::{Config, DataBits, InterruptHandler as UARTInterruptHandler, Parity, StopBits, Uart};
9use embassy_time::{with_timeout, Duration, Timer}; 9use embassy_time::{Duration, Timer, with_timeout};
10use heapless::Vec; 10use heapless::Vec;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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;
11use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; 11use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler};
12use embassy_rp::gpio::Pull; 12use embassy_rp::gpio::Pull;
13use embassy_rp::peripherals::DMA_CH0; 13use embassy_rp::peripherals::DMA_CH0;
14use embassy_rp::{bind_interrupts, Peri}; 14use embassy_rp::{Peri, bind_interrupts};
15use embassy_sync::blocking_mutex::raw::NoopRawMutex; 15use embassy_sync::blocking_mutex::raw::NoopRawMutex;
16use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; 16use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender};
17use embassy_time::{Duration, Ticker, Timer}; 17use embassy_time::{Duration, Ticker, Timer};
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml
index 449c5ddca..6dc6a353d 100644
--- a/examples/std/Cargo.toml
+++ b/examples/std/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-std-examples" 3name = "embassy-std-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/stm32c0/Cargo.toml b/examples/stm32c0/Cargo.toml
index bb7b57496..696a95854 100644
--- a/examples/stm32c0/Cargo.toml
+++ b/examples/stm32c0/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32c0-examples" 3name = "embassy-stm32c0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
4use chrono::{NaiveDate, NaiveDateTime}; 4use chrono::{NaiveDate, NaiveDateTime};
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::rtc::{Rtc, RtcConfig};
8use embassy_stm32::Config; 7use embassy_stm32::Config;
8use embassy_stm32::rtc::{Rtc, RtcConfig};
9use embassy_time::Timer; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml
index 11ecbe3c2..a78873d21 100644
--- a/examples/stm32f0/Cargo.toml
+++ b/examples/stm32f0/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-stm32f0-examples" 2name = "embassy-stm32f0-examples"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false 6publish = false
7 7
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};
7 7
8use defmt::info; 8use defmt::info;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_stm32::Peri;
10use embassy_stm32::exti::ExtiInput; 11use embassy_stm32::exti::ExtiInput;
11use embassy_stm32::gpio::{AnyPin, Level, Output, Pull, Speed}; 12use embassy_stm32::gpio::{AnyPin, Level, Output, Pull, Speed};
12use embassy_stm32::Peri;
13use embassy_time::Timer; 13use embassy_time::Timer;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
diff --git a/examples/stm32f0/src/bin/multiprio.rs b/examples/stm32f0/src/bin/multiprio.rs
index b5244afc8..9a8dc5685 100644
--- a/examples/stm32f0/src/bin/multiprio.rs
+++ b/examples/stm32f0/src/bin/multiprio.rs
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn USART1() { 115unsafe fn USART1() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn USART2() { 120unsafe fn USART2() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml
index dcb58796b..5714b149a 100644
--- a/examples/stm32f1/Cargo.toml
+++ b/examples/stm32f1/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32f1-examples" 3name = "embassy-stm32f1-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::can::frame::Envelope; 6use embassy_stm32::can::frame::Envelope;
7use embassy_stm32::can::{ 7use embassy_stm32::can::{
8 filter, Can, Fifo, Frame, Id, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, StandardId, 8 Can, Fifo, Frame, Id, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, StandardId,
9 TxInterruptHandler, 9 TxInterruptHandler, filter,
10}; 10};
11use embassy_stm32::peripherals::CAN; 11use embassy_stm32::peripherals::CAN;
12use embassy_stm32::{bind_interrupts, Config}; 12use embassy_stm32::{Config, bind_interrupts};
13use static_cell::StaticCell; 13use static_cell::StaticCell;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
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};
7use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; 8use embassy_stm32::timer::input_capture::{CapturePin, InputCapture};
9use embassy_stm32::timer::{self, Channel}; 9use embassy_stm32::timer::{self, Channel};
10use embassy_stm32::{bind_interrupts, peripherals, Peri}; 10use embassy_stm32::{Peri, bind_interrupts, peripherals};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
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;
6use embassy_stm32::gpio::{AfioRemap, Level, Output, Pull, Speed}; 6use embassy_stm32::gpio::{AfioRemap, Level, Output, Pull, Speed};
7use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::pwm_input::PwmInput; 8use embassy_stm32::timer::pwm_input::PwmInput;
9use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; 9use embassy_stm32::{Peri, bind_interrupts, peripherals, timer};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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;
7use embassy_stm32::gpio::{Level, Output, Speed}; 7use embassy_stm32::gpio::{Level, Output, Speed};
8use embassy_stm32::time::Hertz; 8use embassy_stm32::time::Hertz;
9use embassy_stm32::usb::{Driver, Instance}; 9use embassy_stm32::usb::{Driver, Instance};
10use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 10use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use embassy_usb::Builder;
12use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 13use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
13use embassy_usb::driver::EndpointError; 14use embassy_usb::driver::EndpointError;
14use embassy_usb::Builder;
15use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
16 16
17bind_interrupts!(struct Irqs { 17bind_interrupts!(struct Irqs {
diff --git a/examples/stm32f2/Cargo.toml b/examples/stm32f2/Cargo.toml
index 498c20d84..f726018c3 100644
--- a/examples/stm32f2/Cargo.toml
+++ b/examples/stm32f2/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32f2-examples" 3name = "embassy-stm32f2-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::time::Hertz;
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::time::Hertz;
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
diff --git a/examples/stm32f3/Cargo.toml b/examples/stm32f3/Cargo.toml
index 23025ef0b..4349e8055 100644
--- a/examples/stm32f3/Cargo.toml
+++ b/examples/stm32f3/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32f3-examples" 3name = "embassy-stm32f3-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
15use embassy_stm32::gpio::{Level, Output, Pull, Speed}; 15use embassy_stm32::gpio::{Level, Output, Pull, Speed};
16use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; 16use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
17use embassy_sync::channel::Channel; 17use embassy_sync::channel::Channel;
18use embassy_time::{with_timeout, Duration, Timer}; 18use embassy_time::{Duration, Timer, with_timeout};
19use {defmt_rtt as _, panic_probe as _}; 19use {defmt_rtt as _, panic_probe as _};
20 20
21struct Leds<'a> { 21struct Leds<'a> {
diff --git a/examples/stm32f3/src/bin/multiprio.rs b/examples/stm32f3/src/bin/multiprio.rs
index 2f2ffdea2..8375e0e8e 100644
--- a/examples/stm32f3/src/bin/multiprio.rs
+++ b/examples/stm32f3/src/bin/multiprio.rs
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn UART4() { 115unsafe fn UART4() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn UART5() { 120unsafe fn UART5() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
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;
7use embassy_stm32::gpio::{Level, Output, Speed}; 7use embassy_stm32::gpio::{Level, Output, Speed};
8use embassy_stm32::time::mhz; 8use embassy_stm32::time::mhz;
9use embassy_stm32::usb::{Driver, Instance}; 9use embassy_stm32::usb::{Driver, Instance};
10use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 10use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use embassy_usb::Builder;
12use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 13use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
13use embassy_usb::driver::EndpointError; 14use embassy_usb::driver::EndpointError;
14use embassy_usb::Builder;
15use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
16 16
17bind_interrupts!(struct Irqs { 17bind_interrupts!(struct Irqs {
diff --git a/examples/stm32f334/Cargo.toml b/examples/stm32f334/Cargo.toml
index 3495b118c..cf22633dd 100644
--- a/examples/stm32f334/Cargo.toml
+++ b/examples/stm32f334/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32f334-examples" 3name = "embassy-stm32f334-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
6use embassy_stm32::adc::{Adc, SampleTime}; 6use embassy_stm32::adc::{Adc, SampleTime};
7use embassy_stm32::peripherals::ADC1; 7use embassy_stm32::peripherals::ADC1;
8use embassy_stm32::time::mhz; 8use embassy_stm32::time::mhz;
9use embassy_stm32::{adc, bind_interrupts, Config}; 9use embassy_stm32::{Config, adc, bind_interrupts};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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};
7use embassy_stm32::opamp::OpAmp; 7use embassy_stm32::opamp::OpAmp;
8use embassy_stm32::peripherals::ADC2; 8use embassy_stm32::peripherals::ADC2;
9use embassy_stm32::time::mhz; 9use embassy_stm32::time::mhz;
10use embassy_stm32::{adc, bind_interrupts, Config}; 10use embassy_stm32::{Config, adc, bind_interrupts};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::Config;
6use embassy_stm32::hrtim::*; 7use embassy_stm32::hrtim::*;
7use embassy_stm32::time::{khz, mhz}; 8use embassy_stm32::time::{khz, mhz};
8use embassy_stm32::Config;
9use embassy_time::Timer; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml
index fb5f86aac..d06b7505c 100644
--- a/examples/stm32f4/Cargo.toml
+++ b/examples/stm32f4/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32f4-examples" 3name = "embassy-stm32f4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3use cortex_m::singleton; 3use cortex_m::singleton;
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, RingBufferedAdc, SampleTime, Sequence};
7use embassy_stm32::Peripherals; 6use embassy_stm32::Peripherals;
7use embassy_stm32::adc::{Adc, RingBufferedAdc, SampleTime, Sequence};
8use embassy_time::Instant; 8use embassy_time::Instant;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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};
9use embassy_stm32::peripherals::ETH; 9use embassy_stm32::peripherals::ETH;
10use embassy_stm32::rng::Rng; 10use embassy_stm32::rng::Rng;
11use embassy_stm32::time::Hertz; 11use embassy_stm32::time::Hertz;
12use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 12use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
13use embassy_time::Timer; 13use embassy_time::Timer;
14use embedded_io_async::Write; 14use embedded_io_async::Write;
15use static_cell::StaticCell; 15use 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::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, StationManagement}; 6use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, StationManagement};
7use embassy_stm32::time::Hertz; 7use embassy_stm32::time::Hertz;
8use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 8use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
9use embassy_time::Timer; 9use embassy_time::Timer;
10use static_cell::StaticCell; 10use static_cell::StaticCell;
11use {defmt_rtt as _, panic_probe as _}; 11use {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;
13use embassy_stm32::rng::Rng; 13use embassy_stm32::rng::Rng;
14use embassy_stm32::spi::Spi; 14use embassy_stm32::spi::Spi;
15use embassy_stm32::time::Hertz; 15use embassy_stm32::time::Hertz;
16use embassy_stm32::{bind_interrupts, peripherals, rng, spi, Config}; 16use embassy_stm32::{Config, bind_interrupts, peripherals, rng, spi};
17use embassy_time::{Delay, Timer}; 17use embassy_time::{Delay, Timer};
18use embedded_hal_bus::spi::ExclusiveDevice; 18use embedded_hal_bus::spi::ExclusiveDevice;
19use embedded_io_async::Write; 19use 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};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::flash::{Flash, InterruptHandler}; 6use embassy_stm32::flash::{Flash, InterruptHandler};
7use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; 7use embassy_stm32::gpio::{AnyPin, Level, Output, Speed};
8use embassy_stm32::{bind_interrupts, Peri}; 8use embassy_stm32::{Peri, bind_interrupts};
9use embassy_time::Timer; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
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};
7use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; 8use embassy_stm32::timer::input_capture::{CapturePin, InputCapture};
9use embassy_stm32::timer::{self, Channel}; 9use embassy_stm32::timer::{self, Channel};
10use embassy_stm32::{bind_interrupts, peripherals, Peri}; 10use embassy_stm32::{Peri, bind_interrupts, peripherals};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
diff --git a/examples/stm32f4/src/bin/multiprio.rs b/examples/stm32f4/src/bin/multiprio.rs
index 2f2ffdea2..8375e0e8e 100644
--- a/examples/stm32f4/src/bin/multiprio.rs
+++ b/examples/stm32f4/src/bin/multiprio.rs
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn UART4() { 115unsafe fn UART4() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn UART5() { 120unsafe fn UART5() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
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::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::gpio::OutputType; 6use embassy_stm32::gpio::OutputType;
7use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::Channel;
8use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; 9use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin};
9use embassy_stm32::timer::simple_pwm::PwmPin; 10use embassy_stm32::timer::simple_pwm::PwmPin;
10use embassy_stm32::timer::Channel;
11use embassy_time::Timer; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
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;
6use embassy_stm32::gpio::{Level, Output, Pull, Speed}; 6use embassy_stm32::gpio::{Level, Output, Pull, Speed};
7use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::pwm_input::PwmInput; 8use embassy_stm32::timer::pwm_input::PwmInput;
9use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; 9use embassy_stm32::{Peri, bind_interrupts, peripherals, timer};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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 @@
4use chrono::{NaiveDate, NaiveDateTime}; 4use chrono::{NaiveDate, NaiveDateTime};
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::rtc::{Rtc, RtcConfig};
8use embassy_stm32::Config; 7use embassy_stm32::Config;
8use embassy_stm32::rtc::{Rtc, RtcConfig};
9use embassy_time::Timer; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::sdmmc::{DataBlock, Sdmmc}; 6use embassy_stm32::sdmmc::{DataBlock, Sdmmc};
7use embassy_stm32::time::{mhz, Hertz}; 7use embassy_stm32::time::{Hertz, mhz};
8use embassy_stm32::{bind_interrupts, peripherals, sdmmc, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, sdmmc};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11/// This is a safeguard to not overwrite any data on the SD card. 11/// 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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_net::tcp::TcpSocket;
7use embassy_net::StackResources; 6use embassy_net::StackResources;
7use embassy_net::tcp::TcpSocket;
8use embassy_stm32::rng::{self, Rng}; 8use embassy_stm32::rng::{self, Rng};
9use embassy_stm32::time::Hertz; 9use embassy_stm32::time::Hertz;
10use embassy_stm32::usb::Driver; 10use embassy_stm32::usb::Driver;
11use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 11use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
12use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; 12use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState};
13use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; 13use embassy_usb::class::cdc_ncm::{CdcNcmClass, State};
14use embassy_usb::{Builder, UsbDevice}; 14use 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 86b6fa95f..9971e43f5 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;
10use embassy_stm32::gpio::Pull; 10use embassy_stm32::gpio::Pull;
11use embassy_stm32::time::Hertz; 11use embassy_stm32::time::Hertz;
12use embassy_stm32::usb::Driver; 12use embassy_stm32::usb::Driver;
13use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 13use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
14use embassy_usb::class::hid::{ 14use embassy_usb::class::hid::{
15 HidBootProtocol, HidProtocolMode, HidReaderWriter, HidSubclass, ReportId, RequestHandler, State, 15 HidBootProtocol, HidProtocolMode, HidReaderWriter, HidSubclass, ReportId, RequestHandler, State,
16}; 16};
diff --git a/examples/stm32f4/src/bin/usb_hid_mouse.rs b/examples/stm32f4/src/bin/usb_hid_mouse.rs
index 977db4c15..e83d01f88 100644
--- a/examples/stm32f4/src/bin/usb_hid_mouse.rs
+++ b/examples/stm32f4/src/bin/usb_hid_mouse.rs
@@ -8,13 +8,13 @@ use embassy_executor::Spawner;
8use embassy_futures::join::join; 8use embassy_futures::join::join;
9use embassy_stm32::time::Hertz; 9use embassy_stm32::time::Hertz;
10use embassy_stm32::usb::Driver; 10use embassy_stm32::usb::Driver;
11use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 11use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
12use embassy_time::Timer; 12use embassy_time::Timer;
13use embassy_usb::Builder;
13use embassy_usb::class::hid::{ 14use embassy_usb::class::hid::{
14 HidBootProtocol, HidProtocolMode, HidSubclass, HidWriter, ReportId, RequestHandler, State, 15 HidBootProtocol, HidProtocolMode, HidSubclass, HidWriter, ReportId, RequestHandler, State,
15}; 16};
16use embassy_usb::control::OutResponse; 17use embassy_usb::control::OutResponse;
17use embassy_usb::Builder;
18use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; 18use usbd_hid::descriptor::{MouseReport, SerializedDescriptor};
19use {defmt_rtt as _, panic_probe as _}; 19use {defmt_rtt as _, panic_probe as _};
20 20
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::*;
53use embassy_executor::Spawner; 53use embassy_executor::Spawner;
54use embassy_stm32::time::Hertz; 54use embassy_stm32::time::Hertz;
55use embassy_stm32::usb::Driver; 55use embassy_stm32::usb::Driver;
56use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 56use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
57use embassy_usb::control::{InResponse, OutResponse, Recipient, Request, RequestType}; 57use embassy_usb::control::{InResponse, OutResponse, Recipient, Request, RequestType};
58use embassy_usb::msos::{self, windows_version}; 58use embassy_usb::msos::{self, windows_version};
59use embassy_usb::types::InterfaceNumber; 59use 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;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::time::Hertz; 7use embassy_stm32::time::Hertz;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15bind_interrupts!(struct Irqs { 15bind_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};
6use defmt::{panic, *}; 6use defmt::{panic, *};
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::time::Hertz; 8use embassy_stm32::time::Hertz;
9use embassy_stm32::{bind_interrupts, interrupt, peripherals, timer, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, interrupt, peripherals, timer, usb};
10use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex};
11use embassy_sync::blocking_mutex::Mutex; 10use embassy_sync::blocking_mutex::Mutex;
11use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex};
12use embassy_sync::signal::Signal; 12use embassy_sync::signal::Signal;
13use embassy_sync::zerocopy_channel; 13use embassy_sync::zerocopy_channel;
14use embassy_usb::class::uac1; 14use 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 @@
15use embassy_executor::Spawner; 15use embassy_executor::Spawner;
16use embassy_stm32::gpio::OutputType; 16use embassy_stm32::gpio::OutputType;
17use embassy_stm32::time::khz; 17use embassy_stm32::time::khz;
18use embassy_stm32::timer::Channel;
18use embassy_stm32::timer::low_level::CountingMode; 19use embassy_stm32::timer::low_level::CountingMode;
19use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 20use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
20use embassy_stm32::timer::Channel;
21use embassy_time::{Duration, Ticker, Timer}; 21use embassy_time::{Duration, Ticker, Timer};
22use {defmt_rtt as _, panic_probe as _}; 22use {defmt_rtt as _, panic_probe as _};
23 23
diff --git a/examples/stm32f469/Cargo.toml b/examples/stm32f469/Cargo.toml
index f1d0e411a..5216e19b4 100644
--- a/examples/stm32f469/Cargo.toml
+++ b/examples/stm32f469/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32f469-examples" 3name = "embassy-stm32f469-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::dsihost::{blocking_delay_ms, DsiHost, PacketType}; 6use embassy_stm32::dsihost::{DsiHost, PacketType, blocking_delay_ms};
7use embassy_stm32::gpio::{Level, Output, Speed}; 7use embassy_stm32::gpio::{Level, Output, Speed};
8use embassy_stm32::ltdc::Ltdc; 8use embassy_stm32::ltdc::Ltdc;
9use embassy_stm32::pac::dsihost::regs::{Ier0, Ier1}; 9use embassy_stm32::pac::dsihost::regs::{Ier0, Ier1};
@@ -211,7 +211,7 @@ async fn main(_spawner: Spawner) {
211 const HORIZONTAL_SYNC_ACTIVE: u16 = 4; // ((HSA as u32 * LANE_BYTE_CLK_K_HZ as u32 ) / LCD_CLOCK as u32 ) as u16; 211 const HORIZONTAL_SYNC_ACTIVE: u16 = 4; // ((HSA as u32 * LANE_BYTE_CLK_K_HZ as u32 ) / LCD_CLOCK as u32 ) as u16;
212 const HORIZONTAL_BACK_PORCH: u16 = 77; //((HBP as u32 * LANE_BYTE_CLK_K_HZ as u32 ) / LCD_CLOCK as u32) as u16; 212 const HORIZONTAL_BACK_PORCH: u16 = 77; //((HBP as u32 * LANE_BYTE_CLK_K_HZ as u32 ) / LCD_CLOCK as u32) as u16;
213 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 */ 213 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 */
214 // FIXME: Make depend on orientation 214 // FIXME: Make depend on orientation
215 const VERTICAL_SYNC_ACTIVE: u16 = VSA; 215 const VERTICAL_SYNC_ACTIVE: u16 = VSA;
216 const VERTICAL_BACK_PORCH: u16 = VBP; 216 const VERTICAL_BACK_PORCH: u16 = VBP;
217 const VERTICAL_FRONT_PORCH: u16 = VFP; 217 const VERTICAL_FRONT_PORCH: u16 = VFP;
@@ -658,7 +658,7 @@ const NT35510_RASET_LANDSCAPE: &[u8] = &[NT35510_CMD_RASET, 0x00, 0x00, 0x01, 0x
658 658
659const NT35510_WRITES_26: &[u8] = &[NT35510_CMD_TEEON, 0x00]; // Tear on 659const NT35510_WRITES_26: &[u8] = &[NT35510_CMD_TEEON, 0x00]; // Tear on
660const NT35510_WRITES_27: &[u8] = &[NT35510_CMD_SLPOUT, 0x00]; // Sleep out 660const NT35510_WRITES_27: &[u8] = &[NT35510_CMD_SLPOUT, 0x00]; // Sleep out
661 // 28,29 missing 661// 28,29 missing
662const NT35510_WRITES_30: &[u8] = &[NT35510_CMD_DISPON, 0x00]; // Display on 662const NT35510_WRITES_30: &[u8] = &[NT35510_CMD_DISPON, 0x00]; // Display on
663 663
664const NT35510_WRITES_31: &[u8] = &[NT35510_CMD_WRDISBV, 0x7F]; 664const NT35510_WRITES_31: &[u8] = &[NT35510_CMD_WRDISBV, 0x7F];
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml
index 5d7763334..565277394 100644
--- a/examples/stm32f7/Cargo.toml
+++ b/examples/stm32f7/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32f7-examples" 3name = "embassy-stm32f7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3 3
4use core::num::{NonZeroU16, NonZeroU8}; 4use core::num::{NonZeroU8, NonZeroU16};
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3 3
4use aes_gcm::Aes128Gcm;
4use aes_gcm::aead::heapless::Vec; 5use aes_gcm::aead::heapless::Vec;
5use aes_gcm::aead::{AeadInPlace, KeyInit}; 6use aes_gcm::aead::{AeadInPlace, KeyInit};
6use aes_gcm::Aes128Gcm;
7use defmt::info; 7use defmt::info;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_stm32::cryp::{self, *}; 9use embassy_stm32::cryp::{self, *};
10use embassy_stm32::{bind_interrupts, peripherals, Config}; 10use embassy_stm32::{Config, bind_interrupts, peripherals};
11use embassy_time::Instant; 11use embassy_time::Instant;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
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};
9use embassy_stm32::peripherals::ETH; 9use embassy_stm32::peripherals::ETH;
10use embassy_stm32::rng::Rng; 10use embassy_stm32::rng::Rng;
11use embassy_stm32::time::Hertz; 11use embassy_stm32::time::Hertz;
12use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 12use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
13use embassy_time::Timer; 13use embassy_time::Timer;
14use embedded_io_async::Write; 14use embedded_io_async::Write;
15use static_cell::StaticCell; 15use 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 @@
4use defmt::info; 4use defmt::info;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::hash::*; 6use embassy_stm32::hash::*;
7use embassy_stm32::{bind_interrupts, hash, peripherals, Config}; 7use embassy_stm32::{Config, bind_interrupts, hash, peripherals};
8use embassy_time::Instant; 8use embassy_time::Instant;
9use hmac::{Hmac, Mac}; 9use hmac::{Hmac, Mac};
10use sha2::{Digest, Sha256}; 10use 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 @@
4 4
5use defmt::info; 5use defmt::info;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::Config as StmCfg;
7use embassy_stm32::mode::Async; 8use embassy_stm32::mode::Async;
8use embassy_stm32::qspi::enums::{AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *}; 9use embassy_stm32::qspi::enums::{AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *};
9use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig}; 10use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig};
10use embassy_stm32::time::mhz; 11use embassy_stm32::time::mhz;
11use embassy_stm32::Config as StmCfg;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14const MEMORY_PAGE_SIZE: usize = 256; 14const 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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::sdmmc::Sdmmc; 6use embassy_stm32::sdmmc::Sdmmc;
7use embassy_stm32::time::{mhz, Hertz}; 7use embassy_stm32::time::{Hertz, mhz};
8use embassy_stm32::{bind_interrupts, peripherals, sdmmc, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, sdmmc};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11bind_interrupts!(struct Irqs { 11bind_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;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::time::Hertz; 7use embassy_stm32::time::Hertz;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15bind_interrupts!(struct Irqs { 15bind_interrupts!(struct Irqs {
diff --git a/examples/stm32g0/Cargo.toml b/examples/stm32g0/Cargo.toml
index 1c9451469..16f28500d 100644
--- a/examples/stm32g0/Cargo.toml
+++ b/examples/stm32g0/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32g0-examples" 3name = "embassy-stm32g0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::info; 4use defmt::info;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::Config as PeripheralConfig;
6use embassy_stm32::gpio::OutputType; 7use embassy_stm32::gpio::OutputType;
7use embassy_stm32::time::khz; 8use embassy_stm32::time::khz;
9use embassy_stm32::timer::Channel;
8use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; 10use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin};
9use embassy_stm32::timer::simple_pwm::PwmPin; 11use embassy_stm32::timer::simple_pwm::PwmPin;
10use embassy_stm32::timer::Channel;
11use embassy_stm32::Config as PeripheralConfig;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14#[embassy_executor::main] 14#[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::*;
13use embassy_executor::Spawner; 13use embassy_executor::Spawner;
14use embassy_stm32::gpio::{Level, Output, OutputType, Pull, Speed}; 14use embassy_stm32::gpio::{Level, Output, OutputType, Pull, Speed};
15use embassy_stm32::time::khz; 15use embassy_stm32::time::khz;
16use embassy_stm32::timer::Channel;
16use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; 17use embassy_stm32::timer::input_capture::{CapturePin, InputCapture};
17use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 18use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
18use embassy_stm32::timer::Channel; 19use embassy_stm32::{Peri, bind_interrupts, peripherals, timer};
19use embassy_stm32::{bind_interrupts, peripherals, timer, Peri};
20use embassy_time::Timer; 20use embassy_time::Timer;
21use {defmt_rtt as _, panic_probe as _}; 21use {defmt_rtt as _, panic_probe as _};
22 22
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;
17use embassy_executor::Spawner; 17use embassy_executor::Spawner;
18use embassy_stm32::gpio::OutputType; 18use embassy_stm32::gpio::OutputType;
19use embassy_stm32::time::khz; 19use embassy_stm32::time::khz;
20use embassy_stm32::timer::Channel;
20use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; 21use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin};
21use embassy_stm32::timer::simple_pwm::PwmPin; 22use embassy_stm32::timer::simple_pwm::PwmPin;
22use embassy_stm32::timer::Channel;
23use {defmt_rtt as _, panic_probe as _}; 23use {defmt_rtt as _, panic_probe as _};
24 24
25#[embassy_executor::main] 25#[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};
14use embassy_stm32::time::khz; 14use embassy_stm32::time::khz;
15use embassy_stm32::timer::pwm_input::PwmInput; 15use embassy_stm32::timer::pwm_input::PwmInput;
16use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 16use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
17use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; 17use embassy_stm32::{Peri, bind_interrupts, peripherals, timer};
18use embassy_time::Timer; 18use embassy_time::Timer;
19use {defmt_rtt as _, panic_probe as _}; 19use {defmt_rtt as _, panic_probe as _};
20 20
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::rtc::{DateTime, DayOfWeek, Rtc, RtcConfig};
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::rtc::{DateTime, DayOfWeek, Rtc, RtcConfig};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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, *};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::usb::{Driver, Instance}; 7use embassy_stm32::usb::{Driver, Instance};
8use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
9use embassy_usb::Builder;
9use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
10use embassy_usb::driver::EndpointError; 11use embassy_usb::driver::EndpointError;
11use embassy_usb::Builder;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14bind_interrupts!(struct Irqs { 14bind_interrupts!(struct Irqs {
diff --git a/examples/stm32g4/Cargo.toml b/examples/stm32g4/Cargo.toml
index 102960980..6fd282d6d 100644
--- a/examples/stm32g4/Cargo.toml
+++ b/examples/stm32g4/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32g4-examples" 3name = "embassy-stm32g4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, SampleTime};
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::adc::{Adc, SampleTime};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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 @@
8 8
9use defmt::*; 9use defmt::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_stm32::adc::{Adc, SampleTime};
12use embassy_stm32::Config; 11use embassy_stm32::Config;
12use embassy_stm32::adc::{Adc, SampleTime};
13use embassy_time::Timer; 13use embassy_time::Timer;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime};
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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 @@
7 7
8use defmt::*; 8use defmt::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_stm32::Config;
10use embassy_stm32::adc::vals::{Rovsm, Trovs}; 11use embassy_stm32::adc::vals::{Rovsm, Trovs};
11use embassy_stm32::adc::{Adc, SampleTime}; 12use embassy_stm32::adc::{Adc, SampleTime};
12use embassy_stm32::Config;
13use embassy_time::Timer; 13use embassy_time::Timer;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
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::*;
4use embassy_executor::Spawner; 4use embassy_executor::Spawner;
5use embassy_stm32::peripherals::*; 5use embassy_stm32::peripherals::*;
6use embassy_stm32::time::Hertz; 6use embassy_stm32::time::Hertz;
7use embassy_stm32::{bind_interrupts, can, Config}; 7use embassy_stm32::{Config, bind_interrupts, can};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use static_cell::StaticCell; 9use static_cell::StaticCell;
10use {defmt_rtt as _, panic_probe as _}; 10use {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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3 3
4use defmt::{error, info, Format}; 4use defmt::{Format, error, info};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, Ucpd}; 6use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, Ucpd};
7use embassy_stm32::{bind_interrupts, peripherals, Config}; 7use embassy_stm32::{Config, bind_interrupts, peripherals};
8use embassy_time::{with_timeout, Duration}; 8use embassy_time::{Duration, with_timeout};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11bind_interrupts!(struct Irqs { 11bind_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;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::time::Hertz; 7use embassy_stm32::time::Hertz;
8use embassy_stm32::usb::{self, Driver, Instance}; 8use embassy_stm32::usb::{self, Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15bind_interrupts!(struct Irqs { 15bind_interrupts!(struct Irqs {
diff --git a/examples/stm32h5/Cargo.toml b/examples/stm32h5/Cargo.toml
index 66680c027..475ba7e8a 100644
--- a/examples/stm32h5/Cargo.toml
+++ b/examples/stm32h5/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h5-examples" 3name = "embassy-stm32h5-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, SampleTime};
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::adc::{Adc, SampleTime};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::peripherals::*; 6use embassy_stm32::peripherals::*;
7use embassy_stm32::{bind_interrupts, can, rcc, Config}; 7use embassy_stm32::{Config, bind_interrupts, can, rcc};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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;
6use embassy_stm32::dts::{Dts, InterruptHandler, SampleTime}; 6use embassy_stm32::dts::{Dts, InterruptHandler, SampleTime};
7use embassy_stm32::peripherals::DTS; 7use embassy_stm32::peripherals::DTS;
8use embassy_stm32::rcc::frequency; 8use embassy_stm32::rcc::frequency;
9use embassy_stm32::{bind_interrupts, dts, Config}; 9use embassy_stm32::{Config, bind_interrupts, dts};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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::{
12}; 12};
13use embassy_stm32::rng::Rng; 13use embassy_stm32::rng::Rng;
14use embassy_stm32::time::Hertz; 14use embassy_stm32::time::Hertz;
15use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 15use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
16use embassy_time::Timer; 16use embassy_time::Timer;
17use embedded_io_async::Write; 17use embedded_io_async::Write;
18use static_cell::StaticCell; 18use 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 @@
3 3
4use defmt::info; 4use defmt::info;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::{sai, Config}; 6use embassy_stm32::{Config, sai};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::main] 9#[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 @@
3#![no_std] 3#![no_std]
4#![no_main] 4#![no_main]
5 5
6use defmt::{error, info, Format}; 6use defmt::{Format, error, info};
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::gpio::Output; 8use embassy_stm32::gpio::Output;
9use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, Ucpd}; 9use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, Ucpd};
10use embassy_stm32::{bind_interrupts, peripherals, Config}; 10use embassy_stm32::{Config, bind_interrupts, peripherals};
11use embassy_time::{with_timeout, Duration}; 11use embassy_time::{Duration, with_timeout};
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14bind_interrupts!(struct Irqs { 14bind_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;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::time::Hertz; 7use embassy_stm32::time::Hertz;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15bind_interrupts!(struct Irqs { 15bind_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};
6use defmt::{panic, *}; 6use defmt::{panic, *};
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::time::Hertz; 8use embassy_stm32::time::Hertz;
9use embassy_stm32::{bind_interrupts, interrupt, peripherals, timer, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, interrupt, peripherals, timer, usb};
10use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex};
11use embassy_sync::blocking_mutex::Mutex; 10use embassy_sync::blocking_mutex::Mutex;
11use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex};
12use embassy_sync::signal::Signal; 12use embassy_sync::signal::Signal;
13use embassy_sync::zerocopy_channel; 13use embassy_sync::zerocopy_channel;
14use embassy_usb::class::uac1; 14use embassy_usb::class::uac1;
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index 9a2080013..5993110de 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h7-examples" 3name = "embassy-stm32h7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, SampleTime};
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::adc::{Adc, SampleTime};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime};
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::adc::{Adc, AdcChannel as _, SampleTime};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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, *};
6use embassy_stm32::gpio::{Level, Output, Speed}; 6use embassy_stm32::gpio::{Level, Output, Speed};
7use embassy_stm32::i2c::I2c; 7use embassy_stm32::i2c::I2c;
8use embassy_stm32::rcc::{Mco, Mco1Source, McoConfig, McoPrescaler}; 8use embassy_stm32::rcc::{Mco, Mco1Source, McoConfig, McoPrescaler};
9use embassy_stm32::{bind_interrupts, i2c, peripherals, Config}; 9use embassy_stm32::{Config, bind_interrupts, i2c, peripherals};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use ov7725::*; 11use ov7725::*;
12use {defmt_rtt as _, panic_probe as _}; 12use {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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::peripherals::*; 6use embassy_stm32::peripherals::*;
7use embassy_stm32::{bind_interrupts, can, rcc, Config}; 7use embassy_stm32::{Config, bind_interrupts, can, rcc};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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 @@
3 3
4use cortex_m_rt::entry; 4use cortex_m_rt::entry;
5use defmt::*; 5use defmt::*;
6use embassy_stm32::dac::{DacCh1, Value};
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::dac::{DacCh1, Value};
8use {defmt_rtt as _, panic_probe as _}; 8use {defmt_rtt as _, panic_probe as _};
9 9
10#[entry] 10#[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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::Peri;
6use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; 7use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray};
7use embassy_stm32::mode::Async; 8use embassy_stm32::mode::Async;
8use embassy_stm32::pac::timer::vals::Mms; 9use embassy_stm32::pac::timer::vals::Mms;
@@ -10,7 +11,6 @@ use embassy_stm32::peripherals::{DAC1, TIM6, TIM7};
10use embassy_stm32::rcc::frequency; 11use embassy_stm32::rcc::frequency;
11use embassy_stm32::time::Hertz; 12use embassy_stm32::time::Hertz;
12use embassy_stm32::timer::low_level::Timer; 13use embassy_stm32::timer::low_level::Timer;
13use embassy_stm32::Peri;
14use micromath::F32Ext; 14use micromath::F32Ext;
15use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
16 16
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};
8use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; 8use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue};
9use embassy_stm32::peripherals::ETH; 9use embassy_stm32::peripherals::ETH;
10use embassy_stm32::rng::Rng; 10use embassy_stm32::rng::Rng;
11use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 11use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
12use embassy_time::Timer; 12use embassy_time::Timer;
13use embedded_io_async::Write; 13use embedded_io_async::Write;
14use static_cell::StaticCell; 14use 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};
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_net::tcp::client::{TcpClient, TcpClientState};
9use embassy_net::StackResources; 8use embassy_net::StackResources;
9use embassy_net::tcp::client::{TcpClient, TcpClientState};
10use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; 10use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue};
11use embassy_stm32::peripherals::ETH; 11use embassy_stm32::peripherals::ETH;
12use embassy_stm32::rng::Rng; 12use embassy_stm32::rng::Rng;
13use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 13use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
14use embassy_time::Timer; 14use embassy_time::Timer;
15use embedded_io_async::Write; 15use embedded_io_async::Write;
16use embedded_nal_async::TcpConnect; 16use 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};
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_net::tcp::client::{TcpClient, TcpClientState};
9use embassy_net::StackResources; 8use embassy_net::StackResources;
9use embassy_net::tcp::client::{TcpClient, TcpClientState};
10use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; 10use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue};
11use embassy_stm32::peripherals::ETH; 11use embassy_stm32::peripherals::ETH;
12use embassy_stm32::rng::Rng; 12use embassy_stm32::rng::Rng;
13use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 13use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
14use embassy_time::Timer; 14use embassy_time::Timer;
15use embedded_io_async::Write; 15use embedded_io_async::Write;
16use embedded_nal_async::TcpConnect; 16use 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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::fmc::Fmc;
7use embassy_stm32::Config; 6use embassy_stm32::Config;
7use embassy_stm32::fmc::Fmc;
8use embassy_time::{Delay, Timer}; 8use embassy_time::{Delay, Timer};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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;
9use embassy_stm32::i2c::{self, I2c}; 9use embassy_stm32::i2c::{self, I2c};
10use embassy_stm32::mode::Async; 10use embassy_stm32::mode::Async;
11use embassy_stm32::{bind_interrupts, peripherals}; 11use embassy_stm32::{bind_interrupts, peripherals};
12use embassy_sync::blocking_mutex::raw::NoopRawMutex;
13use embassy_sync::blocking_mutex::NoopMutex; 12use embassy_sync::blocking_mutex::NoopMutex;
13use embassy_sync::blocking_mutex::raw::NoopRawMutex;
14use embassy_time::{Duration, Timer}; 14use embassy_time::{Duration, Timer};
15use embedded_hal_1::i2c::I2c as _; 15use embedded_hal_1::i2c::I2c as _;
16use static_cell::StaticCell; 16use 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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::gpio::{AfType, Flex, OutputType, Speed}; 6use embassy_stm32::gpio::{AfType, Flex, OutputType, Speed};
7use embassy_stm32::time::{khz, Hertz}; 7use embassy_stm32::time::{Hertz, khz};
8use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; 8use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer};
9use embassy_stm32::timer::{Ch1, Ch2, Ch3, Ch4, Channel, GeneralInstance32bit4Channel, TimerPin}; 9use embassy_stm32::timer::{Ch1, Ch2, Ch3, Ch4, Channel, GeneralInstance32bit4Channel, TimerPin};
10use embassy_stm32::{Config, Peri}; 10use embassy_stm32::{Config, Peri};
diff --git a/examples/stm32h7/src/bin/multiprio.rs b/examples/stm32h7/src/bin/multiprio.rs
index 2f2ffdea2..8375e0e8e 100644
--- a/examples/stm32h7/src/bin/multiprio.rs
+++ b/examples/stm32h7/src/bin/multiprio.rs
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn UART4() { 115unsafe fn UART4() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn UART5() { 120unsafe fn UART5() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::Config;
6use embassy_stm32::gpio::OutputType; 7use embassy_stm32::gpio::OutputType;
7use embassy_stm32::time::khz; 8use embassy_stm32::time::khz;
8use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 9use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
9use embassy_stm32::Config;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::rng::Rng; 6use embassy_stm32::rng::Rng;
7use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; 7use embassy_stm32::{Config, bind_interrupts, peripherals, rng};
8use {defmt_rtt as _, panic_probe as _}; 8use {defmt_rtt as _, panic_probe as _};
9 9
10bind_interrupts!(struct Irqs { 10bind_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 @@
4use chrono::{NaiveDate, NaiveDateTime}; 4use chrono::{NaiveDate, NaiveDateTime};
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::Config;
7use embassy_stm32::rcc::LsConfig; 8use embassy_stm32::rcc::LsConfig;
8use embassy_stm32::rtc::{Rtc, RtcConfig}; 9use embassy_stm32::rtc::{Rtc, RtcConfig};
9use embassy_stm32::Config;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::sdmmc::Sdmmc; 6use embassy_stm32::sdmmc::Sdmmc;
7use embassy_stm32::time::mhz; 7use embassy_stm32::time::mhz;
8use embassy_stm32::{bind_interrupts, peripherals, sdmmc, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, sdmmc};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11bind_interrupts!(struct Irqs { 11bind_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::*;
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_stm32::mode::Blocking; 10use embassy_stm32::mode::Blocking;
11use embassy_stm32::time::mhz; 11use embassy_stm32::time::mhz;
12use embassy_stm32::{spi, Config}; 12use embassy_stm32::{Config, spi};
13use heapless::String; 13use heapless::String;
14use static_cell::StaticCell; 14use static_cell::StaticCell;
15use {defmt_rtt as _, panic_probe as _}; 15use {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::*;
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_stm32::mode::Async; 10use embassy_stm32::mode::Async;
11use embassy_stm32::time::mhz; 11use embassy_stm32::time::mhz;
12use embassy_stm32::{spi, Config}; 12use embassy_stm32::{Config, spi};
13use grounded::uninit::GroundedArrayCell; 13use grounded::uninit::GroundedArrayCell;
14use heapless::String; 14use heapless::String;
15use static_cell::StaticCell; 15use 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::*;
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_stm32::mode::Async; 10use embassy_stm32::mode::Async;
11use embassy_stm32::time::mhz; 11use embassy_stm32::time::mhz;
12use embassy_stm32::{spi, Config}; 12use embassy_stm32::{Config, spi};
13use heapless::String; 13use heapless::String;
14use static_cell::StaticCell; 14use static_cell::StaticCell;
15use {defmt_rtt as _, panic_probe as _}; 15use {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, *};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::usb::{Driver, Instance}; 7use embassy_stm32::usb::{Driver, Instance};
8use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
9use embassy_usb::Builder;
9use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
10use embassy_usb::driver::EndpointError; 11use embassy_usb::driver::EndpointError;
11use embassy_usb::Builder;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14bind_interrupts!(struct Irqs { 14bind_interrupts!(struct Irqs {
diff --git a/examples/stm32h723/Cargo.toml b/examples/stm32h723/Cargo.toml
index 7e4ccc528..93a5109e2 100644
--- a/examples/stm32h723/Cargo.toml
+++ b/examples/stm32h723/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h723-examples" 3name = "embassy-stm32h723-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
7 7
8use defmt::{info, trace}; 8use defmt::{info, trace};
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_futures::select::{select, Either}; 10use embassy_futures::select::{Either, select};
11use embassy_stm32::spdifrx::{self, Spdifrx}; 11use embassy_stm32::spdifrx::{self, Spdifrx};
12use embassy_stm32::{bind_interrupts, peripherals, sai, Peri}; 12use embassy_stm32::{Peri, bind_interrupts, peripherals, sai};
13use grounded::uninit::GroundedArrayCell; 13use grounded::uninit::GroundedArrayCell;
14use hal::sai::*; 14use hal::sai::*;
15use {defmt_rtt as _, embassy_stm32 as hal, panic_probe as _}; 15use {defmt_rtt as _, embassy_stm32 as hal, panic_probe as _};
diff --git a/examples/stm32h735/Cargo.toml b/examples/stm32h735/Cargo.toml
index 22b7ad96a..1ad2eeb2e 100644
--- a/examples/stm32h735/Cargo.toml
+++ b/examples/stm32h735/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h735-examples" 3name = "embassy-stm32h735-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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};
15use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge}; 15use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge};
16use embassy_stm32::{bind_interrupts, peripherals}; 16use embassy_stm32::{bind_interrupts, peripherals};
17use embassy_time::{Duration, Timer}; 17use embassy_time::{Duration, Timer};
18use embedded_graphics::Pixel;
18use embedded_graphics::draw_target::DrawTarget; 19use embedded_graphics::draw_target::DrawTarget;
19use embedded_graphics::geometry::{OriginDimensions, Point, Size}; 20use embedded_graphics::geometry::{OriginDimensions, Point, Size};
20use embedded_graphics::image::Image; 21use embedded_graphics::image::Image;
21use embedded_graphics::pixelcolor::raw::RawU24;
22use embedded_graphics::pixelcolor::Rgb888; 22use embedded_graphics::pixelcolor::Rgb888;
23use embedded_graphics::pixelcolor::raw::RawU24;
23use embedded_graphics::prelude::*; 24use embedded_graphics::prelude::*;
24use embedded_graphics::primitives::Rectangle; 25use embedded_graphics::primitives::Rectangle;
25use embedded_graphics::Pixel;
26use heapless::{Entry, FnvIndexMap}; 26use heapless::{Entry, FnvIndexMap};
27use tinybmp::Bmp; 27use tinybmp::Bmp;
28use {defmt_rtt as _, panic_probe as _}; 28use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/stm32h742/Cargo.toml b/examples/stm32h742/Cargo.toml
index c76340b5f..9b5e5d93d 100644
--- a/examples/stm32h742/Cargo.toml
+++ b/examples/stm32h742/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h742-examples" 3name = "embassy-stm32h742-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
4 4
5use defmt::info; 5use defmt::info;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::Config as StmCfg;
7use embassy_stm32::mode::Blocking; 8use embassy_stm32::mode::Blocking;
8use embassy_stm32::qspi::enums::{AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *}; 9use embassy_stm32::qspi::enums::{AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *};
9use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig}; 10use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig};
10use embassy_stm32::Config as StmCfg;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13const MEMORY_PAGE_SIZE: usize = 256; 13const MEMORY_PAGE_SIZE: usize = 256;
diff --git a/examples/stm32h755cm4/Cargo.toml b/examples/stm32h755cm4/Cargo.toml
index c73f9df79..b5c313523 100644
--- a/examples/stm32h755cm4/Cargo.toml
+++ b/examples/stm32h755cm4/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h755cm4-examples" 3name = "embassy-stm32h755cm4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::gpio::{Level, Output, Speed};
9use embassy_stm32::SharedData; 8use embassy_stm32::SharedData;
9use embassy_stm32::gpio::{Level, Output, Speed};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
diff --git a/examples/stm32h755cm4/src/bin/intercore.rs b/examples/stm32h755cm4/src/bin/intercore.rs
index f584e31e9..c0db8cdd3 100644
--- a/examples/stm32h755cm4/src/bin/intercore.rs
+++ b/examples/stm32h755cm4/src/bin/intercore.rs
@@ -85,7 +85,7 @@ mod shared {
85 } 85 }
86 } 86 }
87 87
88 #[link_section = ".ram_d3"] 88 #[unsafe(link_section = ".ram_d3")]
89 pub static SHARED_LED_STATE: SharedLedState = SharedLedState::new(); 89 pub static SHARED_LED_STATE: SharedLedState = SharedLedState::new();
90} 90}
91 91
@@ -93,13 +93,13 @@ use core::mem::MaybeUninit;
93 93
94use defmt::*; 94use defmt::*;
95use embassy_executor::Spawner; 95use embassy_executor::Spawner;
96use embassy_stm32::gpio::{Level, Output, Speed};
97use embassy_stm32::SharedData; 96use embassy_stm32::SharedData;
97use embassy_stm32::gpio::{Level, Output, Speed};
98use embassy_time::Timer; 98use embassy_time::Timer;
99use shared::SHARED_LED_STATE; 99use shared::SHARED_LED_STATE;
100use {defmt_rtt as _, panic_probe as _}; 100use {defmt_rtt as _, panic_probe as _};
101 101
102#[link_section = ".ram_d3"] 102#[unsafe(link_section = ".ram_d3")]
103static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 103static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
104 104
105/// Task that continuously blinks the red LED as a heartbeat indicator 105/// Task that continuously blinks the red LED as a heartbeat indicator
diff --git a/examples/stm32h755cm7/Cargo.toml b/examples/stm32h755cm7/Cargo.toml
index c34d4e45c..7a1519aae 100644
--- a/examples/stm32h755cm7/Cargo.toml
+++ b/examples/stm32h755cm7/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h755cm7-examples" 3name = "embassy-stm32h755cm7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::gpio::{Level, Output, Speed};
9use embassy_stm32::SharedData; 8use embassy_stm32::SharedData;
9use embassy_stm32::gpio::{Level, Output, Speed};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
diff --git a/examples/stm32h755cm7/src/bin/intercore.rs b/examples/stm32h755cm7/src/bin/intercore.rs
index a4e1b5ff4..3df0b26d7 100644
--- a/examples/stm32h755cm7/src/bin/intercore.rs
+++ b/examples/stm32h755cm7/src/bin/intercore.rs
@@ -97,7 +97,7 @@ mod shared {
97 } 97 }
98 } 98 }
99 99
100 #[link_section = ".ram_d3"] 100 #[unsafe(link_section = ".ram_d3")]
101 pub static SHARED_LED_STATE: SharedLedState = SharedLedState::new(); 101 pub static SHARED_LED_STATE: SharedLedState = SharedLedState::new();
102 102
103 // Memory region constants for MPU configuration 103 // Memory region constants for MPU configuration
@@ -106,7 +106,7 @@ mod shared {
106 pub const SRAM4_REGION_NUMBER: u8 = 0; 106 pub const SRAM4_REGION_NUMBER: u8 = 0;
107} 107}
108 108
109#[link_section = ".ram_d3"] 109#[unsafe(link_section = ".ram_d3")]
110static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 110static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
111 111
112/// Configure MPU to make SRAM4 region non-cacheable 112/// Configure MPU to make SRAM4 region non-cacheable
diff --git a/examples/stm32h7b0/Cargo.toml b/examples/stm32h7b0/Cargo.toml
index 1917749c5..4cd7b84e5 100644
--- a/examples/stm32h7b0/Cargo.toml
+++ b/examples/stm32h7b0/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h7b0-examples" 3name = "embassy-stm32h7b0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
5 5
6use defmt::info; 6use defmt::info;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::Config;
8use embassy_stm32::gpio::{Level, Output, Speed}; 9use embassy_stm32::gpio::{Level, Output, Speed};
9use embassy_stm32::mode::Blocking; 10use embassy_stm32::mode::Blocking;
10use embassy_stm32::ospi::{ 11use embassy_stm32::ospi::{
@@ -12,7 +13,6 @@ use embassy_stm32::ospi::{
12 OspiWidth, TransferConfig, WrapSize, 13 OspiWidth, TransferConfig, WrapSize,
13}; 14};
14use embassy_stm32::time::Hertz; 15use embassy_stm32::time::Hertz;
15use embassy_stm32::Config;
16use embassy_time::Timer; 16use embassy_time::Timer;
17use {defmt_rtt as _, panic_probe as _}; 17use {defmt_rtt as _, panic_probe as _};
18 18
diff --git a/examples/stm32h7rs/Cargo.toml b/examples/stm32h7rs/Cargo.toml
index bfe59b68d..445916972 100644
--- a/examples/stm32h7rs/Cargo.toml
+++ b/examples/stm32h7rs/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32h7rs-examples" 3name = "embassy-stm32h7rs-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::Config;
6use embassy_stm32::gpio::{Level, Output, Speed}; 7use embassy_stm32::gpio::{Level, Output, Speed};
7use embassy_stm32::time::Hertz; 8use embassy_stm32::time::Hertz;
8use embassy_stm32::Config;
9use embassy_time::Timer; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::peripherals::*; 6use embassy_stm32::peripherals::*;
7use embassy_stm32::{bind_interrupts, can, rcc, Config}; 7use embassy_stm32::{Config, bind_interrupts, can, rcc};
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
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};
8use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; 8use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue};
9use embassy_stm32::peripherals::ETH; 9use embassy_stm32::peripherals::ETH;
10use embassy_stm32::rng::Rng; 10use embassy_stm32::rng::Rng;
11use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 11use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng};
12use embassy_time::Timer; 12use embassy_time::Timer;
13use heapless::Vec; 13use heapless::Vec;
14use static_cell::StaticCell; 14use static_cell::StaticCell;
diff --git a/examples/stm32h7rs/src/bin/multiprio.rs b/examples/stm32h7rs/src/bin/multiprio.rs
index 2f2ffdea2..8375e0e8e 100644
--- a/examples/stm32h7rs/src/bin/multiprio.rs
+++ b/examples/stm32h7rs/src/bin/multiprio.rs
@@ -113,12 +113,12 @@ static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
113 113
114#[interrupt] 114#[interrupt]
115unsafe fn UART4() { 115unsafe fn UART4() {
116 EXECUTOR_HIGH.on_interrupt() 116 unsafe { EXECUTOR_HIGH.on_interrupt() }
117} 117}
118 118
119#[interrupt] 119#[interrupt]
120unsafe fn UART5() { 120unsafe fn UART5() {
121 EXECUTOR_MED.on_interrupt() 121 unsafe { EXECUTOR_MED.on_interrupt() }
122} 122}
123 123
124#[entry] 124#[entry]
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 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::rng::Rng; 6use embassy_stm32::rng::Rng;
7use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; 7use embassy_stm32::{Config, bind_interrupts, peripherals, rng};
8use {defmt_rtt as _, panic_probe as _}; 8use {defmt_rtt as _, panic_probe as _};
9 9
10bind_interrupts!(struct Irqs { 10bind_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 @@
4use chrono::{NaiveDate, NaiveDateTime}; 4use chrono::{NaiveDate, NaiveDateTime};
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::Config;
7use embassy_stm32::rcc::LsConfig; 8use embassy_stm32::rcc::LsConfig;
8use embassy_stm32::rtc::{Rtc, RtcConfig}; 9use embassy_stm32::rtc::{Rtc, RtcConfig};
9use embassy_stm32::Config;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::time::Hertz; 7use embassy_stm32::time::Hertz;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15bind_interrupts!(struct Irqs { 15bind_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;
8 8
9use defmt::info; 9use defmt::info;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_stm32::Config;
11use embassy_stm32::gpio::{Level, Output, Speed}; 12use embassy_stm32::gpio::{Level, Output, Speed};
12use embassy_stm32::mode::Blocking; 13use embassy_stm32::mode::Blocking;
13use embassy_stm32::time::Hertz; 14use embassy_stm32::time::Hertz;
@@ -15,7 +16,6 @@ use embassy_stm32::xspi::{
15 AddressSize, ChipSelectHighTime, DummyCycles, FIFOThresholdLevel, Instance, MemorySize, MemoryType, TransferConfig, 16 AddressSize, ChipSelectHighTime, DummyCycles, FIFOThresholdLevel, Instance, MemorySize, MemoryType, TransferConfig,
16 WrapSize, Xspi, XspiWidth, 17 WrapSize, Xspi, XspiWidth,
17}; 18};
18use embassy_stm32::Config;
19use embassy_time::Timer; 19use embassy_time::Timer;
20use {defmt_rtt as _, panic_probe as _}; 20use {defmt_rtt as _, panic_probe as _};
21 21
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml
index d42cdac15..a9c71d655 100644
--- a/examples/stm32l0/Cargo.toml
+++ b/examples/stm32l0/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32l0-examples" 3name = "embassy-stm32l0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::Config;
6use embassy_stm32::exti::ExtiInput; 7use embassy_stm32::exti::ExtiInput;
7use embassy_stm32::gpio::Pull; 8use embassy_stm32::gpio::Pull;
8use embassy_stm32::Config;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11#[embassy_executor::main] 11#[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;
12use embassy_stm32::timer::low_level::{Timer as LLTimer, *}; 12use embassy_stm32::timer::low_level::{Timer as LLTimer, *};
13use embassy_stm32::timer::simple_pwm::PwmPin; 13use embassy_stm32::timer::simple_pwm::PwmPin;
14use embassy_stm32::timer::{Ch3, Channel}; 14use embassy_stm32::timer::{Ch3, Channel};
15use embassy_stm32::{interrupt, pac, Config}; 15use embassy_stm32::{Config, interrupt, pac};
16use panic_probe as _; 16use panic_probe as _;
17 17
18const DDS_SINE_DATA: [u8; 256] = [ 18const 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 @@
3 3
4use defmt::{info, unwrap}; 4use defmt::{info, unwrap};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::flash::{Flash, EEPROM_BASE, EEPROM_SIZE}; 6use embassy_stm32::flash::{EEPROM_BASE, EEPROM_SIZE, Flash};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::main] 9#[embassy_executor::main]
diff --git a/examples/stm32l0/src/bin/raw_spawn.rs b/examples/stm32l0/src/bin/raw_spawn.rs
index 6385e3c8f..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;
5 5
6use cortex_m_rt::entry; 6use cortex_m_rt::entry;
7use defmt::*; 7use defmt::*;
8use embassy_executor::raw::TaskStorage;
9use embassy_executor::Executor; 8use embassy_executor::Executor;
9use embassy_executor::raw::TaskStorage;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use static_cell::StaticCell; 11use static_cell::StaticCell;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
@@ -48,5 +48,5 @@ fn main() -> ! {
48} 48}
49 49
50unsafe fn make_static<T>(t: &T) -> &'static T { 50unsafe fn make_static<T>(t: &T) -> &'static T {
51 mem::transmute(t) 51 unsafe { mem::transmute(t) }
52} 52}
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;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::usb::{self, Driver, Instance}; 7use embassy_stm32::usb::{self, Driver, Instance};
8use embassy_stm32::{bind_interrupts, peripherals}; 8use embassy_stm32::{bind_interrupts, peripherals};
9use embassy_usb::Builder;
9use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
10use embassy_usb::driver::EndpointError; 11use embassy_usb::driver::EndpointError;
11use embassy_usb::Builder;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14bind_interrupts!(struct Irqs { 14bind_interrupts!(struct Irqs {
diff --git a/examples/stm32l1/Cargo.toml b/examples/stm32l1/Cargo.toml
index 76ceade9c..7f6b31ed5 100644
--- a/examples/stm32l1/Cargo.toml
+++ b/examples/stm32l1/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32l1-examples" 3name = "embassy-stm32l1-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::{info, unwrap}; 4use defmt::{info, unwrap};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::flash::{Flash, EEPROM_BASE, EEPROM_SIZE}; 6use embassy_stm32::flash::{EEPROM_BASE, EEPROM_SIZE, Flash};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::main] 9#[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;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::usb::{self, Driver, Instance}; 7use embassy_stm32::usb::{self, Driver, Instance};
8use embassy_stm32::{bind_interrupts, peripherals}; 8use embassy_stm32::{bind_interrupts, peripherals};
9use embassy_usb::Builder;
9use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
10use embassy_usb::driver::EndpointError; 11use embassy_usb::driver::EndpointError;
11use embassy_usb::Builder;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14bind_interrupts!(struct Irqs { 14bind_interrupts!(struct Irqs {
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index 1b7f15b1d..936472199 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32l4-examples" 3name = "embassy-stm32l4-examples"
4version = "0.1.1" 4version = "0.1.1"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
2#![no_main] 2#![no_main]
3 3
4use defmt::*; 4use defmt::*;
5use embassy_stm32::adc::{Adc, Resolution};
6use embassy_stm32::Config; 5use embassy_stm32::Config;
6use embassy_stm32::adc::{Adc, Resolution};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[cortex_m_rt::entry] 9#[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::{
8 Can, Fifo, Frame, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler, 8 Can, Fifo, Frame, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler,
9}; 9};
10use embassy_stm32::peripherals::CAN1; 10use embassy_stm32::peripherals::CAN1;
11use embassy_stm32::{bind_interrupts, Config}; 11use embassy_stm32::{Config, bind_interrupts};
12use embassy_time::Timer; 12use embassy_time::Timer;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::Peri;
6use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray}; 7use embassy_stm32::dac::{DacCh1, DacCh2, ValueArray};
7use embassy_stm32::mode::Async; 8use embassy_stm32::mode::Async;
8use embassy_stm32::pac::timer::vals::Mms; 9use embassy_stm32::pac::timer::vals::Mms;
@@ -10,7 +11,6 @@ use embassy_stm32::peripherals::{DAC1, TIM6, TIM7};
10use embassy_stm32::rcc::frequency; 11use embassy_stm32::rcc::frequency;
11use embassy_stm32::time::Hertz; 12use embassy_stm32::time::Hertz;
12use embassy_stm32::timer::low_level::Timer; 13use embassy_stm32::timer::low_level::Timer;
13use embassy_stm32::Peri;
14use micromath::F32Ext; 14use micromath::F32Ext;
15use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
16 16
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::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::rcc::{Pll, PllMul, PllPreDiv, PllQDiv, PllRDiv, PllSource, Sysclk}; 6use embassy_stm32::rcc::{Pll, PllMul, PllPreDiv, PllQDiv, PllRDiv, PllSource, Sysclk};
7use embassy_stm32::rng::Rng; 7use embassy_stm32::rng::Rng;
8use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, rng};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11bind_interrupts!(struct Irqs { 11bind_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 @@
4use chrono::{NaiveDate, NaiveDateTime}; 4use chrono::{NaiveDate, NaiveDateTime};
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::Config;
7use embassy_stm32::rtc::{Rtc, RtcConfig}; 8use embassy_stm32::rtc::{Rtc, RtcConfig};
8use embassy_stm32::time::Hertz; 9use embassy_stm32::time::Hertz;
9use embassy_stm32::Config;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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 @@
16use core::marker::PhantomData; 16use core::marker::PhantomData;
17use core::sync::atomic::{AtomicI32, Ordering}; 17use core::sync::atomic::{AtomicI32, Ordering};
18 18
19use defmt::{error, info, println, unwrap, Format}; 19use defmt::{Format, error, info, println, unwrap};
20use defmt_rtt as _; // global logger 20use defmt_rtt as _; // global logger
21use embassy_executor::Spawner; 21use embassy_executor::Spawner;
22use embassy_futures::select::{select, Either}; 22use embassy_futures::select::{Either, select};
23use embassy_futures::yield_now; 23use embassy_futures::yield_now;
24use embassy_net::tcp::TcpSocket; 24use embassy_net::tcp::TcpSocket;
25use embassy_net::{Ipv4Address, Ipv4Cidr, Stack, StackResources, StaticConfigV4}; 25use embassy_net::{Ipv4Address, Ipv4Cidr, Stack, StackResources, StaticConfigV4};
26use embassy_net_adin1110::{Device, Runner, ADIN1110}; 26use embassy_net_adin1110::{ADIN1110, Device, Runner};
27use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; 27use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
28use embassy_stm32::i2c::{self, Config as I2C_Config, I2c}; 28use embassy_stm32::i2c::{self, Config as I2C_Config, I2c};
29use embassy_stm32::mode::Async; 29use embassy_stm32::mode::Async;
@@ -159,7 +159,9 @@ async fn main(spawner: Spawner) {
159 159
160 // Check the SPI mode selected with the "HW CFG" dip-switch 160 // Check the SPI mode selected with the "HW CFG" dip-switch
161 if !cfg1_spi_mode { 161 if !cfg1_spi_mode {
162 error!("Driver doesn´t support SPI Protolcol \"OPEN Alliance\".\nplease use the \"Generic SPI\"! Turn On \"HW CFG\": \"SPI_CFG1\""); 162 error!(
163 "Driver doesn´t support SPI Protolcol \"OPEN Alliance\".\nplease use the \"Generic SPI\"! Turn On \"HW CFG\": \"SPI_CFG1\""
164 );
163 loop { 165 loop {
164 led_uc2_red.toggle(); 166 led_uc2_red.toggle();
165 Timer::after(Duration::from_hz(10)).await; 167 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
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_futures::join::join; 7use embassy_futures::join::join;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use panic_probe as _; 13use panic_probe as _;
14 14
15bind_interrupts!(struct Irqs { 15bind_interrupts!(struct Irqs {
diff --git a/examples/stm32l432/Cargo.toml b/examples/stm32l432/Cargo.toml
index f173c651e..14f41992d 100644
--- a/examples/stm32l432/Cargo.toml
+++ b/examples/stm32l432/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32l432-examples" 3name = "embassy-stm32l432-examples"
4version = "0.1.1" 4version = "0.1.1"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml
index 9999300b8..b6158c854 100644
--- a/examples/stm32l5/Cargo.toml
+++ b/examples/stm32l5/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32l5-examples" 3name = "embassy-stm32l5-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::rcc::{Pll, PllMul, PllPreDiv, PllRDiv, PllSource, Sysclk}; 6use embassy_stm32::rcc::{Pll, PllMul, PllPreDiv, PllRDiv, PllSource, Sysclk};
7use embassy_stm32::rng::Rng; 7use embassy_stm32::rng::Rng;
8use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, rng};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11bind_interrupts!(struct Irqs { 11bind_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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_net::tcp::TcpSocket;
7use embassy_net::StackResources; 6use embassy_net::StackResources;
7use embassy_net::tcp::TcpSocket;
8use embassy_stm32::rng::Rng; 8use embassy_stm32::rng::Rng;
9use embassy_stm32::usb::Driver; 9use embassy_stm32::usb::Driver;
10use embassy_stm32::{bind_interrupts, peripherals, rng, usb, Config}; 10use embassy_stm32::{Config, bind_interrupts, peripherals, rng, usb};
11use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; 11use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState};
12use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; 12use embassy_usb::class::cdc_ncm::{CdcNcmClass, State};
13use embassy_usb::{Builder, UsbDevice}; 13use 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 8c7cdbef5..d8f2de941 100644
--- a/examples/stm32l5/src/bin/usb_hid_mouse.rs
+++ b/examples/stm32l5/src/bin/usb_hid_mouse.rs
@@ -7,13 +7,13 @@ use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_futures::join::join; 8use embassy_futures::join::join;
9use embassy_stm32::usb::Driver; 9use embassy_stm32::usb::Driver;
10use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 10use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use embassy_usb::Builder;
12use embassy_usb::class::hid::{ 13use embassy_usb::class::hid::{
13 HidBootProtocol, HidProtocolMode, HidSubclass, HidWriter, ReportId, RequestHandler, State, 14 HidBootProtocol, HidProtocolMode, HidSubclass, HidWriter, ReportId, RequestHandler, State,
14}; 15};
15use embassy_usb::control::OutResponse; 16use embassy_usb::control::OutResponse;
16use embassy_usb::Builder;
17use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; 17use usbd_hid::descriptor::{MouseReport, SerializedDescriptor};
18use {defmt_rtt as _, panic_probe as _}; 18use {defmt_rtt as _, panic_probe as _};
19 19
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, *};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::usb::{Driver, Instance}; 7use embassy_stm32::usb::{Driver, Instance};
8use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
9use embassy_usb::Builder;
9use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
10use embassy_usb::driver::EndpointError; 11use embassy_usb::driver::EndpointError;
11use embassy_usb::Builder;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14bind_interrupts!(struct Irqs { 14bind_interrupts!(struct Irqs {
diff --git a/examples/stm32u0/Cargo.toml b/examples/stm32u0/Cargo.toml
index 9318414a5..9f5227e3f 100644
--- a/examples/stm32u0/Cargo.toml
+++ b/examples/stm32u0/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32u0-examples" 3name = "embassy-stm32u0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
2#![no_main] 2#![no_main]
3 3
4use defmt::*; 4use defmt::*;
5use embassy_stm32::adc::{Adc, Resolution};
6use embassy_stm32::Config; 5use embassy_stm32::Config;
6use embassy_stm32::adc::{Adc, Resolution};
7use embassy_time::Duration; 7use embassy_time::Duration;
8use {defmt_rtt as _, panic_probe as _}; 8use {defmt_rtt as _, panic_probe as _};
9 9
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::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::rcc::mux::Clk48sel; 6use embassy_stm32::rcc::mux::Clk48sel;
7use embassy_stm32::rng::Rng; 7use embassy_stm32::rng::Rng;
8use embassy_stm32::{bind_interrupts, peripherals, rng, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, rng};
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11bind_interrupts!(struct Irqs { 11bind_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 @@
4use chrono::{NaiveDate, NaiveDateTime}; 4use chrono::{NaiveDate, NaiveDateTime};
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::rtc::{Rtc, RtcConfig};
8use embassy_stm32::Config; 7use embassy_stm32::Config;
8use embassy_stm32::rtc::{Rtc, RtcConfig};
9use embassy_time::Timer; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
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
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_futures::join::join; 7use embassy_futures::join::join;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use panic_probe as _; 13use panic_probe as _;
14 14
15bind_interrupts!(struct Irqs { 15bind_interrupts!(struct Irqs {
diff --git a/examples/stm32u5/Cargo.toml b/examples/stm32u5/Cargo.toml
index f2ffe52c5..7a1e62406 100644
--- a/examples/stm32u5/Cargo.toml
+++ b/examples/stm32u5/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32u5-examples" 3name = "embassy-stm32u5-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_stm32::adc; 5use embassy_stm32::adc;
6use embassy_stm32::adc::{adc4, AdcChannel}; 6use embassy_stm32::adc::{AdcChannel, adc4};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::main] 9#[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};
13use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge}; 13use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge};
14use embassy_stm32::{bind_interrupts, peripherals}; 14use embassy_stm32::{bind_interrupts, peripherals};
15use embassy_time::{Duration, Timer}; 15use embassy_time::{Duration, Timer};
16use embedded_graphics::Pixel;
16use embedded_graphics::draw_target::DrawTarget; 17use embedded_graphics::draw_target::DrawTarget;
17use embedded_graphics::geometry::{OriginDimensions, Point, Size}; 18use embedded_graphics::geometry::{OriginDimensions, Point, Size};
18use embedded_graphics::image::Image; 19use embedded_graphics::image::Image;
19use embedded_graphics::pixelcolor::raw::RawU24;
20use embedded_graphics::pixelcolor::Rgb888; 20use embedded_graphics::pixelcolor::Rgb888;
21use embedded_graphics::pixelcolor::raw::RawU24;
21use embedded_graphics::prelude::*; 22use embedded_graphics::prelude::*;
22use embedded_graphics::primitives::Rectangle; 23use embedded_graphics::primitives::Rectangle;
23use embedded_graphics::Pixel;
24use heapless::{Entry, FnvIndexMap}; 24use heapless::{Entry, FnvIndexMap};
25use tinybmp::Bmp; 25use tinybmp::Bmp;
26use {defmt_rtt as _, panic_probe as _}; 26use {defmt_rtt as _, panic_probe as _};
@@ -317,7 +317,7 @@ impl OriginDimensions for DoubleBuffer {
317mod rcc_setup { 317mod rcc_setup {
318 318
319 use embassy_stm32::time::Hertz; 319 use embassy_stm32::time::Hertz;
320 use embassy_stm32::{rcc, Config, Peripherals}; 320 use embassy_stm32::{Config, Peripherals, rcc};
321 321
322 /// Sets up clocks for the stm32u5g9zj mcu 322 /// Sets up clocks for the stm32u5g9zj mcu
323 /// change this if you plan to use a different microcontroller 323 /// 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
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_futures::join::join; 7use embassy_futures::join::join;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use panic_probe as _; 13use panic_probe as _;
14 14
15bind_interrupts!(struct Irqs { 15bind_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
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_futures::join::join; 7use embassy_futures::join::join;
8use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
9use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 9use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
10use embassy_usb::Builder;
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::Builder;
13use panic_probe as _; 13use panic_probe as _;
14 14
15bind_interrupts!(struct Irqs { 15bind_interrupts!(struct Irqs {
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml
index 7ab13c290..783690c11 100644
--- a/examples/stm32wb/Cargo.toml
+++ b/examples/stm32wb/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32wb-examples" 3name = "embassy-stm32wb-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
8use embassy_stm32::bind_interrupts; 8use embassy_stm32::bind_interrupts;
9use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 9use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
10use embassy_stm32::rcc::WPAN_DEFAULT; 10use embassy_stm32::rcc::WPAN_DEFAULT;
11use embassy_stm32_wpan::TlMbox;
12use embassy_stm32_wpan::hci::BdAddr;
11use embassy_stm32_wpan::hci::host::uart::UartHci; 13use embassy_stm32_wpan::hci::host::uart::UartHci;
12use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 14use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
13use embassy_stm32_wpan::hci::types::AdvertisingType; 15use embassy_stm32_wpan::hci::types::AdvertisingType;
14use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; 16use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role};
15use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; 17use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands;
16use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; 18use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
17use embassy_stm32_wpan::hci::BdAddr;
18use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 19use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
19use embassy_stm32_wpan::TlMbox;
20use {defmt_rtt as _, panic_probe as _}; 20use {defmt_rtt as _, panic_probe as _};
21 21
22bind_interrupts!(struct Irqs{ 22bind_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;
8use embassy_stm32::bind_interrupts; 8use embassy_stm32::bind_interrupts;
9use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 9use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
10use embassy_stm32::rcc::WPAN_DEFAULT; 10use embassy_stm32::rcc::WPAN_DEFAULT;
11use embassy_stm32_wpan::TlMbox;
11use embassy_stm32_wpan::hci::event::command::{CommandComplete, ReturnParameters}; 12use embassy_stm32_wpan::hci::event::command::{CommandComplete, ReturnParameters};
12use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci}; 13use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci};
13use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 14use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
@@ -28,7 +29,6 @@ use embassy_stm32_wpan::hci::{BdAddr, Event};
28use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 29use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
29use embassy_stm32_wpan::sub::ble::Ble; 30use embassy_stm32_wpan::sub::ble::Ble;
30use embassy_stm32_wpan::sub::mm; 31use embassy_stm32_wpan::sub::mm;
31use embassy_stm32_wpan::TlMbox;
32use {defmt_rtt as _, panic_probe as _}; 32use {defmt_rtt as _, panic_probe as _};
33 33
34bind_interrupts!(struct Irqs{ 34bind_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;
6use embassy_stm32::bind_interrupts; 6use embassy_stm32::bind_interrupts;
7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
8use embassy_stm32::rcc::WPAN_DEFAULT; 8use embassy_stm32::rcc::WPAN_DEFAULT;
9use embassy_stm32_wpan::TlMbox;
9use embassy_stm32_wpan::mac::commands::{AssociateResponse, ResetRequest, SetRequest, StartRequest}; 10use embassy_stm32_wpan::mac::commands::{AssociateResponse, ResetRequest, SetRequest, StartRequest};
10use embassy_stm32_wpan::mac::event::MacEvent; 11use embassy_stm32_wpan::mac::event::MacEvent;
11use embassy_stm32_wpan::mac::typedefs::{MacChannel, MacStatus, PanId, PibId, SecurityLevel}; 12use embassy_stm32_wpan::mac::typedefs::{MacChannel, MacStatus, PanId, PibId, SecurityLevel};
12use embassy_stm32_wpan::sub::mm; 13use embassy_stm32_wpan::sub::mm;
13use embassy_stm32_wpan::TlMbox;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
16bind_interrupts!(struct Irqs{ 16bind_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;
6use embassy_stm32::bind_interrupts; 6use embassy_stm32::bind_interrupts;
7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
8use embassy_stm32::rcc::WPAN_DEFAULT; 8use embassy_stm32::rcc::WPAN_DEFAULT;
9use embassy_stm32_wpan::TlMbox;
9use embassy_stm32_wpan::mac::commands::{ResetRequest, SetRequest, StartRequest}; 10use embassy_stm32_wpan::mac::commands::{ResetRequest, SetRequest, StartRequest};
10use embassy_stm32_wpan::mac::typedefs::{MacChannel, PanId, PibId}; 11use embassy_stm32_wpan::mac::typedefs::{MacChannel, PanId, PibId};
11use embassy_stm32_wpan::mac::{self, Runner}; 12use embassy_stm32_wpan::mac::{self, Runner};
12use embassy_stm32_wpan::sub::mm; 13use embassy_stm32_wpan::sub::mm;
13use embassy_stm32_wpan::TlMbox;
14use static_cell::StaticCell; 14use static_cell::StaticCell;
15use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
16 16
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;
6use embassy_stm32::bind_interrupts; 6use embassy_stm32::bind_interrupts;
7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
8use embassy_stm32::rcc::WPAN_DEFAULT; 8use embassy_stm32::rcc::WPAN_DEFAULT;
9use embassy_stm32_wpan::TlMbox;
9use embassy_stm32_wpan::mac::commands::{AssociateRequest, DataRequest, GetRequest, ResetRequest, SetRequest}; 10use embassy_stm32_wpan::mac::commands::{AssociateRequest, DataRequest, GetRequest, ResetRequest, SetRequest};
10use embassy_stm32_wpan::mac::event::MacEvent; 11use embassy_stm32_wpan::mac::event::MacEvent;
11use embassy_stm32_wpan::mac::typedefs::{ 12use embassy_stm32_wpan::mac::typedefs::{
12 AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, 13 AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel,
13}; 14};
14use embassy_stm32_wpan::sub::mm; 15use embassy_stm32_wpan::sub::mm;
15use embassy_stm32_wpan::TlMbox;
16use {defmt_rtt as _, panic_probe as _}; 16use {defmt_rtt as _, panic_probe as _};
17 17
18bind_interrupts!(struct Irqs{ 18bind_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;
6use embassy_stm32::bind_interrupts; 6use embassy_stm32::bind_interrupts;
7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 7use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
8use embassy_stm32::rcc::WPAN_DEFAULT; 8use embassy_stm32::rcc::WPAN_DEFAULT;
9use embassy_stm32_wpan::sub::mm;
10use embassy_stm32_wpan::TlMbox; 9use embassy_stm32_wpan::TlMbox;
10use embassy_stm32_wpan::sub::mm;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13bind_interrupts!(struct Irqs{ 13bind_interrupts!(struct Irqs{
diff --git a/examples/stm32wba/Cargo.toml b/examples/stm32wba/Cargo.toml
index e1196614a..3496b41b0 100644
--- a/examples/stm32wba/Cargo.toml
+++ b/examples/stm32wba/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32wba-examples" 3name = "embassy-stm32wba-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
2#![no_main] 2#![no_main]
3 3
4use defmt::*; 4use defmt::*;
5use embassy_stm32::adc::{adc4, AdcChannel}; 5use embassy_stm32::adc::{AdcChannel, adc4};
6use {defmt_rtt as _, panic_probe as _}; 6use {defmt_rtt as _, panic_probe as _};
7 7
8#[embassy_executor::main] 8#[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 @@
4use defmt::*; 4use defmt::*;
5use defmt_rtt as _; // global logger 5use defmt_rtt as _; // global logger
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::Config;
7use embassy_stm32::gpio::OutputType; 8use embassy_stm32::gpio::OutputType;
8use embassy_stm32::rcc::{ 9use embassy_stm32::rcc::{
9 AHB5Prescaler, AHBPrescaler, APBPrescaler, PllDiv, PllMul, PllPreDiv, PllSource, Sysclk, VoltageScale, 10 AHB5Prescaler, AHBPrescaler, APBPrescaler, PllDiv, PllMul, PllPreDiv, PllSource, Sysclk, VoltageScale,
10}; 11};
11use embassy_stm32::time::khz; 12use embassy_stm32::time::khz;
12use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 13use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
13use embassy_stm32::Config;
14use embassy_time::Timer; 14use embassy_time::Timer;
15use panic_probe as _; 15use panic_probe as _;
16 16
diff --git a/examples/stm32wba6/Cargo.toml b/examples/stm32wba6/Cargo.toml
index f98317846..04bb27cb0 100644
--- a/examples/stm32wba6/Cargo.toml
+++ b/examples/stm32wba6/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32wba6-examples" 3name = "embassy-stm32wba6-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
2#![no_main] 2#![no_main]
3 3
4use defmt::*; 4use defmt::*;
5use embassy_stm32::adc::{adc4, AdcChannel}; 5use embassy_stm32::adc::{AdcChannel, adc4};
6use {defmt_rtt as _, panic_probe as _}; 6use {defmt_rtt as _, panic_probe as _};
7 7
8#[embassy_executor::main] 8#[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 @@
4use defmt::*; 4use defmt::*;
5use defmt_rtt as _; // global logger 5use defmt_rtt as _; // global logger
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::Config;
7use embassy_stm32::gpio::OutputType; 8use embassy_stm32::gpio::OutputType;
8use embassy_stm32::rcc::{ 9use embassy_stm32::rcc::{
9 AHB5Prescaler, AHBPrescaler, APBPrescaler, PllDiv, PllMul, PllPreDiv, PllSource, Sysclk, VoltageScale, 10 AHB5Prescaler, AHBPrescaler, APBPrescaler, PllDiv, PllMul, PllPreDiv, PllSource, Sysclk, VoltageScale,
10}; 11};
11use embassy_stm32::time::khz; 12use embassy_stm32::time::khz;
12use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 13use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
13use embassy_stm32::Config;
14use embassy_time::Timer; 14use embassy_time::Timer;
15use panic_probe as _; 15use panic_probe as _;
16 16
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, *};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_futures::join::join; 6use embassy_futures::join::join;
7use embassy_stm32::usb::{Driver, Instance}; 7use embassy_stm32::usb::{Driver, Instance};
8use embassy_stm32::{bind_interrupts, peripherals, usb, Config}; 8use embassy_stm32::{Config, bind_interrupts, peripherals, usb};
9use embassy_usb::Builder;
9use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 10use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
10use embassy_usb::driver::EndpointError; 11use embassy_usb::driver::EndpointError;
11use embassy_usb::Builder;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14bind_interrupts!(struct Irqs { 14bind_interrupts!(struct Irqs {
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml
index 825d25c0d..1754aa0b8 100644
--- a/examples/stm32wl/Cargo.toml
+++ b/examples/stm32wl/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32wl-examples" 3name = "embassy-stm32wl-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::adc::{Adc, CkModePclk, Clock, SampleTime};
9use embassy_stm32::SharedData; 8use embassy_stm32::SharedData;
9use embassy_stm32::adc::{Adc, CkModePclk, Clock, SampleTime};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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;
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::gpio::{Level, Output, Speed};
9use embassy_stm32::SharedData; 8use embassy_stm32::SharedData;
9use embassy_stm32::gpio::{Level, Output, Speed};
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
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;
5 5
6use cortex_m_rt::entry; 6use cortex_m_rt::entry;
7use defmt::*; 7use defmt::*;
8use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
9use embassy_stm32::SharedData; 8use embassy_stm32::SharedData;
9use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[unsafe(link_section = ".shared_data")] 12#[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;
5 5
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::SharedData;
8use embassy_stm32::exti::ExtiInput; 9use embassy_stm32::exti::ExtiInput;
9use embassy_stm32::gpio::Pull; 10use embassy_stm32::gpio::Pull;
10use embassy_stm32::SharedData;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13#[unsafe(link_section = ".shared_data")] 13#[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;
5 5
6use defmt::{info, unwrap}; 6use defmt::{info, unwrap};
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::flash::Flash;
9use embassy_stm32::SharedData; 8use embassy_stm32::SharedData;
9use embassy_stm32::flash::Flash;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[unsafe(link_section = ".shared_data")] 12#[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::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::rng::{self, Rng}; 8use embassy_stm32::rng::{self, Rng};
9use embassy_stm32::time::Hertz; 9use embassy_stm32::time::Hertz;
10use embassy_stm32::{bind_interrupts, peripherals, SharedData}; 10use embassy_stm32::{SharedData, bind_interrupts, peripherals};
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13bind_interrupts!(struct Irqs{ 13bind_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;
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::usart::{Config, InterruptHandler, Uart}; 8use embassy_stm32::usart::{Config, InterruptHandler, Uart};
9use embassy_stm32::{bind_interrupts, peripherals, SharedData}; 9use embassy_stm32::{SharedData, bind_interrupts, peripherals};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12bind_interrupts!(struct Irqs{ 12bind_interrupts!(struct Irqs{
diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml
index e8897506c..79d50b584 100644
--- a/examples/wasm/Cargo.toml
+++ b/examples/wasm/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-wasm-example" 3name = "embassy-wasm-example"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/rustfmt.toml b/rustfmt.toml
index 2561562fd..3d5eeed93 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,4 +1,4 @@
1group_imports = "StdExternalCrate" 1group_imports = "StdExternalCrate"
2imports_granularity = "Module" 2imports_granularity = "Module"
3edition = "2021" 3edition = "2024"
4max_width = 120 4max_width = 120
diff --git a/tests/mspm0/Cargo.toml b/tests/mspm0/Cargo.toml
index 227d898d5..df52b538d 100644
--- a/tests/mspm0/Cargo.toml
+++ b/tests/mspm0/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-mspm0-tests" 3name = "embassy-mspm0-tests"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
11 11
12use defmt::{assert, assert_eq, *}; 12use defmt::{assert, assert_eq, *};
13use embassy_executor::Spawner; 13use embassy_executor::Spawner;
14use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word};
15use embassy_mspm0::Peri; 14use embassy_mspm0::Peri;
15use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word};
16use {defmt_rtt as _, panic_probe as _}; 16use {defmt_rtt as _, panic_probe as _};
17 17
18#[embassy_executor::main] 18#[embassy_executor::main]
diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml
index 8acf27ce7..3a9b86cef 100644
--- a/tests/nrf/Cargo.toml
+++ b/tests/nrf/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-nrf-examples" 3name = "embassy-nrf-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/tests/perf-client/Cargo.toml b/tests/perf-client/Cargo.toml
index c426fdd74..3756046fa 100644
--- a/tests/perf-client/Cargo.toml
+++ b/tests/perf-client/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "perf-client" 2name = "perf-client"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false 6publish = false
7 7
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, *};
4use embassy_futures::join::join; 4use embassy_futures::join::join;
5use embassy_net::tcp::TcpSocket; 5use embassy_net::tcp::TcpSocket;
6use embassy_net::{Ipv4Address, Stack}; 6use embassy_net::{Ipv4Address, Stack};
7use embassy_time::{with_timeout, Duration, Timer}; 7use embassy_time::{Duration, Timer, with_timeout};
8 8
9pub struct Expected { 9pub struct Expected {
10 pub down_kbps: usize, 10 pub down_kbps: usize,
diff --git a/tests/perf-server/Cargo.toml b/tests/perf-server/Cargo.toml
index f048eade2..72f92ed8d 100644
--- a/tests/perf-server/Cargo.toml
+++ b/tests/perf-server/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "perf-server" 2name = "perf-server"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false 6publish = false
7 7
diff --git a/tests/riscv32/Cargo.toml b/tests/riscv32/Cargo.toml
index c441e8ed3..935c6a2ee 100644
--- a/tests/riscv32/Cargo.toml
+++ b/tests/riscv32/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-riscv-tests" 3name = "embassy-riscv-tests"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml
index 19461520a..640e58f11 100644
--- a/tests/rp/Cargo.toml
+++ b/tests/rp/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-rp-tests" 3name = "embassy-rp-tests"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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 @@
3teleprobe_meta::target!(b"rpi-pico"); 3teleprobe_meta::target!(b"rpi-pico");
4 4
5use cyw43::JoinOptions; 5use cyw43::JoinOptions;
6use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; 6use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
7use defmt::{panic, *}; 7use defmt::{panic, *};
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_net::{Config, StackResources}; 9use 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");
7 7
8use defmt::{info, unwrap}; 8use defmt::{info, unwrap};
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_rp::Peri;
10use embassy_rp::gpio::{Input, Level, Output, Pull}; 11use embassy_rp::gpio::{Input, Level, Output, Pull};
11use embassy_rp::multicore::{spawn_core1, Stack}; 12use embassy_rp::multicore::{Stack, spawn_core1};
12use embassy_rp::peripherals::{PIN_0, PIN_1}; 13use embassy_rp::peripherals::{PIN_0, PIN_1};
13use embassy_rp::Peri;
14use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 14use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
15use embassy_sync::channel::Channel; 15use embassy_sync::channel::Channel;
16use static_cell::StaticCell; 16use 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");
7 7
8use defmt::{info, unwrap}; 8use defmt::{info, unwrap};
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_rp::multicore::{spawn_core1, Stack}; 10use embassy_rp::multicore::{Stack, spawn_core1};
11use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 11use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
12use embassy_sync::channel::Channel; 12use embassy_sync::channel::Channel;
13use static_cell::StaticCell; 13use 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");
8 8
9use defmt::info; 9use defmt::info;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage}; 11use embassy_rp::clocks::{ClockConfig, CoreVoltage, clk_sys_freq, core_voltage};
12use embassy_rp::config::Config; 12use embassy_rp::config::Config;
13use embassy_time::Instant; 13use embassy_time::Instant;
14use {defmt_rtt as _, panic_probe as _}; 14use {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) {
57 assert_eq!(loaded2.wrap.target, 14); 57 assert_eq!(loaded2.wrap.target, 14);
58 58
59 // wrapping around the end of program space automatically works 59 // wrapping around the end of program space automatically works
60 let prg3 = pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2",); 60 let prg3 = pio_asm!(
61 "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2",
62 );
61 let loaded3 = common.load_program(&prg3.program); 63 let loaded3 = common.load_program(&prg3.program);
62 assert_eq!(loaded3.origin, 24); 64 assert_eq!(loaded3.origin, 24);
63 assert_eq!(loaded3.wrap.source, 3); 65 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");
5 5
6use defmt::{assert, *}; 6use defmt::{assert, *};
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_futures::select::{select, Either}; 8use embassy_futures::select::{Either, select};
9use embassy_rp::bind_interrupts; 9use embassy_rp::bind_interrupts;
10use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc}; 10use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc};
11use embassy_time::{Duration, Instant, Timer}; 11use 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");
7 7
8use defmt::{info, unwrap}; 8use defmt::{info, unwrap};
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_rp::multicore::{spawn_core1, Stack}; 10use embassy_rp::multicore::{Stack, spawn_core1};
11use embassy_rp::spinlock_mutex::SpinlockRawMutex; 11use embassy_rp::spinlock_mutex::SpinlockRawMutex;
12use embassy_sync::channel::Channel; 12use embassy_sync::channel::Channel;
13use static_cell::StaticCell; 13use static_cell::StaticCell;
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index 891ec93fd..1161e827b 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-stm32-tests" 3name = "embassy-stm32-tests"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
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;
16use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 16use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
17use embassy_stm32::timer::{Ch1, Ch2}; 17use embassy_stm32::timer::{Ch1, Ch2};
18use embassy_stm32::usart::{Uart, UartRx, UartTx}; 18use embassy_stm32::usart::{Uart, UartRx, UartTx};
19use embassy_stm32::{bind_interrupts, Peripherals}; 19use embassy_stm32::{Peripherals, bind_interrupts};
20 20
21#[cfg(not(feature = "afio-connectivity-line"))] 21#[cfg(not(feature = "afio-connectivity-line"))]
22bind_interrupts!(struct Irqs { 22bind_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 @@
5#[path = "../common.rs"] 5#[path = "../common.rs"]
6mod common; 6mod common;
7 7
8use aes_gcm::Aes128Gcm;
8use aes_gcm::aead::heapless::Vec; 9use aes_gcm::aead::heapless::Vec;
9use aes_gcm::aead::{AeadInPlace, KeyInit}; 10use aes_gcm::aead::{AeadInPlace, KeyInit};
10use aes_gcm::Aes128Gcm;
11use common::*; 11use common::*;
12use embassy_executor::Spawner; 12use embassy_executor::Spawner;
13use embassy_stm32::cryp::{self, *}; 13use 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;
8use common::*; 8use common::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_stm32::peripherals::*; 10use embassy_stm32::peripherals::*;
11use embassy_stm32::{bind_interrupts, can, Config}; 11use embassy_stm32::{Config, bind_interrupts, can};
12use embassy_time::Duration; 12use embassy_time::Duration;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
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;
9use common::*; 9use common::*;
10use cortex_m_rt::entry; 10use cortex_m_rt::entry;
11use embassy_executor::Spawner; 11use embassy_executor::Spawner;
12use embassy_stm32::low_power::{stop_ready, stop_with_rtc, Executor, StopMode}; 12use embassy_stm32::Config;
13use embassy_stm32::low_power::{Executor, StopMode, stop_ready, stop_with_rtc};
13use embassy_stm32::rcc::LsConfig; 14use embassy_stm32::rcc::LsConfig;
14use embassy_stm32::rtc::{Rtc, RtcConfig}; 15use embassy_stm32::rtc::{Rtc, RtcConfig};
15use embassy_stm32::Config;
16use embassy_time::Timer; 16use embassy_time::Timer;
17use static_cell::StaticCell; 17use static_cell::StaticCell;
18 18
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};
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_futures::join::join; 10use embassy_futures::join::join;
11use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd}; 11use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd};
12use embassy_stm32::{bind_interrupts, peripherals, Peri}; 12use embassy_stm32::{Peri, bind_interrupts, peripherals};
13use embassy_time::Timer; 13use embassy_time::Timer;
14 14
15bind_interrupts!(struct Irqs { 15bind_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::*;
7use defmt::{assert, assert_eq, unreachable}; 7use defmt::{assert, assert_eq, unreachable};
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_stm32::usart::{Config, ConfigError, Error, Uart}; 9use embassy_stm32::usart::{Config, ConfigError, Error, Uart};
10use embassy_time::{block_for, Duration, Instant}; 10use embassy_time::{Duration, Instant, block_for};
11 11
12#[embassy_executor::main] 12#[embassy_executor::main]
13async fn main(_spawner: Spawner) { 13async 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;
12use embassy_stm32::bind_interrupts; 12use embassy_stm32::bind_interrupts;
13use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 13use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
14use embassy_stm32::rcc::WPAN_DEFAULT; 14use embassy_stm32::rcc::WPAN_DEFAULT;
15use embassy_stm32_wpan::TlMbox;
16use embassy_stm32_wpan::hci::BdAddr;
15use embassy_stm32_wpan::hci::host::uart::UartHci; 17use embassy_stm32_wpan::hci::host::uart::UartHci;
16use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 18use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
17use embassy_stm32_wpan::hci::types::AdvertisingType; 19use embassy_stm32_wpan::hci::types::AdvertisingType;
18use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; 20use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role};
19use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; 21use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands;
20use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; 22use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
21use embassy_stm32_wpan::hci::BdAddr;
22use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 23use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
23use embassy_stm32_wpan::sub::mm; 24use embassy_stm32_wpan::sub::mm;
24use embassy_stm32_wpan::TlMbox;
25use {defmt_rtt as _, panic_probe as _}; 25use {defmt_rtt as _, panic_probe as _};
26 26
27bind_interrupts!(struct Irqs{ 27bind_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;
10use embassy_stm32::bind_interrupts; 10use embassy_stm32::bind_interrupts;
11use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 11use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
12use embassy_stm32::rcc::WPAN_DEFAULT; 12use embassy_stm32::rcc::WPAN_DEFAULT;
13use embassy_stm32_wpan::TlMbox;
13use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; 14use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest};
14use embassy_stm32_wpan::mac::event::MacEvent; 15use embassy_stm32_wpan::mac::event::MacEvent;
15use embassy_stm32_wpan::mac::typedefs::{ 16use embassy_stm32_wpan::mac::typedefs::{
16 AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, 17 AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel,
17}; 18};
18use embassy_stm32_wpan::sub::mm; 19use embassy_stm32_wpan::sub::mm;
19use embassy_stm32_wpan::TlMbox;
20use {defmt_rtt as _, panic_probe as _}; 20use {defmt_rtt as _, panic_probe as _};
21 21
22bind_interrupts!(struct Irqs{ 22bind_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 @@
1#![macro_use] 1#![macro_use]
2 2
3pub use defmt::*; 3pub use defmt::*;
4use embassy_stm32::Config;
4#[allow(unused)] 5#[allow(unused)]
5use embassy_stm32::rcc::*; 6use embassy_stm32::rcc::*;
6#[allow(unused)] 7#[allow(unused)]
7use embassy_stm32::time::Hertz; 8use embassy_stm32::time::Hertz;
8use embassy_stm32::Config;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11#[cfg(feature = "stm32f103c8")] 11#[cfg(feature = "stm32f103c8")]
diff --git a/tests/utils/Cargo.toml b/tests/utils/Cargo.toml
index ddb990e0f..da04a1f5d 100644
--- a/tests/utils/Cargo.toml
+++ b/tests/utils/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "test-utils" 2name = "test-utils"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false 6publish = false
7 7
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;
2use std::time::Duration; 2use std::time::Duration;
3use std::{env, io, process, thread}; 3use std::{env, io, process, thread};
4 4
5use rand::{rng, Rng}; 5use rand::{Rng, rng};
6use serial::SerialPort; 6use serial::SerialPort;
7 7
8pub fn main() { 8pub fn main() {