/****************************************************************************/
/* Copyright 2012-2018 MBARI												*/
/****************************************************************************/
/* Summary	: Definitions for IMU on BEDS2 on PIC32MX470					*/
/* Filename : imu.h															*/
/* Author	: Robert Herlien (rah)											*/
/* Project	: BEDS2 (Benthic Event Detection System)						*/	
/* Revision : 1.0															*/
/* Created	: 10/15/2012													*/
/*																			*/
/* MBARI provides this documentation and code "as is", with no warranty,	*/
/* express or implied, of its quality or consistency. It is provided without*/
/* support and without obligation on the part of the Monterey Bay Aquarium	*/
/* Research Institute to assist in its use, correction, modification, or	*/
/* enhancement. This information should not be published or distributed to	*/
/* third parties without specific written permission from MBARI.			*/
/*																			*/
/****************************************************************************/
/* Modification History:													*/
/* 15oct2012 rah - created dmpSetup.h										*/
/* 23feb2018 rah - ported to imu.h for BEDS2 on PIC32MX470					*/
/****************************************************************************/

#ifndef INCimuh
#define INCimuh			1

// FIFO is 1024 bytes.	Packet size is 42 bytes.  So FIFO can hold 24 packets.
// Use 2/3 that amount, leaving 1/3 free for overruns

#define FIFO_DEPTH		16
#define IMU_RCD_SIZE	42

typedef enum {IMU_NO_MOTION=0, IMU_MOTION} ImuMotionState;


/****************************************/
/* Function Declarations				*/
/****************************************/

Errno	imuInit(void);
Errno	imuSetup(Int32 rate);
int		imuReadFifo(void);
Errno	imuGetAccel(Nat32 *accel, Nat32 axes);
Errno	imuGetQuat(Nat32 *quat, Nat32 axes);
ImuMotionState imuGetMotionState(void);
Nat32	imuLoopDelay(Int32 fifoRate);

#endif	/* INCdmpSetuph */
