• It is useful to document the bits,, and perhaps sorting them later by function, interaction, ones that have to be set a particular way to work with the module code. (A todo)

    Magnetometer bits

    TEMP_COMP

    Temperature compensation enable. Default value: 0
    (0: temperature compensation disabled; 1: temperature compensation enabled)
    For the output of the magnetic data compensated by temperature, the
    TEMP_COMP bit in CTRL_REG1_M (20h) must be set to ‘1’.

    OM

    0 = Low-power mode
    1 = Medium-performance mode
    2 = High-performance mode
    3 = Ultra-high performance

    DO

    0 = 0.625 Hz.
    1= 1.25
    2 = 2.5
    3 = 5
    4 = 10
    5 = 20
    6 = 40
    7 = 80

    FAST_ODR

    enables data rates higher than 80 Hz. Default value: 0
    (0: Fast_ODR disabled; 1: FAST_ODR enabled)

    ST

    Self-test enable. Default value: 0
    (0: self-test disabled; 1: self-test enabled)

    FS

    Full scale
    0 = ± 4 gauss
    1 = ± 8 gauss
    2 = ± 12 gauss
    3 = ± 16 gauss

    REBOOT

    Reboot memory content. Default value: 0
    (0: normal mode; 1: reboot memory content)

    SOFT_RST

    Configuration registers and user register reset function.
    (0: default value; 1: reset operation)

    I2C_DISABLE

    Disable I2C interface. Default value 0. (0: I2C enable; 1: I2C disable)

    LP

    Low-power mode configuration. Default value: 0
    If this bit is ‘1’, the DO[2:0] is set to 0.625 Hz and the system performs, for each
    channel, the minimum number of averages. Once the bit is set to ‘0’, the magnetic
    data rate is configured by the DO bits in the CTRL_REG1_M (20h) register.

    SIM

    SPI Serial Interface mode selection. Default value: 0
    (0: SPI only write operations enabled; 1: SPI read and write operations enable).

    MD

    Operating mode selection. Default value: 11
    0 = Continuous-conversion mode
    1 = Single-conversion mode
    2 = Power-down mode
    3 = Power-down mode
    The magnetic sensor has three operating modes available: power-down (default),
    continuous-conversion mode and single-conversion mode. Switching from power-down to
    the other modes requires one write operation to CTRL_REG3_M (22h), setting values in the
    MD[1:0] bits. For the output of the magnetic data compensated by temperature, the
    TEMP_COMP bit in CTRL_REG1_M (20h) must be set to ‘1’.

    OMZ

    Z-axis operative mode selection
    0 = Low-power mode
    1 = Medium-performance mode
    2 = High-performance mode
    3 = Ultra-high performance mode

    BLE

    Big/Little Endian data selection. Default value: 0
    (0: data LSb at lower address; 1: data MSb at lower address)

    FAST_READ

    FAST_READ allows reading the high part of DATA OUT only in order to increase
    reading efficiency. Default value: 0
    (0: FAST_READ disabled; 1: FAST_READ enabled)

    BDU

    Block data update for magnetic data. Default value: 0
    (0: continuous update; 1: output registers not updated until MSB and LSB have
    been read)

    ZYXOR

    X, Y and Z-axis data overrun. Default value: 0
    (0: no overrun has occurred;
    1: a new set of data has overwritten the previous set)

    ZOR

    Z-axis data overrun. Default value: 0
    (0: no overrun has occurred;
    1: new data for the Z-axis has overwritten the previous data)

    YOR

    Y-axis data overrun. Default value: 0
    (0: no overrun has occurred;
    1: new data for the Y-axis has overwritten the previous data)

    XOR

    X-axis data overrun. Default value: 0
    (0: no overrun has occurred;
    1: new data for the X-axis has overwritten the previous data)

    ZYXDA

    X, Y and Z-axis new data available. Default value: 0
    (0: a new set of data is not yet available;
    1: a new set of data is available)

    ZDA

    Z-axis new data available. Default value: 0
    (0: new data for the Z-axis is not yet available;
    1: new data for the Z-axis is available)

    YDA

    Y-axis new data available. Default value: 0
    (0: new data for the Y-axis is not yet available;
    1: new data for the Y-axis is available)

    XDA

    X-axis new data available. Default value: 0
    (0: a new data for the X-axis is not yet available;
    1: a new data for the X-axis is available)

    XIEN

    Enable interrupt generation on X-axis. Default value: 0
    0: disable interrupt request; 1: enable interrupt request

    YIEN

    Enable interrupt generation on Y-axis. Default value: 0
    0: disable interrupt request; 1: enable interrupt request

    ZIEN

    Enable interrupt generation on Z-axis. Default value: 0
    0: disable interrupt request; 1: enable interrupt request

    IEA

    Interrupt active configuration on INT_MAG. Default value: 0
    0: low; 1: high

    IEL

    Latch interrupt request. Default value: 0
    0: interrupt request latched; 1: interrupt request not latched)
    Once latched, the INT_M pin remains in the same state until INT_SRC_M (31h)) is
    read.

    IEN

    Interrupt enable on the INT_M pin. Default value: 0
    0: disable; 1: enable

    PTH_X

    Value on X-axis exceeds the threshold on the positive side.
    Default value: 0

    PTH_Y

    Value on Y-axis exceeds the threshold on the positive side.
    Default value: 0

    PTH_Z

    Value on Z-axis exceeds the threshold on the positive side.
    Default value: 0

    NTH_X

    Value on X-axis exceeds the threshold on the negative side.
    Default value: 0

    NTH_Y

    Value on Y-axis exceeds the threshold on the negative side.
    Default value: 0

    NTH_Z

    Value on Z-axis exceeds the threshold on the negative side.
    Default value: 0

    MROI

    Internal measurement range overflow on magnetic value.
    Default value: 0

    INT

    This bit signals when the interrupt event occurs.

About