Since we have had some success porting the Adafruit TFT and GFX libraries to my mind the Adafruit Touch library looks like a pretty reasonable target for our porting efforts.
If I get a chance in the next couple of days I will take a look at this, my initial wildly enthusiastic “try it and see, but don’t bother reading the instructions” method crashed and burned with a bunch of interesting errors,
so I suspect a little more digging is required.
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:4:38: error: 'PIN_MAP' was not declared in this scope
#define digitalPinToPort(P) ( PIN_MAP[P].gpio_device )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:57:21: note: in expansion of macro 'digitalPinToPort'
uint8_t xp_port = digitalPinToPort(_xp);
^
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:5:61: error: 'BIT' was not declared in this scope
#define digitalPinToBitMask(P) ( BIT(PIN_MAP[P].gpio_bit) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:62:20: note: in expansion of macro 'digitalPinToBitMask'
uint8_t xp_pin = digitalPinToBitMask(_xp);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:70:16: error: 'INPUT' was not declared in this scope
pinMode(_yp, INPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:70:21: error: 'pinMode' was not declared in this scope
pinMode(_yp, INPUT);
^
In file included from /home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/pins_arduino.h:6:0,
from /home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:6:
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:73:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(yp_port) &= ~yp_pin;
^
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:74:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(ym_port) &= ~ym_pin;
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:78:16: error: 'OUTPUT' was not declared in this scope
pinMode(_xp, OUTPUT);
^
In file included from /home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/pins_arduino.h:6:0,
from /home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:6:
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:82:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xp_port) |= xp_pin;
^
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:83:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xm_port) &= ~xm_pin;
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:86:33: error: 'analogRead' was not declared in this scope
samples[i] = analogRead(_yp);
^
In file included from /home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/pins_arduino.h:6:0,
from /home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:6:
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:98:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xp_port) &= ~xp_pin;
^
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:102:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(yp_port) |= yp_pin;
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:107:33: error: 'analogRead' was not declared in this scope
samples[i] = analogRead(_xm);
^
In file included from /home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/pins_arduino.h:6:0,
from /home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:6:
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:121:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xp_port) &= ~xp_pin;
^
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:125:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(ym_port) |= ym_pin;
^
/home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/variant.h:6:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->regs->ODR) )
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:129:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(yp_port) &= ~yp_pin;
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:133:27: error: 'analogRead' was not declared in this scope
int z1 = analogRead(_xm);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp: In member function 'int TouchScreen::readTouchX()':
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:180:17: error: 'INPUT' was not declared in this scope
pinMode(_yp, INPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:180:22: error: 'pinMode' was not declared in this scope
pinMode(_yp, INPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:182:22: error: 'LOW' was not declared in this scope
digitalWrite(_yp, LOW);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:182:25: error: 'digitalWrite' was not declared in this scope
digitalWrite(_yp, LOW);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:185:17: error: 'OUTPUT' was not declared in this scope
pinMode(_xp, OUTPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:186:22: error: 'HIGH' was not declared in this scope
digitalWrite(_xp, HIGH);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:190:31: error: 'analogRead' was not declared in this scope
return (1023-analogRead(_yp));
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp: In member function 'int TouchScreen::readTouchY()':
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:195:17: error: 'INPUT' was not declared in this scope
pinMode(_xp, INPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:195:22: error: 'pinMode' was not declared in this scope
pinMode(_xp, INPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:197:22: error: 'LOW' was not declared in this scope
digitalWrite(_xp, LOW);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:197:25: error: 'digitalWrite' was not declared in this scope
digitalWrite(_xp, LOW);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:200:17: error: 'OUTPUT' was not declared in this scope
pinMode(_yp, OUTPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:201:22: error: 'HIGH' was not declared in this scope
digitalWrite(_yp, HIGH);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:205:31: error: 'analogRead' was not declared in this scope
return (1023-analogRead(_xm));
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp: In member function 'uint16_t TouchScreen::pressure()':
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:211:16: error: 'OUTPUT' was not declared in this scope
pinMode(_xp, OUTPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:211:22: error: 'pinMode' was not declared in this scope
pinMode(_xp, OUTPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:212:21: error: 'LOW' was not declared in this scope
digitalWrite(_xp, LOW);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:212:24: error: 'digitalWrite' was not declared in this scope
digitalWrite(_xp, LOW);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:216:21: error: 'HIGH' was not declared in this scope
digitalWrite(_ym, HIGH);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:220:16: error: 'INPUT' was not declared in this scope
pinMode(_xm, INPUT);
^
/home/ahull/Arduino/libraries/TouchScreen/TouchScreen.cpp:224:26: error: 'analogRead' was not declared in this scope
int z1 = analogRead(_xm);
^
http://www.rinkydinkelectronics.com/library.php?id=56
This is for all ali/ebay ILI9341 TFT’s with touch (or all modules using the xpt2046 controller chip)
The only nice thing could be translating the calibration example sketch to the adafruit one (written for UTFT)
Edit: I think I translated the adafruit touch library some months ago… with a very disappointing result (and yes, this lib doesn’t work with xpt2046 chips, so I abandoned the “project”, because I don’t use my other displays anymore)
Andy: Don’t forget: If you are using a touchpad controller, don’t waste your time with this lib! (two different technologies..)
EDIT: I’ll look at the contents of your .zip too. Probably tomorrow before I get a chance.
Are they resistive touch screen with resistive output like the Nintendo DS ones?
These…
http://www.ebay.co.uk/itm/271751780632? … EBIDX%3AIT
.. are neither ILI9341, nor digital touch screen. They look the same, or very similar but they have a different controller, 8 bit parallel interface, and a resistive touch screen multiplexed with the display control lines. I have yet to get mine working, but given enough time I intend to give it a try.
BTW: Which TFT library do you use for this? May you can post it?
Thanks
Matthias
BTW: Which TFT library do you use for this? May you can post it?
Thanks
Matthias
edit: you have to change the ‘#ifndef’s start at line 102 in SWIFT.h for your board. I tried it out on my nucleo and it works!
Currently the new board is sulking downstairs attached to my dev. machine after I flashed a sketch that said “use more than 64K of ram if you dare” and I am too lazy to go down there and give it a stern talking to. I fear I may have lobotomised it
On the plus side, if it is toast, there is another one on its way on the slow boat from China… and at least this time nothing actually exploded, so all is not lost.
BTW: I toasted my first mini exactly yet!
BTW: I toasted my first mini exactly yet!
http://www.rinkydinkelectronics.com/library.php?id=56
This is for all ali/ebay ILI9341 TFT’s with touch (or all modules using the xpt2046 controller chip)
The only nice thing could be translating the calibration example sketch to the adafruit one (written for UTFT)
Edit: I think I translated the adafruit touch library some months ago… with a very disappointing result (and yes, this lib doesn’t work with xpt2046 chips, so I abandoned the “project”, because I don’t use my other displays anymore)
Do you own a maple mini (clone)?
Here is a link with a working bundle:
UTFT library (SPI) + touch-lib + two test sketches. I tried this out just yet, so it should working (IF the touch has no hardware failure). I see that I’ve take some backups of the touch library – maybe I changed a little thing? (I can’t really remember)
Pin definition is in the sketches (RS = DC!) and take care: it is using hardware SPI, so don’t change the SCK or SDA pins.
https://drive.google.com/file/d/0B3sgtw … sp=sharing
EDIT: Are you sure that the the TFT module is fitted with the XPT2046 chip? (Small 16 pin smd chip on the backside, “U1”)
These…
http://www.ebay.co.uk/itm/271751780632? … EBIDX%3AIT
.. are neither ILI9341, nor digital touch screen. They look the same, or very similar but they have a different controller, 8 bit parallel interface, and a resistive touch screen multiplexed with the display control lines. I have yet to get mine working, but given enough time I intend to give it a try.
Try the UTFT and UTouch drivers here http://www.rinkydinkelectronics.com/library.php?id=56 and here http://www.rinkydinkelectronics.com/library.php?id=52
I haven’t used the TFT drivers, but I might give them a go later. I am using the UTouch lib though and it works for my panel.
I used the Adafruit Libs for the display however. It would be interesting to see which library is quicker for the same display type the Adafruit ones or the UTFT ones.
I believe the UTFT libs probably support both your screen and touch panel too. The touch panel on those boards has been reported as not working by some people, but I think that is because it multiplexes the touch pins with the data pins. In other words it appears that the touch pins are not brought out on the connectors, but they are.. they are just on shared pins. This means a little more head scratching will be involved in making it work. Keep us posted if you manage.
Failing that, grab one of these… http://www.ebay.co.uk/itm/291346921118? … EBIDX%3AIT since this is what I used for the PigScope.
…
EDIT: Are you sure that the the TFT module is fitted with the XPT2046 chip? (Small 16 pin smd chip on the backside, “U1”)
Do you own a maple mini (clone)?
Here is a link with a working bundle:
UTFT library (SPI) + touch-lib + two test sketches. I tried this out just yet, so it should working (IF the touch has no hardware failure). I see that I’ve take some backups of the touch library – maybe I changed a little thing? (I can’t really remember)
Pin definition is in the sketches (RS = DC!) and take care: it is using hardware SPI, so don’t change the SCK or SDA pins.
https://drive.google.com/file/d/0B3sgtw … sp=sharing
EDIT: Are you sure that the the TFT module is fitted with the XPT2046 chip? (Small 16 pin smd chip on the backside, “U1”)
I got the TFT but it seems it doesn’t work.
Communication is parallel and not SPI and it is a shield for Arduino UNO.
I followed the instructions here
http://misc.ws/2015/01/24/lcd-touch-screen-information/
My shield is made by KeDei http://kedei.taobao.com and there is a date 2015/01/20 but they don’t sell it anymore.
I run the identification sketch and got a id of 0x0303 but with the modified Adafruit library, that has a function for reading the ID I get a 0x343!
I made modifications for the two ID with no luck.
I will try the UTFT library but I have different pins. I have to modify the library or connect wires. Since connecting wires seems more simple I will use wires and if successful I will modify the library since I have a shield that fit on Arduino UNO.
Maybe it is faulty, I am not shure if it’s better to write to the seller. Maybe after trying the UTFT library.
ahull wrote:
Failing that, grab one of these… http://www.ebay.co.uk/itm/291346921118? … EBIDX%3AIT since this is what I used for the PigScope.
UTFT is a grat library but there are some strange things
The PDFs are protected so one can’t copy the relevant parts. IMHO is silly because you can unlock them easily
The very strange thing is that if I disable a driver that I use in the constructor I don’t get any error.
zoomx: You should give my libraries/sketches a try:
I think it is exactly the display I own!
So please download this:
https://drive.google.com/file/d/0B3sgtw … sp=sharing
In this folder you will find:
1) The adapted swift-shield library by myself: Attention! You have to edit the nucleo_103rb.h file (in the swift-library folder) for changing the pins. There is no need to rename it (I didn’t made any #ifdef’s, so this file is loaded by the library anyway equal which board you use!):
Starting at line 38-41 (CS,CD,WR,RD) and(!)
starting at line 90-99 (the 8-bit port pins) [for sure this can be done faster: use a whole port-write, but I used it as shield for the nucleo, so I wasn’t able to select the pins by myself]
2) The adapted touchscreen library by myself
3) Test Sketches:
3.1.) “7781”: raw code for the display, no driver needed (was for testing, creepy slow!
3.2.) “7783”: all swift library test sketches (inclusive touchscreen example)
I tested it on nucleo only, so please adapt all pins!
edit: If you find some “Serial2” in my code: This was the “old” simple “Serial” on nucleo, so just change every “Serial2” to “Serial”
regards
Matthias
Maybe I will find the difference with the other drivers.
Did your swift-shield library make it in to the main repo or is it separate?
No plan if the library is cross compatible at the moment, because I use the Arduino IDE only for STM32 (for the rest I use UECIDE), but I think for this version I’ve disabled the #ifdefs (shouldn’t be a problem to solve if needed)
Did you modify it to do 8 bit single port write, or does it do 8 writes to individual pins?
-> individual pins, because I need it as “Arduino shield”. Look at nucleo_f103rb.h here is all the magic done!
More or less the same game like: (You have to change a pin many times in this code, so be careful!)
gpio_write_bit(GPIOA, 9, (d) & BIT0_MSK_8BIT);\
gpio_write_bit(GPIOC, 7, (d) & BIT1_MSK_8BIT);\
gpio_write_bit(GPIOA, 10, (d) & BIT2_MSK_8BIT);\
gpio_write_bit(GPIOB, 3, (d) & BIT3_MSK_8BIT);\
gpio_write_bit(GPIOB, 5, (d) & BIT4_MSK_8BIT);\
gpio_write_bit(GPIOB, 4, (d) & BIT5_MSK_8BIT);\
gpio_write_bit(GPIOB, 10, (d) & BIT6_MSK_8BIT);\
gpio_write_bit(GPIOA, 8, (d) & BIT7_MSK_8BIT);\


