New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LIS3DH sensor #1954
Add LIS3DH sensor #1954
Conversation
// Note: While we theoretically should divide by 16 here, | ||
// according to my measurements the actual divisor is around 24: | ||
// When 24 is used measurements match other scales and 1G is closer to 1G rather than 0.64G. | ||
// I was not able to find section in datasheet explaining why this is 24 (exactly 50% more). | ||
AccelerationScale.Scale16G => Max / 24, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v-beer for anyone who can find something about this in the spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good all up, few comments
/// <inheritdoc/> | ||
public override void Dispose() | ||
{ | ||
_i2c?.Dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not supposed to dispose I2cDevice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we do that in other bindings? I've copy & pasted the template for this binding including this specific line of code. I2cDevice is not much reusable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iot/src/devices/Lps25h/Lps25h.cs
Line 113 in 78a7365
_i2c?.Dispose(); |
iot/src/devices/Mpu6886/Mpu6886.cs
Line 184 in 78a7365
_i2c?.Dispose(); |
iot/src/devices/Mfrc522/Mfrc522.cs
Line 839 in 68e50c9
_i2CDevice.Dispose(); |
iot/src/devices/Adxl357/Adxl357.cs
Line 187 in e0dbd64
_i2CDevice.Dispose(); |
4 random I2C devices I opened
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, we should not because we don't create those!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe intent is that you do - the device takes ownership of that object since it's useless without the device binding - it's bound to a specific address (as oposed to I2cBus i.e.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still. And we have to then make things clear about this.
Add binding for LIS3DH accelerometer.
Microsoft Reviewers: Open in CodeFlow