From d9bee632550105eca2beadd7384916cf787ee222 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Tue, 31 Oct 2023 19:25:06 +0800 Subject: [PATCH] fix DM6300_detect() --- src/dm6300.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dm6300.c b/src/dm6300.c index e3ebcfe..62a827b 100644 --- a/src/dm6300.c +++ b/src/dm6300.c @@ -878,9 +878,16 @@ CODE_SEG const dm6300_reg_value_t dm6300_init_regs[] = { uint8_t DM6300_detect(void) { uint32_t rdat = 0; - SPI_Write(0x3, 0xFF0, 0x18); - SPI_Read(0x3, 0x254, &rdat); + SPI_Write(0x6, 0xFF0, 0x18); + SPI_Read(0x6, 0xFF0, &rdat); +#ifdef _DEBUG_MODE + if (rdat != 0x18) { + debugf("\r\ndm6300 lost"); + } else { + debugf("\r\ndm6300 alive"); + } +#endif return rdat != 0x18; }