Fix read bytes returning bytearray consistently.
This commit is contained in:
parent
a01cdc7e7e
commit
9898cda623
3 changed files with 9 additions and 7 deletions
|
|
@ -317,7 +317,7 @@ class BNO055(object):
|
|||
# Read a number of unsigned byte values starting from the provided address.
|
||||
if self._i2c_device is not None:
|
||||
# I2C read.
|
||||
return self._i2c_device.readList(address, length)
|
||||
return bytearray(self._i2c_device.readList(address, length))
|
||||
else:
|
||||
# Build and send serial register read command.
|
||||
command = bytearray(4)
|
||||
|
|
@ -531,8 +531,10 @@ class BNO055(object):
|
|||
"""
|
||||
# Switch to configuration mode, as mentioned in section 3.10.4 of datasheet.
|
||||
self._config_mode()
|
||||
# Read the 22 bytes of calibration data.
|
||||
cal_data = self._read_bytes(ACCEL_OFFSET_X_LSB_ADDR, 22)
|
||||
# Read the 22 bytes of calibration data and convert it to a list (from
|
||||
# a bytearray) so it's more easily serialized should the caller want to
|
||||
# store it.
|
||||
cal_data = list(self._read_bytes(ACCEL_OFFSET_X_LSB_ADDR, 22))
|
||||
# Go back to normal operation mode.
|
||||
self._operation_mode()
|
||||
return cal_data
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ from Adafruit_BNO055 import BNO055
|
|||
# Create and configure the BNO sensor connection. Make sure only ONE of the
|
||||
# below 'bno = ...' lines is uncommented:
|
||||
# Raspberry Pi configuration with serial UART and RST connected to GPIO 18:
|
||||
#bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
|
||||
bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
|
||||
# BeagleBone Black configuration with default I2C connection (SCL=P9_19, SDA=P9_20),
|
||||
# and RST connected to pin P9_12:
|
||||
bno = BNO055.BNO055(rst='P9_12')
|
||||
#bno = BNO055.BNO055(rst='P9_12')
|
||||
|
||||
|
||||
# Enable verbose debug logging if -v is passed as a parameter.
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ from Adafruit_BNO055 import BNO055
|
|||
# Create and configure the BNO sensor connection. Make sure only ONE of the
|
||||
# below 'bno = ...' lines is uncommented:
|
||||
# Raspberry Pi configuration with serial UART and RST connected to GPIO 18:
|
||||
#bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
|
||||
bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
|
||||
# BeagleBone Black configuration with default I2C connection (SCL=P9_19, SDA=P9_20),
|
||||
# and RST connected to pin P9_12:
|
||||
bno = BNO055.BNO055(rst='P9_12')
|
||||
#bno = BNO055.BNO055(rst='P9_12')
|
||||
|
||||
# Application configuration below. You probably don't need to change these values.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue