Skip to content

Feature Request: Implement Axis Remap in CircuitPython version #73

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

Closed
ViennaMike opened this issue Mar 31, 2021 · 1 comment
Closed

Comments

@ViennaMike
Copy link
Contributor

ViennaMike commented Mar 31, 2021

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?

@ViennaMike
Copy link
Contributor Author

Capability added by #78

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

No branches or pull requests

1 participant