The current version lib (latest commit version) does not implement the accelerometer user offset correction block feature, that can be enabled by setting the USR_OFF_ON_OUT bit of the CTRL7_C register and is mandatory in order to be able to apply offset correction.
this pull request implements the following:
From Application note (AN5444) IIS3DWB: ultrawide bandwidth, low-noise, 3-axis digital vibration sensor:
"The device provides accelerometer offset registers (X_OFS_USR, Y_OFS_USR, Z_OFS_USR) which can be
used for zero-g offset correction or, in general, to apply an offset to the accelerometer output data.
The accelerometer offset block can be enabled by setting the USR_OFF_ON_OUT bit of the CTRL7_C register. The offset value set in the offset registers is internally subtracted from the measured acceleration value for the respective axis; internally processed data are then sent to the accelerometer output register and to the FIFO (if enabled). These register values are expressed as an 8-bit word in two’s complement and must be in the range [-127, 127].
The weight [g/LSB] to be applied to the offset register values is independent of the accelerometer selected full scale and can be configured using the USR_OFF_W bit of the CTRL6_C register:
• 2-10 g/LSB if the USR_OFF_W bit is set to 0.
• 2-6 g/LSB if the USR_OFF_W bit is set to 1."
in "iis3dwb_reg.c" file:
func "iis3dwb_usr_offset_block_set":
Enables the accelerometer user offset correction block, can be enabled
by setting the USR_OFF_ON_OUT bit of the CTRL7_C register.[set]
func "iis3dwb_usr_offset_block_get":
Get Status of the accelerometer user offset correction block, can be done
by getting the USR_OFF_ON_OUT bit of the CTRL7_C register.[get]
in "iis3dwb_reg.h" file:
IIS3DWB_CTRL7 register map and definitions
The current version lib (latest commit version) does not implement the accelerometer user offset correction block feature, that can be enabled by setting the USR_OFF_ON_OUT bit of the CTRL7_C register and is mandatory in order to be able to apply offset correction.
this pull request implements the following:
From Application note (AN5444) IIS3DWB: ultrawide bandwidth, low-noise, 3-axis digital vibration sensor: "The device provides accelerometer offset registers (X_OFS_USR, Y_OFS_USR, Z_OFS_USR) which can be used for zero-g offset correction or, in general, to apply an offset to the accelerometer output data. The accelerometer offset block can be enabled by setting the USR_OFF_ON_OUT bit of the CTRL7_C register. The offset value set in the offset registers is internally subtracted from the measured acceleration value for the respective axis; internally processed data are then sent to the accelerometer output register and to the FIFO (if enabled). These register values are expressed as an 8-bit word in two’s complement and must be in the range [-127, 127]. The weight [g/LSB] to be applied to the offset register values is independent of the accelerometer selected full scale and can be configured using the USR_OFF_W bit of the CTRL6_C register: • 2-10 g/LSB if the USR_OFF_W bit is set to 0. • 2-6 g/LSB if the USR_OFF_W bit is set to 1."
in "iis3dwb_reg.c" file: func "iis3dwb_usr_offset_block_set": Enables the accelerometer user offset correction block, can be enabled by setting the USR_OFF_ON_OUT bit of the CTRL7_C register.[set]
func "iis3dwb_usr_offset_block_get": Get Status of the accelerometer user offset correction block, can be done by getting the USR_OFF_ON_OUT bit of the CTRL7_C register.[get]
in "iis3dwb_reg.h" file: IIS3DWB_CTRL7 register map and definitions