Files
FilmForge/Inc/ntc.h
T

21 lines
573 B
C
Raw 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.
#ifndef NTC_H
#define NTC_H
#include "gd32f4xx.h"
#include "board_config.h"
/**
* @brief 初始化 NTC 测温(PC5 模拟输入 + ADC0 常规通道,软件触发单次转换)。
*/
void ntc_init(void);
/**
* @brief 读取一次 NTC 温度(多次采样均值 + B 值公式换算)。
* @details 分压关系:V = VREF * R_ntc / (R_PULL + R_ntc)(硬件上拉在 VREF 侧,
* NTC 接 GND 侧),再由 B 值公式换算温度,单位摄氏度。
* @return 温度值(摄氏度,float)
*/
float ntc_read_temperature(void);
#endif // NTC_H