TouchlessResetWatcher

Struct TouchlessResetWatcher 

Source
pub struct TouchlessResetWatcher { /* private fields */ }
Expand description

Watcher for the 1200-baud touchless reset.

Track CDC SET_LINE_CODING (baud rate) and SET_CONTROL_LINE_STATE (DTR / RTS) events. When the host opens the port at 1200 baud and then drops DTR, return RescueAction::TriggerDfu so the caller can put the device into serial DFU mode.

The watcher self-suppresses after firing — once TouchlessResetWatcher::fired is true, subsequent events return None until TouchlessResetWatcher::reset is called. In normal operation the BSP’s enter_dfu_serial() diverges so the suppression is moot; it exists for defensive symmetry and testability.

Implementations§

Source§

impl TouchlessResetWatcher

Source

pub const fn new() -> Self

Construct with the conventional power-on assumption: baud 115200, DTR low (host has not yet opened the port).

Source

pub fn on_line_coding(&mut self, baud: u32) -> RescueAction

Notify of a CDC SET_LINE_CODING request.

Source

pub fn on_control_line_state(&mut self, dtr: bool, _rts: bool) -> RescueAction

Notify of a CDC SET_CONTROL_LINE_STATE request. Only dtr is consulted; rts is accepted for API completeness but ignored, since the Arduino-ecosystem 1200-baud convention is DTR-driven.

Source

pub fn fired(&self) -> bool

Source

pub fn reset(&mut self)

Trait Implementations§

Source§

impl Debug for TouchlessResetWatcher

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TouchlessResetWatcher

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.