Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AZimi
New Contributor II
1,117 Views

D2000: BMC150 Library

Hello!

I'm trying to use BMC150 on D2000 dev board. And looked at the library in functionof reading magentometer data:

qm_rc_t bmc150_read_mag(bmc150_mag_t *const mag)

{

...

rc = read_register(magneto_addr, BMC150_REG_MAG_X_LSB, raw_mag,

sizeof(raw_mag));

if (QM_RC_OK != rc) {

return rc;

}

x = EXTRACT_MAG_XY(raw_mag[1], raw_mag[0]);

y = EXTRACT_MAG_XY(raw_mag[3], raw_mag[2]);

z = EXTRACT_MAG_Z(raw_mag[5], raw_mag[4]);

rhall = EXTRACT_RHALL(raw_mag[7], raw_mag[6]);

mag->x = compensate_xy(&digital_comp, rhall, x, AXIS_X);

mag->y = compensate_xy(&digital_comp, rhall, y, AXIS_Y);

mag->z = compensate_z(&digital_comp, rhall, z);

return QM_RC_OK;

}

This function read only BMC150_REG_MAG_X_LSB which content only 5bits LSB data for the X-axis. How it works?

I want to use High-Threshold Interrupt for Z-axis, and then I need to read Z register, but I don't know how...

Thanks.

UPD. Sorry, missed one thing: function read_register can read more than one byte at time. and BMC150_REG_MAG_X_LSB just a start point.

0 Kudos
2 Replies
Pedro_M_Intel
Employee
51 Views

Hello Lockdog,

Could you please let me know where did you get this code? I am trying to find where BMC150_REG_MAG_X_LSB is declared to try and identify its function, nevertheless, I am not able to find it in https://github.com/quark-mcu/qmsi GitHub - quark-mcu/qmsi .

However, if you are using the BMC150, you could try this guide: https://software.intel.com/en-us/articles/d2000-accelerometer IoT - Intel® Quark™ Microcontroller D2000 - Accelerometer Tutorial | Intel® Software . It explains an example which applies this sensor.

Peter.

AZimi
New Contributor II
51 Views

Hello, Peter.

You should go to the ISSM folder, then: \firmware\bsp\1.0\board\drivers\bmc150

I've resolved my issue already, thanks!

Reply