-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
I'm writing a MicroPython driver for your board. In my testing it is only possible to change the device mode if you first change the mode to _CONFIG_MODE. Unfortunately I don't have any hardware capable of running CircuitPython but I think the following test will fail:
import adafruit_bno055
from busio import I2C
from board import SDA, SCL
i2c = I2C(SCL, SDA)
imu = adafruit_bno055.BNO055(i2c)
print(imu.euler) # Check it's working
imu.mode = 5
print(imu.mode) # I think this will be unchangedThe need to set _CONFIG_MODE prior to setting any other mode is contradicted in the chip datasheet (section 3.3.1). Consequently before I submit a PR I would be grateful if someone could perform the above test to confirm my findings.
For reference this is my mode setting code. This includes delays mandated by the device datasheet.
def mode(self, new_mode=None):
old_mode = self._read(_MODE_REGISTER)
if new_mode is not None:
self._write(_MODE_REGISTER, _CONFIG_MODE) # This is empirically necessary if the mode is to be changed
time.sleep_ms(20) # Datasheet table 3.6
if new_mode != _CONFIG_MODE:
self._write(_MODE_REGISTER, new_mode)
time.sleep_ms(10) # Table 3.6
return old_modeMetadata
Metadata
Assignees
Labels
No labels