Skip to main content

Touchpad

Struct Touchpad 

Source
pub struct Touchpad<S: SpiDevice<u8>, M: Mode> { /* private fields */ }

Implementations§

Source§

impl<S: SpiDevice<u8>, M: Mode> Touchpad<S, M>

Source

pub fn product_id(&mut self) -> Result<u8, S::Error>

Source

pub fn firmware_id(&mut self) -> Result<u8, S::Error>

Source

pub fn firmware_version(&mut self) -> Result<u8, S::Error>

Source

pub fn status(&mut self) -> Result<Status, S::Error>

When a touch is detected, Pinnacle loads X and Y position data into the position registers and asserts the SW_DR flag, which also triggers the HW_DR signal. While the finger/stylus is present, the position registers are updated every 10 ms and SW_DR and HW_DR are asserted.

Source

pub fn calibrate(&mut self, c: &Calibration) -> Result<(), S::Error>

Forces Pinnacle to re-calibrate.

If the touchpad is reporting touches when no fingers are on the pad then calibration (compensation) is wrong. Calling this function will fix the problem.

IMPORTANT: after calling this function, wait until Touchpad::calibrated is true and then Touchpad::enable_feed. Until then, the device will not produce any data and you should not touch the device.

Source

pub fn calibrated(&mut self) -> Result<bool, S::Error>

Check if the touchpad is calibrated.

Source

pub fn clear_flags(&mut self) -> Result<(), S::Error>

Clear Command Complete and Software Data Ready flags simultaneously.

Source

pub fn sample_rate(&mut self) -> Result<u8, S::Error>

Number of samples generated per second.

Source

pub fn set_sample_rate(&mut self, sample_rate: u8) -> Result<(), S::Error>

Set the number of samples generated per second.

Source

pub fn z_idle(&mut self) -> Result<u8, S::Error>

During Z-idle (no touch detected) and when in absolute data mode, Pinnacle will continue to send empty packets (both X and Y data set to 0x00) every 10 ms. The number of empty packets to be sent can be set using Touchpad::set_z_idle. The default value is 0x1E (30 decimal). When set to zero (0), this register prevents any empty packets from being sent, and the position registers will contain the last sensed location until a new finger presence is detected.

The Z-Idle count can be a helpful design tool. For example, tap-frequency can be determined by counting the number of Z-idle packets reported between a finger lifting off and touching back down (cutting short the stream of Z-idle packets).

Source

pub fn set_z_idle(&mut self, z_idle: u8) -> Result<(), S::Error>

Set the number of empty packets sent during Z-idle.

Source

pub fn z_scaler(&mut self) -> Result<u8, S::Error>

Contains the pen Z_On threshold.

Source

pub fn set_z_scaler(&mut self, z_scaler: u8) -> Result<(), S::Error>

Set the pen Z_On threshold.

Source

pub fn sleep_timer(&mut self) -> Result<u8, S::Error>

Source

pub fn set_sleep_timer(&mut self, sleep_timer: u8) -> Result<(), S::Error>

Source

pub fn sleep_interval(&mut self) -> Result<u8, S::Error>

Source

pub fn set_sleep_interval(&mut self, sleep_interval: u8) -> Result<(), S::Error>

Source

pub fn disable_feed(&mut self) -> Result<(), S::Error>

Source

pub fn enable_feed(&mut self) -> Result<(), S::Error>

Source

pub fn power_mode(&mut self) -> Result<PowerMode, S::Error>

Get the current power mode.

Source

pub fn set_power_mode(&mut self, mode: PowerMode) -> Result<(), S::Error>

Set the power mode.

Source§

impl<S: SpiDevice<u8>> Touchpad<S, Absolute>

Source

pub fn read_absolute(&mut self) -> Result<AbsoluteData, S::Error>

Source§

impl<S: SpiDevice<u8>> Touchpad<S, Relative>

Source

pub fn read_relative(&mut self) -> Result<RelativeData, S::Error>

Auto Trait Implementations§

§

impl<S, M> Freeze for Touchpad<S, M>
where S: Freeze,

§

impl<S, M> RefUnwindSafe for Touchpad<S, M>

§

impl<S, M> Send for Touchpad<S, M>
where S: Send, M: Send,

§

impl<S, M> Sync for Touchpad<S, M>
where S: Sync, M: Sync,

§

impl<S, M> Unpin for Touchpad<S, M>
where S: Unpin, M: Unpin,

§

impl<S, M> UnsafeUnpin for Touchpad<S, M>
where S: UnsafeUnpin,

§

impl<S, M> UnwindSafe for Touchpad<S, M>
where S: UnwindSafe, M: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.