pub enum PeripheralSignal {
Pulse {
pin: u8,
on_ms: u64,
off_ms: u64,
},
Sensor {
open: bool,
},
}Expand description
A signal on the wires between a device and its peripherals, modelled on the drawer-kick connector of receipt printers.
use hardless_core::PeripheralSignal;
let kick = PeripheralSignal::Pulse { pin: 2, on_ms: 50, off_ms: 500 };
assert_eq!(
serde_json::to_value(&kick).unwrap(),
serde_json::json!({ "type": "pulse", "pin": 2, "onMs": 50, "offMs": 500 })
);Variants§
Pulse
A drawer-kick pulse: pin (2 or 5) is driven for on_ms, then released for off_ms.
Fields
Sensor
The drawer-open sensor (connector pin 3): true while the drawer is open.
Trait Implementations§
Source§impl Clone for PeripheralSignal
impl Clone for PeripheralSignal
Source§impl Debug for PeripheralSignal
impl Debug for PeripheralSignal
Source§impl<'de> Deserialize<'de> for PeripheralSignal
impl<'de> Deserialize<'de> for PeripheralSignal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PeripheralSignal
Source§impl PartialEq for PeripheralSignal
impl PartialEq for PeripheralSignal
Source§impl Serialize for PeripheralSignal
impl Serialize for PeripheralSignal
impl StructuralPartialEq for PeripheralSignal
Auto Trait Implementations§
impl Freeze for PeripheralSignal
impl RefUnwindSafe for PeripheralSignal
impl Send for PeripheralSignal
impl Sync for PeripheralSignal
impl Unpin for PeripheralSignal
impl UnsafeUnpin for PeripheralSignal
impl UnwindSafe for PeripheralSignal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more