Bugs in reg_check_readable/writable functions
In the functions lsm6dsm_reg_check_writable
and lsm6dsm_reg_check_readable
in "lsm6dsm.c", if (size + start_reg >= lsm6dsm_register_number)
should be if (size + start_reg > lsm6dsm_register_number)
as far as I can tell, given that size is at least 1 (currently does not affect functionality as last register is reserved anyways).
Additionally, in the while loops of the same functions, the same bit is checked for all iterations. Either ++start_reg
could be used or something like if (!(lsm6dsm_writable_regs[(start_reg + size - 1) / 32] & (1 << ((start_reg + size - 1) % 32))))
.
edit: ++start_reg;
in reg_check_writable needed as well, only fixed for reg_check_readable.