2026-05-10 17:28:14 +08:00
|
|
|
#ifndef DEVICE_TEMP_SENSOR_H
|
|
|
|
|
#define DEVICE_TEMP_SENSOR_H
|
|
|
|
|
|
|
|
|
|
#include "device/adc.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 温度采样模块。
|
|
|
|
|
* @note 当前作为 ADC 模块的轻量门面,复用 Adc::Sample 作为结果类型。
|
|
|
|
|
*/
|
|
|
|
|
class TempSensor {
|
|
|
|
|
public:
|
|
|
|
|
using Data = Adc::Sample;
|
|
|
|
|
|
2026-05-10 21:27:51 +08:00
|
|
|
/**
|
|
|
|
|
* @brief 初始化温度采样依赖资源。
|
|
|
|
|
* @param[in] 无。
|
|
|
|
|
* @param[out] 无。
|
|
|
|
|
* @retval 无返回值。
|
|
|
|
|
* @note 当前通过调用 Adc::init() 完成内部通道准备。
|
|
|
|
|
*/
|
2026-05-10 17:28:14 +08:00
|
|
|
static void init();
|
2026-05-10 21:27:51 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 采集一次温度相关样本。
|
|
|
|
|
* @param[in] 无。
|
|
|
|
|
* @param[out] data 指向输出 Data 结构体的指针。
|
|
|
|
|
* @retval 无返回值。
|
|
|
|
|
* @note 内部调用 Adc::collectSample() 填充完整 ADC 结果。
|
|
|
|
|
*/
|
2026-05-10 17:28:14 +08:00
|
|
|
static void sample(Data *data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using temp_sensor_data_t = TempSensor::Data;
|
|
|
|
|
|
2026-05-10 21:27:51 +08:00
|
|
|
#endif /* DEVICE_TEMP_SENSOR_H */
|