autd3_driver/datagram/
synchronize.rs

1use std::convert::Infallible;
2
3use crate::firmware::operation::SyncOp;
4
5use crate::datagram::*;
6
7/// [`Datagram`] to synchronize the devices.
8#[derive(Default, Debug)]
9pub struct Synchronize {}
10
11impl Synchronize {
12    /// Creates a new [`Synchronize`] instance.
13    #[must_use]
14    pub const fn new() -> Self {
15        Self {}
16    }
17}
18
19pub struct SynchronizeOpGenerator {}
20
21impl OperationGenerator for SynchronizeOpGenerator {
22    type O1 = SyncOp;
23    type O2 = NullOp;
24
25    fn generate(&mut self, _: &Device) -> (Self::O1, Self::O2) {
26        (Self::O1::new(), Self::O2 {})
27    }
28}
29
30impl Datagram for Synchronize {
31    type G = SynchronizeOpGenerator;
32    type Error = Infallible;
33
34    fn operation_generator(self, _: &Geometry, _: bool) -> Result<Self::G, Self::Error> {
35        Ok(SynchronizeOpGenerator {})
36    }
37}