89 lines
2.6 KiB
C
89 lines
2.6 KiB
C
|
|
/* USER CODE BEGIN Header */
|
|||
|
|
/**
|
|||
|
|
******************************************************************************
|
|||
|
|
* @file : adc_sample.h
|
|||
|
|
* @brief : ADC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|||
|
|
* @version : 1.0
|
|||
|
|
* @changelog : version 1.0 <EFBFBD><EFBFBD>ʼ<EFBFBD>汾 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"
|
|||
|
|
|
|||
|
|
// <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>¶ȡ<C2B6><C8A1><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>AD<41><44><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
#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<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD>
|
|||
|
|
* @note <EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD>ʶ<EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>adc_result[]<EFBFBD><EFBFBD>result_voltage[]<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>λ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
typedef enum
|
|||
|
|
{
|
|||
|
|
ADC_IDX_ELEC, // ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>
|
|||
|
|
ADC_IDX_NTC, // NTC<54>¶ȴ<C2B6><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>
|
|||
|
|
ADC_IDX_PRESS, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>
|
|||
|
|
ADC_IDX_220V, // <20><><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>
|
|||
|
|
ADC_IDX_INTERNAL_VREF1P2, // 1.2V<EFBFBD>ڲ<EFBFBD><EFBFBD>ο<EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><EFBFBD>
|
|||
|
|
ADC_SAMPLE_COUNT // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>/<2F>߽<EFBFBD><DFBD><EFBFBD><EFBFBD>飩
|
|||
|
|
} 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****/
|
|||
|
|
|