Add no-chip-version-assertion to disable checking the chip for the version

This commit is contained in:
Michael Watzko 2021-03-23 22:55:11 +01:00
commit a0f46ae95e
2 changed files with 5 additions and 0 deletions

View file

@ -16,3 +16,6 @@ embedded-hal = "0.2.4"
embedded-nal = "0.4.0"
bit_field = "0.10.1"
nb = "1.0.0"
[features]
no-chip-version-assertion = []

View file

@ -84,6 +84,7 @@ impl<SpiBus: Bus> UninitializedDevice<SpiBus> {
mut host: HostImpl,
mode_options: Mode,
) -> Result<Device<SpiBus, HostImpl>, InitializeError<SpiBus::Error>> {
#[cfg(not(feature = "no-chip-version-assertion"))]
self.assert_chip_version(0x4)?;
// RESET
@ -96,6 +97,7 @@ impl<SpiBus: Bus> UninitializedDevice<SpiBus> {
Ok(Device::new(self.bus, host))
}
#[cfg(not(feature = "no-chip-version-assertion"))]
fn assert_chip_version(
&mut self,
expected_version: u8,