aquarium_control/sensors/dht_config.rs
1/* Copyright 2024 Uwe Martin
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
5The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
7THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8*/
9use serde_derive::Deserialize;
10
11/// Holds the configuration data for interacting with GPIO
12/// The configuration is loaded from the .toml configuration file.
13/// This struct does not contain any implementation.
14#[derive(Deserialize, Debug)]
15pub struct DhtConfig {
16 /// allows deactivation of the data acquisition
17 #[allow(unused)] // used in conditionally compiled code
18 pub active: bool,
19
20 /// indicates if the thread shall be started or not
21 #[cfg(feature = "target_hw")]
22 pub execute: bool,
23
24 /// duration to keep pin down during start signal in microseconds
25 #[allow(unused)]
26 pub sensor_init_pin_down_duration_micros: u64,
27
28 /// duration to keep pin up during start signal in microseconds
29 #[allow(unused)]
30 pub sensor_init_pin_up_duration_micros: u64,
31
32 /// duration for sensor to respond after sending start signal in microseconds
33 #[allow(unused)]
34 pub sensor_init_input_duration_micros: u64,
35
36 /// maximum permissible duration for the sensor to respond in microseconds
37 #[allow(unused)]
38 pub timeout_duration_micros: u64,
39
40 /// duration in milliseconds the sensor is switched off before requesting transmission
41 #[allow(unused)]
42 pub sensor_reset_duration_millis: u64,
43
44 /// duration in milliseconds the sensor is given to initialize
45 #[allow(unused)]
46 pub sensor_startup_duration_millis: u64,
47
48 /// duration in milliseconds the sensor is given to pause between transmissions
49 #[allow(unused)]
50 pub sensor_pause_duration_millis: u64,
51
52 /// duration in milliseconds between two measurements
53 #[allow(unused)] // used in conditionally compiled code
54 pub measurement_interval_millis: u64,
55}