Files
drivers/lps22hb/lps22hb_nano_33_ble.go
2023-08-08 11:16:50 +02:00

25 lines
646 B
Go

//go:build nano_33_ble
package lps22hb
import (
"machine"
"time"
"tinygo.org/x/drivers/internal/legacy"
)
// Configure sets up the LPS22HB device for communication.
func (d *Device) Configure() {
// Following lines are Nano 33 BLE specific, they have nothing to do with sensor per se
machine.LPS_PWR.Configure(machine.PinConfig{Mode: machine.PinOutput})
machine.LPS_PWR.High()
machine.I2C_PULLUP.Configure(machine.PinConfig{Mode: machine.PinOutput})
machine.I2C_PULLUP.High()
// Wait a moment
time.Sleep(10 * time.Millisecond)
// set to block update mode
legacy.WriteRegister(d.bus, d.Address, LPS22HB_CTRL1_REG, []byte{0x02})
}