stm32/accel: Fix Accel.read() method so it does read a byte.

This bug was introduced in a0f7b4c678
This commit is contained in:
Damien George 2019-10-18 11:53:34 +11:00
parent 925f244ab3
commit 69b238ec63

View File

@ -255,7 +255,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_filtered_xyz_obj, pyb_accel_filtered_
STATIC mp_obj_t pyb_accel_read(mp_obj_t self_in, mp_obj_t reg) {
uint8_t data[1] = { mp_obj_get_int(reg) };
i2c_writeto(I2C1, ACCEL_ADDR, data, 1, false);
i2c_writeto(I2C1, ACCEL_ADDR, data, 1, true);
i2c_readfrom(I2C1, ACCEL_ADDR, data, 1, true);
return mp_obj_new_int(data[0]);
}
MP_DEFINE_CONST_FUN_OBJ_2(pyb_accel_read_obj, pyb_accel_read);