Files
drivers/lps22hb/lps22hb_nano_33_ble.go
T
Alan Wang bee7422c3a Fix Nano 33 BLE drivers (#351)
Fix HTS221, LPS22HB and APDS9960 drivers and their examples for Arduino Nano 33 BLE:

* Update hts221_nano_33_ble.go
* Update lps22hb_nano_33_ble.go
* Update apds9960_nano_33_ble.go
2021-12-20 09:57:37 +01:00

24 lines
619 B
Go

//go:build nano_33_ble
// +build nano_33_ble
package lps22hb
import (
"machine"
"time"
)
// 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.LSP_PWR.Configure(machine.PinConfig{Mode: machine.PinOutput})
machine.LSP_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
d.bus.WriteRegister(d.Address, LPS22HB_CTRL1_REG, []byte{0x02})
}