acdt/users/Src/adcs.c

46 lines
1.1 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: wujunchao wujunchao@wuxismart.com
* @Date: 2024-08-21 13:24:11
* @LastEditors: wujunchao wujunchao@wuxismart.com
* @LastEditTime: 2024-09-13 16:42:49
* @FilePath: \acdt\users\Src\adcs.c
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#include "adcs.h"
uint32_t ADC_ConvertedValue = 0; //ADC数据
short Temp = 0; //温度
void adcs_init(void)
{
//HAL_ADC_Start_DMA(&hadc1, (uint32_t *)ADC_ConvertedValue, 1);
}
void adcs_data(void)
{
HAL_ADC_Start(&hadc1);
ADC_ConvertedValue = HAL_ADC_GetValue(&hadc1);
}
void analog_gather(void)
{
if(it_10ms_flag == 1)
{
it_10ms_flag = 0;
mf5803_loop(); //sensor_1 and sensor_2, 气压检测
adcs_data(); //定位器输出回采
ads1256_get_data(); //8路模拟输入
ads1220_get_data(); //比例阀1&2自带反馈 + 输出回采
}
if(it_100ms_flag == 1)
{
it_100ms_flag = 0;
Temp = ds18b20_get_temp();
InputReg[19] = Temp;
}
}