You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
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?
The text was updated successfully, but these errors were encountered: