Expand description
§FT3x68 Touch Controller Driver Crate
A driver for the FT3x68 touch controller(s), providing functionality to read touch points, gestures, and manage power modes.
There is limited public information relative to the FocalTech FT touch controllers. As such, much of the operational infromation is not documented in datasheets. This driver is largely based on the Arduino_DriveBus repo found here: https://github.com/Xk-w/Arduino_DriveBus/tree/master.
This driver is embedded-hal compatible and provides a generic interface for the implementing the device reset functionality.
This is because the reset pin can be controlled via a GPIO port or an I2C I/O expander-controlled pin.
Some drivers include an INT pin indicating touch events, but this driver does not use it. If interrupts need to be supported, the user can attach the pin output to an interrupt and implement their own callback.
The driver currenlty supports both the FT3168 and FT3268 devices.
§Usage
- Implement the
ResetInterfacetrait for your specific reset mechanism. - Create an instance of the
Ft3x68Driver. - Initialize the touch driver.
- Use the provided methods to read touch points and/or gestures.
// Initialize GPIO Reset Pin with pin or I2C instance
// ResetDriver would be a type that implements the `ResetInterface` trait.
let reset = ResetDriver::new(PinInstance);
let mut touch = Ft3x68Driver::new(
I2CInstace,
FT3168_DEVICE_ADDRESS,
reset,
delay,
);
touch
.initialize()
.expect("Failed to initialize touch driver");
loop {
touch
.touch1()
.map(|touch| println!("Touch 1: {:?}", touch))
.unwrap();
}Notes:
- To detect gestures, the gesture mode must be enabled using the
set_gesture_modemethod. - If the reset pin is controlled via an I2C GPIO expander sharing the same bus with the touch driver, you should use the
embedded_hal_busto manage multiple instances of I2C. Refer to the examples folder to see how that looks like.
Structs§
- Ft3x68
Driver - FT3x68 touch driver
- Touch
Point - Represents a single touch point.
Enums§
- Driver
Error - Driver Errors
- Gesture
- Gesture IDs returned by the device.
- Power
Mode - Power modes for the touch device.
- Touch
State - Represents the touch state - either active with coordinates or released
Constants§
Traits§
- Reset
Interface - Trait for controlling the FT3x658 hardware reset pin.