The low threshold example uses a 0x0A value, which corresponds to 10 in decimal, so 10*6 = 60 uT is the low threshold limit the example have set, but it doesn't specify whether it's a positive or a negative limit, or for which axis the limit is.
/*! low threshold limit */
/*! high threshold limit */
Also, both low and high threshold limit are uint8_t, so I would like to know if it's possible to use a negative limit in order to get a interrupt, since both the raw and compensated micro tesla values of the magnetometer are sometimes negative.
Solved! Go to Solution.
I've attached the STM32 project with the high threshold example. I made that it reads only when there is an interrupt.
As you can see in the GIF that I have attached as well, the interrupt happens all the time, the status never seems to change even if I move all the axes to check where the interrupt is, since in the example it does not specify which axis is used. The limit is set to 0x12.
Sorry for the delay reply.
Your code will do self test every time when it is powered on. Can you change it to the following code logic and test it again?
rslt = bmm150_interface_selection(&bmm150dev);
rslt = init_bmm150(&bmm150dev);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
rslt = bmm150_get_interrupt_status(&bmm150dev);
if (bmm150dev.int_status & BMM150_INT_ASSERTED_HIGH_THRES)
rslt = bmm150_read_mag_data(&mag_data, &bmm150dev);
compass = atan2(mag_data.y, mag_data.x) * 180 / M_PI;