Prevent constructing some types

This commit is contained in:
Dániel Buga 2023-06-26 18:44:09 +02:00 committed by Scott Mabin
parent 9570a660a1
commit 14823d669f
2 changed files with 13 additions and 0 deletions

View File

@ -9,6 +9,7 @@ use crate::{
macro_rules! impl_channel {
($num: literal) => {
paste::paste! {
#[non_exhaustive]
pub struct [<Channel $num>] {}
impl RegisterAccess for [<Channel $num>] {
@ -365,6 +366,7 @@ macro_rules! impl_channel {
}
}
#[non_exhaustive]
pub struct [<Channel $num TxImpl>] {}
impl<'a> TxChannel<[<Channel $num>]> for [<Channel $num TxImpl>] {
@ -375,6 +377,7 @@ macro_rules! impl_channel {
}
}
#[non_exhaustive]
pub struct [<Channel $num RxImpl>] {}
impl<'a> RxChannel<[<Channel $num>]> for [<Channel $num RxImpl>] {
@ -385,6 +388,7 @@ macro_rules! impl_channel {
}
}
#[non_exhaustive]
pub struct [<ChannelCreator $num>] {}
impl [<ChannelCreator $num>] {
@ -437,6 +441,7 @@ macro_rules! impl_channel {
}
}
#[non_exhaustive]
pub struct [<SuitablePeripheral $num>] {}
impl PeripheralMarker for [<SuitablePeripheral $num>] {}

View File

@ -9,6 +9,7 @@ use crate::{
macro_rules! ImplSpiChannel {
($num: literal) => {
paste::paste! {
#[non_exhaustive]
pub struct [<Spi $num DmaChannel>] {}
impl RegisterAccess for [<Spi $num DmaChannel>] {
@ -195,6 +196,7 @@ macro_rules! ImplSpiChannel {
}
}
#[non_exhaustive]
pub struct [<Spi $num DmaChannelTxImpl>] {}
impl<'a> TxChannel<[<Spi $num DmaChannel>]> for [<Spi $num DmaChannelTxImpl>] {
@ -205,6 +207,7 @@ macro_rules! ImplSpiChannel {
}
}
#[non_exhaustive]
pub struct [<Spi $num DmaChannelRxImpl>] {}
impl<'a> RxChannel<[<Spi $num DmaChannel>]> for [<Spi $num DmaChannelRxImpl>] {
@ -215,6 +218,7 @@ macro_rules! ImplSpiChannel {
}
}
#[non_exhaustive]
pub struct [<Spi $num DmaChannelCreator>] {}
impl [<Spi $num DmaChannelCreator>] {
@ -511,11 +515,13 @@ macro_rules! ImplI2sChannel {
};
}
#[non_exhaustive]
pub struct Spi2DmaSuitablePeripheral {}
impl PeripheralMarker for Spi2DmaSuitablePeripheral {}
impl SpiPeripheral for Spi2DmaSuitablePeripheral {}
impl Spi2Peripheral for Spi2DmaSuitablePeripheral {}
#[non_exhaustive]
pub struct Spi3DmaSuitablePeripheral {}
impl PeripheralMarker for Spi3DmaSuitablePeripheral {}
impl SpiPeripheral for Spi3DmaSuitablePeripheral {}
@ -524,6 +530,7 @@ impl Spi3Peripheral for Spi3DmaSuitablePeripheral {}
ImplSpiChannel!(2);
ImplSpiChannel!(3);
#[non_exhaustive]
pub struct I2s0DmaSuitablePeripheral {}
impl PeripheralMarker for I2s0DmaSuitablePeripheral {}
impl I2sPeripheral for I2s0DmaSuitablePeripheral {}
@ -531,6 +538,7 @@ impl I2s0Peripheral for I2s0DmaSuitablePeripheral {}
ImplI2sChannel!(0, "I2S0");
#[non_exhaustive]
pub struct I2s1DmaSuitablePeripheral {}
impl PeripheralMarker for I2s1DmaSuitablePeripheral {}
impl I2sPeripheral for I2s1DmaSuitablePeripheral {}