Touchscreen.h

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.

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.

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

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

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.


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.

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!

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.

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.

Yes,
Definitely i will try it out
Thanks a lot

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.

okay:+1:
Thank you.:slightly_smiling_face:


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.

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

1 Like

yes

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

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

1.8.5

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

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.