Skip to content

Commit 69b238e

Browse files
committed
stm32/accel: Fix Accel.read() method so it does read a byte.
This bug was introduced in a0f7b4c
1 parent 925f244 commit 69b238e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ports/stm32/accel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_filtered_xyz_obj, pyb_accel_filtered_
255255
STATIC mp_obj_t pyb_accel_read(mp_obj_t self_in, mp_obj_t reg) {
256256
uint8_t data[1] = { mp_obj_get_int(reg) };
257257
i2c_writeto(I2C1, ACCEL_ADDR, data, 1, false);
258-
i2c_writeto(I2C1, ACCEL_ADDR, data, 1, true);
258+
i2c_readfrom(I2C1, ACCEL_ADDR, data, 1, true);
259259
return mp_obj_new_int(data[0]);
260260
}
261261
MP_DEFINE_CONST_FUN_OBJ_2(pyb_accel_read_obj, pyb_accel_read);

0 commit comments

Comments
 (0)