pub struct ProtocolLayer<DRIVER: Driver, TIMER: Timer> { /* private fields */ }Expand description
The USB PD protocol layer.
Implementations§
Source§impl<DRIVER: Driver, TIMER: Timer> ProtocolLayer<DRIVER, TIMER>
impl<DRIVER: Driver, TIMER: Timer> ProtocolLayer<DRIVER, TIMER>
Sourcepub fn new(driver: DRIVER, default_header: Header) -> Self
pub fn new(driver: DRIVER, default_header: Header) -> Self
Create a new protocol layer from a driver and default header.
Sourcepub fn get_timer(timer_type: TimerType) -> impl Future<Output = ()>
pub fn get_timer(timer_type: TimerType) -> impl Future<Output = ()>
Get a timer future for a given type.
Sourcepub async fn receive_message(&mut self) -> Result<Message, Error>
pub async fn receive_message(&mut self) -> Result<Message, Error>
Receive a message.
Sourcepub async fn receive_message_type(
&mut self,
message_types: &[MessageType],
timer_type: TimerType,
) -> Result<Message, Error>
pub async fn receive_message_type( &mut self, message_types: &[MessageType], timer_type: TimerType, ) -> Result<Message, Error>
Wait until a message of one of the chosen types is received, or a timeout occurs.
Sourcepub async fn hard_reset(&mut self) -> Result<(), Error>
pub async fn hard_reset(&mut self) -> Result<(), Error>
Perform a hard-reset procedure.
Sourcepub async fn wait_for_vbus(&mut self)
pub async fn wait_for_vbus(&mut self)
Wait for VBUS to be available.
FIXME: Check what the logic should be.
Sourcepub async fn wait_for_source_capabilities(&mut self) -> Result<Message, Error>
pub async fn wait_for_source_capabilities(&mut self) -> Result<Message, Error>
Wait for the source to provide its capabilities.
Sourcepub async fn transmit_control_message(
&mut self,
control_message_type: ControlMessageType,
) -> Result<(), Error>
pub async fn transmit_control_message( &mut self, control_message_type: ControlMessageType, ) -> Result<(), Error>
Transmit a control message of the provided type.
Sourcepub async fn request_power(
&mut self,
supply: PowerSourceRequest,
) -> Result<(), Error>
pub async fn request_power( &mut self, supply: PowerSourceRequest, ) -> Result<(), Error>
Request a certain power level from the source.
Trait Implementations§
Auto Trait Implementations§
impl<DRIVER, TIMER> Freeze for ProtocolLayer<DRIVER, TIMER>where
DRIVER: Freeze,
impl<DRIVER, TIMER> RefUnwindSafe for ProtocolLayer<DRIVER, TIMER>where
DRIVER: RefUnwindSafe,
TIMER: RefUnwindSafe,
impl<DRIVER, TIMER> Send for ProtocolLayer<DRIVER, TIMER>
impl<DRIVER, TIMER> Sync for ProtocolLayer<DRIVER, TIMER>
impl<DRIVER, TIMER> Unpin for ProtocolLayer<DRIVER, TIMER>
impl<DRIVER, TIMER> UnwindSafe for ProtocolLayer<DRIVER, TIMER>where
DRIVER: UnwindSafe,
TIMER: UnwindSafe,
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
Source§impl<T, U> UnsafeFrom<U> for Twhere
U: Into<T>,
impl<T, U> UnsafeFrom<U> for Twhere
U: Into<T>,
Source§unsafe fn unsafe_from(other: U) -> T
unsafe fn unsafe_from(other: U) -> T
Calls U::into(other).
That is, this conversion is whatever the implementation of Into<T> for U chooses to
do.
Source§impl<T, U> UnsafeInto<U> for Twhere
U: UnsafeFrom<T>,
impl<T, U> UnsafeInto<U> for Twhere
U: UnsafeFrom<T>,
Source§unsafe fn unsafe_into(self) -> U
unsafe fn unsafe_into(self) -> U
Calls U::unsafe_from(self).
That is, this conversion is whatever the implementation of UnsafeFrom<T> for U
chooses to do.