autd3-protobuf 32.0.0

gRPC protobuf for autd3
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{AUTDProtoBufError, pb::*, traits::FromMessage};

impl FromMessage<FpgaStateResponseLightweight>
    for Vec<Option<autd3_driver::firmware::fpga::FPGAState>>
{
    fn from_msg(msg: FpgaStateResponseLightweight) -> Result<Self, AUTDProtoBufError> {
        Ok(msg
            .fpga_state_list
            .iter()
            .map(|v| {
                v.state.map(|s| {
                    let state = s as u8;
                    unsafe { std::mem::transmute(state) }
                })
            })
            .collect())
    }
}