pub struct GpioPin { /* private fields */ }Expand description
A GpioPin represents a single pin on a gpio device.
This is a lightweight wrapper around the Zephyr gpio_dt_spec structure.
Implementations§
Source§impl GpioPin
impl GpioPin
Sourcepub unsafe fn wait_for_high(&mut self) -> impl Future<Output = ()> + use<'_>
pub unsafe fn wait_for_high(&mut self) -> impl Future<Output = ()> + use<'_>
Asynchronously wait for a gpio pin to become high.
§Safety
Safety of multiple GPIOs depends on the underlying controller.
Sourcepub unsafe fn wait_for_low(&mut self) -> impl Future<Output = ()> + use<'_>
pub unsafe fn wait_for_low(&mut self) -> impl Future<Output = ()> + use<'_>
Asynchronously wait for a gpio pin to become low.
§Safety
Safety of multiple GPIOs depends on the underlying controller.
Source§impl GpioPin
impl GpioPin
Sourcepub unsafe fn raw_new(
device: *const device,
device_static: &'static GpioStatic,
pin: u32,
dt_flags: u32,
) -> GpioPin
pub unsafe fn raw_new( device: *const device, device_static: &'static GpioStatic, pin: u32, dt_flags: u32, ) -> GpioPin
An unsafe constructor intended for use outside of this crate. Does not guarantee any uniqueness (which isn’t guaranteed or needed by the Gpio device anyway).
§Safety
devicemust be a valid pointer to a Zephyr GPIO controller device that remains valid for the lifetime of the returnedGpioPin.device_staticmust be theGpioStaticassociated with that same controller.pinanddt_flagsmust fit within Zephyr’sgpio_pin_tandgpio_dt_flags_ttypes respectively (values are truncated on cast).
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Verify that the device is ready for use. At a minimum, this means the device has been successfully initialized.
Sourcepub fn configure(&mut self, extra_flags: gpio_flags_t)
pub fn configure(&mut self, extra_flags: gpio_flags_t)
Sourcepub fn toggle_pin(&mut self)
pub fn toggle_pin(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpioPin
impl !RefUnwindSafe for GpioPin
impl !Sync for GpioPin
impl Unpin for GpioPin
impl UnsafeUnpin for GpioPin
impl !UnwindSafe for GpioPin
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