Add repr(C) to DmaDescriptor, allow unstably constructing dma::Channel (#2988)

* Add repr(C) to DmaDescriptor

* Allow creating DMA channel drivers
This commit is contained in:
Dániel Buga 2025-01-17 09:55:18 +01:00 committed by GitHub
parent 81382bafc7
commit 3fac1979d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- `DmaDescriptor` is now `#[repr(C)]` (#2988)
### Removed
## [0.23.1] - 2025-01-15

View File

@ -274,6 +274,7 @@ impl defmt::Format for DmaDescriptorFlags {
/// A DMA transfer descriptor.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(C)]
pub struct DmaDescriptor {
/// Descriptor flags.
pub flags: DmaDescriptorFlags,
@ -2463,7 +2464,9 @@ impl<'d, CH> Channel<'d, Blocking, CH>
where
CH: DmaChannel,
{
pub(crate) fn new(channel: impl Peripheral<P = CH>) -> Self {
/// Creates a new DMA channel driver.
#[instability::unstable]
pub fn new(channel: impl Peripheral<P = CH>) -> Self {
let (rx, tx) = unsafe {
channel
.clone_unchecked()