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

     1  //go:build nano_33_ble
     2  
     3  package hts221
     4  
     5  import (
     6  	"machine"
     7  	"time"
     8  )
     9  
    10  // Configure sets up the HTS221 device for communication.
    11  func (d *Device) Configure() {
    12  	// Following lines are Nano 33 BLE specific, they have nothing to do with sensor per se
    13  	machine.HTS_PWR.Configure(machine.PinConfig{Mode: machine.PinOutput})
    14  	machine.HTS_PWR.High()
    15  	machine.I2C_PULLUP.Configure(machine.PinConfig{Mode: machine.PinOutput})
    16  	machine.I2C_PULLUP.High()
    17  	// Wait a moment
    18  	time.Sleep(10 * time.Millisecond)
    19  
    20  	// read calibration data
    21  	d.calibration()
    22  	// activate device and use block data update mode
    23  	d.Power(true)
    24  }