89 lines
2.6 KiB
C
89 lines
2.6 KiB
C
/* USER CODE BEGIN Header */
|
||
/**
|
||
******************************************************************************
|
||
* @file : adc_sample.h
|
||
* @brief : ADC采样头文件
|
||
* @version : 1.0
|
||
* @changelog : version 1.0 初始版本 2025.12.01
|
||
******************************************************************************
|
||
* @attention
|
||
*
|
||
* Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China
|
||
* THIS SOFTWARE is licensed under the Mulan PSL v1.
|
||
* can use this software according to the terms and conditions of the Mulan PSL v1.
|
||
* You may obtain a copy of Mulan PSL v1 at:
|
||
* http://license.coscl.org.cn/MulanPSL
|
||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||
* PURPOSE.
|
||
* See the Mulan PSL v1 for more details.
|
||
*
|
||
******************************************************************************
|
||
*/
|
||
/* USER CODE END Header */
|
||
|
||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||
#ifndef __ADC_SAMPLE_H
|
||
#define __ADC_SAMPLE_H
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
#include <stdint.h>
|
||
#include "fm33lg0xx_fl.h"
|
||
#include "fm33lg0xx_queue.h"
|
||
#include "fm33lg0xx_event.h"
|
||
|
||
// 对压力、温度、网电压、压缩机电流进行AD采样
|
||
|
||
#define ADC_PRESS_GPIO_PIN FL_GPIO_PIN_2
|
||
#define ADC_PRESS_GPIO_PORT GPIOD
|
||
|
||
#define ADC_NTC_GPIO_PIN FL_GPIO_PIN_5
|
||
#define ADC_NTC_GPIO_PORT GPIOD
|
||
|
||
#define ADC_220V_GPIO_PIN FL_GPIO_PIN_6
|
||
#define ADC_220V_GPIO_PORT GPIOD
|
||
|
||
#define ADC_ELEC_GPIO_PIN FL_GPIO_PIN_3
|
||
#define ADC_ELEC_GPIO_PORT GPIOD
|
||
|
||
|
||
#define ADC_ELEC_CHANNEL FL_ADC_EXTERNAL_CH2
|
||
#define ADC_NTC_CHANNEL FL_ADC_EXTERNAL_CH3
|
||
#define ADC_PRESS_CHANNEL FL_ADC_EXTERNAL_CH8
|
||
#define ADC_220V_CHANNEL FL_ADC_EXTERNAL_CH10
|
||
|
||
|
||
|
||
/**
|
||
* @brief ADC采样数据数组索引枚举
|
||
* @note 用于标识不同采样数据在adc_result[]或result_voltage[]数组中的位置
|
||
*/
|
||
typedef enum
|
||
{
|
||
ADC_IDX_ELEC, // 压缩机电流(索引0)
|
||
ADC_IDX_NTC, // NTC温度传感器(索引1)
|
||
ADC_IDX_PRESS, // 储气罐压力(索引2)
|
||
ADC_IDX_220V, // 网电压(索引3)
|
||
ADC_IDX_INTERNAL_VREF1P2, // 1.2V内部参考电压(索引4)
|
||
ADC_SAMPLE_COUNT // 采样项总数(用于数组大小定义/边界检查)
|
||
} AdcSampleIndex;
|
||
|
||
|
||
|
||
|
||
void adc_sample_init(void);
|
||
void sample_adc_process_task(void);
|
||
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* __ADC_SAMPLE_H */
|
||
|
||
/************************ (C) COPYRIGHT Yuwell *****END OF FILE****/
|
||
|