• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * $Id: AKFS_Measure.h 580 2012-03-29 09:56:21Z yamada.rj $
3  ******************************************************************************
4  *
5  * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 #ifndef AKFS_INC_MEASURE_H
20 #define AKFS_INC_MEASURE_H
21 
22 /* Include files for AK8975 library. */
23 #include "AKFS_Compass.h"
24 
25 /*** Constant definition ******************************************************/
26 #define AK8975_SELFTEST_MIN_X	(-100)
27 #define AK8975_SELFTEST_MAX_X	100
28 
29 #define AK8975_SELFTEST_MIN_Y	(-100)
30 #define AK8975_SELFTEST_MAX_Y	100
31 
32 #define AK8975_SELFTEST_MIN_Z	(-1000)
33 #define AK8975_SELFTEST_MAX_Z	(-300)
34 
35 #define CONVERT_ACC(a)	((int)((a) * 720 / 9.8f))
36 #define CONVERT_MAG(m)	((int)((m) / 0.06f))
37 #define CONVERT_ORI(o)	((int)((o) * 64))
38 
39 /*** Type declaration *********************************************************/
40 
41 /*** Global variables *********************************************************/
42 
43 /*** Prototype of function ****************************************************/
44 int16 AKFS_ReadAK8975FUSEROM(
45 		uint8 regs[3]
46 );
47 
48 int16 AKFS_SelfTest(void);
49 
50 struct timespec AKFS_CalcSleep(
51 	const struct timespec* end,
52 	const struct timespec* start,
53 	const int64_t minimum
54 );
55 
56 int16 AKFS_GetInterval(
57 		uint16*  flag,
58 		int64_t* minimum
59 );
60 
61 void AKFS_OutputResult(
62 	const	uint16			flag,
63 	const	AKSENSOR_DATA*	acc,
64 	const	AKSENSOR_DATA*	mag,
65 	const	AKSENSOR_DATA*	ori
66 );
67 
68 void AKFS_MeasureLoop(void);
69 
70 #endif
71 
72