rsiot/components/cmp_linux_uart_master/
config.rs1use std::time::Duration;
2
3use crate::{
4 components_config::{
5 master_device::DeviceTrait,
6 uart_general::{Baudrate, DataBits, FieldbusRequest, FieldbusResponse, Parity, StopBits},
7 },
8 message::MsgDataBound,
9};
10
11#[derive(Debug)]
14pub struct Config<TMsg>
15where
16 TMsg: MsgDataBound,
17{
18 pub port: &'static str,
27
28 pub baudrate: Baudrate,
30
31 pub data_bits: DataBits,
33
34 pub parity: Parity,
36
37 pub stop_bits: StopBits,
39
40 pub timeout: Duration,
42
43 pub gpio_chip: &'static str,
51
52 pub pin_rts: Option<u32>,
64
65 pub devices: Vec<Box<dyn DeviceTrait<TMsg, FieldbusRequest, FieldbusResponse>>>,
67}
68impl<TMsg> Default for Config<TMsg>
71where
72 TMsg: MsgDataBound,
73{
74 fn default() -> Self {
75 Self {
76 port: "/dev/ttyAMA0",
77 baudrate: Baudrate::default(),
78 data_bits: DataBits::default(),
79 parity: Parity::default(),
80 stop_bits: StopBits::default(),
81 timeout: Duration::from_millis(100),
82 gpio_chip: "/dev/gpiochip0",
83 pin_rts: Some(17),
84 devices: vec![],
85 }
86 }
87}