Shop OBEX P1 Docs P2 Docs Learn Events
LCD_GRAPHICS_DRIVER (Clusso99) ILI9341 — Parallax Forums

LCD_GRAPHICS_DRIVER (Clusso99) ILI9341

celtic3celtic3 Posts: 16
edited 2024-07-16 08:14 in PASM2/Spin2 (P2)

Having trouble trying to get the Touch screen to work proper. Using the following code it shows sporadic numbers for tx, ty. P2 edge card pin36 is the IRQ pin it is attached to on the ILI9341 screen..

if not pinr(36)
      tx        := lcd.get_ts($91)                                                      ' $91 turns off interupt and collects x position
      tempA   := lcd.get_ts($91)                                                         ' $91 keeps off interupt after x data, calibration point tx_topx
      ty        := lcd.get_ts($D1)                                                      ' $D1 keeps off interupt and collects y position
      tempA   := lcd.get_ts($D0)                                                         ' $D0 turns interupt back on after calibration point ty_topy

    lcd.drawString(8,180, "       ")
    lcd.drawString(25,180, cstr.dec(tx,3))
    lcd.drawString(8,190, "       ")
    lcd.drawString(25,190, cstr.dec(ty,3))

Could someone provide a snippet of how to go about this. Thank you

Comments

  • VonSzarvasVonSzarvas Posts: 3,488
    edited 2024-07-13 06:33

    Is the indenting in your actual code file as you need it to be?

    Thinking that might be worth checking because of the indentation shown in the code snippet above. Could just be the forum, or could be a clue!

    Ps. Added the code backticks for you, and removed the duplicate post. If you click the cog icon to edit your own post, you’ll see where the ticks are.

  • Thank you for the reply.
    The code indenting is fine, the forum changed it a little.

  • Figured it out.
    The values are being given in reverse of what i expected 0 right to 900+ left, also the values are higher than I expected. Feel like an idiot lol

  • evanhevanh Posts: 16,032
    edited 2024-07-15 23:35

    @celtic3 said:
    Thank you for the reply.
    The code indenting is fine, the forum changed it a little.

    The usual reason for that is because tabs and spaces are mixed differently on different lines. The forum's mono space is currently set at a tab-stop every four spaces.

    Importantly, the compiler can be confused as to the intended indentation when tabs and spaces are mixed differently on different lines. Ensure either one or the other is used exclusively in your Spin source code.

  • @evanh @"Christof Eb."
    Tabs and Highlight chat moved here: https://forums.parallax.com/discussion/comment/1560576/#Comment_1560576

  • celtic3celtic3 Posts: 16
    edited 2024-08-01 04:24

    If anyone interested ARCing function for
    1.44in 128x128 ILI9163 color LCD.........4.00in 480x320 ST7796S color LCD.........2.4in & 3.2in 320x240 ILI9341 Touch LCD
    XPT2046 Touch Panel support
    LCD_Graphics_Driver = https://obex.parallax.com/obex/ili9341_xpt2046/

    Circle (siz = scale of arc, ds = Degree start, de = Degree end, osx and osy = screen offset position, col = color)

    pub Circle(siz1,siz2,ds, de, osx, osy, col)
       repeat deg from ds to de
         mathb := QSIN(siz1, deg, 360)
         matha := QCOS(siz2, deg, 360)
         lcd.setWindow(osx+matha, osy+mathb, osx+matha, osy+mathb)
         lcd.fillWindow(col)
    
  • evanhevanh Posts: 16,032

    You might want link to where the "lcd" source code lives.

  • @celtic3 said:
    Circle (siz = scale of arc, ds = Degree start, de = Degree end, osx and osy = screen offset position, col = color)

    Are you sure that this works? I thought QSIN and QCOS require the angle input to be 0..$1_0000_0000 for 0..360° instead of an integer number for degrees. Degrees as integer would be quite coarse, anyway.

  • celtic3celtic3 Posts: 16
    edited 2024-08-08 10:37

    yes it work for me?

  • Ah, I've just seen, there is a third parameter of 360 which defines what value is taken for a full circle. So yes, it works.

Sign In or Register to comment.