tof_control/helper/
ltb_type.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize)]
6pub struct LTBMoniData {
7 pub ltb_temp: LTBTemp,
8 pub ltb_thresh: LTBThreshold,
9}
10#[derive(Debug, Serialize, Deserialize)]
12pub struct LTBTemp {
13 pub trenz_temp: f32,
14 pub board_temp: f32,
15}
16#[derive(Debug, Serialize, Deserialize)]
18pub struct LTBThreshold {
19 pub thresh_0: f32,
20 pub thresh_1: f32,
21 pub thresh_2: f32,
22}
23
24#[derive(Debug)]
26pub enum LTBError {
27 I2C(i2cdev::linux::LinuxI2CError),
29 SetThreshold,
31}
32
33impl std::fmt::Display for LTBError {
34 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 write!(f, "LTBError")
36 }
37}
38
39impl From<i2cdev::linux::LinuxI2CError> for LTBError {
40 fn from(e: i2cdev::linux::LinuxI2CError) -> Self {
41 LTBError::I2C(e)
42 }
43}