rsiot/components/cmp_esp_gpio/
config.rs1use esp_idf_svc::hal::gpio::{AnyIOPin, AnyOutputPin, Pull};
2
3use crate::message::{Message, MsgDataBound};
4
5pub struct Config<TMsg>
7where
8 TMsg: MsgDataBound,
9{
10 #[doc = include_str!("test/config_inputs.rs")]
16 pub inputs: Vec<ConfigGpioInput<TMsg>>,
18
19 #[doc = include_str!("test/config_outputs.rs")]
25 pub outputs: Vec<ConfigGpioOutput<TMsg>>,
27}
28
29impl<TMsg> Default for Config<TMsg>
30where
31 TMsg: MsgDataBound,
32{
33 fn default() -> Self {
34 Self {
35 inputs: vec![],
36 outputs: vec![],
37 }
38 }
39}
40
41pub struct ConfigGpioInput<TMsg>
43where
44 TMsg: MsgDataBound,
45{
46 pub peripherals: AnyIOPin,
48
49 pub fn_output: fn(bool) -> Message<TMsg>,
51
52 pub pull: Pull,
54}
55
56pub struct ConfigGpioOutput<TMsg>
58where
59 TMsg: MsgDataBound,
60{
61 pub peripherals: AnyOutputPin,
63
64 pub fn_input: fn(Message<TMsg>) -> Option<bool>,
70
71 pub is_low_triggered: bool,
73}