Single-file C library for FT6X36 capacitive touch controllers.
Copy ft6x36.h and ft6x36.c into your project.
Include the driver:
#include"ft6x36.h"Implement the necessary platform-specific functions:
boolread_int_pin(void) {
// Return INT pin state (active low)
}
voidreset_chip(void) {
// Reset the FT6X36 chip
}
voidi2c_read(uint32_taddr, uint32_treg, void*data, intlen) {
// I2C read implementation
}
voidi2c_write(uint32_taddr, uint32_treg, void*data, intlen) {
// I2C write implementation
}Initialize the driver:
// InitializeFT6X36Config_tconfig= {
.fnReadIntPin=read_int_pin,
.fnResetChip=reset_chip,
.fnSerialRead=i2c_read,
.fnSerialWrite=i2c_write
};
ft6326_init(&config);You're now ready to start using the device:
// Check for touchesif (ft6x36_touched()) {
FT6X36Touchpoint_ttouches[FT6X36_MAX_TOUCH_POINTS];
intcount=ft6x36_get_touches(touches);
for (inti=0; i<count; i++) {
printf("Touch %d: x=%d, y=%d\n", i, touches[i].x, touches[i].y);
}
}ft6326_init(config)- Initialize the driver with platform callbacksft6x36_touched()- Check if screen is touchedft6x36_get_touches(array)- Get touch coordinates and details