From 987c5fd079b4ca6d30fcdad2adfd68289a4090d4 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 27 Jun 2023 09:37:05 +0800 Subject: [PATCH] update --- app/MDK-ARM/startup_stm32f103xb.s | 4 ++-- src/board/hardware.cpp | 9 ++++++++- src/umain.cpp | 13 ++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/MDK-ARM/startup_stm32f103xb.s b/app/MDK-ARM/startup_stm32f103xb.s index fd82d4f..a8b7d3b 100644 --- a/app/MDK-ARM/startup_stm32f103xb.s +++ b/app/MDK-ARM/startup_stm32f103xb.s @@ -29,7 +29,7 @@ ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; -Stack_Size EQU 0x400 +Stack_Size EQU 0x0F00 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size @@ -40,7 +40,7 @@ __initial_sp ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; -Heap_Size EQU 0x200 +Heap_Size EQU 0x2000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base diff --git a/src/board/hardware.cpp b/src/board/hardware.cpp index 5027794..60f5ae7 100644 --- a/src/board/hardware.cpp +++ b/src/board/hardware.cpp @@ -36,7 +36,14 @@ void Hardware::periodicJob() {} /******************************************************************************* * 测试指示灯 * *******************************************************************************/ -void Hardware::debug_light_init() { DEBUG_LIGHT_GPIO.initAsOutput(STM32_GPIO::kOutput_nopull, false, false); } +void Hardware::debug_light_init() { + DEBUG_LIGHT_GPIO.initAsOutput(STM32_GPIO::kOutput_nopull, false, false); + + for (size_t i = 0; i < 5; i++) { + DEBUG_LIGHT_GPIO.toggleState(); + HAL_Delay(100); + } +} void Hardware::debug_light_periodicJob() { static uint32_t lastprocess = 0; if (sys_haspassedms(lastprocess) > 300) { diff --git a/src/umain.cpp b/src/umain.cpp index 4008927..83339f5 100644 --- a/src/umain.cpp +++ b/src/umain.cpp @@ -34,7 +34,7 @@ struct ad77681_init_param ADC_default_init_param = { .conv_mode = AD77681_CONV_CONTINUOUS, // conv_mode .diag_mux_sel = AD77681_POSITIVE_FS, // diag_mux_sel .conv_diag_sel = false, // conv_diag_sel - .conv_len = AD77681_CONV_16BIT, // conv_len + .conv_len = AD77681_CONV_24BIT, // conv_len .crc_sel = AD77681_CRC, // crc_sel .status_bit = 0, // status_bit .VCM_out = AD77681_VCM_HALF_VCC, /* VCM setup*/ @@ -61,8 +61,10 @@ void Main::generateScheduleTicket() { } } -void Main::adcslaveinit() {} -void Main::onTimerCallbackIRQ(STM32_TIM *tim) { +void Main::adcslaveinit() {} +// #pragma GCC push_options +// #pragma GCC optimize("Ofast") +void Main::onTimerCallbackIRQ(STM32_TIM *tim) { int32_t voice = m_ad77681.triggerOnceAdcReadAndReadLastResult(); m_voiceCacheQueue.push(&voice); } @@ -87,6 +89,7 @@ void Main::STM32_GPIO_onIRQ(STM32_GPIO *GPIO_Pin, STM32_GPIO::IrqTypeEvent_t irq } } } +// #pragma GCC pop_options void Main::main(int argc, char const *argv[]) { sys_loggger_enable(true); @@ -109,7 +112,7 @@ void Main::main(int argc, char const *argv[]) { // 初始化音频采集定时器 STM32_TIM2.initialize(&htim2, STM32_TIM::kTimMode_timer); STM32_TIM2.regListener(this); - STM32_TIM2.startTimerByFreq(16000); + STM32_TIM2.startTimerByFreq(24000); } { @@ -154,6 +157,6 @@ void Main::main(int argc, char const *argv[]) { m_hardware.input_sensors_table_dump(0); } - // HAL_IWDG_Refresh(&hiwdg); + HAL_IWDG_Refresh(&hiwdg); } }