generated from hulk/gd32f4xx_template_cmake_vscode
21 lines
573 B
C
21 lines
573 B
C
#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
|