Skip to content

Conversation

@ysoldak
Copy link
Contributor

@ysoldak ysoldak commented Oct 17, 2025

This re-uses internal buffer to avoid unnecessary heap allocations in lsm9ds1 driver; switches away from the legacy I2C interface.

Same as #766 but for lsm9ds1 driver.

Copy link
Contributor

@soypat soypat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you Yurii for the heap allocation removals!

Also keep on the lookout for further improvements in future refactors, like fulfilling Sensor interface like Ayke implemented in this PR #798

if err != nil || data[0] != 0x68 {
return false
}
data, err = d.readBytes(d.MagAddress, WHO_AM_I_M, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not required, but this could be rewritten as d.readByte (single byte return)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also heads up: regmap package implements read/write logic related to heapless register mapped peripherals, like this one https://github.com/tinygo-org/drivers/blob/dev/internal/regmap/devices.go

May help out in future modernizations :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants