Created
March 22, 2023 07:24
-
-
Save reefwing/74bb9a288314b721034810328e6e6656 to your computer and use it in GitHub Desktop.
LSM9DS1 Who Am I register check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint8_t ReefwingLSM9DS1::whoAmIGyro() { | |
// Read WHO_AM_I register for LSM9DS1 accel/gyro | |
return readByte(LSM9DS1AG_ADDRESS, LSM9DS1AG_WHO_AM_I); | |
} | |
uint8_t ReefwingLSM9DS1::whoAmIMag() { | |
// Read WHO_AM_I register for LSM9DS1 magnetometer | |
return readByte(LSM9DS1M_ADDRESS, LSM9DS1M_WHO_AM_I); | |
} | |
bool ReefwingLSM9DS1::connected() { | |
return (whoAmIGyro() == LSM9DS1AG_WHO_AM_I_VALUE && | |
whoAmIMag() == LSM9DS1M_WHO_AM_I_VALUE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment