modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
720 stars 128 forks source link

LIS3MDL SPI driver: address reading is not advanced #1176

Open ser-plu opened 4 weeks ago

ser-plu commented 4 weeks ago

When using LIS3MDL with Lis3TransportSpi, the data addressing does not automatically increment. Therefore one value is read to all registers.

To fix this, this line needs to be corrected: https://github.com/modm-io/modm/blob/7a8c57dd587de1348255425e8f863f1339f5a765/src/modm/driver/inertial/lis3_transport_impl.hpp#L106 to

RF_CALL(SpiMaster::transfer(reg | Read | AddressIncrement ));

However, this should be applied not to all sensors. I have checked another LIS3 sensor, and it does not have the autoincrement bit.