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

     1  //go:build nano_33_ble
     2  
     3  // Nano 33 BLE [Sense] has LSM9DS1 unit on-board.
     4  // This custom Configure function powers unit up
     5  // and enables I2C, so unit can can be accessed.
     6  package lsm9ds1
     7  
     8  import (
     9  	"machine"
    10  	"time"
    11  )
    12  
    13  // Configure sets up the device for communication.
    14  func (d *Device) Configure(cfg Configuration) error {
    15  	// Following lines are Nano 33 BLE specific, they have nothing to do with sensor per se
    16  	machine.LSM_PWR.Configure(machine.PinConfig{Mode: machine.PinOutput})
    17  	machine.LSM_PWR.High()
    18  	machine.I2C_PULLUP.Configure(machine.PinConfig{Mode: machine.PinOutput})
    19  	machine.I2C_PULLUP.High()
    20  	// Wait a moment
    21  	time.Sleep(100 * time.Millisecond)
    22  	// Common initialisation code
    23  	return d.doConfigure(cfg)
    24  }