⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accelerometer.h

📁 freescale badge board 开发板测试 源程序
💻 H
字号:
/*!
 * \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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -