tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/apds9960/apds9960_nano_33_ble.go (about)

     1  //go:build nano_33_ble
     2  
     3  package apds9960
     4  
     5  import (
     6  	"machine"
     7  	"time"
     8  )
     9  
    10  // Configure sets up the APDS-9960 device.
    11  func (d *Device) Configure(cfg Configuration) {
    12  
    13  	// Following lines are Nano 33 BLE specific, they have nothing to do with sensor per se
    14  	machine.LSM_PWR.Configure(machine.PinConfig{Mode: machine.PinOutput})
    15  	machine.LSM_PWR.High()
    16  	machine.I2C_PULLUP.Configure(machine.PinConfig{Mode: machine.PinOutput})
    17  	machine.I2C_PULLUP.High()
    18  	// Wait a moment
    19  	time.Sleep(10 * time.Millisecond)
    20  
    21  	// configure device
    22  	d.configureDevice(cfg)
    23  }