adafruit / Adafruit_CircuitPython_LSM6DS

CircuitPython helper library for the LSM6DS family of motion sensors from ST
MIT License
25 stars 21 forks source link

Access to built in temperature sensor [enhancement] #25

Closed walchko closed 3 years ago

walchko commented 4 years ago

Curious if I am missing it, but I don't think you have enabled access to the on-board temperature sensor. This is available in the Arduino version and you have the correct address in __init__.py. Could you add this as a property?

BTW: How does this work? In LSM6DS, I can see where you create self.i2c_device(i2c_bus, address) and I assume you read from that, but you never call a read function in the code??? I was going to just add it myself, but was confused by what you were doing.

siddacious commented 4 years ago

@walchko thanks for pointing this out, temperature does indeed appear to be absent! We should add it and a PR would help speed that along ;)

The self.i2c_device is used by the Struct, RWBits and other data descriptors that come from the Adafruit_CircuitPython_Register library. To add temperature you'd add another Struct alongside the _raw_accel_data and raw_gyro_data Structs that points to the correct address and has a format string appropriate for the data type.

You would then add a temperature property that reads the raw value and applies whatever scaling / offsetting is called for

I'm happy to help answer questions or give more pointers if you're interested in helping

jposada202020 commented 3 years ago

solved by #41