0

Pygamer with tinygo
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Pygamer with tinygo

by jypelle on Wed Nov 04, 2020 5:15 pm

Hi!

I'm using tinygo with my pygamer.

Buttons and the 5 neopixels are ok, but I encounter some issues with TFT:

When I configure SPI1 like this:

Code: Select all | TOGGLE FULL SIZE
   machine.SPI1.Configure(machine.SPIConfig{
      SCK:       machine.SPI1_SCK_PIN,
      SDO:       machine.SPI1_SDO_PIN,
      SDI:       machine.SPI1_SDI_PIN,
   })


, the pygamer crashes

Could you tell me what i missed ?

jypelle
 
Posts: 2
Joined: Wed Nov 04, 2020 5:09 pm

Re: Pygamer with tinygo

by TitiMoby on Sun Aug 01, 2021 9:15 am

I know it's been a long time, but did you succeeded?

I tried another approach with the following code.

Code: Select all | TOGGLE FULL SIZE
package main

import (
   "image/color"
   "machine"
   "time"

   "tinygo.org/x/drivers/st7735"
)

var red = color.RGBA{255, 0, 0, 255}
var green = color.RGBA{0, 255, 0, 255}

func main() {
   machine.SPI0.Configure(machine.SPIConfig{
      Frequency: machine.TWI_FREQ_100KHZ,
   })

   resetPin := machine.TFT_RST
   dcPin := machine.TFT_DC
   csPin := machine.TFT_CS
   backLightPin := machine.TFT_LITE

   display := st7735.New(machine.SPI0, resetPin, dcPin, csPin, backLightPin)
   display.Configure(st7735.Config{})
   i := 0
   for {
      display.FillScreen(green)
      time.Sleep(2 * time.Second)
      display.FillScreen(red)
      time.Sleep(2 * time.Second)
      i++
   }
}


But it only light the backlight and no sign of colors on the display.

TitiMoby
 
Posts: 10
Joined: Tue Sep 01, 2015 3:59 am

Re: Pygamer with tinygo

by jypelle on Sun Aug 01, 2021 10:05 am

It succeed with Tinygo >=0.16 (or tinygo 0.15 with this fix: https://github.com/tinygo-org/tinygo/co ... a56fcdc725 )

I released a working template here: https://github.com/jypelle/xship

jypelle
 
Posts: 2
Joined: Wed Nov 04, 2020 5:09 pm

Please be positive and constructive with your questions and comments.