atsamd icon indicating copy to clipboard operation
atsamd copied to clipboard

Updates the DSU peripheral to use the `clock::v2` API

Open kyp44 opened this issue 5 months ago • 3 comments

Summary

As part of the clock::v2 effort tracked in Issue #912, this PR updates the dsu to use the clock::v2 API by requiring ownership of its AhbClk and ApbClk. Note that this peripheral is only on thumbv7 targets.

The following Tier 1 BSP examples are now broken and cannot be fixed until the noted peripherals are also migrated and merged (see the notes about this in Issue #912):

  • feather_m4/nvm_dsu (usb::UsbBus)

Checklist

  • [X] All new or modified code is well documented, especially public items
  • [X] No new warnings or clippy suggestions have been introduced - CI will deny clippy warnings by default! You may #[allow] certain lints where reasonable, but ideally justify those with a short comment.

kyp44 avatar Jul 14 '25 03:07 kyp44

@kyp44 regarding the broken example, I believe this can be worked around as clock::V2 clocks have a .into() method to convert them into their V1 counterparts

rnd-ash avatar Jul 19 '25 11:07 rnd-ash

@rnd-ash The conversion to the v1 types does not help here because usb::UsbBus::new requires a &mut Mclk, which is not possible to pass when using v2 because the Mclk is consumed by clock::v2::clock_system_at_reset to use the v2 API.

kyp44 avatar Jul 19 '25 14:07 kyp44

Ah right, in this case I personally was calling unsafe to steal mclk .... But you are right, it's probably best to avoid an unsafe block in our examples

rnd-ash avatar Jul 19 '25 14:07 rnd-ash