Files
STM32F4-Base/test/host/adc_input/stub/tpafe5160.h
T
wandering1 696a1a49a9 主机单测:新增 ADC 输入层(L1)用例 70 项并登记 L1/L2 单测钩子
新增 App/algo/adc_input.c 的主机侧单测(L1),补齐 L1/L2 算法层
"每个函数都可离线验证"的最后一处空白。

- test/host/adc_input/{adc_input_test.c,run_unit_test.py,stub/}:
  70 个用例,覆盖 6 个公开函数 + map_check + stm32_scan。
  关键判据 = "通道号 <-> Rank 顺序 <-> 语义"三者映射:给每个 Rank
  注入互不相同的码值,逐通道钉死映射(板端无信号源,无法验此项)。
  另钉死 HAL 启动失败 / 轮询超时 / 参数错 / 无有效数据等分支。
- .pre-commit-config.yaml:登记 phasor-unit-test(7d)与
  adc-input-unit-test(7e)两个主机侧单测钩子。

主机侧全套:adc_input 70/70、phasor 52/52,均 0 失败、无 /W4 告警。
2026-10-10 17:46:45 +08:00

29 lines
1004 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.
/*
* 主机侧单测桩:tpafe5160.h
* 模块功能:为 App/algo/adc_input.c 提供主机可编译的 TPAFE5160 快照接口声明
* (真实头会经 main.h 拖入 HAL 与 GPIO 宏,主机侧无法编译)。
*
* ⚠ 仅供 test/host/adc_input/ 使用,不参与 MCU 构建。
*
* 被测代码只消费 tpafe5160_snapshot()(E-58 原子快照),故桩只保留该声明;
* 其返回值语义(1=新帧 / 0=无新帧 / -1=参数错)与真实驱动一致,由测试单元
* 给强符号桩并按用例注入。
*
* 创建日期:2026-10-10
*/
#ifndef TPAFE5160_H
#define TPAFE5160_H
#include <stdint.h>
/*
* 函数功能:原子快照最新一帧(消费者取数的唯一正确姿势)
* 入口参数:dst - 输出缓冲区 int16_t* 不为 NULL
* count - 拷贝通道数 uint8_t 1 - 8
* 返 回 值:1 - 取到新帧,0 - 无新帧,-1 - 参数无效
*/
int tpafe5160_snapshot(int16_t *dst, uint8_t count);
#endif /* TPAFE5160_H */