/************************************************************************** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file Accel.h * * @author (last) Dara Navaei * @date (last) 24-Aug-2020 * * @author (original) Sean Nash * @date (original) 29-Jul-2020 * ***************************************************************************/ #ifndef __ACCEL_H__ #define __ACCEL_H__ #include "Common.h" /** * @defgroup Accel Accel * @brief Accelerometer monitor module. Monitors the accelerometer sensor (Analog Devices ADXL345). * * @addtogroup Accel * @{ */ // ********** public definitions ********** /// Enumeration of accelerometer axes. typedef enum Accelerometer_Axes { ACCEL_AXIS_X = 0, ///< X axis of accelerometer ACCEL_AXIS_Y, ///< Y axis of accelerometer ACCEL_AXIS_Z, ///< Z axis of accelerometer NUM_OF_ACCEL_AXES ///< Number of accelerometer axes } ACCEL_AXIS_T; /// Record structure for broadcast accelerometer data. typedef struct { F32 x; ///< X axis reading (in g) F32 y; ///< Y axis reading (in g) F32 z; ///< Z axis reading (in g) F32 xMax; ///< X axis max reading (in g) F32 yMax; ///< Y axis max reading (in g) F32 zMax; ///< Z axis max reading - 1.0 (in g) F32 xTilt; ///< X axis tilt (in degrees) F32 yTilt; ///< Y axis tilt (in degrees) F32 zTilt; ///< Z axis tilt (in degrees) } ACCEL_DATA_PAYLOAD_T; /// Payload record structure for an accelerometer calibration message. typedef struct { F32 xOffset; F32 yOffset; F32 zOffset; } ACCEL_CAL_PAYLOAD_T; // ********** public function prototypes ********** void initAccel( void ); void execAccel( void ); F32 getMeasuredAccelAxis( U32 axis ); F32 getMaxAccelAxis( U32 axis ); SELF_TEST_STATUS_T execAccelTest( void ); BOOL setAccelCalibration( F32 offsetX, F32 offsetY, F32 offsetZ ); void getAccelCalibration( F32 *offsetX, F32 *offsetY, F32 *offsetZ ); BOOL testSetAccelDataPublishIntervalOverride( U32 value ); BOOL testResetAccelDataPublishIntervalOverride( void ); BOOL testSetAccelAxisOverride( U32 axis, F32 value ); BOOL testResetAccelAxisOverride( U32 axis ); BOOL testSetAccelMaxOverride( U32 axis, F32 value ); BOOL testResetAccelMaxOverride( U32 axis ); /**@}*/ #endif