Struct linux_embedded_hal::CdevPin
source · [−]pub struct CdevPin(pub LineHandle, _);Expand description
Newtype around gpio_cdev::LineHandle that implements the embedded-hal traits
Tuple Fields
0: LineHandleImplementations
sourceimpl CdevPin
impl CdevPin
sourcepub fn new(handle: LineHandle) -> Result<Self, Error>
pub fn new(handle: LineHandle) -> Result<Self, Error>
See gpio_cdev::Line::request for details.
Methods from Deref<Target = LineHandle>
sourcepub fn get_value(&self) -> Result<u8, Error>
pub fn get_value(&self) -> Result<u8, Error>
Request the current state of this Line from the kernel
This call is expected to succeed for both input and output lines. It should be noted, however, that some drivers may not be able to give any useful information when the value is requested for an output line.
This value should be 0 or 1 which a “1” representing that the line is active. Usually this means that the line is at logic-level high but it could mean the opposite if the line has been marked as being ACTIVE_LOW.
sourcepub fn set_value(&self, value: u8) -> Result<(), Error>
pub fn set_value(&self, value: u8) -> Result<(), Error>
Request that the line be driven to the specified value
The value should be 0 or 1 with 1 representing a request to make the line “active”. Usually “active” means logic level high unless the line has been marked as ACTIVE_LOW.
Calling set_value on a line that is not an output will
likely result in an error (from the kernel).
sourcepub fn flags(&self) -> LineRequestFlags
pub fn flags(&self) -> LineRequestFlags
Get the flags with which this handle was created
Trait Implementations
sourceimpl Deref for CdevPin
impl Deref for CdevPin
type Target = LineHandle
type Target = LineHandle
The resulting type after dereferencing.
sourceimpl IoPin<CdevPin, CdevPin> for CdevPin
impl IoPin<CdevPin, CdevPin> for CdevPin
Auto Trait Implementations
impl RefUnwindSafe for CdevPin
impl Send for CdevPin
impl Sync for CdevPin
impl Unpin for CdevPin
impl UnwindSafe for CdevPin
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more