Releases: wollewald/ICM20948_WE
Connection issue solved
Added functions to query offsets
I added functions to query acceleration and gyroscope offset and to write these values back:
getAccOffsets()
getGyrOffsets()
setAccOffsets()
setGyrOffsets()
Further changes for the init procedure
Still there are issues when re-powering the ICM20948. Found this for ESP32 boards. If you add a delay of 2000 ms at the beginning of setup. it becomes better. Unfortunately still not perfect. No issues at all with Atmega328P based boards.
More reliable startup after re-power
When re-powered, the initiation sometimes failed. In this case a second attempt will be carried out.
Multiple tries to initiate the magnetometer
It seems that at least one user had issues to initiate the magnetometer. It only worked after few resets of the sketches.
I have implemented that, in case the magnetometer initiation fails, it is tried again up to ten times in total.
CS Pin changed from int16_t to int
Defining the cs pin variable as int16_t gave an error for some boards. Changed to int.
Change to default SPI clock
I noticed that the max SPI clock is 7 MHz according to the data sheet. I adjusted the default to 7 MHz accordingly from 8 MHz which also worked well so far in my tests.
Added a sleep example sketch
I added the example sketch ICM20948_16_sleep.ino to show how to set the ICM20948 and its magnetometer to sleep mode.
Replaced #define by constexpr
Several changes:
- Replaced #define by constexpr
- Replaced private by protected
- Replaced C-cast by static_cast
- Tidied the constructors
Separated xyzFloat definition
If you want to use both an MPU9250 and an ICM20948 in one sketch it won't compile because of the double definition of xyzFloat. I have separated xyzFloat. You can delete xyzFloat.h and xyzFloat.cpp in one of the libraries if you use both.