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

     1  //go:build nano_33_ble
     2  
     3  package lps22hb
     4  
     5  import (
     6  	"machine"
     7  	"time"
     8  
     9  	"tinygo.org/x/drivers/internal/legacy"
    10  )
    11  
    12  // Configure sets up the LPS22HB device for communication.
    13  func (d *Device) Configure() {
    14  	// Following lines are Nano 33 BLE specific, they have nothing to do with sensor per se
    15  	machine.LPS_PWR.Configure(machine.PinConfig{Mode: machine.PinOutput})
    16  	machine.LPS_PWR.High()
    17  	machine.I2C_PULLUP.Configure(machine.PinConfig{Mode: machine.PinOutput})
    18  	machine.I2C_PULLUP.High()
    19  	// Wait a moment
    20  	time.Sleep(10 * time.Millisecond)
    21  
    22  	// set to block update mode
    23  	legacy.WriteRegister(d.bus, d.Address, LPS22HB_CTRL1_REG, []byte{0x02})
    24  }