sick_dt35/User/device/ads8864.h
2025-04-02 20:51:10 +08:00

31 lines
926 B
C

#pragma once
/* Includes ----------------------------------------------------------------- */
#include <stdint.h>
/* Exported constants ------------------------------------------------------- */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
//近10次ADC数据
typedef struct {
uint16_t adc_data[10]; // ADC 数据
} Ads8864_Raw_t;
// 滤波后的ADC数据
typedef struct {
uint16_t adc_data;
float distance; // 距离(mm)
} Ads8864_Filtered_t;
// ADC数据结构体
typedef struct {
Ads8864_Raw_t raw; // 原始数据
Ads8864_Filtered_t filtered; // 滤波后的数据
} Ads8864_t;
extern Ads8864_t ads8864; // 声明全局变量
/* Exported functions prototypes -------------------------------------------- */
int8_t ads8864_Init(Ads8864_t *ads8864);
int8_t Ads8864_Read(Ads8864_t *ads8864);