tof_control/helper/
pb_type.rs

1use serde::{Deserialize, Serialize};
2
3/// PB Data Type
4// All PB Monitoring Types
5#[derive(Debug, Serialize, Deserialize)]
6pub struct PBMoniData {
7    pub pb_temp: PBTemp,
8    pub pb_vcp: PBVcp,
9}
10// PB Temperature Sensor Data Type
11#[derive(Debug, Serialize, Deserialize)]
12pub struct PBTemp {
13    pub pds_temp: f32,
14    pub pas_temp: f32,
15    pub nas_temp: f32,
16    pub shv_temp: f32,
17}
18// PB VCP (Voltage, Current and Power) Sensor
19#[derive(Debug, Serialize, Deserialize)]
20pub struct PBVcp {
21    pub p3v6_pa_vcp:    [f32; 3],
22    pub n1v6_pa_vcp:    [f32; 3],
23    pub p3v4f_ltb_vcp:      [f32; 3],
24    pub p3v4d_ltb_vcp:      [f32; 3],
25    pub p3v6_ltb_vcp:       [f32; 3],
26    pub n1v6_ltb_vcp:       [f32; 3],
27}
28
29/// PB Error Type
30#[derive(Debug)]
31pub enum PBError {
32    // I2C Error
33    I2C(i2cdev::linux::LinuxI2CError),
34}
35
36impl std::fmt::Display for PBError {
37    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38        write!(f, "PBError")
39    }
40}
41
42impl From<i2cdev::linux::LinuxI2CError> for PBError {
43    fn from(e: i2cdev::linux::LinuxI2CError) -> Self {
44        PBError::I2C(e)
45    }
46}