Touchscreen.h


(Daniel kirubakaran) #1

I am working on TFT touch display,it shows compilation error in arduino ide for Hifive1,tells like no library found “Touchscreen.h”. Where can i get Touchscreen.h for sifive? in any repo?
please kindly help me.


(Bruce Hoult) #2

I get the same error trying to compile a sketch for Arduino Uno if I #include “Touchscreen.h” so it seems it’s not a standard library. Where did you read about it?

Many Arduino libraries will “just work” if they are written in C, without any AVR assembly language, and if they only use interfaces available on the HiFive1.

The one at https://github.com/Seeed-Studio/Touch_Screen_Driver for example uses analogRead(), which the HiFive1 doesn’t support. You could add an ADC via an I2C bus if you want.


(Daniel kirubakaran) #3

I read in error message box in arduino ide.
ok then i will try with ADC.
does Hifive1 support I2C ?


(Bruce Hoult) #4

But where did you get the idea to type #include "Touchscreen.h" in your program? Did you read it on some web site?

On standard AVR Arduinos I2C is supported by the “wire” library, which we don’t supply. However I2C is extremely easy to implement yourself using digitalRead() and digitalWrite() and a couple of pins. You can find an overview of a wide choice of Arduino I2C libraries at


(Daniel kirubakaran) #5

i downloaded the zip file of adafruit_ILI9341 from sifive repository and included the library in Arduino ide.Then i went for some examples “breakouttouchpaint” under Adafruit_ILI9341.
Tried compilation for HIFIVE1 board ,then i got these following error message.


/home/maxvy04/Arduino/libraries/Adafruit_ILI9341/examples/breakouttouchpaint/breakouttouchpaint.ino:21:25: fatal error: TouchScreen.h: No such file or directory
#include “TouchScreen.h”
^
compilation terminated.
exit status 1
Error compiling for board HiFive 1.



(Bruce Hoult) #6

Oh! I didn’t know @mwachs5 had ported that!

You might try the other examples. They don’t look to need Touchscreen.h. I guess Megan didn’t do anything to port that particular example.


(Daniel kirubakaran) #7

Yeah, i tried the other example “graphictest” and it has compiled successfully.

but i may need that touch option in future because i am going to give some inputs via touch.
That is why!


(Bruce Hoult) #8

OK, good.

The thing is, it looks like you’re going to need some external AtoD converter to use that example anyway, as the FE310 doesn’t have any analogue inputs built in.


(Daniel kirubakaran) #9

And kindly let me know if you are familiar with Softwareserial

I want to convert digital pins other than 0 and 1 to UART pins for my sensor.
Library is there for AVR boards but i couldnt find it for Hifive1.


(Daniel kirubakaran) #10

Yes,
Definitely i will try it out
Thanks a lot


(Bruce Hoult) #11

I’ve heard of it :slight_smile: I see it uses interrupts. The HiFive1 supports edge and level interrupts on every GPIO pin. I don’t actually know offhand whether attachInterrupt() has been implemented in the Arduino environment, but you can definitely do it from plain C. You can read about that in the E300 Platform Reference Manual. You’ll need assembly language if you write your own interrupt handlers. “attribute ((interrupt))” has recently been added to RISC-V gcc to enable interrupt handlers to be written in pure C but I don’t think the Arduino package has been updated to include that.


(Daniel kirubakaran) #12

okay:+1:
Thank you.:slightly_smiling_face:


(Daniel kirubakaran) #13


I think they are Sifive people!!
These people had tested with touch display shield ,if they could tell the library that they used it would be good .I can try it out with my breakout board.


(Bruce Hoult) #14

Interesting. I hadn’t seen that video or those prototype boards before! And those have to be @mwachs5 hands holding that board+shield.


(Daniel kirubakaran) #15

yes


(Megan A. Wachs) #16

Yes, we have ported the Adafruit touchscreen library to the HiFive1. You can find it on our SiFive github:


(Megan A. Wachs) #17

The compile errors you’re getting may be an Arduino version compatability issue. What version of the Arduino IDE are you using?


(Daniel kirubakaran) #18

1.8.5


(Daniel kirubakaran) #19

This version was mentioned in the hifive1 getting started guide.So i followed the link.


(Bruce Hoult) #20

The issue is that…

… does a #include of TouchScreen.h which is not included in that repo, and not in either our or the standard Arduino IDE download.

And then the YP and XM defines in breakouttouchpaint.ino “must be an analog pin”, which the HiFive1 does not have any of.