mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-18 05:33:58 +00:00
mpu6050: return I2C error when configuring fails
An I2C bus can generate errors (like any I/O can), but they weren't returned. This commit fixes this oversight. Found while trying to figure out why LLVM 15 is broken just for the itsybitsy-m4.
This commit is contained in:
committed by
Ron Evans
parent
c00cb3abdd
commit
42dc6eb068
+2
-2
@@ -31,8 +31,8 @@ func (d Device) Connected() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure sets up the device for communication.
|
// Configure sets up the device for communication.
|
||||||
func (d Device) Configure() {
|
func (d Device) Configure() error {
|
||||||
d.bus.WriteRegister(uint8(d.Address), PWR_MGMT_1, []uint8{0})
|
return d.bus.WriteRegister(uint8(d.Address), PWR_MGMT_1, []uint8{0})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadAcceleration reads the current acceleration from the device and returns
|
// ReadAcceleration reads the current acceleration from the device and returns
|
||||||
|
|||||||
Reference in New Issue
Block a user