/* * @Author : stark1898y 1658608470@qq.com * @Date : 2024-09-13 13:11:09 * @LastEditors : stark1898y 1658608470@qq.com * @LastEditTime : 2025-01-23 16:17:44 * @FilePath : \JT-DT-YD4N02A_4G_RTT_MRS\bsp\inc\bsp_vin_detection.h * @Description * * Copyright (c) 2024 by yzy, All Rights Reserved. */ #ifndef __BSP_VIN_DETECTION_H__ #define __BSP_VIN_DETECTION_H__ #include "board.h" #if 1 #define VIN_THREAD_STACK_SIZE (1024) #define VIN_THREAD_PRIORITY (5) #define VIN_THREAD_TIMESLICE (5) #endif #define VIN_VOLTAGE_RATIO (4.19148936F) #ifdef VIN_THREAD_ENABLE // 不含输入二极管的压降 // (4.7/19.7) * 13V = 3.1V, 3.1/3.3*4096 = 3723 #define VIN_ADC_HIGH_THRESHOLD (uint16_t)3847 // 13V // (4.7/19.7) * 10V = 2.39V, 2.39/3.3*4096 = 2966 #define VIN_ADC_LOW_THRESHOLD (uint16_t)2369 // 8V #else #define VIN_ADC_LOW_THRESHOLD (8000) //8V #endif float Get_VIN_Voltage(void); uint16_t Get_VIN_VoltageInt1000x(void); int BSP_VIN_Detection_Init(void); #endif // !__BSP_VIN_DETECTION_H__