1 /****************************************************************************** 2 * $Id: AKFS_AK8975.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_AK8975_H 20 #define AKFS_INC_AK8975_H 21 22 #include "AKFS_Device.h" 23 24 /***** Constant definition ****************************************************/ 25 #define AK8975_BDATA_SIZE 8 26 27 #define AK8975_HSENSE_DEFAULT 1 28 #define AK8975_HSENSE_TARGET 0.3f 29 #define AK8975_ASENSE_DEFAULT 720 30 #define AK8975_ASENSE_TARGET 9.80665f 31 32 #define AK8975_HDATA_CONVERTER(hi, low, asa) \ 33 (AKFLOAT)((int16)((((uint16)(hi))<<8)+(uint16)(low))*(((asa)/256.0f) + 0.5f)) 34 35 #define AK8975_ST_ERROR(st) (((st)&0x09) != 0x01) 36 37 /***** Type declaration *******************************************************/ 38 39 /***** Prototype of function **************************************************/ 40 AKLIB_C_API_START 41 int16 AKFS_DecompAK8975( 42 const int16 mag[3], 43 const int16 status, 44 const uint8vec* asa, 45 const int16 nhdata, 46 AKFVEC hdata[] 47 ); 48 AKLIB_C_API_END 49 50 #endif 51 52