refactor(ads1256): 修改等待 DRDY 和硬件复位函数返回值,增加超时处理

This commit is contained in:
2026-05-14 21:17:53 +08:00
parent 16683e40d8
commit 93e7990fdf
3 changed files with 32 additions and 19 deletions
+4 -2
View File
@@ -13,8 +13,9 @@ int ads1256_init(void);
/**
* @brief 等待 DRDY 拉低(转换结果可读),带超时保护。
* @param timeout_ms 超时时间(毫秒)。
* @return 0 成功,-ETIMEDOUT 超时。
*/
void ads1256_wait_drdy(uint16_t timeout_ms);
int ads1256_wait_drdy(uint16_t timeout_ms);
/**
* @brief 向 ADS1256 写单个寄存器。
@@ -37,8 +38,9 @@ void ads1256_sync_wakeup(void);
/**
* @brief 硬件复位 ADS1256(通过 RESET 引脚),等待复位后自校准完成。
* @return 0 成功,-ETIMEDOUT 芯片无响应。
*/
void ads1256_hwreset(void);
int ads1256_hwreset(void);
/**
* @brief 读取当前 24 位转换结果,符号扩展为 int32_t。