This repository has been archived by the owner on Aug 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Adafruit_9DOF.h
55 lines (48 loc) · 1.55 KB
/
Adafruit_9DOF.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*!
* @file Adafruit_9DOF.h
* This is a library for the Adafruit 9DOF Breakout
*
* Designed specifically to work with the Adafruit 9DOF Breakout:
* http://www.adafruit.com/products/1714
* These displays use I2C to communicate, 2 pins are required to interface.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit andopen-source hardware by purchasing products
* from Adafruit!
*
* Written by Kevin Townsend for Adafruit Industries.
* BSD license, all text above must be included in any redistribution
*/
#ifndef __ADAFRUIT_9DOF_H__
#define __ADAFRUIT_9DOF_H__
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Adafruit_L3GD20_U.h>
#include <Adafruit_LSM303_U.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
/** Sensor axis */
typedef enum {
SENSOR_AXIS_X = (1),
SENSOR_AXIS_Y = (2),
SENSOR_AXIS_Z = (3)
} sensors_axis_t;
/** Driver for the the 9DOF breakout sensors */
class Adafruit_9DOF {
public:
Adafruit_9DOF(void);
bool begin(void);
bool accelGetOrientation(sensors_event_t *event, sensors_vec_t *orientation);
bool magTiltCompensation(sensors_axis_t axis, sensors_event_t *mag_event,
sensors_event_t *accel_event);
bool magGetOrientation(sensors_axis_t axis, sensors_event_t *event,
sensors_vec_t *mag_orientation);
bool fusionGetOrientation(sensors_event_t *accel_event,
sensors_event_t *mag_event,
sensors_vec_t *orientation);
private:
};
#endif