forked from wanrenqi/PASII
71 lines
1.7 KiB
C
71 lines
1.7 KiB
C
/*************************************************************************************************
|
||
**Filename: lsm6d.h
|
||
**Version :
|
||
**Author :
|
||
**Date :
|
||
**Description:
|
||
**
|
||
*************************************************************************************************/
|
||
#ifndef __LSM6D_H_
|
||
#define __LSM6D_H_
|
||
|
||
#include "ARMCM0.h"
|
||
#include "lsm6dso_reg.h"
|
||
|
||
/*********************************************************************
|
||
* Global Macros ('#define')
|
||
*/
|
||
#define LSM6DSO_ADDRESS (LSM6DSO_I2C_ADD_L>>1)
|
||
#define LSM6DSO_ID 0x6C
|
||
|
||
#ifndef ABS
|
||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||
#endif
|
||
|
||
/*********************************************************************
|
||
* Struct type definitions('typedef')
|
||
*/
|
||
typedef struct
|
||
{
|
||
float C_angle;
|
||
float bias_cf;
|
||
float C_angle_dot;
|
||
|
||
}tFilter_Type;
|
||
|
||
typedef struct
|
||
{
|
||
uint8_t exist;
|
||
uint8_t batt_level;
|
||
uint16_t batt_vol;
|
||
int16_t RPM;
|
||
int16_t angle;
|
||
uint8_t actFlag;
|
||
uint8_t adjustFlag;
|
||
uint16_t sleepCnt;
|
||
uint8_t sleepFlag;
|
||
uint8_t sleepState;
|
||
uint8_t chargeState;
|
||
uint32_t transpModes; //运输模式标志位 注意:要占4个字节,否则Flash数据保存标志位的时候会出问题
|
||
uint8_t exitTransmode; //退出运输模式标志
|
||
|
||
} PAS_SENSOR_t;
|
||
|
||
/*********************************************************************
|
||
* Global Variable declared ('extern')
|
||
*/
|
||
extern float Angle;
|
||
extern PAS_SENSOR_t PAS;
|
||
|
||
/*********************************************************************
|
||
* Global Function declared ('extern')
|
||
*/
|
||
void Lsm6dso_Init(void);
|
||
void Lsm6dso_RPM_Cal(void);
|
||
void Lsm6dso_Correct(void);
|
||
void Lsm6dso_Disable(void);
|
||
|
||
#endif
|
||
|
||
/*************************************************************************************************/
|