fix(README): 修正文档中协议字段链接路径
fix(main): 修正主循环中延时以保持程序运行
This commit is contained in:
+1
-2
@@ -26,15 +26,14 @@ LOG_MODULE_REGISTER(ads1256, LOG_LEVEL_INF);
|
||||
#define SPI_OP (SPI_OP_MODE_MASTER | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE)
|
||||
|
||||
/* --- 硬件资源 --- */
|
||||
static const struct device *spi_dev;
|
||||
static struct spi_config spi_cfg;
|
||||
static const struct device *spi_dev;
|
||||
static const struct gpio_dt_spec cs_spec = GPIO_DT_SPEC_GET(DT_ALIAS(ads_cs), gpios);
|
||||
static const struct gpio_dt_spec drdy_spec = GPIO_DT_SPEC_GET(DT_ALIAS(ads_drdy), gpios);
|
||||
static const struct gpio_dt_spec reset_spec = GPIO_DT_SPEC_GET(DT_ALIAS(ads_reset), gpios);
|
||||
|
||||
void ads1256_wait_drdy(uint16_t timeout_ms) {
|
||||
/* drdy_spec 配了 GPIO_ACTIVE_LOW,逻辑 1 表示 DRDY 有效(物理拉低) */
|
||||
/* 用 k_usleep 代替 k_busy_wait,让出 CPU 给其他线程 */
|
||||
int64_t deadline = k_uptime_get() + timeout_ms;
|
||||
while (gpio_pin_get_dt(&drdy_spec) == 0) {
|
||||
k_usleep(10);
|
||||
|
||||
Reference in New Issue
Block a user