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:
bool read_int_pin(void) {
// Return INT pin state (active low)
}
void reset_chip(void) {
// Reset the FT6X36 chip
}
void i2c_read(uint32_t addr, uint32_t reg, void *data, int len) {
// I2C read implementation
}
void i2c_write(uint32_t addr, uint32_t reg, void *data, int len) {
// I2C write implementation
}Initialize the driver:
// Initialize
FT6X36Config_t config = {
.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 touches
if (ft6x36_touched()) {
FT6X36Touchpoint_t touches[FT6X36_MAX_TOUCH_POINTS];
int count = ft6x36_get_touches(touches);
for (int i = 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