C/C++ Question TFTv2 & SeeedTouchScreen Driver Library HELP

Gentry

Member
Licensed User
Longtime User
Trying to build the library wrappers to push a 2.8" TFT Touchscreen. I have downloaded the source libraries, put them in their own directory, and tried to generate the B4R library xml with:

B4X:
java -jar B4Rh2xml.jar TFTv2.h TFTv2.xml

Skipping: inline void sendCMD(INT8U index)
Skipping: {
Error parsing: TFT_DC_LOW;
parser._parsemethod (java line: 527)
java.lang.NumberFormatException: For input string: "error"
        at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
        at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
        at java.lang.Double.parseDouble(Unknown Source)
        at b4j.example.parser._parsemethod(parser.java:527)
        at b4j.example.parser._parseline(parser.java:464)
        at b4j.example.parser._parseh(parser.java:422)
        at b4j.example.parser._parse(parser.java:267)
        at b4j.example.main._appstart(main.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
        at b4j.example.main.main(main.java:29)

and

B4X:
java -jar B4Rh2xml.jar SeeedTouchScreen.h SeeedTouchScreen.xml

Error parsing: Point(void);
parser._parsemethod (java line: 527)
java.lang.NumberFormatException: For input string: "error"
        at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
        at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
        at java.lang.Double.parseDouble(Unknown Source)
        at b4j.example.parser._parsemethod(parser.java:527)
        at b4j.example.parser._parseline(parser.java:464)
        at b4j.example.parser._parseh(parser.java:422)
        at b4j.example.parser._parse(parser.java:267)
        at b4j.example.main._appstart(main.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
        at b4j.example.main.main(main.java:29)

I'm guessing that unknown source means that I need to acquire some dependent libraries, but I'm not sure where to go to get these. I've tried copying what I could find (like spi.h & spi.c) into the directory i'm generating from, but doesn't seem to have an effect.

Java -version reports 1.8.0_91-b14

Any pointers on where to go next is appreciated.

Attached one of the source libraries, the other one is too large.

Gentry
 

Attachments

  • Touch_Screen_Driver-master.zip
    6.1 KB · Views: 457

Gentry

Member
Licensed User
Longtime User
I've created a wrapper (based on your example) and it generates the library xml file, and seems to load into B4R successfully. When I try to compile though I get

sketch\TFTv2.cpp:23:19: fatal error: TFTv2.h: No such file or directory

(the base library .h and .cpp are all in the library directory). If I remove the #include "TFTv2.h" reference from the wrapper rTFTv2.h file, this error is not raised, but I get a new batch of errors

B4X:
In file included from sketch\B4RDefines.h:20:0,
                 from sketch\B4RArduino.cpp:1:
rTFTv2.h:8: error: 'TFT' was not declared in this scope
    uint8_t beTFTv2[sizeof(TFT)];
                           ^
rTFTv2.h:9: error: 'TFT' does not name a type
    TFT* driver;
    ^
exit status 1
'TFT' was not declared in this scope

Which sort of makes sense if the include is missing. I am using the reference to TFT because this is the classname in the original driver files I am attempting to wrap.

Attached find the B4R library attempt, and a simple B4R script that calls the library.

Thanks for looking!
Gentry
 

Attachments

  • rTFTv2.zip
    7.7 KB · Views: 437
  • TFT Sample Script.zip
    766 bytes · Views: 434

Gentry

Member
Licensed User
Longtime User
It is "TFTv2.h" in the file. The B4R reports it as <TFTv2.h> even though it is not.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
See the error message:
SS-2016-05-22_08.11.38.png


Line 23 in TFTv2.cpp
 

Gentry

Member
Licensed User
Longtime User
Opps, thanks. I think i'm pretty close, having a difficult time figuring out how to define the Initialize function. Here's my current error msg:

B4X:
rTFTv2.cpp:3: error: prototype for 'void B4R::B4RTFTv2::Initialize()' does not match any in class 'B4R::B4RTFTv2'
  void B4RTFTv2::Initialize(void) {
       ^
In file included from sketch\B4RDefines.h:20:0,
                 from sketch\rTFTv2.cpp:1:
rTFTv2.h:12: error: candidate is: void B4R::B4RTFTv2::Initialize(Byte)
    void Initialize(Byte Address);
         ^
exit status 1
prototype for 'void B4R::B4RTFTv2::Initialize()' does not match any in class 'B4R::B4RTFTv2'

and in the rTFTv2.cpp wrapper I'm defining it like:

B4X:
#include "B4RDefines.h"
namespace B4R {
    void B4RTFTv2::Initialize(void) {
        driver = new (TFT) TFT(void);
        driver->TFTInit(void);
    }

In the TFTv2.cpp has this defined as:

B4X:
void TFT::TFTinit (void)

soooo close. only had to comment out the drawString function (which was overloaded and also has a *string parameter, so need to figure out how to cope with those.

Current (flawed) library attempt attached.

Thanks,
Gentry
 

Attachments

  • rTFTv2 (2).zip
    7.7 KB · Views: 436

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
what are supported TFTs for example? is attached lib final release?

Thanks
 

Gentry

Member
Licensed User
Longtime User
Sorry, I gave up on the TFT library, couldn't figure out how to model the backend variable Erel suggested. I was targeting the library for this 2.8 TFT touch screen, but i'm stalled unless someone can assist bringing this down under my head.
 

Mostez

Well-Known Member
Licensed User
Longtime User
sorry to hear that, i hope someday you bring it to life, i always get many problems with library wrapper too.
 
Top