67 lines
1.5 KiB
C
67 lines
1.5 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;
|
|
int16_t RPM;
|
|
int16_t angle;
|
|
uint8_t actFlag;
|
|
uint8_t adjustFlag;
|
|
uint16_t sleepCnt;
|
|
uint8_t sleepFlag;
|
|
uint8_t sleepState;
|
|
|
|
} 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
|
|
|
|
/*************************************************************************************************/
|