Merge pull request 'bmstall is configurable now as well' (#15) from va108xx-update-package into main
Some checks failed
Rust/va108xx-rs/pipeline/head There was a failure building this commit
Some checks failed
Rust/va108xx-rs/pipeline/head There was a failure building this commit
Reviewed-on: #15
This commit is contained in:
commit
e2a55e7309
@ -125,6 +125,7 @@ fn main() -> ! {
|
|||||||
Some(spi_clk_cfg),
|
Some(spi_clk_cfg),
|
||||||
Some(SPI_MODE),
|
Some(SPI_MODE),
|
||||||
BLOCKMODE,
|
BLOCKMODE,
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
spi.cfg_transfer(&transfer_cfg);
|
spi.cfg_transfer(&transfer_cfg);
|
||||||
@ -138,6 +139,7 @@ fn main() -> ! {
|
|||||||
Some(SPI_MODE),
|
Some(SPI_MODE),
|
||||||
Some(hw_cs_pin),
|
Some(hw_cs_pin),
|
||||||
BLOCKMODE,
|
BLOCKMODE,
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
spi.cfg_transfer(&transfer_cfg);
|
spi.cfg_transfer(&transfer_cfg);
|
||||||
|
@ -301,6 +301,9 @@ pub struct TransferConfig {
|
|||||||
/// the BMSTOP bit is set on a dataword. A frame is defined as CSn being active for the
|
/// the BMSTOP bit is set on a dataword. A frame is defined as CSn being active for the
|
||||||
/// duration of multiple data words
|
/// duration of multiple data words
|
||||||
pub blockmode: bool,
|
pub blockmode: bool,
|
||||||
|
/// Only used when blockmode is used. The SCK will be stalled until an explicit stop bit
|
||||||
|
/// is set on a written word.
|
||||||
|
pub bmstall: bool,
|
||||||
pub hw_cs: HwChipSelectId,
|
pub hw_cs: HwChipSelectId,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,6 +312,7 @@ impl TransferConfigWithHwcs<NoneT> {
|
|||||||
clk_cfg: Option<SpiClkConfig>,
|
clk_cfg: Option<SpiClkConfig>,
|
||||||
mode: Option<Mode>,
|
mode: Option<Mode>,
|
||||||
blockmode: bool,
|
blockmode: bool,
|
||||||
|
bmstall: bool,
|
||||||
sod: bool,
|
sod: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
TransferConfigWithHwcs {
|
TransferConfigWithHwcs {
|
||||||
@ -318,6 +322,7 @@ impl TransferConfigWithHwcs<NoneT> {
|
|||||||
mode,
|
mode,
|
||||||
sod,
|
sod,
|
||||||
blockmode,
|
blockmode,
|
||||||
|
bmstall,
|
||||||
hw_cs: HwChipSelectId::Invalid,
|
hw_cs: HwChipSelectId::Invalid,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -330,6 +335,7 @@ impl<HwCs: HwCsProvider> TransferConfigWithHwcs<HwCs> {
|
|||||||
mode: Option<Mode>,
|
mode: Option<Mode>,
|
||||||
hw_cs: Option<HwCs>,
|
hw_cs: Option<HwCs>,
|
||||||
blockmode: bool,
|
blockmode: bool,
|
||||||
|
bmstall: bool,
|
||||||
sod: bool,
|
sod: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
TransferConfigWithHwcs {
|
TransferConfigWithHwcs {
|
||||||
@ -339,6 +345,7 @@ impl<HwCs: HwCsProvider> TransferConfigWithHwcs<HwCs> {
|
|||||||
mode,
|
mode,
|
||||||
sod,
|
sod,
|
||||||
blockmode,
|
blockmode,
|
||||||
|
bmstall,
|
||||||
hw_cs: HwCs::CS_ID,
|
hw_cs: HwCs::CS_ID,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -421,6 +428,11 @@ impl SpiConfig {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn bmstall(mut self, enable: bool) -> Self {
|
||||||
|
self.bmstall = enable;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn mode(mut self, mode: Mode) -> Self {
|
pub fn mode(mut self, mode: Mode) -> Self {
|
||||||
self.init_mode = mode;
|
self.init_mode = mode;
|
||||||
self
|
self
|
||||||
@ -744,12 +756,8 @@ where
|
|||||||
} else {
|
} else {
|
||||||
w.sod().clear_bit();
|
w.sod().clear_bit();
|
||||||
}
|
}
|
||||||
if transfer_cfg.cfg.blockmode {
|
w.blockmode().bit(transfer_cfg.cfg.blockmode);
|
||||||
w.blockmode().set_bit();
|
w.bmstall().bit(transfer_cfg.cfg.bmstall)
|
||||||
} else {
|
|
||||||
w.blockmode().clear_bit();
|
|
||||||
}
|
|
||||||
w
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user