Files
99_7018_lmx/apps/earphone/xtell_Sensor/LIS2DH12.h

59 lines
1.5 KiB
C
Raw Normal View History

2025-10-29 16:24:16 +08:00
#ifndef LIS2DH12_H
#define LIS2DH12_H
#include "gSensor/gSensor_manage.h"
#include "le_rcsp_adv_module.h"
2025-10-30 11:33:38 +08:00
// --- 物理常量定义 ---
#define GRAVITY_EARTH 9.80665f // 地球重力加速度 (m/s^2)
#define SAMPLING_PERIOD_S 0.2f // 采样周期 (对应于200ms的定时器)
2025-10-29 16:24:16 +08:00
2025-10-30 11:33:38 +08:00
// --- 数据结构定义 ---
2025-10-29 16:24:16 +08:00
2025-10-30 11:33:38 +08:00
// 三轴数据结构体 (可用于加速度、速度、距离)
2025-10-29 16:24:16 +08:00
typedef struct {
float x;
float y;
float z;
} axis_info_xtell;
2025-10-30 11:33:38 +08:00
// 运动数据结构体,包含速度和距离
2025-10-29 16:24:16 +08:00
typedef struct {
2025-10-30 11:33:38 +08:00
axis_info_xtell velocity; // 速度 (m/s)
axis_info_xtell distance; // 距离 (m)
2025-10-29 16:24:16 +08:00
} motion_data_t;
2025-10-30 11:33:38 +08:00
// --- API 函数声明 ---
2025-10-29 16:24:16 +08:00
2025-10-30 11:33:38 +08:00
/**
* @brief LIS2DH12传感器
* @return 0 , -1
*/
unsigned char LIS2DH12_Config(void);
2025-10-29 16:24:16 +08:00
2025-10-30 11:33:38 +08:00
/**
* @brief
*/
void xtell_i2c_test(void);
2025-10-29 16:24:16 +08:00
2025-10-30 11:33:38 +08:00
// --- 数据获取函数声明 ---
/**
* @brief
* @param data motion_data_t
*/
2025-10-29 16:24:16 +08:00
void get_motion_data(motion_data_t *data);
2025-10-30 11:33:38 +08:00
/**
* @brief m/s^2
* @return axis_info_xtell x,y,z轴总加速度的结构体
*/
axis_info_xtell get_current_accel_mss(void);
2025-10-29 16:24:16 +08:00
2025-10-30 11:33:38 +08:00
/**
* @brief 线 m/s^2
* @return axis_info_xtell x,y,z轴线性加速度的结构体
*/
axis_info_xtell get_linear_accel_mss(void);
2025-10-29 16:24:16 +08:00
#endif