Reimplement control logic
Move logic into its own module and implement it using nicer programming patterns
This commit is contained in:
parent
a92f0c45f2
commit
ebff378b0a
4 changed files with 162 additions and 9 deletions
|
|
@ -66,6 +66,15 @@ impl Fieldbus {
|
|||
pii.copy_from_slice(&data.pii);
|
||||
data.piq.copy_from_slice(piq);
|
||||
}
|
||||
|
||||
pub fn with_process_images<F, R>(&mut self, f: F) -> R
|
||||
where
|
||||
F: FnOnce(&[u8; PII_SIZE], &mut [u8; PIQ_SIZE]) -> R,
|
||||
{
|
||||
let mut data = self.inner.lock().unwrap();
|
||||
let data = &mut *data;
|
||||
f(&data.pii, &mut data.piq)
|
||||
}
|
||||
}
|
||||
|
||||
struct PeripheralInfo {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue