Skip to content

Add i2c_struct class for arbitrary structure register. #1

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

Merged
merged 1 commit into from
Jan 3, 2017
Merged

Conversation

tdicola
Copy link
Contributor

@tdicola tdicola commented Jan 3, 2017

No description provided.

with obj.i2c_device:
obj.i2c_device.writeto(self.buffer, end=1, stop=False)
obj.i2c_device.readfrom_into(self.buffer, start=1)
return ustruct.unpack_from(self.format, memoryview(self.buffer)[1:])
Copy link
Member

Choose a reason for hiding this comment

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

If this gets used a lot we may want to tweak ustruct to take start and end itself so that we don't need the heap to do this.

@tannewt tannewt merged commit ed32e2a into master Jan 3, 2017
@evaherrada evaherrada deleted the struct branch June 21, 2021 14:01
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