Skip to content

Commit f468315

Browse files
committed
style: improve readability in rf24-rs sources
also moves RadioConfig out of linux only binding for rf24-py
1 parent 3383200 commit f468315

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

bindings/python/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod radio;
44
#[cfg(target_os = "linux")]
55
fn bind_radio_impl(m: &Bound<'_, PyModule>) -> PyResult<()> {
66
m.add_class::<radio::interface::RF24>()?;
7-
m.add_class::<radio::config::RadioConfig>()
7+
Ok(())
88
}
99

1010
#[cfg(not(target_os = "linux"))]
@@ -21,5 +21,6 @@ fn rf24_py(m: &Bound<'_, PyModule>) -> PyResult<()> {
2121
m.add_class::<radio::types::FifoState>()?;
2222
m.add_class::<radio::types::PaLevel>()?;
2323
m.add_class::<radio::types::StatusFlags>()?;
24+
m.add_class::<radio::config::RadioConfig>()?;
2425
Ok(())
2526
}

crates/rf24-rs/src/radio/rf24/radio.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ where
6060
// write() also clears the status flags and asserts the CE pin
6161
return Ok(false);
6262
}
63-
self._delay_impl.delay_ns(10000);
63+
self._delay_impl.delay_us(10);
6464
// now block until we get a tx_ds or tx_df event
65-
while self._status.into_bits() & 0x30 == 0 {
65+
while self._status.into_bits() & (mnemonics::MASK_MAX_RT | mnemonics::MASK_TX_DS) == 0 {
6666
self.spi_read(0, commands::NOP)?;
6767
}
6868
Ok(self._status.tx_ds())
@@ -161,7 +161,7 @@ where
161161
return Ok(false);
162162
}
163163
self.rewrite()?;
164-
self._delay_impl.delay_ns(10000);
164+
self._delay_impl.delay_us(10);
165165
// now block until a tx_ds or tx_df event occurs
166166
while self._status.into_bits() & 0x30 == 0 {
167167
self.spi_read(0, commands::NOP)?;

0 commit comments

Comments
 (0)