-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AV-1055] MIDAS Gyro / Backup LowG (#14)
* implemented backup low g sensor * renamed backuplowg to gyroscope * changed thread sleep from 16 to 10 * "balls" - rbhog * "sad emoji" - eisha
- Loading branch information
Showing
7 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
|
||
enum ErrorCode { | ||
NoError, | ||
LowGCouldNotBeInitialized | ||
LowGCouldNotBeInitialized, | ||
GyroCouldNotBeInitialized | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "sensors.h" | ||
|
||
// #include sensor library | ||
#include <SparkFunLSM6DS3.h> | ||
// global static instance of the sensor | ||
LSM6DS3 LSM; | ||
|
||
ErrorCode Gyroscope::init() { | ||
// do whatever steps to initialize the sensor | ||
// if it errors, return the relevant error code | ||
if (!LSM.begin()) { | ||
return ErrorCode::GyroCouldNotBeInitialized; | ||
} | ||
return ErrorCode::NoError; | ||
} | ||
|
||
GyroscopeData Gyroscope::read() { | ||
// read from aforementioned global instance of sensor | ||
GyroscopeData result; | ||
result.gx = LSM.readFloatGyroX(); | ||
result.gy = LSM.readFloatGyroY(), | ||
result.gz = LSM.readFloatGyroZ(); | ||
return result; | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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