Hi Luke,
There are 9 registers associated with the embedded magnetic threshold function. These are registers 0x52 to 0x5A.
1. Register 0x52 M_THS_CFG: Magnetic threshold function - configuration register
2. Register 0x53 M_THS_SRC: Magnetic threshold function - interrupt source register
3. Registers 0x54 – 0x59 M_THS_XYZ: Magnetic threshold function - threshold limits
4. Register 0x5A M_THS_COUNT: Magnetic threshold function – debounce counter
Here is an example settings considering your requirements:
1. Write CTRL_REG1 = 0x00 // Standby mode to change registers
2. Write M_THS_CFG = 0xE3 // Enable latch, “OR” condition, z-axis, interrupt and route it to INT1 pin
3. Write M_THS_Z_MSB = 0x05 // Set z-axis threshold to 150 uT = 1500 counts = 0x05DC
4. Write M_THS_Z_LSB = 0xDC
5. Write M_THS_COUNT = 0x01 // Set debounce time to e.g. 80 ms at 12.5 Hz (see table 194 for more info)
6. Write M_CTRL_REG1 = 0x1D // Max oversampling to reduce magnetometer noise, only magnetometer active
7. Write CTRL_REG1 = 0x29 // 12.5 Hz ODR, active mode
8. Idle until INT1 is triggered.
9. In your ISR, read the M_THS_SRC register 0x53 to clear the event flags and deassert the INT1 interrupt.
I hope that helps.
Regards,
Tomas