Hello,
here is a brief description of the setup:
7" capacitive touch screen with a FT5316 controller talking to Teensy via i2c, the function returns coordinates from the FT5316 as x=0~800, y=0~480, so far I'm not trying multitouch, but the controller is capable of it, just single touch.
I use arduino ide 1.8.5 with teensyduino 1.40
I've tried all possible combinations of USB types selected in the IDE, and I've tried the absolute mouse approach and the touchscreen class, couldn't get the touchscreen class to work with Android (tried 6.0 and 7.0) at all, it sort of did work with Windows7, but it was registering single clicks even though I was holding my finger down, and generally not behaving like I expected it to at all, setting it up as a mouse has gotten me the furthest so far.
this code lets me draw stuff in Windows paint like I expect it to, but once plugged in into the Android device - nothing happens, at best the the cursor pops up in the middle of the screen, but clicks are not registered, nor there is any "movement", meaning - clicking on different parts of the touch screen gives the same result - nothing happens. The method of calculating XX/YY values to be used for Mouse.moveTo is crude, but this was just for general testing, I didn't try to refine it since it doesn't do what I need to on the Android device.
So I was googling around for solution, and red these topics and tried everything that was in there:
https://forum.pjrc.com/threads/32331-USB-HID-Touchscreen-support-needed
https://forum.pjrc.com/threads/2894...ice-to-Teensyduino-1-23-(works-also-on-Linux)
I also tried the older IDE with the older teensyduino and edited usb descriptor files by mr.Elmue, but couldn't get it to work like it should with the android device. https://www.codeproject.com/Articles/1001891/A-USB-HID-Keyboard-Mouse-Touchscreen-emulator-with
Then I tried to figure out the usb descriptors, but the official text is basically unreadable for an amateur like me, but I opened up the usb_desc.c from teensy/avr/cores/teensy3/ and had a look around, and as soon as I recompiled my sketch with these changes, the thing started exhibiting some life when plugged into the Android device:
Android device started to actually react to me touching the touchscreen, it is registering a click and a movement, but the movement is relative, and I tried editing few other lines in that same mouse descriptor section that had some meaningful comment, but nothing seemed to result is anything resembling an absolute coordinate system, at best nothing happened, or the android just wouldn't respond to recompiled sketch with additional modifications to descriptor file at all.
Am I doing something really wrong or there are some known problems that I wasn't able to google solutions for?
here is a brief description of the setup:
7" capacitive touch screen with a FT5316 controller talking to Teensy via i2c, the function returns coordinates from the FT5316 as x=0~800, y=0~480, so far I'm not trying multitouch, but the controller is capable of it, just single touch.
I use arduino ide 1.8.5 with teensyduino 1.40
I've tried all possible combinations of USB types selected in the IDE, and I've tried the absolute mouse approach and the touchscreen class, couldn't get the touchscreen class to work with Android (tried 6.0 and 7.0) at all, it sort of did work with Windows7, but it was registering single clicks even though I was holding my finger down, and generally not behaving like I expected it to at all, setting it up as a mouse has gotten me the furthest so far.
this code lets me draw stuff in Windows paint like I expect it to, but once plugged in into the Android device - nothing happens, at best the the cursor pops up in the middle of the screen, but clicks are not registered, nor there is any "movement", meaning - clicking on different parts of the touch screen gives the same result - nothing happens. The method of calculating XX/YY values to be used for Mouse.moveTo is crude, but this was just for general testing, I didn't try to refine it since it doesn't do what I need to on the Android device.
Code:
#include <SPI.h>
#include "Wire.h"
#include "FT5xx6.h"
#define CTP_INT 2 // touch data ready for read from touch panel
FT5xx6 cmt = FT5xx6(CTP_INT);
word prev_coordinates[10]; // 5 pairs of x and y
byte nr_of_touches = 0;
int isLeftPressed = 0;
int didMouseMove = 0;
void setup() {
cmt.init(true);
Mouse.begin();
}
void loop() {
byte registers[FT5xx6_NUMBER_OF_REGISTERS];
word coordinates[10];
if (cmt.touched()){
cmt.getRegisterInfo(registers);
nr_of_touches = cmt.getTouchPositions(coordinates, registers);
//singleTouchOutput(coordinates);
int doImoveMouse = 1;
word x = coordinates[0];
word y = coordinates[1];
word XX = 12.5*x ;
word YY = 20.8*y ;
if (y > 2000 || y <= 0 || x > 2000 || x <= 0 ){
doImoveMouse = 0;
}
if (doImoveMouse == 1){
Mouse.moveTo(XX, YY);
}
if (registers[2] == 1 && isLeftPressed == 0){
Mouse.press(MOUSE_LEFT);
isLeftPressed = 1;
}
}
if (registers[2] == 0 && isLeftPressed == 1){
Mouse.release(MOUSE_LEFT);
isLeftPressed = 0;
}
delay(25);
}
So I was googling around for solution, and red these topics and tried everything that was in there:
https://forum.pjrc.com/threads/32331-USB-HID-Touchscreen-support-needed
https://forum.pjrc.com/threads/2894...ice-to-Teensyduino-1-23-(works-also-on-Linux)
I also tried the older IDE with the older teensyduino and edited usb descriptor files by mr.Elmue, but couldn't get it to work like it should with the android device. https://www.codeproject.com/Articles/1001891/A-USB-HID-Keyboard-Mouse-Touchscreen-emulator-with
Then I tried to figure out the usb descriptors, but the official text is basically unreadable for an amateur like me, but I opened up the usb_desc.c from teensy/avr/cores/teensy3/ and had a look around, and as soon as I recompiled my sketch with these changes, the thing started exhibiting some life when plugged into the Android device:
Code:
#ifdef MOUSE_INTERFACE
// Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension
static uint8_t mouse_report_desc[] = {
// 0x05, 0x01, // Usage Page (Generic Desktop) <---- I commented out these 2 lines
// 0x09, 0x02, // Usage (Mouse) <---- and added 2 first lines from the touch multitouch descriptor
0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x04, // Usage (Touch Screen)
Android device started to actually react to me touching the touchscreen, it is registering a click and a movement, but the movement is relative, and I tried editing few other lines in that same mouse descriptor section that had some meaningful comment, but nothing seemed to result is anything resembling an absolute coordinate system, at best nothing happened, or the android just wouldn't respond to recompiled sketch with additional modifications to descriptor file at all.
Am I doing something really wrong or there are some known problems that I wasn't able to google solutions for?
Last edited: