This commit is contained in:
parent
8434ec872d
commit
c34fbb01f5
@ -267,13 +267,13 @@ pub trait TransferConfigProvider {
|
|||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct TransferConfigWithHwcs<HwCs> {
|
pub struct TransferConfigWithHwcs<HwCs> {
|
||||||
pub hw_cs: Option<HwCs>,
|
pub hw_cs: Option<HwCs>,
|
||||||
pub cfg: CommonTransferConfig,
|
pub cfg: TransferConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type erased variant of the transfer configuration. This is required to avoid generics in
|
/// Type erased variant of the transfer configuration. This is required to avoid generics in
|
||||||
/// the SPI constructor.
|
/// the SPI constructor.
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct CommonTransferConfig {
|
pub struct TransferConfig {
|
||||||
pub clk_cfg: Option<SpiClkConfig>,
|
pub clk_cfg: Option<SpiClkConfig>,
|
||||||
pub mode: Option<Mode>,
|
pub mode: Option<Mode>,
|
||||||
pub sod: bool,
|
pub sod: bool,
|
||||||
@ -293,7 +293,7 @@ impl TransferConfigWithHwcs<NoneT> {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
TransferConfigWithHwcs {
|
TransferConfigWithHwcs {
|
||||||
hw_cs: None,
|
hw_cs: None,
|
||||||
cfg: CommonTransferConfig {
|
cfg: TransferConfig {
|
||||||
clk_cfg,
|
clk_cfg,
|
||||||
mode,
|
mode,
|
||||||
sod,
|
sod,
|
||||||
@ -314,7 +314,7 @@ impl<HwCs: HwCsProvider> TransferConfigWithHwcs<HwCs> {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
TransferConfigWithHwcs {
|
TransferConfigWithHwcs {
|
||||||
hw_cs,
|
hw_cs,
|
||||||
cfg: CommonTransferConfig {
|
cfg: TransferConfig {
|
||||||
clk_cfg,
|
clk_cfg,
|
||||||
mode,
|
mode,
|
||||||
sod,
|
sod,
|
||||||
@ -324,7 +324,7 @@ impl<HwCs: HwCsProvider> TransferConfigWithHwcs<HwCs> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn downgrade(self) -> CommonTransferConfig {
|
pub fn downgrade(self) -> TransferConfig {
|
||||||
self.cfg
|
self.cfg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,7 +591,7 @@ where
|
|||||||
spi: SpiI,
|
spi: SpiI,
|
||||||
pins: (Sck, Miso, Mosi),
|
pins: (Sck, Miso, Mosi),
|
||||||
spi_cfg: SpiConfig,
|
spi_cfg: SpiConfig,
|
||||||
transfer_cfg: Option<&CommonTransferConfig>,
|
transfer_cfg: Option<&TransferConfig>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
enable_peripheral_clock(syscfg, SpiI::PERIPH_SEL);
|
enable_peripheral_clock(syscfg, SpiI::PERIPH_SEL);
|
||||||
let SpiConfig {
|
let SpiConfig {
|
||||||
|
Loading…
Reference in New Issue
Block a user