From ae079c1fc5d990ba55714d4b3a51b19f96edaec4 Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期四, 24 四月 2025 16:01:43 +0800
Subject: [PATCH] 改为中断来低电平触发发送当前扫描数据,3s内扫描不到的会退出,串口来55 AA 75 70 64 61 74 65,进入升级模式

---
 01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_hal_adc.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_hal_adc.c b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_hal_adc.c
index f372920..204a862 100644
--- a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_hal_adc.c
+++ b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_hal_adc.c
@@ -8,19 +8,24 @@
  * Copyright (C) 2023 Panchip Technology Corp. All rights reserved.
  *****************************************************************************/
 #include "pan_hal.h"
+#if CONFIG_OS_EN
 #include "freertos.h"
 #include "semphr.h"
+#endif
 
+#if CONFIG_OS_EN
 SemaphoreHandle_t xSemaphore = NULL;
+#endif
 
 void HAL_ADC_Init(ADC_HandleTypeDef *pADC)
 {
+#if CONFIG_OS_EN
 	if (xSemaphore == NULL) {
 		xSemaphore = xSemaphoreCreateMutex();
 	} else {
 		return;
 	}
-	
+#endif
 	/* Setting input range (0 ~ 1.2V) as default 
 	 *  Note: if the input voltage over 1.2V, should
 	 *  adopt r1/r1+r2 mothod
@@ -43,11 +48,13 @@
 	uint32_t result_code;
 	
 	if ((pADC->id > ADC_CH_BATTERY) || ((pADC->id > ADC_CH7) && (pADC->id < ADC_CH_TEMP))) {
-		return PAN_HAL_IO_ERROR;
+		return HAL_IO_ERROR;
 	}
-	
+
+#if CONFIG_OS_EN
 	xSemaphoreTake(xSemaphore, portMAX_DELAY);
-	
+#endif
+
 	/* Open clock related adc */
 	CLK_APB1PeriphClockCmd(CLK_APB1Periph_ADC, ENABLE);
 	
@@ -84,9 +91,12 @@
 	
 	/* Open clock related adc */
 	CLK_APB1PeriphClockCmd(CLK_APB1Periph_ADC, DISABLE);
+
+#if CONFIG_OS_EN
 	xSemaphoreGive(xSemaphore);
-	
-	return PAN_HAL_SUCCESS;
+#endif
+
+	return HAL_SUCCESS;
 }
 
 

--
Gitblit v1.9.3