From cbe3b0a4c27e0d28628e4c57a7835526591c6201 Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期三, 06 三月 2024 22:10:15 +0800
Subject: [PATCH] V1.5 增加电量,心跳包功能,但是好像有bug,一段时间后UWB不测距。

---
 Src/OnChipDevices/ADC.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Src/OnChipDevices/ADC.c b/Src/OnChipDevices/ADC.c
index cfdf1c0..c029a89 100644
--- a/Src/OnChipDevices/ADC.c
+++ b/Src/OnChipDevices/ADC.c
@@ -1,5 +1,6 @@
 #include "ADC.h"
 #include "main.h"
+
 uint16_t Get_ADC_Value()
 {
 HAL_ADC_Start(&hadc);
@@ -9,6 +10,18 @@
 			return HAL_ADC_GetValue(&hadc);
 		}          
 }
+uint16_t GetRandomValue(void)
+{
+   uint16_t temp;
+   for(uint8_t i=0;i<16;i++)
+    {
+        if(Get_ADC_Value()%2)
+        {
+            temp=temp|(1<<i);
+        }
+    }
+    return temp;
+}
 float bat_volt;
 uint8_t Get_Battary(void)
 {static float last_value = 100;

--
Gitblit v1.9.3