ASCEND Flight Software
Loading...
Searching...
No Matches
LSM9DS1Sensor.h
Go to the documentation of this file.
1#ifndef LSM9DS1SENSOR_H
2#define LSM9DS1SENSOR_H
3
4#include <Adafruit_LSM9DS1.h> // Updated to use the Adafruit library
5#include <Adafruit_Sensor.h>
6#include <string.h>
7
8#include "PayloadConfig.h"
9#include "Sensor.h"
10
15class LSM9DS1Sensor : public Sensor {
16 private:
17 Adafruit_LSM9DS1 lsm; // Using Adafruit_LSM9DS1 instead of SparkFunLSM9DS1
18
19 void setupSensor(); // Function to set up sensor ranges and data rates
20 float accel_offsets[3]; // Offsets for accelerometer calibration
21 float gyro_offsets[3]; // Offsets for gyroscope calibration
22 float mag_offsets[3]; // Offsets for magnetometer calibration
23
24 public:
26 LSM9DS1Sensor(unsigned long minimum_period);
27 bool verify() override;
28 String readData() override;
29 void calibrate(); // calibration function
30 void readDataPacket(uint8_t*& packet) override;
31 String decodeToCSV(uint8_t*& packet) override;
32};
33
34#endif
Central location for pinout and config defines.
int attempt_number
Definition Device.h:19
Implementation of the Sensor class for the LSM9DS1 (9-axis IMU)
Definition LSM9DS1Sensor.h:15
void calibrate()
Calibrates the LSM9DS1 sensor by collecting offset data for gyro and accel.
Definition LSM9DS1Sensor.cpp:95
bool verify() override
Verifies that the LSM is connected and working.
Definition LSM9DS1Sensor.cpp:36
void setupSensor()
Helper function to set up sensor ranges and data rates.
Definition LSM9DS1Sensor.cpp:48
float mag_offsets[3]
Definition LSM9DS1Sensor.h:22
LSM9DS1Sensor()
Construct a new LSM9DS1Sensor object with default minimum_period of 0.
Definition LSM9DS1Sensor.cpp:7
Adafruit_LSM9DS1 lsm
Definition LSM9DS1Sensor.h:17
float accel_offsets[3]
Definition LSM9DS1Sensor.h:20
String decodeToCSV(uint8_t *&packet) override
Decodes the LSM9DS1 sensor data from the packet buffer into a CSV string.
Definition LSM9DS1Sensor.cpp:191
float gyro_offsets[3]
Definition LSM9DS1Sensor.h:21
String readData() override
Retrieves data from LSM 9-axis IMU.
Definition LSM9DS1Sensor.cpp:65
void readDataPacket(uint8_t *&packet) override
Appends the LSM9DS1 sensor data to the packet buffer as raw bytes.
Definition LSM9DS1Sensor.cpp:152
Parent class for sensor objects.
Definition Sensor.h:13
unsigned long minimum_period
Definition Sensor.h:15