jessebraham / icm42670

An embedded-hal driver for the ICM-42670 6-axis IMU
Apache License 2.0
7 stars 9 forks source link

Bitfield work #11

Closed Ben-PH closed 7 months ago

Ben-PH commented 7 months ago

This adds a couple of bit-fields to read/write, as well as streamlining the use of read/write methods by means of coupling a bit-field to its register address and offset using associated consts/types.

Bitfields added, and chapter in datasheet: https://invensense.tdk.com/wp-content/uploads/2021/07/ds-000451_icm-42670-p-datasheet.pdf

Register read/write structure

instead of having to manually choose which &dyn Register to provide when calling a bit-field read/write, the Bitfield trait must now define which Register it's associated with, and which Register implementing value it's associated with. The read/write methods take these definitions required by Bitfield implementation to determine the metadata needed to read/write the correct register.