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>
impl<'d> Touch<'d, OneShot, Blocking>
Sourcepub fn one_shot_mode(
touch_peripheral: TOUCH<'d>,
config: Option<TouchConfig>,
) -> Self
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>
impl<'d> Touch<'d, Continuous, Blocking>
Sourcepub fn continuous_mode(
touch_peripheral: TOUCH<'d>,
config: Option<TouchConfig>,
) -> Self
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>
impl<'d> Touch<'d, Continuous, Async>
Sourcepub fn async_mode(
touch_peripheral: TOUCH<'d>,
rtc: &mut Rtc<'_>,
config: Option<TouchConfig>,
) -> Self
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);