android13/hardware/rockchip/sensor/mpu_vr/akm8963/AK8963Driver.h

112 lines
3.2 KiB
C
Executable File

/******************************************************************************
*
* $Id: AK8963Driver.h 303 2011-08-12 04:22:45Z kihara.gb $
*
* -- Copyright Notice --
*
* Copyright (c) 2004 Asahi Kasei Microdevices Corporation, Japan
* All Rights Reserved.
*
* This software program is proprietary program of Asahi Kasei Microdevices
* Corporation("AKM") licensed to authorized Licensee under Software License
* Agreement (SLA) executed between the Licensee and AKM.
*
* Use of the software by unauthorized third party, or use of the software
* beyond the scope of the SLA is strictly prohibited.
*
* -- End Asahi Kasei Microdevices Copyright Notice --
*
******************************************************************************/
#ifndef AKMD_INC_AK8963DRIVER_H
#define AKMD_INC_AK8963DRIVER_H
//#include <linux/akm8963.h> /* Device driver */
#include "akm8963.h" /* Device driver */
#include <stdint.h> /* int8_t, int16_t etc. */
/*** Constant definition ******************************************************/
#define AKD_TRUE 1 /*!< Represents true */
#define AKD_FALSE 0 /*!< Represents false */
#define AKD_SUCCESS 1 /*!< Represents success.*/
#define AKD_FAIL 0 /*!< Represents fail. */
#define AKD_ERROR -1 /*!< Represents error. */
/*! 0:Don't Output data, 1:Output data */
#define AKD_DBG_DATA 0
/*! Typical interval in ns */
#define AK8963_MEASUREMENT_TIME_NS ((AK8963_MEASUREMENT_TIME_US) * 1000)
/*! 720 LSG = 1G = 9.8 m/s2 */
#define LSG 720
/*** Type declaration *********************************************************/
typedef unsigned char BYTE;
/*!
Open device driver.
This function opens device driver of acceleration sensor.
@return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
the return value is #AKD_FAIL.
*/
typedef int16_t(*ACCFNC_INITDEVICE)(void);
/*!
Close device driver.
This function closes device drivers of acceleration sensor.
*/
typedef void(*ACCFNC_DEINITDEVICE)(void);
/*!
Acquire acceleration data from acceleration sensor and convert it to Android
coordinate system.
@return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
the return value is #AKD_FAIL.
@param[out] data A acceleration data array. The coordinate system of the
acquired data follows the definition of Android. Unit is SmartCompass.
*/
typedef int16_t(*ACCFNC_GETACCDATA)(short data[3]);
/*** Global variables *********************************************************/
/*** Prototype of Function ***************************************************/
int16_t AKD_InitDevice(void);
void AKD_DeinitDevice(void);
int16_t AKD_TxData(
const BYTE address,
const BYTE* data,
const uint16_t numberOfBytesToWrite);
int16_t AKD_RxData(
const BYTE address,
BYTE* data,
const uint16_t numberOfBytesToRead);
int16_t AKD_ResetAK8963(void);
int16_t AKD_GetMagneticData(BYTE data[SENSOR_DATA_SIZE]);
void AKD_SetYPR(const int buf[YPR_DATA_SIZE]);
int AKD_GetOpenStatus(int* status);
int AKD_GetCloseStatus(int* status);
int16_t AKD_SetMode(const BYTE mode);
int16_t AKD_GetDelay(int64_t delay[AKM_NUM_SENSORS]);
int16_t AKD_GetLayout(int16_t* layout);
int16_t AKD_GetOutbit(int16_t* outbit);
int16_t AKD_GetAccelerationData(int16_t data[3]);
#endif //AKMD_INC_AK8963DRIVER_H