From 42dc6eb06854f358e456c2ac9b3716d8b41307b3 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 17 Oct 2022 16:23:10 +0200 Subject: [PATCH] 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. --- mpu6050/mpu6050.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mpu6050/mpu6050.go b/mpu6050/mpu6050.go index e707c14..effebed 100644 --- a/mpu6050/mpu6050.go +++ b/mpu6050/mpu6050.go @@ -31,8 +31,8 @@ func (d Device) Connected() bool { } // Configure sets up the device for communication. -func (d Device) Configure() { - d.bus.WriteRegister(uint8(d.Address), PWR_MGMT_1, []uint8{0}) +func (d Device) Configure() error { + return d.bus.WriteRegister(uint8(d.Address), PWR_MGMT_1, []uint8{0}) } // ReadAcceleration reads the current acceleration from the device and returns