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. Note that
multiple pins may share a gpio controller, and as such, all methods on this are both unsafe,
and require a mutable reference to the GpioToken
.
Implementations§
Source§impl GpioPin
impl GpioPin
Source§impl GpioPin
impl GpioPin
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 unsafe fn configure(
&mut self,
_token: &mut GpioToken,
extra_flags: gpio_flags_t,
)
pub unsafe fn configure( &mut self, _token: &mut GpioToken, extra_flags: gpio_flags_t, )
Configure a single pin.
§Safety
The _token
enforces single threaded use of gpios from Rust code. However, many drivers
within Zephyr use GPIOs, and to use gpios safely, the caller must ensure that there is
either not simultaneous use, or the gpio driver in question is thread safe.
Sourcepub unsafe fn toggle_pin(&mut self, _token: &mut GpioToken)
pub unsafe fn toggle_pin(&mut self, _token: &mut GpioToken)
Toggle pin level.
§Safety
The _token
enforces single threaded use of gpios from Rust code. However, many drivers
within Zephyr use GPIOs, and to use gpios safely, the caller must ensure that there is
either not simultaneous use, or the gpio driver in question is thread safe.