B4R Question rAdafruit_STMPE610 & rAdafruit_ILI9341 not compiling

lenk54

Member
Licensed User
Longtime User
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.

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.


Hope someone can help.
 

lenk54

Member
Licensed User
Longtime User
Hi

Thanks 'thetahsk' for the info and prompt reply, seems to work ok.

Is the reason very technical?

Regards
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…