[−][src]Struct rust_gpiozero::input_devices::DigitalInputDevice
Represents a generic input device with typical on/off behaviour. Adds machinery to fire the active and inactive events for devices that operate in a typical digital manner: straight forward on / off states with (reasonably) clean transitions between the two.
Methods
impl DigitalInputDevice
[src]
pub fn new(pin: u8) -> DigitalInputDevice
[src]
Returns a DigitalInputDevice with the pin number given with the pin pulled to low by default
is_active
property is adjusted accordingly so that
True
still means active regardless of the :attr:pull_up
setting
Arguments
pin
- The GPIO pin which the device is attached to
Note: BCM pins 2 and 3 are i2c SDA and SCL respectively and include a fixed, 1.8 kohms pull-up to 3.3v
These pins are not suitable for use where no pullup resistor is required Source: https://pinout.xyz/pinout/pin5_gpio3
pub fn new_with_pullup(pin: u8) -> DigitalInputDevice
[src]
Returns a DigitalInputDevice with the pin number given with the pin pulled high with an internal resistor by default
is_active
property is adjusted accordingly so that
True
still means active regardless of the :attr:pull_up
setting
Arguments
pin
- The GPIO pin which the device is attached to
pub fn is_active(&self) -> bool
[src]
Returns True
if the device is currently active and False
otherwise.
pub fn close(self)
[src]
Shut down the device and release all associated resources.
pub fn pin(&self) -> u8
[src]
The Pin
that the device is connected to.
pub fn value(&self) -> bool
[src]
Returns True
if the device is currently active and False
otherwise.
pub fn wait_for_inactive(&mut self, timeout: Option<f32>)
[src]
Pause the program until the device is deactivated, or the timeout is reached.
pub fn wait_for_active(&mut self, timeout: Option<f32>)
[src]
Pause the program until the device is activated, or the timeout is reached.
Trait Implementations
Auto Trait Implementations
impl Send for DigitalInputDevice
impl Sync for DigitalInputDevice
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,