tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/ft6336/basic/m5stack_core2.go (about)

     1  //go:build m5stack_core2
     2  
     3  package main
     4  
     5  import (
     6  	"machine"
     7  
     8  	"tinygo.org/x/drivers/ft6336"
     9  	"tinygo.org/x/drivers/i2csoft"
    10  	"tinygo.org/x/drivers/touch"
    11  )
    12  
    13  // InitDisplay initializes the display of each board.
    14  func initDevices() (touch.Pointer, error) {
    15  	i2c := i2csoft.New(machine.SCL0_PIN, machine.SDA0_PIN)
    16  	i2c.Configure(i2csoft.I2CConfig{Frequency: 100e3})
    17  
    18  	resistiveTouch := ft6336.New(i2c, machine.Pin(39))
    19  	resistiveTouch.Configure(ft6336.Config{})
    20  	resistiveTouch.SetPeriodActive(0x00)
    21  
    22  	return resistiveTouch, nil
    23  }