Skip to main content

Crate tm040040

Crate tm040040 

Source
Expand description

An embedded-hal driver for the TM040040 Pinnacle touch pads from Cirque.

The Pinnacle touch pad supports X and Y axis movement, tap detection and other features. Note that while the touch pad supports both I²C and SPI, only I²C is supported in this driver. For I²C to be active, the R1 resistor needs to be removed from the touch pad, if there is one. This was only tested with the TM040040 touch pad,but should work with all Pinnacle touch pads. This library only supports the non-AG (Advanced Gestures) version of Pinnacle touch pads.

For additional information, please consult the datasheet as well as the Pinnacle ASIC documentation.

§Example

use esp_idf_hal::{
    i2c::{I2cConfig, I2cDriver},
    peripherals::Peripherals,
};
use anyhow::Result;

use tm040040::{Address, FeedMode, Tm040040, XYInverted};
fn main() -> Result<()> {
    esp_idf_svc::sys::link_patches();
    let peripherals = Peripherals::take().unwrap();

    let sda = peripherals.pins.gpio10;
    let scl = peripherals.pins.gpio8;
    let config = I2cConfig::new().baudrate(400.kHz().into());
    let i2c = I2cDriver::new(peripherals.i2c0, sda, scl, &config)?;
    let mut trackpad = Tm040040::new(i2c, Address::Primary).enable().unwrap();
    let pad_data = trackpad.relative_data().unwrap();
    if let Some(touch_data) = pad_data {
        // the above is only `Some` if the pad is currently touched, otherwise it's `None`.
        // Do something with the touch data
    }
}

Structs§

Absolute
AbsoluteData
Position and button data in absolute mode
FeedEnabled
NoFeed
Relative
RelativeData
Position and button data in relative mode
Tm040040

Enums§

Address
i2c adress
Error
FeedMode
Feed mode controls if position reporting is turned on or not.
FilterMode
Enable or disable hardware filters. Cirque does not reccommend disabling filters.
GlideExtendMode
Control glide extend mode. In glide extend mode, drag actions can be extended by lifting the finger when an edge is reached and repositioning the finger.
IntelliMouseMode
Intelli mouse mode controlls scroll reporting.
PositionMode
Position reporting mode
PowerMode
Touchpad power modes
ScrollMode
Control scroll mode. Cirque docs don’t say what this actually does.
TapMode
Handle what types of taps are detected by hardware.
XYEnable
Disable specific axis.
XYInverted
Invert axis reporting (flips sign).
XYSwapped
Swap X and Y axis.

Traits§

FeedState
PositionReportingMode