Skip to content

Feature Request: Implement Axis Remap in CircuitPython version #73

@ViennaMike

Description

@ViennaMike

The pre-CircuitPython version allowed one to read and write to the Axis Remap registers (see Section 3.4 of the datasheet). This seems very useful as the orientation of the board may vary depending upon usage.

I have a need for this in my current project and I'm willing to implement it, but I don't really understand the I2C read and write functions in the code and why they differ from the UART ones (which I do mostly understand). I've got the read working for UART by adding register constants up top in the code and adding this in the UART class:
'''
@Property
def axis_remap(self):
# Get the axis remap register value.
map_config = self._read_register(_AXIS_MAP_CONFIG_REGISTER)
z = (map_config >> 4) & 0x03
y = (map_config >> 2) & 0x03
x = map_config & 0x03
# Get the axis remap sign register value.
sign_config = self._read_register(_AXIS_MAP_SIGN_REGISTER)
x_sign = (sign_config >> 2) & 0x01
y_sign = (sign_config >> 1) & 0x01
z_sign = sign_config & 0x01
# Return the results as a tuple of all 3 values.
return (x, y, z, x_sign, y_sign, z_sign)
'''
Update on Saturday 4/3: I've got the setter function now working as well and have tested it with both the I2C and UART interface. I can probably put in a pull request next week. Anything I need to know about doing that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions