diff --git a/README.rst b/README.rst index 3d416f6..f5ac48f 100644 --- a/README.rst +++ b/README.rst @@ -69,7 +69,7 @@ Usage Example while True: print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sox.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(sox.gyro)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s"%(sox.gyro)) print("") time.sleep(0.5) diff --git a/adafruit_lsm6ds.py b/adafruit_lsm6ds.py index 436e670..3671121 100644 --- a/adafruit_lsm6ds.py +++ b/adafruit_lsm6ds.py @@ -49,6 +49,7 @@ __version__ = "0.0.0-auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LSM6DSOX.git" from time import sleep +from math import radians from micropython import const import adafruit_bus_device.i2c_device as i2c_device from adafruit_register.i2c_struct import ROUnaryStruct, Struct @@ -293,12 +294,9 @@ def acceleration(self): @property def gyro(self): - """The x, y, z angular velocity values returned in a 3-tuple and are in degrees / second""" + """The x, y, z angular velocity values returned in a 3-tuple and are in radians / second""" raw_gyro_data = self._raw_gyro_data - x = self._scale_gyro_data(raw_gyro_data[0]) - y = self._scale_gyro_data(raw_gyro_data[1]) - z = self._scale_gyro_data(raw_gyro_data[2]) - + x, y, z = [radians(self._scale_gyro_data(i)) for i in raw_gyro_data] return (x, y, z) def _scale_xl_data(self, raw_measurement): diff --git a/examples/lsm6ds_full_test.py b/examples/lsm6ds_full_test.py index d455f2e..2c89ad0 100644 --- a/examples/lsm6ds_full_test.py +++ b/examples/lsm6ds_full_test.py @@ -28,7 +28,7 @@ while True: print( - "Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s" + "Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f radians/s" % (sensor.acceleration + sensor.gyro) ) time.sleep(0.05) diff --git a/examples/lsm6ds_ism330dhct_simpletest.py b/examples/lsm6ds_ism330dhct_simpletest.py index e6a99ec..a5fca83 100644 --- a/examples/lsm6ds_ism330dhct_simpletest.py +++ b/examples/lsm6ds_ism330dhct_simpletest.py @@ -9,6 +9,6 @@ while True: print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro)) print("") time.sleep(0.5) diff --git a/examples/lsm6ds_lsm6ds33_simpletest.py b/examples/lsm6ds_lsm6ds33_simpletest.py index ccb3e35..c4b4fed 100644 --- a/examples/lsm6ds_lsm6ds33_simpletest.py +++ b/examples/lsm6ds_lsm6ds33_simpletest.py @@ -9,6 +9,6 @@ while True: print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro)) print("") time.sleep(0.5) diff --git a/examples/lsm6ds_lsm6dsox_simpletest.py b/examples/lsm6ds_lsm6dsox_simpletest.py index b2355d5..961a679 100644 --- a/examples/lsm6ds_lsm6dsox_simpletest.py +++ b/examples/lsm6ds_lsm6dsox_simpletest.py @@ -9,6 +9,6 @@ while True: print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro)) print("") time.sleep(0.5) diff --git a/register_map.json b/register_map.json deleted file mode 100644 index 2d67414..0000000 --- a/register_map.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "sensor_name": "LSM6DS0X", - "default_address": 106, - "registers": { - "FUNC_CFG_ACCESS" : { - "address" : "01h", - "fields" :[ - "FUNC_CFG_ACCESS", - "SHUB_REG_ACCESS", - null, - null, - null, - null, - null, - "OIS_CTRL_FROM_UI" - ] - }, - "PIN_CTRL": { - "address" : "02h", - "fields" : ["OIS_PU_DIS","SDO_PU_EN", null, null, null, null, null, null] - }, - "UI_INT_OIS": { - "address": "6Fh", - "fields" : ["INT2_DRDY_OIS", "LVL2_OIS", "DEN_LH_OIS", null, "SPI2_READ_EN", null, null, null] - }, - "WHOAMI": { - "address": "0Fh", - "length" : 1, - "format_str" : ">b", - "human_name" : "chip_id" - }, - "CTRL1_XL": { - "address" : "10h", - "fields" :["ODR_XL3", "ODR_XL2", "ODR_XL1", "ODR_XL0", "FS1_XL", "FS0_XL", "LPF2_XL_EN", null] - }, - "CTRL2_G": { - "address" : "11h", - "fields" :["ODR_G3", "ODR_G2", "ODR_G1", "ODR_G0", "FS1_G", "FS0_G", "FS_125", null], - "cvs" : { - "ODR": [ - ["250 DPS", 0], - ["500 DPS", 1], - ["1000 DPS", 2], - ["2000 DPS", 3] - ] - - } - }, - "CTRL3_C": { - "address" : "12h", - "fields":["BOOT", "BDU", "H_LACTIVE", "PP_OD", "SIM", "IF_INC", null, "SW_RESET"] - }, - "CTRL_5_C" : { - "address" : "14h", - "fields" : [ - - "XL_ULP_EN", - "ROUNDING1", - "ROUNDING0", - "ROUNDING_STATUS", - "ST1_G", - "ST0_G", - "ST1_XL", - "ST0_XL" - - ] - }, - "MASTER_CONFIG": { - "address" : "14h", - "fields" : [ - "RST_MASTER_REGS", - "WRITE_ONCE", - "START_CONFIG", - "PASS_THROUGH_MODE", - "SHUB_PU_EN", - "MASTER_ON", - "AUX_SENS_ON1", - "AUX_SENS_ON0" - ] - }, - "CTRL9_XL" : { - "address" : "18h", - "fields" : [ - "DEN_X", - "DEN_Y", - "DEN_Z", - "DEN_XL_G", - "DEN_XL_EN", - "DEN_LH", - "I3C_DISABLE", - null - ] - }, - "OUT_TEMP_L": { - "address": "20h", - "format_str" : "