This commit is contained in:
TuxMonkey
2025-11-20 17:37:07 +08:00
parent a5428702d7
commit bc248a88f7
2 changed files with 16 additions and 6 deletions

View File

@@ -28,10 +28,8 @@ __attribute__((section (".AXI_SRAM"))) uint16_t ADC_Voltage_Val[2];
*/ */
void BSP_ADC_Init(void) void BSP_ADC_Init(void)
{ {
HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED); HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED);
HAL_ADC_Start_DMA(&hadc1, (uint32_t *) ADC_Voltage_Val, 2); HAL_ADC_Start_DMA(&hadc1, (uint32_t *) ADC_Voltage_Val, 2);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -43,11 +41,8 @@ void BSP_ADC_Init(void)
*/ */
float USER_ADC_Voltage_Update(void) float USER_ADC_Voltage_Update(void)
{ {
auto Voltage = (ADC_Voltage_Val[0] * 3.3f / 65535) * 11.0f;
float Voltage;
Voltage = (ADC_Voltage_Val[0] * 3.3f / 65535) * 11.0f;
return Voltage; return Voltage;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

15
openocd_cfg/CMSIS_DAP.cfg Normal file
View File

@@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# ARM CMSIS-DAP compliant adapter
#
# http://www.keil.com/support/man/docs/dapdebug/
#
adapter driver cmsis-dap
transport select swd
source [find target/stm32h7x.cfg]
# download speed = 10MHz
adapter speed 1000
# Optionally specify the serial number of CMSIS-DAP usb device.
# adapter serial 02200201E6661E601B98E3B9