pub struct CcPhy<'d, T: Instance> { /* private fields */ }Expand description
Control and monitoring of TypeC CC pin functionality.
Implementations§
Source§impl<'d, T: Instance> CcPhy<'d, T>
impl<'d, T: Instance> CcPhy<'d, T>
Sourcepub fn set_pull(&mut self, cc_pull: CcPull)
pub fn set_pull(&mut self, cc_pull: CcPull)
Sets the pull-up/pull-down resistor values exposed on the CC pins.
Sourcepub fn vstate(&self) -> (CcVState, CcVState)
pub fn vstate(&self) -> (CcVState, CcVState)
Returns the current voltage level of CC1 and CC2 pin as tuple.
Interpretation of the voltage levels depends on the configured CC line pull-up/pull-down resistance.
This also marks the current state as seen: wait_for_vstate_change
returns once the state changes after this call.
Sourcepub async fn wait_for_vstate_change(&mut self) -> (CcVState, CcVState)
pub async fn wait_for_vstate_change(&mut self) -> (CcVState, CcVState)
Waits for a change in voltage state on either CC line.
Returns the current voltage state once the hardware has reported a change on CC1 or CC2
since the state was last read, by vstate or by this function. Changes
are latched: one that happened before this call makes it return immediately, so a loop like
let (mut cc1, _) = cc_phy.vstate();
while cc1 != wanted {
(cc1, _) = cc_phy.wait_for_vstate_change().await;
}can’t miss a change. The returned state can be equal to the one seen before, for example if the line changed and changed back.