LSM9DS1 IMU sensor driver i2c

Dependents:   read_Pmod optWingforHAPS_Eigen hexaTest_Eigen

Files at this revision

API Documentation at this revision

Comitter:
NaotoMorita
Date:
Thu Sep 01 14:04:52 2022 +0000
Parent:
4:ac533087fb16
Commit message:
os6

Changed in this revision

LSM9DS1.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ac533087fb16 -r f44765a174ab LSM9DS1.cpp
--- a/LSM9DS1.cpp	Thu Oct 28 09:44:23 2021 +0000
+++ b/LSM9DS1.cpp	Thu Sep 01 14:04:52 2022 +0000
@@ -68,7 +68,7 @@
 {
     char cmd[4] = {
         CTRL_REG1_G,
-        gScale | G_ODR_119_BW_14,
+        (char)(gScale | G_ODR_119_BW_14),
         0,          // Default data out and int out
         0           // Default power mode and high pass settings
     };
@@ -82,7 +82,7 @@
     char cmd[4] = {
         CTRL_REG5_XL,
         0x38,       // Enable all axis and don't decimate data in out Registers
-        (A_ODR_119 << 5) | (aScale << 3) | (A_BW_AUTO_SCALE),   // 119 Hz ODR, set scale, and auto BW
+        (char)((A_ODR_119 << 5) | (aScale << 3) | (A_BW_AUTO_SCALE)),   // 119 Hz ODR, set scale, and auto BW
         0           // Default resolution mode and filtering settings
     };
 
@@ -95,7 +95,7 @@
     char cmd[4] = {
         CTRL_REG1_M,
         0x10,       // Default data rate, xy axes mode, and temp comp
-        mScale << 5, // Set mag scale
+        (char)(mScale << 5), // Set mag scale
         0           // Enable I2C, write only SPI, not LP mode, Continuous conversion mode
     };