Hi
This is only my second post so I hope I am doing it OK.
I am trying to get a TFT spi (ILI9341) display to work with a esp32 (VROOM-32) board. It works fine within the Arduino system but with the same setup I cant get it to work with B4R.
I used Erel's rAdafruit_STMPE610 & rAdafruit_ILI9341 - Touch Sensitive Screen example and code with the libraries required but it will not compile.
Libs: rAdafruit_ILI9341
rAdafruit_STMPE610
rAdafuitGFX
I have uninstalled B4R and re-installed but no change.
The following is just a slice of the error codes. All 3 libraries show errors.
I assume I am doing something wrong.
I have tried compiling with other libs just in case there are other dependencies.
Hope someone can help.
This is only my second post so I hope I am doing it OK.
I am trying to get a TFT spi (ILI9341) display to work with a esp32 (VROOM-32) board. It works fine within the Arduino system but with the same setup I cant get it to work with B4R.
I used Erel's rAdafruit_STMPE610 & rAdafruit_ILI9341 - Touch Sensitive Screen example and code with the libraries required but it will not compile.
Libs: rAdafruit_ILI9341
rAdafruit_STMPE610
rAdafuitGFX
I have uninstalled B4R and re-installed but no change.
B4X:
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 600
#End Region
'Ctrl+Click to open the C code folder: ide://run?File=%WINDIR%\System32\explorer.exe&Args=%PROJECT%\Objects\Src
Sub Process_Globals
Public Serial1 As Serial
Private STMP As AdafruitSTMPE610
Private ILI As AdafruitILI93411
Private colors(8) As UInt
Private currentColor As UInt
Private colorsHeight As UInt = 20
Private colorsWidth As UInt
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
If STMP.Initialize(8, "STMP_Touch") = False Then
Log("Failed to initialize touch screen.")
Return
End If
' If
ILI.Initialize(5, 17)
ILI.FillScreen(ILI.COLOR_WHITE)
ILI.GFX.ConfigureText(2, ILI.COLOR_BLACK, True)
ILI.GFX.SetCursor(2, 2)
ILI.GFX.DrawText("This is a test")
Dim p As Pin
p.Initialize(0, p.MODE_INPUT)
RndSeed(p.AnalogRead)
colorsWidth = ILI.GFX.Width / colors.Length
For i = 0 To colors.Length - 1
colors(i) = ILI.Color(Rnd(0, 256), Rnd(0, 256), Rnd(0, 256))
ILI.GFX.DrawRect(colorsWidth * i, 0, colorsWidth, colorsHeight, colors(i), True)
Next
currentColor = colors(0)
End Sub
Sub STMP_Touch (X As Int, Y As Int)
'map the touch range to the drawing screen range
Dim fx As Int = MapRange(X, 150, 3800, 0, ILI.GFX.Width)
Dim fy As Int = MapRange(Y, 130, 4000, 0, ILI.GFX.Height)
If fy < colorsHeight Then
currentColor = colors(fx / colorsWidth)
ILI.GFX.DrawRect(0, ILI.GFX.Height - 3, ILI.GFX.Width, ILI.GFX.Height, currentColor, True)
Log("CurrentColor: ", currentColor)
Else
ILI.GFX.DrawCircle(fx, fy, 5, currentColor,True)
End If
End Sub
The following is just a slice of the error codes. All 3 libraries show errors.
I assume I am doing something wrong.
I have tried compiling with other libs just in case there are other dependencies.
rAdafruit_ILI9341.h:20:21: error: 'Byte' has not been declared
void SetRotation(Byte Rotation);
^
rAdafruit_ILI9341.h:21:4: error: 'UInt' does not name a type
UInt Color (Byte R, Byte G, Byte B);
^
In file included from F:\0_esp\DISPLA~1\Objects\bin\sketch\B4RDefines.h:26:0,
from F:\0_esp\DISPLA~1\Objects\bin\sketch\rAdafruit_STMPE610.cpp:2:
rAdafruit_STMPE610.h:7:32: error: typedef 'B4R::SubVoidIntInt' is initialized (use decltype instead)
typedef void (*SubVoidIntInt)(Int X, Int Y) ;
^
rAdafruit_STMPE610.h:7:32: error: 'Int' was not declared in this scope
rAdafruit_STMPE610.h:7:39: error: 'Int' was not declared in this scope
typedef void (*SubVoidIntInt)(Int X, Int Y) ;
^
rAdafruit_STMPE610.h:13:4: error: 'SubVoidIntInt' does not name a type
SubVoidIntInt TouchSub;
^
rAdafruit_STMPE610.h:15:20: error: 'SubVoidIntInt' has not been declared
bool sharedInit(SubVoidIntInt TouchSub, Byte i2caddr);
^
rAdafruit_STMPE610.h:15:44: error: 'Byte' has not been declared
bool sharedInit(SubVoidIntInt TouchSub, Byte i2caddr);
^
rAdafruit_STMPE610.h:20:20: error: 'Byte' has not been declared
bool Initialize(Byte CSPin, SubVoidIntInt TouchSub);
^
rAdafruit_STMPE610.h:20:32: error: 'SubVoidIntInt' has not been declared
bool Initialize(Byte CSPin, SubVoidIntInt TouchSub);
^
rAdafruit_STMPE610.h:24:23: error: 'Byte' has not been declared
bool InitializeI2C(Byte I2CAddress, SubVoidIntInt TouchSub);
^
rAdafruit_STMPE610.h:24:40: error: 'SubVoidIntInt' has not been declared
bool InitializeI2C(Byte I2CAddress, SubVoidIntInt TouchSub);
^
rAdafruit_STMPE610.cpp:4:49: error: 'SubVoidIntInt' has not been declared
bool rAdafruitSTMPE610::Initialize(Byte CSPin, SubVoidIntInt TouchSub) {
^
rAdafruit_STMPE610.cpp:4:7: error: prototype for 'bool B4R::rAdafruitSTMPE610::Initialize(Byte, int)' does not match any in class 'B4R::rAdafruitSTMPE610'
bool rAdafruitSTMPE610::Initialize(Byte CSPin, SubVoidIntInt TouchSub) {
^
In file included from F:\0_esp\DISPLA~1\Objects\bin\sketch\B4RDefines.h:26:0,
from F:\0_esp\DISPLA~1\Objects\bin\sketch\rAdafruit_STMPE610.cpp:2:
rAdafruit_STMPE610.h:20:9: error: candidate is: bool B4R::rAdafruitSTMPE610::Initialize(int, int)
bool Initialize(Byte CSPin, SubVoidIntInt TouchSub);
^
rAdafruit_STMPE610.cpp:8:57: error: 'SubVoidIntInt' has not been declared
bool rAdafruitSTMPE610::InitializeI2C(Byte I2CAddress, SubVoidIntInt TouchSub) {
^
rAdafruit_STMPE610.cpp:8:7: error: prototype for 'bool B4R::rAdafruitSTMPE610::InitializeI2C(Byte, int)' does not match any in class 'B4R::rAdafruitSTMPE610'
bool rAdafruitSTMPE610::InitializeI2C(Byte I2CAddress, SubVoidIntInt TouchSub) {
^
In file included from F:\0_esp\DISPLA~1\Objects\bin\sketch\B4RDefines.h:26:0,
from F:\0_esp\DISPLA~1\Objects\bin\sketch\rAdafruit_STMPE610.cpp:2:
rAdafruit_STMPE610.h:24:9: error: candidate is: bool B4R::rAdafruitSTMPE610::InitializeI2C(int, int)
bool InitializeI2C(Byte I2CAddress, SubVoidIntInt TouchSub);
^
rAdafruit_STMPE610.cpp:13:37: error: 'bool B4R::rAdafruitSTMPE610::sharedInit' is not a static member of 'class B4R::rAdafruitSTMPE610'
bool rAdafruitSTMPE610::sharedInit(SubVoidIntInt TouchSub, Byte i2caddr) {
^
rAdafruit_STMPE610.cpp:13:37: error: 'SubVoidIntInt' was not declared in this scope
rAdafruit_STMPE610.cpp:13:66: error: expected primary-expression before 'i2caddr'
bool rAdafruitSTMPE610::sharedInit(SubVoidIntInt TouchSub, Byte i2caddr) {
^
rAdafruit_STMPE610.cpp:13:73: error: expression list treated as compound expression in initializer [-fpermissive]
bool rAdafruitSTMPE610::sharedInit(SubVoidIntInt TouchSub, Byte i2caddr) {
^
rAdafruit_STMPE610.cpp:13:75: error: expected ',' or ';' before '{' token
bool rAdafruitSTMPE610::sharedInit(SubVoidIntInt TouchSub, Byte i2caddr) {
^
rAdafruit_STMPE610.cpp:37:1: error: expected '}' at end of input
}
^
Using library Wire at version 1.0 in folder: C:\Users\dad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\Wire
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\dad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi
Using library SPI at version 1.0 in folder: C:\Users\dad\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\SPI
exit status 1
DEBUG StatusLogger Stopping LoggerContext[name=1e6f5c3, org.apache.logging.log4j.core.LoggerContext@c9d179]
Hope someone can help.