A quick adaptation of a library made for Arduino by Fabio Varesano Interface a Honeywell HMC58X3 magnetometer to a mbed via i2c.
Fork of HMC58X3 by
Diff: HMC58X3.cpp
- Revision:
- 6:02c679492d35
- Parent:
- 4:8eb12adc8368
- Child:
- 7:5279fb447af1
diff -r 8eb12adc8368 -r 02c679492d35 HMC58X3.cpp --- a/HMC58X3.cpp Sat Nov 09 08:51:00 2013 +0000 +++ b/HMC58X3.cpp Wed Mar 07 04:12:45 2018 +0000 @@ -60,7 +60,7 @@ //HMC58X3::HMC58X3(PinName sda, PinName scl): i2c(sda, scl) -HMC58X3::HMC58X3():i2c(I2C_SDA,I2C_SCL),_thread(&HMC58X3::samplingthread_stub, this, osPriorityAboveNormal),sem(0) +HMC58X3::HMC58X3():i2c(I2C_SDA,I2C_SCL),_thread(osPriorityAboveNormal),sem(0) { //this->i2c= i2c_; x_scale=1.0F; @@ -68,6 +68,8 @@ z_scale=1.0F; HMC58X3_R_IDA = 10; + + _thread.start(callback(&HMC58X3::samplingthread_stub, (void *) this)); } void HMC58X3::samplingthread_stub(void const *p) {