Struct Touch

Source
pub struct Touch<'d, Tm: TouchMode, Dm: DriverMode> { /* private fields */ }
Available on crate feature unstable only.
Expand description

This struct marks a successfully initialized touch peripheral

Implementations§

Source§

impl<'d> Touch<'d, OneShot, Blocking>

Source

pub fn one_shot_mode( touch_peripheral: TOUCH<'d>, config: Option<TouchConfig>, ) -> Self

Initializes the touch peripheral and returns this marker struct. Optionally accepts configuration options.

§Example
let touch_cfg = Some(TouchConfig {
    measurement_duration: Some(0x2000),
    ..Default::default()
});
let touch = Touch::one_shot_mode(peripherals.TOUCH, touch_cfg);
Source§

impl<'d> Touch<'d, Continuous, Blocking>

Source

pub fn continuous_mode( touch_peripheral: TOUCH<'d>, config: Option<TouchConfig>, ) -> Self

Initializes the touch peripheral in continuous mode and returns this marker struct. Optionally accepts configuration options.

§Example
let touch_cfg = Some(TouchConfig {
    measurement_duration: Some(0x3000),
    ..Default::default()
});
let touch = Touch::continuous_mode(peripherals.TOUCH, touch_cfg);
Source§

impl<'d> Touch<'d, Continuous, Async>

Source

pub fn async_mode( touch_peripheral: TOUCH<'d>, rtc: &mut Rtc<'_>, config: Option<TouchConfig>, ) -> Self

Initializes the touch peripheral in continuous async mode and returns this marker struct.

§Warning:

This uses RTC_CORE interrupts under the hood. So the whole async part breaks if you install an interrupt handler with Rtc::set_interrupt_handler().

§Parameters:
  • rtc: The RTC peripheral is needed to configure the required interrupts.
  • config: Optional configuration options.
§Example
let mut rtc = Rtc::new(peripherals.LPWR);
let touch = Touch::async_mode(peripherals.TOUCH, &mut rtc, None);

Auto Trait Implementations§

§

impl<'d, Tm, Dm> Freeze for Touch<'d, Tm, Dm>

§

impl<'d, Tm, Dm> RefUnwindSafe for Touch<'d, Tm, Dm>
where Tm: RefUnwindSafe, Dm: RefUnwindSafe,

§

impl<'d, Tm, Dm> Send for Touch<'d, Tm, Dm>
where Tm: Send, Dm: Send,

§

impl<'d, Tm, Dm> Sync for Touch<'d, Tm, Dm>
where Tm: Sync, Dm: Sync,

§

impl<'d, Tm, Dm> Unpin for Touch<'d, Tm, Dm>
where Tm: Unpin, Dm: Unpin,

§

impl<'d, Tm, Dm> !UnwindSafe for Touch<'d, Tm, Dm>

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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.