adafruit / Adafruit_LIS3MDL

Adafruit library for LIS3MDL magnetometer
Other
11 stars 8 forks source link

WHO_AM_I return code #9

Closed ShuffleWire closed 1 year ago

ShuffleWire commented 1 year ago

Hello !

I'm not sure where to ask it, so here I go :)

I'm playing with the LIS3MDL, and for experiment and learning purpose, rewriting the i2c communication. (I've used this library initially, and checked that the chip work ok, and it did :) )

I've just successfully sent WHO_AM_I, and got the expected answer 0x40 (0b01000000), as found in the datasheet. But, as reading your code here : https://github.com/adafruit/Adafruit_LIS3MDL/blob/00d0ce39b238bab703000d7fdda47d8bc3e512dd/Adafruit_LIS3MDL.cpp#L117 you seems to check against 0x3D. Why is that, and why is it working ? :/ I'm not very skilled in i2c, so I might not understand something !

Thank for your reply, it will be for sure very informative

caternuson commented 1 year ago

0x3D = 0b00111101 which is the expected value from the datasheet: image

ShuffleWire commented 1 year ago

Oh ! I got the LIS2MDL ! Sorry for the inconvenience !