accelerometer.h

来自「freescale badge board 开发板测试 源程序」· C头文件 代码 · 共 58 行

H
58
字号
/*!
 * \file    accelerometer.h
 * \brief   Defines and macros for MPR083 Chip and I2C
 * \version $Revision: 1.2 $
 * \author  Anthony Huereca
 */

#ifndef _ACCELEROMETER_H_
#define _ACCELEROMETER_H_

#include <MCF51JM128.h>
#include <stdlib.h> 
/*******************************************************************/
#define max             0x10         //Max number of samples to average/filter
#define dis_base        base16
#define SENSITIVITY     5000
#define Range15g        0
#define Range2g         1
#define Range4g         2
#define Range6g         3 


typedef struct  {
  dword  reading[max];
  dword  result[max];
  dword  init;
} ResultStct;

/*********************************** Variables ***********************************/
static byte samp=0,mode=0,n_str[5];

static ResultStct x;
static ResultStct y;
static ResultStct z;

word y_output;
word x_output;



dword high;
/*********************************** Prototype ***********************************/


void Accel_init(void);
void filter_data();
word ReadAcceleration(byte channel);    
void avg_data();
void TiltDemo();
void ShakeDemo();
void position_flat();
void position_upright();
void calibrate();
void AccelOn(char sensitivity);
void AccelOff();
/*******************************************************************/

#endif /* _ACCELEROMETER_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?