mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-09-11 00:59:26 +00:00
vl53l1x: Add functions for setting the device address
Implement functions to get and set the device address similar to its reference implementation in C: https://github.com/pololu/vl53l1x-arduino/blob/master/VL53L1X.cpp#L28 Signed-off-by: Michael Meister <michael.meister@bytesatwork.ch>
This commit is contained in:
committed by
Ron Evans
parent
19caee9b76
commit
e4951091f4
@@ -133,6 +133,17 @@ func (d *Device) Configure(use2v8Mode bool) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// SetAddress sets the I2C address which this device listens to.
|
||||
func (d *Device) SetAddress(address uint8) {
|
||||
d.writeReg(I2C_SLAVE_DEVICE_ADDRESS, address)
|
||||
d.Address = uint16(address)
|
||||
}
|
||||
|
||||
// GetAddress returns the I2C address which this device listens to.
|
||||
func (d *Device) GetAddress() uint8 {
|
||||
return uint8(d.Address)
|
||||
}
|
||||
|
||||
// SetTimeout configures the timeout
|
||||
func (d *Device) SetTimeout(timeout uint32) {
|
||||
d.timeout = timeout
|
||||
|
||||
Reference in New Issue
Block a user