generated from hulk/gd32f4xx_template_cmake_vscode
FilmForge: RS485 data link (USART0+DE PA8) and NTC temp (PC5 ADC0)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user