Skip to content

Commit

Permalink
Add FT6336U
Browse files Browse the repository at this point in the history
  • Loading branch information
fvanroie committed Jul 23, 2023
1 parent 124a979 commit 7625d68
Show file tree
Hide file tree
Showing 11 changed files with 645 additions and 2 deletions.
38 changes: 38 additions & 0 deletions lib/FT6336U/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# VS Code Setting
.vscode/

# Build Folder
build/
21 changes: 21 additions & 0 deletions lib/FT6336U/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 aselectroworks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions lib/FT6336U/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# FT6336U Library
FocalTech FT6336U (Self-Capacitive Touch Panel Controller) library for Arduino.

## License
This code is released under the MIT License. Please see [LICENSE](https://github.com/aselectroworks/Arduino-FT6336U/blob/master/LICENSE) for the full text.
40 changes: 40 additions & 0 deletions lib/FT6336U/examples/ReadTouchParam/ReadTouchParam.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "FT6336U.h"

#define I2C_SDA 22
#define I2C_SCL 23
#define RST_N_PIN 21
#define INT_N_PIN 34

FT6336U ft6336u(I2C_SDA, I2C_SCL, RST_N_PIN, INT_N_PIN);

void setup() {
Serial.begin(115200);

ft6336u.begin();

Serial.print("FT6336U Firmware Version: ");
Serial.println(ft6336u.read_firmware_id());
Serial.print("FT6336U Device Mode: ");
Serial.println(ft6336u.read_device_mode());
}

void loop() {
if(digitalRead(INT_N_PIN) != -1) {
Serial.print("FT6336U TD Status: ");
Serial.println(ft6336u.read_td_status());
Serial.print("FT6336U Touch Event/ID 1: (");
Serial.print(ft6336u.read_touch1_event()); Serial.print(" / "); Serial.print(ft6336u.read_touch1_id()); Serial.println(")");
Serial.print("FT6336U Touch Position 1: (");
Serial.print(ft6336u.read_touch1_x()); Serial.print(" , "); Serial.print(ft6336u.read_touch1_y()); Serial.println(")");
Serial.print("FT6336U Touch Weight/MISC 1: (");
Serial.print(ft6336u.read_touch1_weight()); Serial.print(" / "); Serial.print(ft6336u.read_touch1_misc()); Serial.println(")");
Serial.print("FT6336U Touch Event/ID 2: (");
Serial.print(ft6336u.read_touch2_event()); Serial.print(" / "); Serial.print(ft6336u.read_touch2_id()); Serial.println(")");
Serial.print("FT6336U Touch Position 2: (");
Serial.print(ft6336u.read_touch2_x()); Serial.print(" , "); Serial.print(ft6336u.read_touch2_y()); Serial.println(")");
Serial.print("FT6336U Touch Weight/MISC 2: (");
Serial.print(ft6336u.read_touch2_weight()); Serial.print(" / "); Serial.print(ft6336u.read_touch2_misc()); Serial.println(")");
}

}

57 changes: 57 additions & 0 deletions lib/FT6336U/examples/ScanMultiTouch/ScanMultiTouch.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include "FT6336U.h"
#include <stdio.h>

#define I2C_SDA 22
#define I2C_SCL 23
#define RST_N_PIN 21
#define INT_N_PIN 34

FT6336U ft6336u(I2C_SDA, I2C_SCL, RST_N_PIN, INT_N_PIN);

void setup() {
Serial.begin(115200);

ft6336u.begin();

// ft6336u.write_device_mode(factory_mode);
Serial.print("FT6336U Device Mode: ");
Serial.println(ft6336u.read_device_mode());
Serial.print("FT6336U Threshold: 0x");
Serial.println(ft6336u.read_touch_threshold(), HEX);
Serial.print("FT6336U Filter Coefficient: 0x");
Serial.println(ft6336u.read_filter_coefficient(), HEX);
Serial.print("FT6336U Control Mode: 0x");
Serial.println(ft6336u.read_ctrl_mode(), HEX);
Serial.print("FT6336U Time Period for enter to Monitor Mode: 0x");
Serial.println(ft6336u.read_time_period_enter_monitor(), HEX);
Serial.print("FT6336U Active Rate: 0x");
Serial.println(ft6336u.read_active_rate(), HEX);
Serial.print("FT6336U Monitor Rate: 0x");
Serial.println(ft6336u.read_monitor_rate(), HEX);

Serial.print("FT6336U LIB Ver: 0x");
Serial.println(ft6336u.read_library_version(), HEX);
Serial.print("FT6336U Chip ID: 0x");
Serial.println(ft6336u.read_chip_id(), HEX);
Serial.print("FT6336U G Mode: 0x");
Serial.println(ft6336u.read_g_mode(), HEX);
Serial.print("FT6336U POWER Mode: 0x");
Serial.println(ft6336u.read_pwrmode(), HEX);
Serial.print("FT6336U Firm ID: 0x");
Serial.println(ft6336u.read_firmware_id(), HEX);
Serial.print("FT6336U Focal Tehc ID: 0x");
Serial.println(ft6336u.read_focaltech_id(), HEX);
Serial.print("FT6336U Release Code ID: 0x");
Serial.println(ft6336u.read_release_code_id(), HEX);
Serial.print("FT6336U State: 0x");
Serial.println(ft6336u.read_state(), HEX);

}

FT6336U_TouchPointType tp;
void loop() {
tp = ft6336u.scan();
char tempString[128];
sprintf(tempString, "FT6336U TD Count %d / TD1 (%d, %4d, %4d) / TD2 (%d, %4d, %4d)\r", tp.touch_count, tp.tp[0].status, tp.tp[0].x, tp.tp[0].y, tp.tp[1].status, tp.tp[1].x, tp.tp[1].y);
Serial.print(tempString);
}
10 changes: 10 additions & 0 deletions lib/FT6336U/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name=FT6336U CTP Controller
version=1.0.2
author=Atsushi Sasaki
maintainer=Atsushi Sasaki
sentence=Arduino FT6336U CTP Controller library
paragraph=Arduino FT6336U CTP Controller library
category=Sensors
url=
architectures=*
includes=FT6336U.h
Loading

0 comments on commit 7625d68

Please sign in to comment.