Logic_temperature.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. ******************************************************************************
  3. * @file Logic_temperature.h
  4. * @brief 温度数据逻辑层 (Logic)
  5. *
  6. * @note 本文件为逻辑层 (Logic) 接口, 供 UI 页面层获取温度数据。
  7. * 实时温度取自 CPLD 快照 "24 路 BMC 原始温度读数" (经 Mid_temp
  8. * 缓存); 预加热温度取自 CT7428 前 4 路 (映射见 Mid_temp)。
  9. *
  10. * 温度通道划分:
  11. * 通道 0 ~ 11 -> CPU0
  12. * 通道 12 ~ 23 -> CPU1 (共 24 条, 前 12 条 CPU0, 后 12 条 CPU1)
  13. ******************************************************************************
  14. */
  15. #ifndef __LOGIC_TEMPERATURE_H
  16. #define __LOGIC_TEMPERATURE_H
  17. #include <stdint.h>
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /* 温度相关常量 */
  22. #define LOGIC_TEMP_TOTAL_CH 24 /* 温度通道总数 */
  23. #define LOGIC_TEMP_CPU_CH_COUNT 12 /* 每个 CPU 的通道数 */
  24. #define LOGIC_TEMP_INVALID (-127) /* 无数据/无效温度哨兵值 (UI 据此显示 "--") */
  25. /* 功能函数 ----------------------------------------------------------------*/
  26. /**
  27. * @brief 获取指定通道的温度值 (BMC 24 路真实读数)
  28. * @param ch : 通道号 (0 ~ LOGIC_TEMP_TOTAL_CH-1)
  29. * @retval 温度值 (摄氏度, 整数); 无数据/通道无效/越界返回 LOGIC_TEMP_INVALID
  30. */
  31. int8_t Logic_temperature_get(uint8_t ch);
  32. /**
  33. * @brief 获取指定通道所属的 CPU 编号
  34. * @param ch : 通道号
  35. * @retval 0 = CPU0, 1 = CPU1; 越界返回 -1
  36. */
  37. int8_t Logic_temperature_get_cpu(uint8_t ch);
  38. /* 预加热温度 (CT7428 4 路) */
  39. #define LOGIC_PREHEAT_TEMP_NUM 4 /* 预加热温度数量 */
  40. /**
  41. * @brief 获取预加热传感器的温度值
  42. * @note 真实数据源: CPLD 快照内 CT7428 (映射暂定 = 前 4 路, 见 Mid_temp.h)
  43. * @param idx : 序号 (0 ~ LOGIC_PREHEAT_TEMP_NUM-1); 0/1 = CPU0, 2/3 = CPU1
  44. * @retval 温度值 (摄氏度); 无数据/无效/越界返回 LOGIC_TEMP_INVALID
  45. */
  46. int8_t Logic_preheat_get(uint8_t idx);
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /* __LOGIC_TEMPERATURE_H */