From c225296bea54d5002c0e4790e4c3305b557f8103 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期三, 13 十一月 2024 16:45:33 +0800 Subject: [PATCH] 1.15,基站加入测试的gpio,已经注释掉 --- 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