Add no-chip-version-assertion to disable checking the chip for the version
This commit is contained in:
parent
52f0d06e30
commit
a0f46ae95e
2 changed files with 5 additions and 0 deletions
|
|
@ -16,3 +16,6 @@ embedded-hal = "0.2.4"
|
||||||
embedded-nal = "0.4.0"
|
embedded-nal = "0.4.0"
|
||||||
bit_field = "0.10.1"
|
bit_field = "0.10.1"
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
no-chip-version-assertion = []
|
||||||
|
|
@ -84,6 +84,7 @@ impl<SpiBus: Bus> UninitializedDevice<SpiBus> {
|
||||||
mut host: HostImpl,
|
mut host: HostImpl,
|
||||||
mode_options: Mode,
|
mode_options: Mode,
|
||||||
) -> Result<Device<SpiBus, HostImpl>, InitializeError<SpiBus::Error>> {
|
) -> Result<Device<SpiBus, HostImpl>, InitializeError<SpiBus::Error>> {
|
||||||
|
#[cfg(not(feature = "no-chip-version-assertion"))]
|
||||||
self.assert_chip_version(0x4)?;
|
self.assert_chip_version(0x4)?;
|
||||||
|
|
||||||
// RESET
|
// RESET
|
||||||
|
|
@ -96,6 +97,7 @@ impl<SpiBus: Bus> UninitializedDevice<SpiBus> {
|
||||||
Ok(Device::new(self.bus, host))
|
Ok(Device::new(self.bus, host))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no-chip-version-assertion"))]
|
||||||
fn assert_chip_version(
|
fn assert_chip_version(
|
||||||
&mut self,
|
&mut self,
|
||||||
expected_version: u8,
|
expected_version: u8,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue