5 unstable releases
0.3.0 | Nov 3, 2024 |
---|---|
0.2.2 | Oct 25, 2024 |
0.2.1 | Oct 13, 2024 |
0.2.0 | Oct 5, 2024 |
0.1.0 | Oct 4, 2024 |
#1391 in Embedded development
129 downloads per month
31KB
733 lines
tm040040
An embedded-hal
driver for the TM040040 Cirque Circle Trackpad.
Only supports I²C communication.
This is heavily inspired by the icm42670 crate.
lib.rs
:
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
}
}
Create a new trackpad instance.
Dependencies
~56KB