From 2073601b84385608ccacc6b25fb025d3032a6870 Mon Sep 17 00:00:00 2001
From: hanyongwei <2043702190@qq.com>
Date: Fri, 28 Aug 2026 15:48:25 +0800
Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E6=97=A0=E7=94=A8=E7=9A=84?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
iar/plsr.dep | 2291 +++++++++----------------
plsr/accel_curve/plsr_accel_curve.c | 1830 ++++++++++----------
plsr/accel_curve/plsr_accel_curve.h | 123 +-
plsr/command/plsr_command.c | 26 +-
plsr/param/plsr_param.c | 244 +--
plsr/param/plsr_param.h | 33 +-
plsr/plsr.c | 57 +-
plsr/plsr.h | 28 +-
plsr/pulse_driver/plsr_pulse_driver.c | 103 +-
plsr/pulse_driver/plsr_pulse_driver.h | 14 +-
plsr/run_control/plsr_run_control.c | 977 +++++------
plsr/run_control/plsr_run_control.h | 13 +-
plsr/signal_io/plsr_signal_io.c | 38 +-
13 files changed, 2388 insertions(+), 3389 deletions(-)
diff --git a/iar/plsr.dep b/iar/plsr.dep
index 6b9bb3a..4ac35f5 100644
--- a/iar/plsr.dep
+++ b/iar/plsr.dep
@@ -5,2825 +5,2096 @@
Debug
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_usart.xcl
- $PROJ_DIR$\Debug\Obj\plsr_signal_io.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dac.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc.o
+ $PROJ_DIR$\..\app\main.h
+ $PROJ_DIR$\..\app\main.c
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fsmc.xcl
+ $PROJ_DIR$\Debug\Obj\plsr.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmpi2c.o
+ $PROJ_DIR$\Debug\Obj\lib_ascii.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_irda.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash.xcl
+ $PROJ_DIR$\Debug\Obj\os_tmr.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rcc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_i2c.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal.xcl
+ $PROJ_DIR$\Debug\Obj\cpu_c.o
+ $PROJ_DIR$\Debug\Obj\os_time.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_utils.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nand.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sd.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_crc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nand.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc_ex.xcl
+ $PROJ_DIR$\Debug\Obj\tim.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_crc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2s_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_gpio.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rtc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma2d.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c.o
+ $PROJ_DIR$\Debug\Obj\os_task.o
+ $PROJ_DIR$\Debug\Obj\lib_str.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c.o
+ $PROJ_DIR$\Debug\Obj\plsr_pulse_driver.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_exti.o
+ $PROJ_DIR$\Debug\Obj\app_hooks.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pccard.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_param.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2s.xcl
+ $PROJ_DIR$\Debug\Obj\main.xcl
+ $PROJ_DIR$\Debug\Obj\modbus_rtu.xcl
+ $PROJ_DIR$\Debug\Obj\os_mbox.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sram.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_gpio.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rng.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_iwdg.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_usb.xcl
+ $PROJ_DIR$\Debug\Obj\gpio.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cec.o
+ $PROJ_DIR$\Debug\Obj\cpu_core.o
+ $PROJ_DIR$\Debug\Obj\os_mutex.xcl
+ $PROJ_DIR$\Debug\Obj\lib_math.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_uart.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_timebase_tim.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dac.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma.o
+ $PROJ_DIR$\Debug\Obj\os_q.o
+ $PROJ_DIR$\Debug\Obj\plsr_param.o
+ $PROJ_DIR$\Debug\Obj\cpu_a.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cortex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_exti.xcl
+ $PROJ_DIR$\Debug\Obj\os_mutex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ramfunc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_lptim.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_crc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_can.xcl
+ $PROJ_DIR$\Debug\Obj\os_sem.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_usart.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_i2c.o
+ $PROJ_DIR$\Debug\Obj\os_cpu_c.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smartcard.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dfsdm.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_iwdg.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc_ex.xcl
+ $PROJ_DIR$\Debug\Obj\os_core.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_it.o
+ $PROJ_DIR$\Debug\Obj\startup_stm32f407xx.o
+ $PROJ_DIR$\Debug\Obj\os_flag.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_usart.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc.o
+ $PROJ_DIR$\Debug\Obj\lib_mem_a.o
+ $PROJ_DIR$\Debug\Obj\plsr_signal_io.xcl
+ $PROJ_DIR$\Debug\Obj\gpio.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pcd.xcl
+ $PROJ_DIR$\Debug\Obj\os_mem.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spi.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spdifrx.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp.o
+ $PROJ_DIR$\Debug\Obj\os_time.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_adc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_qspi.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nor.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rcc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmpi2c.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_wwdg.xcl
+ $PROJ_DIR$\Debug\Obj\main.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sram.xcl
+ $PROJ_DIR$\Debug\Obj\os_tmr.xcl
$PROJ_DIR$\Debug\Obj\stm32f4xx_ll_tim.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_sdmmc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_exti.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2s_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fsmc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_qspi.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_utils.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_lptim.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_gpio.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dcmi_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_timebase_tim.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_mmc.o
+ $PROJ_DIR$\Debug\Obj\os_cpu_a.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_msp.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dac_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_wwdg.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_pwr.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_lptim.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_eth.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai.o
+ $PROJ_DIR$\Debug\Obj\os_core.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_it.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_crc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_mmc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai_ex.o
+ $PROJ_DIR$\Debug\Obj\modbus_rtu.o
+ $PROJ_DIR$\Debug\Obj\os_mbox.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_spi.o
+ $PROJ_DIR$\Debug\Obj\lib_mem.o
+ $PROJ_DIR$\Debug\Obj\os_dbg.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cortex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dsi.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hcd.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_accel_curve.o
+ $PROJ_DIR$\Debug\Obj\system_stm32f4xx.o
+ $PROJ_DIR$\Debug\Obj\app_hooks.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma2d.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_sdmmc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sdram.xcl
+ $PROJ_DIR$\Debug\Obj\os_q.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_pulse_driver.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dcmi_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cec.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_accel_curve.xcl
+ $PROJ_DIR$\Debug\Obj\plsr.pbd
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sdram.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rng.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spdifrx.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc_ex.xcl
+ $PROJ_DIR$\Debug\Obj\lib_str.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_run_control.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_command.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rng.o
+ $PROJ_DIR$\Debug\Obj\plsr_command.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_adc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_can.o
+ $PROJ_DIR$\Debug\Obj\os_sem.xcl
+ $PROJ_DIR$\Debug\Obj\tim.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spi.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dac.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_persist.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pccard.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rng.xcl
+ $PROJ_DIR$\Debug\Obj\lib_math.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_exti.xcl
$PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dcmi.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dcmi.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_gpio.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sd.o
+ $PROJ_DIR$\Debug\Obj\os_cpu_c.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_sdmmc.xcl
+ $PROJ_DIR$\Debug\Obj\cpu_core.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dfsdm.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma2d.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dsi.xcl
$PROJ_DIR$\Debug\Obj\usart.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc_ex.o
- $PROJ_DIR$\Debug\Obj\plsr_persist.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_uart.xcl
- $TOOLKIT_DIR$\inc\c\string.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ramfunc.o
- $PROJ_DIR$\Debug\Obj\modbus_rtu.xcl
$PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2s.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus.xcl
+ $PROJ_DIR$\Debug\Obj\os_task.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_uart.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pcd_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nor.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_eth.o
+ $PROJ_DIR$\Debug\Obj\usart.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc.xcl
+ $PROJ_DIR$\Debug\Obj\plsr_run_control.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc.o
$PROJ_DIR$\Debug\Obj\stm32f4xx_ll_usart.o
- $PROJ_DIR$\Debug\Obj\os_mbox.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dfsdm.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma2d.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_msp.xcl
$PROJ_DIR$\Debug\Obj\lib_mem.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ex.o
+ $PROJ_DIR$\Debug\Obj\system_stm32f4xx.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_usb.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_pwr.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rtc.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_lptim.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_spi.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dac.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ramfunc.o
$PROJ_DIR$\Debug\Obj\lib_ascii.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hcd.o
+ $PROJ_DIR$\Debug\Exe\plsr.out
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dac.o
+ $PROJ_DIR$\Debug\Obj\os_mem.o
+ $PROJ_DIR$\Debug\Obj\os_flag.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smbus.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim_ex.o
+ $PROJ_DIR$\Debug\Obj\plsr_signal_io.o
+ $PROJ_DIR$\Debug\Obj\plsr_persist.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pcd_ex.o
$PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pcd.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_qspi.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_pwr.o
$PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dac_ex.xcl
- $TOOLKIT_DIR$\lib\shb_l.a
- $PROJ_DIR$\Debug\Obj\os_cpu_c.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp.xcl
- $PROJ_DIR$\Debug\Obj\lib_math.xcl
- $PROJ_DIR$\Debug\Obj\plsr_persist.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nor.o
- $PROJ_DIR$\Debug\Obj\system_stm32f4xx.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2s.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rng.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_usb.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smbus.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pcd_ex.xcl
- $PROJ_DIR$\Debug\Obj\os_task.xcl
- $PROJ_DIR$\Debug\Exe\plsr.out
- $TOOLKIT_DIR$\inc\c\intrinsics.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma2d.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spi.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim.o
- $PROJ_DIR$\Debug\Obj\os_flag.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sd.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dac.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pccard.o
- $PROJ_DIR$\Debug\Obj\tim.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dsi.xcl
- $PROJ_DIR$\Debug\Obj\plsr_run_control.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_eth.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim_ex.o
- $PROJ_DIR$\Debug\Obj\cpu_core.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dac.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_exti.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spdifrx.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_adc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_exti.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spi.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dcmi.o
$PROJ_DIR$\Debug\Obj\plsr.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pcd_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma2d.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_tim.xcl
+ $PROJ_DIR$\Debug\Exe\plsr.hex
+ $PROJ_DIR$\Debug\Obj\os_dbg.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmc.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smartcard.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smbus.xcl
$PROJ_DIR$\Debug\Obj\stm32f4xx_hal_irda.xcl
- $PROJ_DIR$\Debug\Obj\os_sem.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c_ex.o
- $PROJ_DIR$\Debug\Obj\plsr_signal_io.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nor.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc_ex.o
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_usart.xcl
$PROJ_DIR$\Debug\Obj\cpu_c.xcl
$PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma_ex.o
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_exti.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_flash_ramfunc.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_flash_ex.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_gpio_ex.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_flash.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_gpio.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_def.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_dma.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_dma_ex.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_rcc_ex.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_tim_ex.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_tim.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_uart.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_pwr.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_it.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_rcc.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_pwr_ex.h
- $PROJ_DIR$\..\drivers\Include\tim.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_ll_utils.h
- $PROJ_DIR$\..\drivers\Include\usart.h
- $PROJ_DIR$\..\drivers\Source\gpio.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_adc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cec.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_adc_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_can.c
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_ll_pwr.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_ll_system.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_ll_rcc.h
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dfsdm.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma2d.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_exti.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cortex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_can.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_crc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_gpio.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus_ex.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dcmi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash.c
+ $PROJ_DIR$\..\drivers\Source\gpio.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dsi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_eth.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dfsdm.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_gpio.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dac.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_crc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_adc.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash_ramfunc.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cec.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dcmi_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_eth.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_exti.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dac.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma_ex.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dac_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hcd.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cortex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_pwr.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fsmc.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_i2c.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dcmi_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rtc.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_spi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_tim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_usart.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_usb.c
- $PROJ_DIR$\startup_stm32f407xx.s
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_sdmmc.c
- $PROJ_DIR$\..\modbus\modbus_rtu.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_exti.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rcc.c
- $PROJ_DIR$\..\drivers\Source\system_stm32f4xx.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_gpio.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smbus.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim_ex.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fmpi2c.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_it.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_uart.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dac.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma2d.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_crc.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_usart.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rng.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_adc.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rtc.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_tim.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_lptim.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_wwdg.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_usart.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_timebase_tim.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_usart.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_utils.c
- $PROJ_DIR$\..\drivers\Source\tim.c
- $PROJ_DIR$\..\drivers\Source\usart.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sdram.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nor.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rcc.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smartcard.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_lptim.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sram.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dac.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_wwdg.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma2d.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_exti.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_spdifrx.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fsmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_uart.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_gpio.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rcc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rng.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_sdmmc.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_spi.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nand.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_i2c.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sram.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_lptim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_it.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_pwr.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd_ex.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rcc_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smbus.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hcd.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pccard.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_msp.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rcc.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_irda.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pwr.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pwr_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_qspi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_mmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nor.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_iwdg.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pccard.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_lptim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_qspi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rng.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nand.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pwr_ex.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rtc.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rtc_ex.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rng.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai_ex.c
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sd.c
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_mmc.c
- $PROJ_DIR$\..\ucos\uC-CPU\cpu_core.h
- $PROJ_DIR$\..\ucos\uC-CPU\cpu.h
- $PROJ_DIR$\..\ucos\uC-CPU\cpu_c.c
- $PROJ_DIR$\..\plsr\param\plsr_param.c
- $PROJ_DIR$\..\modbus\modbus_rtu.h
- $PROJ_DIR$\..\plsr\run_control\plsr_run_control.c
- $PROJ_DIR$\..\ucos\uC-CPU\cpu_def.h
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pwr.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sdram.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smartcard.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_q.c
+ $PROJ_DIR$\..\ucos\uC-LIB\lib_str.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_core.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_sem.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_time.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_tmr.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mbox.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mem.c
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr_ex.xcl
+ $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus.o
$PROJ_DIR$\..\ucos\uC-LIB\app_hooks.c
- $PROJ_DIR$\..\ucos\uC-LIB\Ports\lib_mem_a.asm
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mutex.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_a.asm
+ $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_c.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_dbg.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_task.c
+ $PROJ_DIR$\..\ucos\uC-LIB\lib_math.c
+ $PROJ_DIR$\..\ucos\uC-LIB\lib_mem.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_flag.c
$PROJ_DIR$\..\ucos\uC-LIB\lib_ascii.c
- $PROJ_DIR$\..\plsr\command\plsr_command.c
- $PROJ_DIR$\..\plsr\pulse_driver\plsr_pulse_driver.c
- $PROJ_DIR$\..\plsr\plsr.c
- $PROJ_DIR$\..\ucos\uC-LIB\app_cfg.h
- $PROJ_DIR$\..\plsr\pulse_driver\plsr_pulse_driver.h
- $PROJ_DIR$\..\ucos\uC-LIB\cpu_cfg.h
- $PROJ_DIR$\..\ucos\uC-LIB\lib_ascii.h
- $PROJ_DIR$\..\plsr\run_control\plsr_run_control.h
+ $PROJ_DIR$\..\plsr\param\plsr_param.h
+ $PROJ_DIR$\..\plsr\persist\plsr_persist.h
$PROJ_DIR$\..\plsr\persist\plsr_persist.c
+ $PROJ_DIR$\..\plsr\signal_io\plsr_signal_io.c
$PROJ_DIR$\..\plsr\plsr.h
- $PROJ_DIR$\..\plsr\command\plsr_command.h
- $PROJ_DIR$\..\plsr\persist\plsr_persist.h
- $PROJ_DIR$\..\ucos\uC-LIB\lib_cfg.h
- $PROJ_DIR$\..\plsr\param\plsr_param.h
- $PROJ_DIR$\..\ucos\uC-CPU\cpu_a.asm
+ $PROJ_DIR$\startup_stm32f407xx.s
+ $PROJ_DIR$\..\plsr\pulse_driver\plsr_pulse_driver.h
$PROJ_DIR$\..\plsr\accel_curve\plsr_accel_curve.c
+ $PROJ_DIR$\..\ucos\uC-CPU\cpu_c.c
+ $PROJ_DIR$\..\ucos\uC-LIB\Ports\lib_mem_a.asm
$PROJ_DIR$\..\ucos\uC-CPU\cpu_core.c
- $PROJ_DIR$\..\ucos\uC-LIB\lib_def.h
- $PROJ_DIR$\..\ucos\uC-LIB\lib_math.c
+ $PROJ_DIR$\..\ucos\uC-CPU\cpu_a.asm
+ $PROJ_DIR$\..\drivers\Source\tim.c
+ $PROJ_DIR$\..\plsr\plsr.c
+ $PROJ_DIR$\..\plsr\pulse_driver\plsr_pulse_driver.c
+ $PROJ_DIR$\..\modbus\modbus_rtu.c
+ $PROJ_DIR$\..\plsr\param\plsr_param.c
$PROJ_DIR$\..\plsr\accel_curve\plsr_accel_curve.h
- $PROJ_DIR$\..\plsr\signal_io\plsr_signal_io.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_utils.c
+ $PROJ_DIR$\..\drivers\Source\system_stm32f4xx.c
+ $PROJ_DIR$\..\plsr\run_control\plsr_run_control.c
+ $PROJ_DIR$\..\plsr\command\plsr_command.c
+ $PROJ_DIR$\..\plsr\command\plsr_command.h
+ $PROJ_DIR$\..\plsr\run_control\plsr_run_control.h
$PROJ_DIR$\..\plsr\signal_io\plsr_signal_io.h
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_task.c
- $PROJ_DIR$\..\ucos\uC-LIB\lib_str.h
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_flag.c
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mbox.c
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mutex.c
- $PROJ_DIR$\..\ucos\uC-LIB\lib_mem.h
- $TOOLKIT_DIR$\lib\rt7M_tl.a
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_q.c
- $PROJ_DIR$\..\ucos\uCOS-II\Source\ucos_ii.h
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mem.c
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash.xcl
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_sem.c
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_qspi.o
- $PROJ_DIR$\..\ucos\uC-LIB\os_cfg.h
- $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_dbg.c
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_tmr.c
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_usart.o
- $PROJ_DIR$\..\ucos\uC-LIB\lib_str.c
- $PROJ_DIR$\..\ucos\uC-LIB\lib_math.h
- $PROJ_DIR$\..\ucos\uC-LIB\lib_mem.c
- $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_c.c
- $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu.h
- $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_a.asm
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_core.c
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_time.c
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmc.o
- $PROJ_DIR$\Debug\Obj\gpio.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_tim.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pcd.xcl
- $PROJ_DIR$\..\app\main.c
- $PROJ_DIR$\..\app\main.h
- $PROJ_DIR$\..\cmsis\Device\Include\system_stm32f4xx.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_conf.h
- $PROJ_DIR$\..\cmsis\Core\Include\cmsis_cp15.h
- $PROJ_DIR$\..\drivers\Include\gpio.h
- $PROJ_DIR$\..\cmsis\Core\Include\mpu_armv7.h
- $PROJ_DIR$\..\cmsis\Core\Include\cmsis_version.h
- $PROJ_DIR$\..\cmsis\Core\Include\core_cm4.h
- $PROJ_DIR$\..\cmsis\Device\Include\stm32f4xx.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal.h
- $PROJ_DIR$\..\drivers\Include\stm32f4xx_hal_cortex.h
- $PROJ_DIR$\..\drivers\Include\Legacy\stm32_hal_legacy.h
- $PROJ_DIR$\..\cmsis\Core\Include\cmsis_compiler.h
- $PROJ_DIR$\..\cmsis\Core\Include\cmsis_iccarm.h
- $PROJ_DIR$\..\cmsis\Device\Include\stm32f407xx.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rtc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_utils.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_exti.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_pwr.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr.xcl
- $PROJ_DIR$\Debug\Obj\os_tmr.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dac_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sram.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_usb.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus_ex.o
- $PROJ_DIR$\Debug\Obj\usart.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fsmc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_timebase_tim.o
- $PROJ_DIR$\Debug\Obj\plsr.xcl
- $PROJ_DIR$\Debug\Obj\os_mutex.xcl
- $TOOLKIT_DIR$\lib\dl7M_tln.a
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dsi.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpsmbus.o
- $PROJ_DIR$\Debug\Obj\os_time.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmpi2c.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_crc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pccard.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_gpio.xcl
- $TOOLKIT_DIR$\inc\c\ysizet.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash.o
- $PROJ_DIR$\Debug\Obj\lib_ascii.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rtc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_tim_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hcd.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash_ex.o
- $PROJ_DIR$\Debug\Obj\os_cpu_a.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sd.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cec.o
- $PROJ_DIR$\Debug\Obj\modbus_rtu.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_exti.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_lptim.o
- $PROJ_DIR$\Debug\Obj\cpu_core.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash.xcl
- $PROJ_DIR$\Debug\Obj\app_hooks.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rng.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_msp.xcl
- $PROJ_DIR$\Debug\Obj\plsr_pulse_driver.o
- $TOOLKIT_DIR$\inc\c\iccarm_builtin.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_i2c.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2c.o
- $PROJ_DIR$\Debug\Obj\lib_math.o
- $PROJ_DIR$\Debug\Obj\lib_str.o
- $PROJ_DIR$\Debug\Obj\tim.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_gpio.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_iwdg.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rcc.xcl
- $PROJ_DIR$\Debug\Obj\os_sem.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_i2c.o
- $PROJ_DIR$\Debug\Obj\os_core.o
- $PROJ_DIR$\Debug\Obj\system_stm32f4xx.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_usart.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_adc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dac.xcl
- $PROJ_DIR$\Debug\Obj\cpu_a.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ramfunc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2s_ex.xcl
- $PROJ_DIR$\Debug\Obj\os_mem.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sram.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fmpi2c.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hash.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_adc_ex.xcl
- $PROJ_DIR$\Debug\Obj\os_q.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_can.xcl
- $PROJ_DIR$\Debug\Obj\plsr_param.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc.o
- $PROJ_DIR$\Debug\Obj\os_dbg.o
- $TOOLKIT_DIR$\inc\c\yvals.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc_ex.xcl
- $PROJ_DIR$\Debug\Exe\plsr.hex
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smbus.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_it.o
- $PROJ_DIR$\Debug\Obj\os_mutex.o
- $TOOLKIT_DIR$\inc\c\DLib_Defaults.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smartcard.o
- $PROJ_DIR$\Debug\Obj\os_task.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_crc.o
- $PROJ_DIR$\Debug\Obj\main.xcl
- $PROJ_DIR$\Debug\Obj\plsr_param.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_gpio.xcl
- $PROJ_DIR$\Debug\Obj\os_dbg.xcl
- $PROJ_DIR$\Debug\List\plsr.map
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cec.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_it.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_spi.xcl
- $PROJ_DIR$\Debug\Obj\plsr_accel_curve.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dcmi_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_crc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_irda.o
- $PROJ_DIR$\Debug\Obj\gpio.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rtc_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_i2s_ex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma.o
- $PROJ_DIR$\Debug\Obj\os_mbox.xcl
- $PROJ_DIR$\Debug\Obj\os_mem.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nand.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_wwdg.o
- $TOOLKIT_DIR$\inc\c\stdint.h
- $PROJ_DIR$\apm32f407xg_flash.icf
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_lptim.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_spi.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_uart.o
- $TOOLKIT_DIR$\lib\m7M_tls.a
- $TOOLKIT_DIR$\inc\c\iar_intrinsics_common.h
- $TOOLKIT_DIR$\inc\c\stddef.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rng.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_msp.o
- $PROJ_DIR$\Debug\Obj\plsr_accel_curve.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_nand.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_dma2d.o
- $PROJ_DIR$\Debug\Obj\plsr_pulse_driver.xcl
- $PROJ_DIR$\Debug\Obj\plsr_command.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_mmc.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_spdifrx.xcl
- $PROJ_DIR$\Debug\Obj\app_hooks.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_smartcard.xcl
- $PROJ_DIR$\Debug\Obj\startup_stm32f407xx.o
- $PROJ_DIR$\Debug\Obj\os_q.xcl
- $TOOLKIT_DIR$\inc\c\ycheck.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rng.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dma2d.xcl
- $PROJ_DIR$\Debug\Obj\cpu_c.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_can.o
- $PROJ_DIR$\Debug\Obj\lib_str.xcl
- $TOOLKIT_DIR$\inc\c\DLib_Product.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_fmpi2c_ex.xcl
- $PROJ_DIR$\Debug\Obj\lib_mem.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_ltdc_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sai.o
- $PROJ_DIR$\Debug\Obj\os_core.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sdram.o
- $PROJ_DIR$\Debug\Obj\plsr.pbd
- $PROJ_DIR$\Debug\Obj\plsr_run_control.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_hcd.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_rcc_ex.o
- $PROJ_DIR$\Debug\Obj\os_cpu_c.xcl
- $PROJ_DIR$\Debug\Obj\main.o
- $PROJ_DIR$\Debug\Obj\plsr_command.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_sdmmc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_eth.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_crc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_rcc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cortex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_sdram.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_timebase_tim.xcl
- $PROJ_DIR$\Debug\Obj\lib_mem_a.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cortex.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_flash_ex.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_fsmc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_wwdg.xcl
- $PROJ_DIR$\Debug\Obj\os_time.o
- $PROJ_DIR$\Debug\Obj\os_flag.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_iwdg.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_gpio.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_mmc.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_utils.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_ll_lptim.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_cryp.o
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_pwr_ex.o
- $TOOLKIT_DIR$\inc\c\DLib_Config_Full.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dcmi_ex.o
- $PROJ_DIR$\Debug\Obj\os_tmr.xcl
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_lptim.o
- $TOOLKIT_DIR$\inc\c\DLib_Product_string.h
- $PROJ_DIR$\Debug\Obj\stm32f4xx_hal_dfsdm.xcl
+ $PROJ_DIR$\..\drivers\Source\usart.c
[ROOT_NODE]
- ILINK
- 46 381
-
-
-
-
- $PROJ_DIR$\Debug\Exe\plsr.out
-
-
- OBJCOPY
- 367
-
-
- ILINK
- 381
-
-
-
-
- ILINK
- 400 327 350 424 325 391 313 335 430 449 336 440 322 344 318 32 364 455 20 396 370 360 74 374 454 287 70 409 441 362 13 331 58 1 418 428 27 12 425 321 450 444 461 303 62 288 10 464 21 421 22 79 302 59 66 312 49 16 291 43 304 295 457 357 317 316 334 75 18 393 390 340 466 3 386 458 408 410 36 55 25 72 354 462 246 68 438 407 363 392 432 339 53 434 373 42 64 50 289 51 60 298 403 250 398 369 347 376 2 394 411 323 259 306 452 338 343 324 29 445 329 282 442 402 4 19 41 283 345 337 296 31 240 404 301
-
-
-
-
- $PROJ_DIR$\..\drivers\Source\gpio.c
-
-
- ICCARM
- 391
-
-
- BICOMP
- 260
-
-
-
-
- ICCARM
- 268 264 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal.c
-
-
- ICCARM
- 428
-
-
- BICOMP
- 375
-
-
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_adc.c
-
-
- ICCARM
- 27
-
-
- BICOMP
- 308
-
-
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
+ ILINK
+ 230
-
+
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_adc_ex.c
+ $PROJ_DIR$\..\app\main.c
ICCARM
- 12
+ 107
BICOMP
- 359
+ 41
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_can.c
+ $PROJ_DIR$\Debug\Exe\plsr.out
- ICCARM
- 425
-
-
- BICOMP
- 361
+ OBJCOPY
+ 245
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cec.c
ICCARM
- 421
+ 52
BICOMP
- 358
+ 157
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma2d.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_adc_ex.c
ICCARM
- 22
+ 255
BICOMP
- 423
+ 83
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp_ex.c
ICCARM
- 43
+ 129
BICOMP
- 429
+ 219
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dcmi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dfsdm.c
ICCARM
- 10
+ 191
BICOMP
- 6
+ 80
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dsi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma2d.c
ICCARM
- 302
+ 243
BICOMP
- 57
+ 150
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_exti.c
ICCARM
- 312
+ 111
BICOMP
- 326
+ 183
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dfsdm.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cortex.c
ICCARM
- 21
+ 64
BICOMP
- 468
+ 144
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_can.c
ICCARM
- 79
+ 173
BICOMP
- 372
+ 72
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_gpio.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_crc.c
ICCARM
- 457
+ 71
BICOMP
- 379
+ 22
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c.c
ICCARM
- 303
+ 32
BICOMP
- 7
+ 248
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dac.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus.c
ICCARM
- 62
+ 361
BICOMP
- 349
+ 199
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_crc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_gpio.c
ICCARM
- 444
+ 117
BICOMP
- 307
+ 45
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash_ramfunc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus_ex.c
ICCARM
- 16
+ 197
BICOMP
- 351
+ 205
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dcmi.c
ICCARM
- 461
+ 241
BICOMP
- 33
+ 184
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash.c
ICCARM
- 334
+ 164
BICOMP
- 28
+ 252
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cec.c
+ $PROJ_DIR$\..\drivers\Source\gpio.c
ICCARM
- 321
+ 51
BICOMP
- 382
+ 92
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dcmi_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dsi.c
ICCARM
- 464
+ 145
BICOMP
- 388
+ 194
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_eth.c
ICCARM
- 59
+ 208
BICOMP
- 443
+ 132
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_exti.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash.c
ICCARM
- 66
+ 39
BICOMP
- 284
+ 8
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dac_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_adc.c
ICCARM
- 288
+ 213
BICOMP
- 30
+ 37
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash_ramfunc.c
ICCARM
- 304
+ 227
BICOMP
- 39
+ 68
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c_ex.c
ICCARM
- 357
+ 210
BICOMP
- 244
+ 160
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal.c
ICCARM
- 317
+ 161
BICOMP
- 328
+ 12
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dac.c
ICCARM
- 18
+ 231
BICOMP
- 38
+ 59
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma.c
ICCARM
- 393
+ 60
BICOMP
- 352
+ 247
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpi2c.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dma_ex.c
ICCARM
- 291
+ 258
BICOMP
- 67
+ 70
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hcd.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dac_ex.c
ICCARM
- 316
+ 125
BICOMP
- 437
+ 240
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_fmpsmbus_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cryp.c
ICCARM
- 295
+ 98
BICOMP
- 9
+ 186
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash_ex.c
ICCARM
- 75
+ 217
BICOMP
- 280
+ 81
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_cortex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_dcmi_ex.c
ICCARM
- 450
+ 156
BICOMP
- 446
+ 119
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_flash_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rtc.c
ICCARM
- 49
+ 25
BICOMP
- 451
+ 222
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_pwr.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_spi.c
ICCARM
- 29
+ 141
BICOMP
- 285
+ 225
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fsmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_tim.c
ICCARM
- 452
+ 110
BICOMP
- 297
+ 244
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_i2c.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_usart.c
ICCARM
- 343
+ 214
BICOMP
- 333
+ 256
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_usb.c
ICCARM
- 259
+ 220
BICOMP
- 292
+ 50
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_spi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smbus.c
ICCARM
- 402
+ 234
BICOMP
- 384
+ 253
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_usb.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim_ex.c
ICCARM
- 41
+ 235
BICOMP
- 290
-
-
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
-
-
- $PROJ_DIR$\startup_stm32f407xx.s
-
-
- AARM
- 418
+ 47
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_sdmmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fmpi2c.c
ICCARM
- 442
+ 4
BICOMP
- 5
-
-
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
+ 105
-
+
- $PROJ_DIR$\..\modbus\modbus_rtu.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_crc.c
ICCARM
- 322
+ 18
BICOMP
- 17
+ 136
-
-
- ICCARM
- 206 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 242 215 203 47 405 208 217 247 255 15 467 221 225 216 268 264 222 223
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_exti.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_adc.c
ICCARM
- 323
+ 172
BICOMP
- 63
+ 100
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rcc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_usart.c
ICCARM
- 445
+ 88
BICOMP
- 341
+ 74
- $PROJ_DIR$\..\drivers\Source\system_stm32f4xx.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim.c
ICCARM
- 345
+ 192
BICOMP
- 37
+ 203
-
-
- ICCARM
- 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 273 266 95 86 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_gpio.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_timebase_tim.c
ICCARM
- 338
+ 57
BICOMP
- 310
+ 120
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fmpi2c.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dac.c
ICCARM
- 306
+ 226
BICOMP
- 356
+ 177
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_it.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_wwdg.c
ICCARM
- 369
+ 128
BICOMP
- 383
+ 106
-
-
- ICCARM
- 264 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 94 242 215 203 47 405 208 217 247 255 233
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_uart.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma2d.c
ICCARM
- 403
+ 27
BICOMP
- 14
+ 193
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dac.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_exti.c
ICCARM
- 2
+ 34
BICOMP
- 54
+ 65
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma2d.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_spdifrx.c
ICCARM
- 411
+ 97
BICOMP
- 48
+ 165
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_crc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fmc.c
ICCARM
- 376
+ 249
BICOMP
- 389
+ 202
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_usart.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_fsmc.c
ICCARM
- 250
+ 113
BICOMP
- 346
+ 2
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rng.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_uart.c
ICCARM
- 329
+ 56
BICOMP
- 422
+ 201
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_adc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_gpio.c
ICCARM
- 347
+ 24
BICOMP
- 65
+ 185
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rtc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma.c
ICCARM
- 282
+ 152
BICOMP
- 314
+ 102
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_tim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rcc.c
ICCARM
- 4
+ 104
BICOMP
- 261
+ 10
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_lptim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_rng.c
ICCARM
- 324
+ 46
BICOMP
- 460
+ 163
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_wwdg.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_sdmmc.c
ICCARM
- 398
+ 151
BICOMP
- 453
+ 189
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_dma.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_spi.c
ICCARM
- 394
+ 176
BICOMP
- 71
+ 96
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_timebase_tim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_i2c.c
ICCARM
- 298
+ 76
BICOMP
- 448
+ 11
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_usart.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sram.c
ICCARM
- 19
+ 44
BICOMP
- 0
+ 108
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_utils.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_lptim.c
ICCARM
- 283
+ 223
BICOMP
- 459
+ 116
-
-
- ICCARM
- 98 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 273 266 95 86 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 107 106 105
-
-
- $PROJ_DIR$\..\drivers\Source\tim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_it.c
ICCARM
- 337
+ 85
BICOMP
- 56
+ 135
-
-
- ICCARM
- 97 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 264
-
-
- $PROJ_DIR$\..\drivers\Source\usart.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_pwr.c
ICCARM
- 296
+ 221
BICOMP
- 11
+ 130
-
-
- ICCARM
- 99 264 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sdram.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c.c
ICCARM
- 434
+ 29
BICOMP
- 447
+ 207
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2c_ex.c
ICCARM
- 386
+ 75
BICOMP
- 431
+ 198
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nor.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s_ex.c
ICCARM
- 36
+ 23
BICOMP
- 77
+ 112
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rcc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd_ex.c
ICCARM
- 68
+ 238
BICOMP
- 348
+ 204
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smartcard.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rcc_ex.c
ICCARM
- 373
+ 126
BICOMP
- 417
+ 166
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_lptim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hcd.c
ICCARM
- 466
+ 229
BICOMP
- 401
+ 146
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sram.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc_ex.c
ICCARM
- 289
+ 127
BICOMP
- 355
+ 78
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_spdifrx.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pccard.c
ICCARM
- 64
+ 36
BICOMP
- 415
+ 179
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_spi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_msp.c
ICCARM
- 50
+ 124
BICOMP
- 69
+ 215
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rcc.c
ICCARM
- 51
+ 89
BICOMP
- 293
+ 95
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_tim_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_irda.c
ICCARM
- 60
+ 6
BICOMP
- 315
+ 254
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nand.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_mmc.c
ICCARM
- 410
+ 121
BICOMP
- 397
+ 137
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rcc_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nor.c
ICCARM
- 438
+ 206
BICOMP
- 366
+ 103
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd.c
ICCARM
- 339
+ 239
BICOMP
- 279
+ 93
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smbus.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_iwdg.c
ICCARM
- 42
+ 48
BICOMP
- 368
+ 82
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_lptim.c
ICCARM
- 25
+ 69
BICOMP
- 262
+ 131
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_qspi.c
ICCARM
- 432
+ 101
BICOMP
- 281
+ 114
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_msp.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_i2s.c
ICCARM
- 408
+ 196
BICOMP
- 330
+ 40
-
-
- ICCARM
- 264 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_irda.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rng.c
ICCARM
- 390
+ 170
BICOMP
- 73
+ 181
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pcd_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_hash_ex.c
ICCARM
- 72
+ 224
BICOMP
- 44
+ 28
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pwr.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_nand.c
ICCARM
- 354
+ 19
BICOMP
- 286
+ 16
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
$PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pwr_ex.c
ICCARM
- 462
+ 58
BICOMP
- 294
+ 360
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rtc.c
ICCARM
- 3
+ 67
BICOMP
- 8
+ 49
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_qspi.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rtc_ex.c
ICCARM
- 246
+ 26
BICOMP
- 26
+ 20
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_iwdg.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai.c
ICCARM
- 340
+ 133
BICOMP
- 456
+ 118
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pccard.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_ltdc.c
ICCARM
- 55
+ 180
BICOMP
- 309
+ 211
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rtc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sai_ex.c
ICCARM
- 363
+ 138
BICOMP
- 319
+ 7
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rtc_ex.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sd.c
ICCARM
- 392
+ 187
BICOMP
- 387
+ 17
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_rng.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_pwr.c
ICCARM
- 407
+ 250
BICOMP
- 40
+ 123
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sd.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_sdram.c
ICCARM
- 53
+ 162
BICOMP
- 320
+ 153
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_mmc.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_hal_smartcard.c
ICCARM
- 458
+ 251
BICOMP
- 414
+ 79
-
-
- ICCARM
- 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\ucos\uC-CPU\cpu_c.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_q.c
ICCARM
- 424
+ 61
BICOMP
- 78
+ 154
-
-
- ICCARM
- 203 47 332 365 371 463 427 405 208 217 202 229 239 224 235 218
-
-
- $PROJ_DIR$\..\plsr\param\plsr_param.c
+ $PROJ_DIR$\..\ucos\uC-LIB\lib_str.c
ICCARM
- 362
+ 31
BICOMP
- 378
+ 167
-
-
- ICCARM
- 225 399 420 365 371 463 427 223 222 206 273 266 95 86 272 278 271 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 242 215 203 47 405 208 217 247 255 15 467
-
-
- $PROJ_DIR$\..\plsr\run_control\plsr_run_control.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_core.c
ICCARM
- 58
+ 84
BICOMP
- 436
+ 134
-
-
- ICCARM
- 219 399 420 365 371 463 427 231 225 216 273 266 95 86 272 278 271 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 222 233 242 215 203 47 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uC-LIB\app_hooks.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_sem.c
ICCARM
- 327
+ 73
BICOMP
- 416
+ 174
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255 273 266 95 86 272 278 271 399 420 270 276 277 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92
-
-
- $PROJ_DIR$\..\ucos\uC-LIB\Ports\lib_mem_a.asm
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_time.c
- AARM
- 449
+ ICCARM
+ 99
+
+
+ BICOMP
+ 14
- $PROJ_DIR$\..\ucos\uC-LIB\lib_ascii.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_tmr.c
ICCARM
- 313
+ 9
BICOMP
- 24
+ 109
-
-
- ICCARM
- 218 203 47 332 365 371 463 427 405 208 217 229
-
-
- $PROJ_DIR$\..\plsr\command\plsr_command.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mbox.c
ICCARM
- 441
+ 43
BICOMP
- 413
+ 140
-
-
- ICCARM
- 222 399 420 365 371 463 427 225 219 221 223 206 273 266 95 86 272 278 271 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 242 215 203 47 405 208 217 247 255
-
-
- $PROJ_DIR$\..\plsr\pulse_driver\plsr_pulse_driver.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mem.c
ICCARM
- 331
+ 232
BICOMP
- 412
+ 94
-
-
- ICCARM
- 216 399 420 365 371 463 427 273 266 95 86 272 278 271 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 225 264
-
-
- $PROJ_DIR$\..\plsr\plsr.c
+ $PROJ_DIR$\..\ucos\uC-LIB\app_hooks.c
ICCARM
- 70
+ 35
BICOMP
- 299
+ 149
-
-
- ICCARM
- 221 399 420 365 371 463 427 225 216 273 266 95 86 272 278 271 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 219 223 222 233 242 215 203 47 405 208 217 247 255
-
-
- $PROJ_DIR$\..\plsr\persist\plsr_persist.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mutex.c
ICCARM
- 13
+ 66
BICOMP
- 35
+ 54
-
-
- ICCARM
- 223 399 420 365 371 463 427 225 222 219 206 273 266 95 86 272 278 271 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 242 215 203 47 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uC-CPU\cpu_a.asm
+ $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_a.asm
AARM
- 350
+ 122
- $PROJ_DIR$\..\plsr\accel_curve\plsr_accel_curve.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_c.c
ICCARM
- 409
+ 188
BICOMP
- 385
+ 77
-
-
- ICCARM
- 231 399 420 365 371 463 427 225
-
-
- $PROJ_DIR$\..\ucos\uC-CPU\cpu_core.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_dbg.c
ICCARM
- 325
+ 246
BICOMP
- 61
+ 143
-
-
- ICCARM
- 202 203 47 332 365 371 463 427 405 208 217 229 239 224 235 218
-
-
- $PROJ_DIR$\..\ucos\uC-LIB\lib_math.c
+ $PROJ_DIR$\..\ucos\uCOS-II\Source\os_task.c
ICCARM
- 335
+ 30
BICOMP
- 34
+ 200
-
-
- ICCARM
- 252 203 47 332 365 371 463 427 405 208 217 202 229 239 224 235 218
-
-
- $PROJ_DIR$\..\plsr\signal_io\plsr_signal_io.c
+ $PROJ_DIR$\..\ucos\uC-LIB\lib_math.c
ICCARM
- 1
+ 55
BICOMP
- 76
+ 182
-
-
- ICCARM
- 233 399 420 365 371 463 427 225 219 264 273 266 95 86 272 278 271 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 242 215 203 47 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_task.c
+ $PROJ_DIR$\..\ucos\uC-LIB\lib_mem.c
ICCARM
- 374
+ 142
BICOMP
- 45
+ 216
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
-
-
$PROJ_DIR$\..\ucos\uCOS-II\Source\os_flag.c
ICCARM
- 455
+ 87
BICOMP
- 52
+ 233
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mbox.c
+ $PROJ_DIR$\..\ucos\uC-LIB\lib_ascii.c
ICCARM
- 20
+ 5
BICOMP
- 395
+ 228
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mutex.c
+ $PROJ_DIR$\..\plsr\persist\plsr_persist.c
ICCARM
- 370
+ 237
BICOMP
- 300
+ 178
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_q.c
+ $PROJ_DIR$\..\plsr\signal_io\plsr_signal_io.c
ICCARM
- 360
+ 236
BICOMP
- 419
+ 91
-
+
+
+ $PROJ_DIR$\startup_stm32f407xx.s
+
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
+ AARM
+ 86
-
+
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_mem.c
+ $PROJ_DIR$\..\plsr\accel_curve\plsr_accel_curve.c
ICCARM
- 396
+ 147
BICOMP
- 353
+ 158
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_sem.c
+ $PROJ_DIR$\..\ucos\uC-CPU\cpu_c.c
ICCARM
- 74
+ 13
BICOMP
- 342
+ 257
-
+
+
+ $PROJ_DIR$\..\ucos\uC-LIB\Ports\lib_mem_a.asm
+
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
+ AARM
+ 90
-
+
- $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_dbg.c
+ $PROJ_DIR$\..\ucos\uC-CPU\cpu_core.c
ICCARM
- 364
+ 53
BICOMP
- 380
+ 190
-
+
+
+ $PROJ_DIR$\..\ucos\uC-CPU\cpu_a.asm
+
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
+ AARM
+ 63
-
+
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_tmr.c
+ $PROJ_DIR$\..\drivers\Source\tim.c
ICCARM
- 287
+ 21
BICOMP
- 465
+ 175
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uC-LIB\lib_str.c
+ $PROJ_DIR$\..\plsr\plsr.c
ICCARM
- 336
+ 242
BICOMP
- 426
+ 3
-
-
- ICCARM
- 235 203 47 332 365 371 463 427 405 208 217 229 218 224
-
-
- $PROJ_DIR$\..\ucos\uC-LIB\lib_mem.c
+ $PROJ_DIR$\..\plsr\pulse_driver\plsr_pulse_driver.c
ICCARM
- 430
+ 33
BICOMP
- 23
+ 155
-
-
- ICCARM
- 239 203 47 332 365 371 463 427 405 208 217 202 229 235 218 224 252
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_c.c
+ $PROJ_DIR$\..\modbus\modbus_rtu.c
ICCARM
- 32
+ 139
BICOMP
- 439
+ 42
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255 229
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Ports\os_cpu_a.asm
+ $PROJ_DIR$\..\plsr\param\plsr_param.c
- AARM
- 318
+ ICCARM
+ 62
+
+
+ BICOMP
+ 38
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_core.c
+ $PROJ_DIR$\..\drivers\Source\stm32f4xx_ll_utils.c
ICCARM
- 344
+ 15
BICOMP
- 433
+ 115
-
-
- ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
-
-
- $PROJ_DIR$\..\ucos\uCOS-II\Source\os_time.c
+ $PROJ_DIR$\..\drivers\Source\system_stm32f4xx.c
ICCARM
- 454
+ 148
BICOMP
- 305
+ 218
-
+
+
+ $PROJ_DIR$\..\plsr\run_control\plsr_run_control.c
+
ICCARM
- 242 215 203 47 332 365 371 463 427 405 208 217 247 255
+ 212
+
+
+ BICOMP
+ 168
-
+
- $PROJ_DIR$\..\app\main.c
+ $PROJ_DIR$\..\plsr\command\plsr_command.c
ICCARM
- 440
+ 171
BICOMP
- 377
+ 169
-
+
+
+ $PROJ_DIR$\..\drivers\Source\usart.c
+
ICCARM
- 264 273 266 95 86 272 278 271 399 420 365 371 463 427 270 276 277 332 267 269 265 275 406 311 89 85 83 80 87 88 274 84 82 81 93 96 91 90 92 99 268 242 215 203 47 405 208 217 247 255 206 97 221 225
+ 209
-
+
+ BICOMP
+ 195
+
+
diff --git a/plsr/accel_curve/plsr_accel_curve.c b/plsr/accel_curve/plsr_accel_curve.c
index 8671300..143c364 100644
--- a/plsr/accel_curve/plsr_accel_curve.c
+++ b/plsr/accel_curve/plsr_accel_curve.c
@@ -1,219 +1,242 @@
/**
* @file plsr_accel_curve.c
- * @brief 脉冲域规划/取频:直线 f^2=f0^2±2an;S/正弦按时间轴剖面
+ * @brief 脉冲域规划/取频:直线 frequency_hz^2=start_frequency_hz^2±2an;S/正弦按时间轴剖面
*
* ============================================================================
* 【阅读指南 — 先看这个再往下翻 if/else】
* ============================================================================
*
- * 本文件只做一件事:给定「段入口 f_cur、目标 f_tgt、出口 f_end、总脉冲 N、
- * 曲线模式 mode」,算出三相预算 acc_n / const_n / dec_n,以及运行时每拍该什么频率。
+ * 本文件只做一件事:给定「段入口 start_frequency_hz、目标 target_frequency_hz、出口 end_frequency_hz、总脉冲 N、
+ * 曲线模式 curve_mode」,算出三相预算 accel_pulses / constant_pulses / decel_pulses,以及运行时每拍该什么频率。
*
* 一、名词(全文件统一)
- * f_cur 段入口频率(规划后实际起点,常由 run_control 的 ResolveStartHz 给出)
- * f_tgt 段目标峰值(段表频率;脉冲不够时会被 FitPeak 压低)
- * f_end 段出口频率(run_control 按 wait/止速 解析后传入)
- * acc_n 从 f_cur 爬到 f_tgt 需要的脉冲个数
- * const_n 保持 f_tgt 的匀速脉冲个数
- * dec_n 从 f_tgt 收到 f_end 的脉冲个数
- * a_acc 加速斜率 Hz/s ≈ default_speed*1000/accel_ms
- * a_dec 减速斜率 Hz/s ≈ default_speed*1000/decel_ms
+ * start_frequency_hz 段入口频率(规划后实际起点,常由 run_control 的 ResolveStartHz 给出)
+ * target_frequency_hz 段目标峰值(段表频率;脉冲不够时会被 FitPeak 压低)
+ * end_frequency_hz 段出口频率(run_control 按 wait/止速 解析后传入)
+ * accel_pulses 从 start_frequency_hz 爬到 target_frequency_hz 需要的脉冲个数
+ * constant_pulses 保持 target_frequency_hz 的匀速脉冲个数
+ * decel_pulses 从 target_frequency_hz 收到 end_frequency_hz 的脉冲个数
+ * accel_rate_hz_per_s 加速斜率 Hz/s ≈ default_speed*1000/acceleration_time_ms
+ * decel_rate_hz_per_s 减速斜率 Hz/s ≈ default_speed*1000/deceleration_time_ms
*
- * 二、三种曲线模式(mode)
- * LINEAR 直线:f_n = sqrt(f0^2 ± 2*a*n);ISR 里 SquareStep ±1Hz 逼近
- * S 时间域 jerk 梯形;规划/ISR 用离散 Δt=1/f 仿真;ISR 查预建表
+ * 二、三种曲线模式(curve_mode)
+ * LINEAR 直线:f_n = sqrt(start_frequency_hz^2 ± 2*a*pulse_count);ISR 里 SquareStep ±1Hz 逼近
+ * S 时间域 jerk 梯形;规划/ISR 用离散 Δt=1/frequency_hz 仿真;ISR 查预建表
* SINE raised-cosine 时间剖面;同上,查预建表
*
* 三、主流程(函数调用链)
* ResolveStartHz / ResolveEndHz → 起跳/落地(配置起止速=0 时用)
* PlsrAccelCurvePlan → 估 acc/dec/const;不够则砍匀速再降峰
- * PlsrAccelPulseRtPrebuild → S/正弦预建频率表(任务上下文,勿在 ISR)
+ * PlsrAccelPrebuildFrequencyTables → S/正弦预建频率表(任务上下文,勿在 ISR)
* PlsrAccelCurveFreqAtPulse → 按「已完成脉冲数」取频(任务侧 RefreshProfile)
- * PlsrAccelPulseRtStep → ISR 每 UPDATE 前进一步,返回下一拍频率
+ * PlsrAccelNextFrequency → ISR 每 UPDATE 前进一步,返回下一拍频率
*
* 四、Plan 里 if/else 决策树(见 PlsrAccelCurvePlan 内注释)
* total=0 → 全 0 返回
* acc+dec <= total → 有匀速:const = total - acc - dec
- * acc+dec > total → 无匀速:FitPeak 降 f_tgt 直到 acc+dec 放得下
+ * acc+dec > total → 无匀速:FitPeak 降 target_frequency_hz 直到 acc+dec 放得下
*
- * 五、FreqAtPulse 的 pulse_done 含义(易混)
- * pulse_done = 已完成脉冲数(不是「当前第几拍」)
- * done=0 → 第 1 拍频率 = f_cur;done=1 → 第 2 拍 ≈ sqrt(f_cur^2+2a) …
+ * 五、FreqAtPulse 的 completed_segment_pulses 含义(易混)
+ * completed_segment_pulses = 已完成脉冲数(不是「当前第几拍」)
+ * done=0 → 第 1 拍频率 = start_frequency_hz;done=1 → 第 2 拍 ≈ sqrt(start_frequency_hz^2+2a) …
*
* @details 模块职责
* 实现 plsr_accel_curve.h 全部 API。核心路径:
- * Plan → 估 acc_n/dec_n → 不够则先砍 const_n,再 FitPeak 降峰;
- * PulseRtBeginAcc/Dec/Const + Step 供 ISR 每脉冲改频。
+ * Plan → 估 accel_pulses/decel_pulses → 不够则先砍 constant_pulses,再 FitPeak 降峰;
+ * BeginAcceleration/BeginDeceleration/BeginConstantSpeed + NextFrequency
+ * 供 ISR 每个脉冲更新频率。
*/
#include "plsr_accel_curve.h"
#include
+PlsrAccelPlan_t g_plsr_accel_plan;
+PlsrAccelRuntime_t g_plsr_accel_runtime;
+
/* 频率大于 100k 时暂时钳到 100k;启动门禁另报 0x04 */
-static uint32_t PlsrAccelCurveClampFreq(uint32_t freq_hz)
+static uint32_t PlsrAccelCurveClampFrequencyHz(uint32_t frequency_hz)
{
- if (freq_hz > 100000U)
+ if (frequency_hz > 100000U)
{
- freq_hz = 100000U;
+ frequency_hz = 100000U;
}
- return freq_hz;
+ return frequency_hz;
}
/*============================================================================*/
/* 整数开方 / 斜率时间 */
/*============================================================================*/
-/** @brief |a-b| */
-static uint32_t PlsrAccelCurveAbsDiff(uint32_t a, uint32_t b)
+/** @brief 两个无符号数之间的距离 */
+static uint32_t PlsrAccelCurveAbsoluteDifference(uint32_t first_value, uint32_t second_value)
{
- return (a >= b) ? (a - b) : (b - a);
+ return (first_value >= second_value) ?
+ (first_value - second_value) : (second_value - first_value);
}
-/** 64 位整数平方根(牛顿法),支持 f^2 + 2an */
-static uint32_t PlsrAccelCurveIsqrt64(uint64_t val)
+/** 64 位整数平方根(牛顿法),支持 frequency_hz^2 + 2an */
+static uint32_t PlsrAccelCurveIntegerSquareRoot(uint64_t squared_frequency)
{
- uint64_t x;
- uint64_t x2;
- uint32_t i;
+ uint64_t estimate;
+ uint64_t next_estimate;
+ uint32_t loop_index;
- if (val <= 1ULL)
+ if (squared_frequency <= 1ULL)
{
- return (uint32_t)val;
+ return (uint32_t)squared_frequency;
}
- x = val;
- if (x > 100000ULL)
+ estimate = squared_frequency;
+ if (estimate > 100000ULL)
{
- x = 100000ULL;
+ estimate = 100000ULL;
}
- for (i = 0U; i < 40U; i++)
+ for (loop_index = 0U; loop_index < 40U; loop_index++)
{
- x2 = (x + val / x) / 2ULL;
- if (x2 >= x)
+ next_estimate = (estimate + squared_frequency / estimate) / 2ULL;
+ if (next_estimate >= estimate)
{
break;
}
- x = x2;
+ estimate = next_estimate;
}
- return (uint32_t)x;
+ return (uint32_t)estimate;
}
/**
- * a = default_spd * 1000 / ramp_ms(Hz/s)。ramp_ms=0 → a=0(阶跃)。
- * 与 Plan 里 a_acc/a_dec 同一公式,起跳/落地必须共用,否则首末频对手算对不上。
+ * a = default_speed_hz * 1000 / ramp_time_ms(Hz/s)。ramp_time_ms=0 → a=0(阶跃)。
+ * 与 Plan 里 accel_rate_hz_per_s/decel_rate_hz_per_s 同一公式,起跳/落地必须共用,否则首末频对手算对不上。
*/
-static uint32_t PlsrAccelCurveAccelHzS(uint32_t default_spd, uint32_t ramp_ms)
+static uint32_t PlsrAccelCurveRateFromDefaultSpeed(uint32_t default_speed_hz, uint32_t ramp_time_ms)
{
- if (ramp_ms == 0U)
+ if (ramp_time_ms == 0U)
{
return 0U;
}
- if (default_spd == 0U)
+ if (default_speed_hz == 0U)
{
return 0U;
}
- return (default_spd * 1000UL) / ramp_ms;
+ return (default_speed_hz * 1000UL) / ramp_time_ms;
+}
+
+/** 按默认速度计算变化率;默认速度未配置时用本段频差计算。 */
+static uint32_t PlsrAccelCurveCalculateRate(uint32_t default_speed_hz,
+ uint32_t start_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t ramp_time_ms)
+{
+ uint32_t rate_hz_per_s;
+ uint32_t frequency_difference_hz;
+
+ rate_hz_per_s = PlsrAccelCurveRateFromDefaultSpeed(default_speed_hz, ramp_time_ms);
+ if ((rate_hz_per_s != 0U) || (ramp_time_ms == 0U))
+ {
+ return rate_hz_per_s;
+ }
+
+ frequency_difference_hz =
+ PlsrAccelCurveAbsoluteDifference(start_frequency_hz, end_frequency_hz);
+ if (frequency_difference_hz == 0U)
+ {
+ return 0U;
+ }
+ return (frequency_difference_hz * 1000UL) / ramp_time_ms;
}
/**
- * 起跳/落地:f = sqrt(f_from^2 + 2a),a 与斜坡规划相同。
- * 不钳到 f_to;f_from=0 → sqrt(2a)。
+ * 起跳/落地:frequency_hz = sqrt(starting_frequency_hz^2 + 2a),a 与斜坡规划相同。
+ * 不钳到 f_to;starting_frequency_hz=0 → sqrt(2a)。
*/
-static uint32_t PlsrAccelCurveJumpFreqFromA(uint32_t f_from, uint32_t a_hz_s)
+static uint32_t PlsrAccelCurveCalculateJumpFrequency(uint32_t starting_frequency_hz, uint32_t acceleration_hz_per_s)
{
- uint64_t val;
- uint32_t f;
+ uint64_t squared_frequency;
+ uint32_t frequency_hz;
- if (a_hz_s == 0U)
+ if (acceleration_hz_per_s == 0U)
{
- return (f_from >= 1U) ? PlsrAccelCurveClampFreq(f_from) : 1U;
+ return (starting_frequency_hz >= 1U) ? PlsrAccelCurveClampFrequencyHz(starting_frequency_hz) : 1U;
}
- val = (uint64_t)f_from * (uint64_t)f_from + (2ULL * (uint64_t)a_hz_s);
- f = PlsrAccelCurveIsqrt64(val);
- if (f < 1U)
+ squared_frequency = (uint64_t)starting_frequency_hz * (uint64_t)starting_frequency_hz + (2ULL * (uint64_t)acceleration_hz_per_s);
+ frequency_hz = PlsrAccelCurveIntegerSquareRoot(squared_frequency);
+ if (frequency_hz < 1U)
{
- f = 1U;
+ frequency_hz = 1U;
}
- return PlsrAccelCurveClampFreq(f);
+ return PlsrAccelCurveClampFrequencyHz(frequency_hz);
}
/**
* 解析配置起速/止速 → 本段实际入口或出口频率。
*
* 三分支(按顺序判断,命中即 return):
- * ① f_cfg > f_tgt → 直接用 f_cfg(例如起速 500、目标 200:先高位再减)
- * ② f_tgt < jump → 用 f_tgt(目标比起跳还低,没必要从 jump 起)
- * ③ 否则 → 用 jump = sqrt(f_cfg^2 + 2a)
+ * ① configured_frequency_hz > target_frequency_hz → 直接用 configured_frequency_hz(例如起速 500、目标 200:先高位再减)
+ * ② target_frequency_hz < jump_frequency_hz → 用 target_frequency_hz(目标比起跳还低,没必要从 jump_frequency_hz 起)
+ * ③ 否则 → 用 jump_frequency_hz = sqrt(configured_frequency_hz^2 + 2a)
*
- * is_start=1 用 accel_ms 算 a;is_start=0 用 decel_ms(ResolveEndHz 止速侧)。
+ * resolving_start=1 用 acceleration_time_ms 算 a;resolving_start=0 用 deceleration_time_ms(ResolveEndHz 止速侧)。
*/
-static uint32_t PlsrAccelCurveResolveBoundHz(uint32_t f_cfg,
- uint32_t f_tgt,
- uint32_t default_spd,
- uint32_t accel_ms,
- uint32_t decel_ms,
- uint8_t is_start)
+static uint32_t PlsrAccelCurveResolveBoundaryFrequency(uint32_t configured_frequency_hz,
+ uint32_t target_frequency_hz,
+ uint32_t default_speed_hz,
+ uint32_t acceleration_time_ms,
+ uint32_t deceleration_time_ms,
+ uint8_t resolving_start)
{
- uint32_t ramp_ms;
- uint32_t a_hz_s;
- uint32_t jump;
+ uint32_t ramp_time_ms;
+ uint32_t acceleration_hz_per_s;
+ uint32_t jump_frequency_hz;
- f_cfg = PlsrAccelCurveClampFreq(f_cfg);
- f_tgt = PlsrAccelCurveClampFreq(f_tgt);
- if (f_tgt < 1U)
+ configured_frequency_hz = PlsrAccelCurveClampFrequencyHz(configured_frequency_hz);
+ target_frequency_hz = PlsrAccelCurveClampFrequencyHz(target_frequency_hz);
+ if (target_frequency_hz < 1U)
{
return 1U;
}
/* 配置起/止速 > 目标:用配置速 */
- if (f_cfg > f_tgt)
+ if (configured_frequency_hz > target_frequency_hz)
{
- return f_cfg;
+ return configured_frequency_hz;
}
- ramp_ms = (is_start != 0U) ? accel_ms : decel_ms;
- a_hz_s = PlsrAccelCurveAccelHzS(default_spd, ramp_ms);
- /* 默认速度未设:回退为本段频差/时间,与 Plan 回退一致 */
- if ((a_hz_s == 0U) && (ramp_ms > 0U))
+ ramp_time_ms = (resolving_start != 0U) ? acceleration_time_ms : deceleration_time_ms;
+ acceleration_hz_per_s =
+ PlsrAccelCurveCalculateRate(default_speed_hz,
+ configured_frequency_hz,
+ target_frequency_hz,
+ ramp_time_ms);
+ if (acceleration_hz_per_s == 0U)
{
- uint32_t df = PlsrAccelCurveAbsDiff(f_cfg, f_tgt);
-
- if (df > 0U)
- {
- a_hz_s = (df * 1000UL) / ramp_ms;
- }
- }
- if (a_hz_s == 0U)
- {
- return (f_cfg >= 1U) ? f_cfg : f_tgt;
+ return (configured_frequency_hz >= 1U) ? configured_frequency_hz : target_frequency_hz;
}
- jump = PlsrAccelCurveJumpFreqFromA(f_cfg, a_hz_s);
+ jump_frequency_hz = PlsrAccelCurveCalculateJumpFrequency(configured_frequency_hz, acceleration_hz_per_s);
/* 目标 < 起跳 → 用目标;目标 >= 起跳 → 用起跳 */
- if (f_tgt < jump)
+ if (target_frequency_hz < jump_frequency_hz)
{
- return f_tgt;
+ return target_frequency_hz;
}
- return jump;
+ return jump_frequency_hz;
}
-uint32_t PlsrAccelCurveResolveStartHz(uint32_t f_cfg,
- uint32_t f_tgt,
- uint32_t default_spd,
- uint32_t accel_ms,
- uint32_t decel_ms)
+uint32_t PlsrAccelCurveResolveStartHz(uint32_t configured_frequency_hz,
+ uint32_t target_frequency_hz,
+ uint32_t default_speed_hz,
+ uint32_t acceleration_time_ms,
+ uint32_t deceleration_time_ms)
{
- return PlsrAccelCurveResolveBoundHz(f_cfg, f_tgt, default_spd,
- accel_ms, decel_ms, 1U);
+ return PlsrAccelCurveResolveBoundaryFrequency(configured_frequency_hz, target_frequency_hz, default_speed_hz,
+ acceleration_time_ms, deceleration_time_ms, 1U);
}
-uint32_t PlsrAccelCurveResolveEndHz(uint32_t f_cfg,
- uint32_t f_tgt,
- uint32_t default_spd,
- uint32_t accel_ms,
- uint32_t decel_ms)
+uint32_t PlsrAccelCurveResolveEndHz(uint32_t configured_frequency_hz,
+ uint32_t target_frequency_hz,
+ uint32_t default_speed_hz,
+ uint32_t acceleration_time_ms,
+ uint32_t deceleration_time_ms)
{
- return PlsrAccelCurveResolveBoundHz(f_cfg, f_tgt, default_spd,
- accel_ms, decel_ms, 0U);
+ return PlsrAccelCurveResolveBoundaryFrequency(configured_frequency_hz, target_frequency_hz, default_speed_hz,
+ acceleration_time_ms, deceleration_time_ms, 0U);
}
/**
@@ -231,78 +254,83 @@ static const uint16_t s_plsr_sine_shape_tab[33] = {
1000U
};
-static uint32_t PlsrAccelCurveShapeSinePermille(uint32_t u)
+static uint32_t PlsrAccelCurveShapeSinePermille(uint32_t progress_permille)
{
- uint32_t idx;
- uint32_t frac;
- uint32_t a;
- uint32_t b;
+ uint32_t table_index;
+ uint32_t segment_progress;
+ uint32_t lower_value;
+ uint32_t upper_value;
- if (u >= 1000U)
+ if (progress_permille >= 1000U)
{
return 1000U;
}
- /* u/1000 → 表下标 0..32,相邻点线性插值 */
- idx = (u * 32UL) / 1000UL;
- if (idx >= 32U)
+ /* progress_permille/1000 → 表下标 0..32,相邻点线性插值 */
+ table_index = (progress_permille * 32UL) / 1000UL;
+ if (table_index >= 32U)
{
return 1000U;
}
- frac = (u * 32UL) - (idx * 1000UL); /* 0..999 对应段内进度 */
- a = (uint32_t)s_plsr_sine_shape_tab[idx];
- b = (uint32_t)s_plsr_sine_shape_tab[idx + 1U];
- return a + (((b - a) * frac) / 1000UL);
+ segment_progress = (progress_permille * 32UL) - (table_index * 1000UL); /* 0..999 对应段内进度 */
+ lower_value = (uint32_t)s_plsr_sine_shape_tab[table_index];
+ upper_value = (uint32_t)s_plsr_sine_shape_tab[table_index + 1U];
+ return lower_value +
+ (((upper_value - lower_value) * segment_progress) / 1000UL);
}
-static uint32_t PlsrAccelCurveLerp(uint32_t a, uint32_t b, uint32_t ratio_permille)
+static uint32_t PlsrAccelCurveInterpolate(uint32_t start_value,
+ uint32_t end_value,
+ uint32_t ratio_permille)
{
if (ratio_permille >= 1000U)
{
- return b;
+ return end_value;
}
- if (b >= a)
+ if (end_value >= start_value)
{
- return a + ((b - a) * ratio_permille) / 1000UL;
+ return start_value +
+ ((end_value - start_value) * ratio_permille) / 1000UL;
}
- return a - ((a - b) * ratio_permille) / 1000UL;
+ return start_value -
+ ((start_value - end_value) * ratio_permille) / 1000UL;
}
/**
- * 脉冲闭合:N = ceil(|f1^2 - f0^2| / (2a))。
+ * 脉冲闭合:N = ceil(|end_frequency_hz^2 - start_frequency_hz^2| / (2a))。
* a=0 且频差非 0 → 0(阶跃,无斜坡脉冲)。
*/
-static uint32_t PlsrAccelCurvePulsesForRamp(uint32_t f0, uint32_t f1,
- uint32_t a_hz_s)
+static uint32_t PlsrAccelCurveCalculateLinearRampPulses(uint32_t start_frequency_hz, uint32_t end_frequency_hz,
+ uint32_t acceleration_hz_per_s)
{
- uint64_t f0s;
- uint64_t f1s;
- uint64_t df2;
- uint64_t two_a;
- uint64_t n;
+ uint64_t start_frequency_squared;
+ uint64_t end_frequency_squared;
+ uint64_t squared_frequency_difference;
+ uint64_t twice_acceleration;
+ uint64_t pulse_count;
- if (f0 == f1)
+ if (start_frequency_hz == end_frequency_hz)
{
return 0U;
}
- if (a_hz_s == 0U)
+ if (acceleration_hz_per_s == 0U)
{
return 0U;
}
- f0s = (uint64_t)f0 * (uint64_t)f0;
- f1s = (uint64_t)f1 * (uint64_t)f1;
- df2 = (f1s > f0s) ? (f1s - f0s) : (f0s - f1s);
- two_a = 2ULL * (uint64_t)a_hz_s;
- n = (df2 + two_a - 1ULL) / two_a;
- if (n == 0ULL)
+ start_frequency_squared = (uint64_t)start_frequency_hz * (uint64_t)start_frequency_hz;
+ end_frequency_squared = (uint64_t)end_frequency_hz * (uint64_t)end_frequency_hz;
+ squared_frequency_difference = (end_frequency_squared > start_frequency_squared) ? (end_frequency_squared - start_frequency_squared) : (start_frequency_squared - end_frequency_squared);
+ twice_acceleration = 2ULL * (uint64_t)acceleration_hz_per_s;
+ pulse_count = (squared_frequency_difference + twice_acceleration - 1ULL) / twice_acceleration;
+ if (pulse_count == 0ULL)
{
- n = 1ULL;
+ pulse_count = 1ULL;
}
- if (n > 0xFFFFFFFFULL)
+ if (pulse_count > 0xFFFFFFFFULL)
{
return 0xFFFFFFFFUL;
}
- return (uint32_t)n;
+ return (uint32_t)pulse_count;
}
/*============================================================================*/
@@ -314,541 +342,516 @@ static uint32_t PlsrAccelCurvePulsesForRamp(uint32_t f0, uint32_t f1,
* Tj : Ta : Tj = 1 : 2 : 1
* Δf = A*(Ta+Tj) ⇒ Tj=Δf/(3A), Ta=2Δf/(3A), T=4Δf/(3A)
*/
-static void PlsrAccelCurveSTimeParams(uint32_t f0, uint32_t f1, uint32_t a_hz_s,
- uint32_t *tj_us, uint32_t *ta_us,
- uint32_t *tramp_us)
+static void PlsrAccelCurveCalculateSCurveTimes(uint32_t start_frequency_hz, uint32_t end_frequency_hz, uint32_t acceleration_hz_per_s,
+ uint32_t *jerk_time_us_out,
+ uint32_t *constant_accel_time_us_out,
+ uint32_t *ramp_time_us_out)
{
- uint32_t df;
- uint64_t num;
- uint64_t den;
- uint32_t tj;
+ uint32_t frequency_difference_hz;
+ uint64_t numerator;
+ uint64_t denominator;
+ uint32_t calculated_jerk_time_us;
- *tj_us = 0U;
- *ta_us = 0U;
- *tramp_us = 0U;
+ *jerk_time_us_out = 0U;
+ *constant_accel_time_us_out = 0U;
+ *ramp_time_us_out = 0U;
- df = PlsrAccelCurveAbsDiff(f0, f1);
- if ((df < 1U) || (a_hz_s < 1U))
+ frequency_difference_hz = PlsrAccelCurveAbsoluteDifference(start_frequency_hz, end_frequency_hz);
+ if ((frequency_difference_hz < 1U) || (acceleration_hz_per_s < 1U))
{
return;
}
- /* Tj_us = ceil(df * 1e6 / (3A)) */
- num = (uint64_t)df * 1000000ULL;
- den = 3ULL * (uint64_t)a_hz_s;
- tj = (uint32_t)((num + den - 1ULL) / den);
- if (tj < 1U)
+ /* Tj_us = ceil(frequency_difference_hz * 1e6 / (3A)) */
+ numerator = (uint64_t)frequency_difference_hz * 1000000ULL;
+ denominator = 3ULL * (uint64_t)acceleration_hz_per_s;
+ calculated_jerk_time_us =
+ (uint32_t)((numerator + denominator - 1ULL) / denominator);
+ if (calculated_jerk_time_us < 1U)
{
- tj = 1U;
+ calculated_jerk_time_us = 1U;
}
- *tj_us = tj;
- *ta_us = tj * 2U;
- *tramp_us = tj * 4U;
+ *jerk_time_us_out = calculated_jerk_time_us;
+ *constant_accel_time_us_out = calculated_jerk_time_us * 2U;
+ *ramp_time_us_out = calculated_jerk_time_us * 4U;
}
/** 正弦 raised-cosine:峰值加速度 = A ⇒ T = π·Δf / (2A) */
-static void PlsrAccelCurveSineTimeParams(uint32_t f0, uint32_t f1, uint32_t a_hz_s,
- uint32_t *tramp_us)
+static void PlsrAccelCurveCalculateSineCurveTime(uint32_t start_frequency_hz, uint32_t end_frequency_hz, uint32_t acceleration_hz_per_s,
+ uint32_t *ramp_time_us)
{
- uint32_t df;
- uint64_t num;
- uint64_t den;
+ uint32_t frequency_difference_hz;
+ uint64_t numerator;
+ uint64_t denominator;
- *tramp_us = 0U;
- df = PlsrAccelCurveAbsDiff(f0, f1);
- if ((df < 1U) || (a_hz_s < 1U))
+ *ramp_time_us = 0U;
+ frequency_difference_hz = PlsrAccelCurveAbsoluteDifference(start_frequency_hz, end_frequency_hz);
+ if ((frequency_difference_hz < 1U) || (acceleration_hz_per_s < 1U))
{
return;
}
- /* T_us = ceil(π*df*1e6 / (2A)),π≈355/113 */
- num = (uint64_t)df * 1000000ULL * 355ULL;
- den = 2ULL * (uint64_t)a_hz_s * 113ULL;
- *tramp_us = (uint32_t)((num + den - 1ULL) / den);
- if (*tramp_us < 1U)
+ /* T_us = ceil(π*frequency_difference_hz*1e6 / (2A)),π≈355/113 */
+ numerator = (uint64_t)frequency_difference_hz * 1000000ULL * 355ULL;
+ denominator = 2ULL * (uint64_t)acceleration_hz_per_s * 113ULL;
+ *ramp_time_us = (uint32_t)((numerator + denominator - 1ULL) / denominator);
+ if (*ramp_time_us < 1U)
{
- *tramp_us = 1U;
+ *ramp_time_us = 1U;
}
}
-/** Δf = A * t_us / 1e6 */
-static uint32_t PlsrAccelCurveDeltaHzFromAt(uint32_t a_hz_s, uint32_t t_us)
+/** Δf = A * elapsed_time_us / 1e6 */
+static uint32_t PlsrAccelCurveDeltaHzFromAt(uint32_t acceleration_hz_per_s, uint32_t elapsed_time_us)
{
- return (uint32_t)(((uint64_t)a_hz_s * (uint64_t)t_us) / 1000000ULL);
+ return (uint32_t)(((uint64_t)acceleration_hz_per_s * (uint64_t)elapsed_time_us) / 1000000ULL);
}
-/** Δf = A * t_us^2 / (2 * tj_us * 1e6) — jerk 段 */
-static uint32_t PlsrAccelCurveDeltaHzFromJerk(uint32_t a_hz_s, uint32_t t_us,
- uint32_t tj_us)
+/** Δf = A * elapsed_time_us^2 / (2 * jerk_time_us * 1e6) — jerk 段 */
+static uint32_t PlsrAccelCurveDeltaHzFromJerk(uint32_t acceleration_hz_per_s, uint32_t elapsed_time_us,
+ uint32_t jerk_time_us)
{
- uint64_t v;
+ uint64_t calculation;
- if ((tj_us < 1U) || (t_us < 1U) || (a_hz_s < 1U))
+ if ((jerk_time_us < 1U) || (elapsed_time_us < 1U) || (acceleration_hz_per_s < 1U))
{
return 0U;
}
- /* ((A * t / tj) * t) / 2e6 */
- v = ((uint64_t)a_hz_s * (uint64_t)t_us) / (uint64_t)tj_us;
- v = (v * (uint64_t)t_us) / 2000000ULL;
- if (v > 0xFFFFFFFFULL)
+ /* ((A * t / jerk_time_us) * t) / 2e6 */
+ calculation = ((uint64_t)acceleration_hz_per_s * (uint64_t)elapsed_time_us) / (uint64_t)jerk_time_us;
+ calculation = (calculation * (uint64_t)elapsed_time_us) / 2000000ULL;
+ if (calculation > 0xFFFFFFFFULL)
{
return 0xFFFFFFFFUL;
}
- return (uint32_t)v;
+ return (uint32_t)calculation;
}
/**
- * 时刻 t_us 的 S 剖面频率(相对进度 0..df,再映射到 f0→f1)。
+ * 时刻 elapsed_time_us 的 S 剖面频率(相对进度 0..frequency_difference_hz,再映射到 start_frequency_hz→end_frequency_hz)。
*/
-static uint32_t PlsrAccelCurveSFreqAtTime(uint32_t f0, uint32_t f1, uint32_t a_hz_s,
- uint32_t tj_us, uint32_t ta_us,
- uint32_t tramp_us, uint32_t t_us)
+static uint32_t PlsrAccelCurveSCurveFrequencyAtTime(uint32_t start_frequency_hz, uint32_t end_frequency_hz, uint32_t acceleration_hz_per_s,
+ uint32_t jerk_time_us, uint32_t constant_accel_time_us,
+ uint32_t ramp_time_us, uint32_t elapsed_time_us)
{
- uint32_t df;
- uint32_t g;
- uint32_t t2;
- uint32_t tau;
- uint8_t rising;
+ uint32_t frequency_difference_hz;
+ uint32_t frequency_change_hz;
+ uint32_t deceleration_start_time_us;
+ uint32_t deceleration_elapsed_us;
+ uint8_t frequency_rising;
- df = PlsrAccelCurveAbsDiff(f0, f1);
- rising = (f1 >= f0) ? 1U : 0U;
+ frequency_difference_hz = PlsrAccelCurveAbsoluteDifference(start_frequency_hz, end_frequency_hz);
+ frequency_rising = (end_frequency_hz >= start_frequency_hz) ? 1U : 0U;
- if ((df < 1U) || (tramp_us < 1U) || (a_hz_s < 1U))
+ if ((frequency_difference_hz < 1U) || (ramp_time_us < 1U) || (acceleration_hz_per_s < 1U))
{
- return PlsrAccelCurveClampFreq(f1);
+ return PlsrAccelCurveClampFrequencyHz(end_frequency_hz);
}
- if (t_us >= tramp_us)
+ if (elapsed_time_us >= ramp_time_us)
{
- return PlsrAccelCurveClampFreq(f1);
+ return PlsrAccelCurveClampFrequencyHz(end_frequency_hz);
}
- if ((tj_us < 1U) || (t_us <= tj_us))
+ if ((jerk_time_us < 1U) || (elapsed_time_us <= jerk_time_us))
{
- /* jerk 升:g = 0.5*(A/Tj)*t^2 */
- g = PlsrAccelCurveDeltaHzFromJerk(a_hz_s, t_us, (tj_us < 1U) ? 1U : tj_us);
+ /* jerk 升:frequency_change_hz = 0.5*(A/Tj)*t^2 */
+ frequency_change_hz = PlsrAccelCurveDeltaHzFromJerk(acceleration_hz_per_s, elapsed_time_us, (jerk_time_us < 1U) ? 1U : jerk_time_us);
}
else
{
- t2 = tj_us + ta_us;
- if (t_us <= t2)
+ deceleration_start_time_us = jerk_time_us + constant_accel_time_us;
+ if (elapsed_time_us <= deceleration_start_time_us)
{
- /* 恒加速:g = 0.5*A*Tj + A*(t-Tj) */
- g = PlsrAccelCurveDeltaHzFromJerk(a_hz_s, tj_us, tj_us);
- g += PlsrAccelCurveDeltaHzFromAt(a_hz_s, t_us - tj_us);
+ /* 恒加速:frequency_change_hz = 0.5*A*Tj + A*(t-Tj) */
+ frequency_change_hz = PlsrAccelCurveDeltaHzFromJerk(acceleration_hz_per_s, jerk_time_us, jerk_time_us);
+ frequency_change_hz += PlsrAccelCurveDeltaHzFromAt(acceleration_hz_per_s, elapsed_time_us - jerk_time_us);
}
else
{
- /* jerk 降:g = 0.5*A*Tj + A*Ta + A*τ - 0.5*(A/Tj)*τ^2 */
- tau = t_us - t2;
- if (tau > tj_us)
+ /* jerk 降:frequency_change_hz = 0.5*A*Tj + A*Ta + A*τ - 0.5*(A/Tj)*τ^2 */
+ deceleration_elapsed_us = elapsed_time_us - deceleration_start_time_us;
+ if (deceleration_elapsed_us > jerk_time_us)
{
- tau = tj_us;
+ deceleration_elapsed_us = jerk_time_us;
}
- g = PlsrAccelCurveDeltaHzFromJerk(a_hz_s, tj_us, tj_us);
- g += PlsrAccelCurveDeltaHzFromAt(a_hz_s, ta_us);
- g += PlsrAccelCurveDeltaHzFromAt(a_hz_s, tau);
+ frequency_change_hz = PlsrAccelCurveDeltaHzFromJerk(acceleration_hz_per_s, jerk_time_us, jerk_time_us);
+ frequency_change_hz += PlsrAccelCurveDeltaHzFromAt(acceleration_hz_per_s, constant_accel_time_us);
+ frequency_change_hz += PlsrAccelCurveDeltaHzFromAt(acceleration_hz_per_s, deceleration_elapsed_us);
{
- uint32_t drop = PlsrAccelCurveDeltaHzFromJerk(a_hz_s, tau, tj_us);
- if (g > drop)
+ uint32_t frequency_drop = PlsrAccelCurveDeltaHzFromJerk(acceleration_hz_per_s, deceleration_elapsed_us, jerk_time_us);
+ if (frequency_change_hz > frequency_drop)
{
- g -= drop;
+ frequency_change_hz -= frequency_drop;
}
else
{
- g = 0U;
+ frequency_change_hz = 0U;
}
}
}
}
- if (g > df)
+ if (frequency_change_hz > frequency_difference_hz)
{
- g = df;
+ frequency_change_hz = frequency_difference_hz;
}
- if (rising != 0U)
+ if (frequency_rising != 0U)
{
- return PlsrAccelCurveClampFreq(f0 + g);
+ return PlsrAccelCurveClampFrequencyHz(start_frequency_hz + frequency_change_hz);
}
- if (f0 > g)
+ if (start_frequency_hz > frequency_change_hz)
{
- return PlsrAccelCurveClampFreq(f0 - g);
+ return PlsrAccelCurveClampFrequencyHz(start_frequency_hz - frequency_change_hz);
}
- return PlsrAccelCurveClampFreq(f1);
+ return PlsrAccelCurveClampFrequencyHz(end_frequency_hz);
}
/**
- * 正弦 raised-cosine:f = f0 + df * (1-cos(π u))/2,u=t/T
+ * 正弦 raised-cosine:frequency_hz = start_frequency_hz + frequency_difference_hz * (1-cos(π progress_permille))/2,progress_permille=t/T
* 用现有 33 点 sine 形状表(已是 raised-cosine 千分比)。
*/
-static uint32_t PlsrAccelCurveSineFreqAtTime(uint32_t f0, uint32_t f1,
- uint32_t tramp_us, uint32_t t_us)
+static uint32_t PlsrAccelCurveSineFrequencyAtTime(uint32_t start_frequency_hz, uint32_t end_frequency_hz,
+ uint32_t ramp_time_us, uint32_t elapsed_time_us)
{
- uint32_t u;
- uint32_t ratio;
- uint32_t f;
+ uint32_t progress_permille;
+ uint32_t ratio_permille;
+ uint32_t frequency_hz;
- if ((tramp_us < 1U) || (f0 == f1))
+ if ((ramp_time_us < 1U) || (start_frequency_hz == end_frequency_hz))
{
- return PlsrAccelCurveClampFreq(f1);
+ return PlsrAccelCurveClampFrequencyHz(end_frequency_hz);
}
- if (t_us >= tramp_us)
+ if (elapsed_time_us >= ramp_time_us)
{
- return PlsrAccelCurveClampFreq(f1);
+ return PlsrAccelCurveClampFrequencyHz(end_frequency_hz);
}
- u = (uint32_t)(((uint64_t)t_us * 1000ULL) / (uint64_t)tramp_us);
- if (u > 1000U)
+ progress_permille = (uint32_t)(((uint64_t)elapsed_time_us * 1000ULL) / (uint64_t)ramp_time_us);
+ if (progress_permille > 1000U)
{
- u = 1000U;
+ progress_permille = 1000U;
}
- ratio = PlsrAccelCurveShapeSinePermille(u);
- f = PlsrAccelCurveLerp(f0, f1, ratio);
- if (f < 1U)
+ ratio_permille = PlsrAccelCurveShapeSinePermille(progress_permille);
+ frequency_hz = PlsrAccelCurveInterpolate(start_frequency_hz, end_frequency_hz, ratio_permille);
+ if (frequency_hz < 1U)
{
- f = 1U;
+ frequency_hz = 1U;
}
- return PlsrAccelCurveClampFreq(f);
+ return PlsrAccelCurveClampFrequencyHz(frequency_hz);
}
/**
- * 与 ISR / 建表一致:逐拍 Δt=1/f 推进时间剖面,得到 S/正弦斜坡脉冲数。
- * (旧版 ∫f dt 解析估算已废弃,避免与离散运行不一致。)
+ * 与 ISR / 建表一致:逐拍 Δt=1/frequency_hz 推进时间剖面,得到 S/正弦斜坡脉冲数。
+ * (旧版 ∫frequency_hz dt 解析估算已废弃,避免与离散运行不一致。)
*/
-static uint32_t PlsrAccelCurvePulsesForDiscreteProfile(uint32_t f0, uint32_t f1,
- uint32_t a_hz_s,
- PlsrAccelMode_e mode);
+static uint32_t PlsrAccelCurveSimulateRampPulses(uint32_t start_frequency_hz, uint32_t end_frequency_hz,
+ uint32_t acceleration_hz_per_s,
+ PlsrAccelMode_e curve_mode);
-static uint32_t PlsrAccelCurvePulsesForModeRamp(uint32_t f0, uint32_t f1,
- uint32_t a_hz_s,
- PlsrAccelMode_e mode)
+static uint32_t PlsrAccelCurveCalculateRampPulses(uint32_t start_frequency_hz, uint32_t end_frequency_hz,
+ uint32_t acceleration_hz_per_s,
+ PlsrAccelMode_e curve_mode)
{
- if ((mode == PLSR_ACCEL_SINE) || (mode == PLSR_ACCEL_S))
+ if ((curve_mode == PLSR_ACCEL_SINE) || (curve_mode == PLSR_ACCEL_S))
{
- return PlsrAccelCurvePulsesForDiscreteProfile(f0, f1, a_hz_s, mode);
+ return PlsrAccelCurveSimulateRampPulses(start_frequency_hz, end_frequency_hz, acceleration_hz_per_s, curve_mode);
}
- return PlsrAccelCurvePulsesForRamp(f0, f1, a_hz_s);
+ return PlsrAccelCurveCalculateLinearRampPulses(start_frequency_hz, end_frequency_hz, acceleration_hz_per_s);
}
-/** 直线:f = sqrt(f0^2 + 2*a*n),升到/降到不超过 limit 方向 */
-static uint32_t PlsrAccelCurveFreqKinematic(uint32_t f0, uint32_t a_hz_s,
- uint32_t n, uint8_t rising,
- uint32_t limit)
+/** 直线:frequency_hz = sqrt(start_frequency_hz^2 + 2*a*pulse_count),升到/降到不超过 target_limit_hz 方向 */
+static uint32_t PlsrAccelCurveLinearFrequencyAtPulse(uint32_t start_frequency_hz, uint32_t acceleration_hz_per_s,
+ uint32_t pulse_count, uint8_t frequency_rising,
+ uint32_t target_limit_hz)
{
- uint64_t val;
- uint32_t f;
+ uint64_t squared_frequency;
+ uint32_t frequency_hz;
- if (n == 0U)
+ if (pulse_count == 0U)
{
- f = f0;
+ frequency_hz = start_frequency_hz;
}
- else if (a_hz_s == 0U)
+ else if (acceleration_hz_per_s == 0U)
{
- f = limit;
+ frequency_hz = target_limit_hz;
}
else
{
- val = (uint64_t)f0 * (uint64_t)f0;
- if (rising != 0U)
+ squared_frequency = (uint64_t)start_frequency_hz * (uint64_t)start_frequency_hz;
+ if (frequency_rising != 0U)
{
- val += 2ULL * (uint64_t)a_hz_s * (uint64_t)n;
- f = PlsrAccelCurveIsqrt64(val);
- if (f > limit)
+ squared_frequency += 2ULL * (uint64_t)acceleration_hz_per_s * (uint64_t)pulse_count;
+ frequency_hz = PlsrAccelCurveIntegerSquareRoot(squared_frequency);
+ if (frequency_hz > target_limit_hz)
{
- f = limit;
+ frequency_hz = target_limit_hz;
}
}
else
{
- uint64_t drop = 2ULL * (uint64_t)a_hz_s * (uint64_t)n;
- if (drop >= val)
+ uint64_t frequency_drop = 2ULL * (uint64_t)acceleration_hz_per_s * (uint64_t)pulse_count;
+ if (frequency_drop >= squared_frequency)
{
- f = limit;
+ frequency_hz = target_limit_hz;
}
else
{
- f = PlsrAccelCurveIsqrt64(val - drop);
- if (f < limit)
+ frequency_hz = PlsrAccelCurveIntegerSquareRoot(squared_frequency - frequency_drop);
+ if (frequency_hz < target_limit_hz)
{
- f = limit;
+ frequency_hz = target_limit_hz;
}
}
}
}
- if (f < 1U)
+ if (frequency_hz < 1U)
{
- f = 1U;
+ frequency_hz = 1U;
}
- return PlsrAccelCurveClampFreq(f);
+ return PlsrAccelCurveClampFrequencyHz(frequency_hz);
}
/**
* 二分峰值:使 acc+dec 脉冲 <= total(脉冲闭合公式)。
*/
-static uint32_t PlsrAccelCurveFitPeak(uint32_t total_pulses,
- uint32_t f_cur,
- uint32_t f_want,
- uint32_t f_end,
- uint32_t a_acc,
- uint32_t a_dec,
- PlsrAccelMode_e mode)
+static uint32_t PlsrAccelCurveFitTargetFrequency(uint32_t total_pulses,
+ uint32_t start_frequency_hz,
+ uint32_t requested_target_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t accel_rate_hz_per_s,
+ uint32_t decel_rate_hz_per_s,
+ PlsrAccelMode_e curve_mode)
{
- uint32_t lo = 0U;
- uint32_t hi;
- uint32_t mid;
- uint32_t best = 0U;
- uint32_t peak;
- uint32_t n_a;
- uint32_t n_d;
- uint32_t span;
+ uint32_t lowest_offset_hz = 0U;
+ uint32_t highest_offset_hz;
+ uint32_t candidate_offset_hz;
+ uint32_t best_offset_hz = 0U;
+ uint32_t candidate_frequency_hz;
+ uint32_t acceleration_pulses;
+ uint32_t deceleration_pulses;
+ uint32_t search_range_hz;
- if (f_want >= f_cur)
+ if (requested_target_frequency_hz >= start_frequency_hz)
{
- span = f_want - f_cur;
+ search_range_hz = requested_target_frequency_hz - start_frequency_hz;
}
else
{
- span = f_cur - f_want;
+ search_range_hz = start_frequency_hz - requested_target_frequency_hz;
}
- hi = span;
+ highest_offset_hz = search_range_hz;
- while (lo <= hi)
+ while (lowest_offset_hz <= highest_offset_hz)
{
- mid = lo + ((hi - lo) / 2UL);
- if (f_want >= f_cur)
+ candidate_offset_hz = lowest_offset_hz + ((highest_offset_hz - lowest_offset_hz) / 2UL);
+ if (requested_target_frequency_hz >= start_frequency_hz)
{
- peak = f_cur + mid;
- n_a = PlsrAccelCurvePulsesForModeRamp(f_cur, peak, a_acc, mode);
+ candidate_frequency_hz = start_frequency_hz + candidate_offset_hz;
+ acceleration_pulses = PlsrAccelCurveCalculateRampPulses(start_frequency_hz, candidate_frequency_hz, accel_rate_hz_per_s, curve_mode);
}
else
{
- peak = f_cur - mid;
- n_a = PlsrAccelCurvePulsesForModeRamp(f_cur, peak, a_dec, mode);
+ candidate_frequency_hz = start_frequency_hz - candidate_offset_hz;
+ acceleration_pulses = PlsrAccelCurveCalculateRampPulses(start_frequency_hz, candidate_frequency_hz, decel_rate_hz_per_s, curve_mode);
}
- n_d = PlsrAccelCurvePulsesForModeRamp(peak, f_end,
- (f_end > peak) ? a_acc : a_dec, mode);
+ deceleration_pulses = PlsrAccelCurveCalculateRampPulses(candidate_frequency_hz, end_frequency_hz,
+ (end_frequency_hz > candidate_frequency_hz) ? accel_rate_hz_per_s : decel_rate_hz_per_s, curve_mode);
- if ((n_a + n_d) <= total_pulses)
+ if ((acceleration_pulses + deceleration_pulses) <= total_pulses)
{
- best = mid;
- if (mid == span)
+ best_offset_hz = candidate_offset_hz;
+ if (candidate_offset_hz == search_range_hz)
{
break;
}
- lo = mid + 1UL;
- if (lo > hi)
+ lowest_offset_hz = candidate_offset_hz + 1UL;
+ if (lowest_offset_hz > highest_offset_hz)
{
break;
}
}
else
{
- if (mid == 0U)
+ if (candidate_offset_hz == 0U)
{
break;
}
- hi = mid - 1UL;
+ highest_offset_hz = candidate_offset_hz - 1UL;
}
}
- if (f_want >= f_cur)
+ if (requested_target_frequency_hz >= start_frequency_hz)
{
- return f_cur + best;
+ return start_frequency_hz + best_offset_hz;
}
- return f_cur - best;
+ return start_frequency_hz - best_offset_hz;
}
/** 按峰值重算加速/减速脉冲预算 */
-static void PlsrAccelCurveRecalcRampNs(uint32_t f_cur,
- uint32_t f_peak,
- uint32_t f_end,
- uint32_t a_acc,
- uint32_t a_dec,
- PlsrAccelMode_e mode,
- uint32_t *acc_n,
- uint32_t *dec_n)
+static void PlsrAccelCurveCalculatePhasePulses(uint32_t start_frequency_hz,
+ uint32_t peak_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t accel_rate_hz_per_s,
+ uint32_t decel_rate_hz_per_s,
+ PlsrAccelMode_e curve_mode,
+ uint32_t *accel_pulses,
+ uint32_t *decel_pulses)
{
- if (f_cur > f_peak)
+ if (start_frequency_hz > peak_frequency_hz)
{
- *acc_n = PlsrAccelCurvePulsesForModeRamp(f_cur, f_peak, a_dec, mode);
+ *accel_pulses = PlsrAccelCurveCalculateRampPulses(start_frequency_hz, peak_frequency_hz, decel_rate_hz_per_s, curve_mode);
}
else
{
- *acc_n = PlsrAccelCurvePulsesForModeRamp(f_cur, f_peak, a_acc, mode);
+ *accel_pulses = PlsrAccelCurveCalculateRampPulses(start_frequency_hz, peak_frequency_hz, accel_rate_hz_per_s, curve_mode);
}
- if (f_end > f_peak)
+ if (end_frequency_hz > peak_frequency_hz)
{
- *dec_n = PlsrAccelCurvePulsesForModeRamp(f_peak, f_end, a_acc, mode);
+ *decel_pulses = PlsrAccelCurveCalculateRampPulses(peak_frequency_hz, end_frequency_hz, accel_rate_hz_per_s, curve_mode);
}
else
{
- *dec_n = PlsrAccelCurvePulsesForModeRamp(f_peak, f_end, a_dec, mode);
+ *decel_pulses = PlsrAccelCurveCalculateRampPulses(peak_frequency_hz, end_frequency_hz, decel_rate_hz_per_s, curve_mode);
}
}
/**
- * FitPeak 后再对齐离散取整:禁止只截断 dec_n,逐步降峰直到 acc+dec<=total。
+ * FitPeak 后再对齐离散取整:禁止只截断 decel_pulses,逐步降峰直到 acc+dec<=total。
*/
-static uint32_t PlsrAccelCurveFitPeakToBudget(uint32_t total_pulses,
- uint32_t f_cur,
- uint32_t f_want,
- uint32_t f_end,
- uint32_t a_acc,
- uint32_t a_dec,
- PlsrAccelMode_e mode,
- uint32_t *acc_n,
- uint32_t *dec_n)
+static uint32_t PlsrAccelCurveFitTargetToPulseBudget(uint32_t total_pulses,
+ uint32_t start_frequency_hz,
+ uint32_t requested_target_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t accel_rate_hz_per_s,
+ uint32_t decel_rate_hz_per_s,
+ PlsrAccelMode_e curve_mode,
+ uint32_t *accel_pulses,
+ uint32_t *decel_pulses)
{
- uint32_t f_peak;
- uint32_t guard;
+ uint32_t peak_frequency_hz;
+ uint32_t iteration_guard;
- f_peak = PlsrAccelCurveFitPeak(total_pulses, f_cur, f_want, f_end,
- a_acc, a_dec, mode);
- PlsrAccelCurveRecalcRampNs(f_cur, f_peak, f_end, a_acc, a_dec, mode,
- acc_n, dec_n);
+ peak_frequency_hz = PlsrAccelCurveFitTargetFrequency(total_pulses, start_frequency_hz, requested_target_frequency_hz, end_frequency_hz,
+ accel_rate_hz_per_s, decel_rate_hz_per_s, curve_mode);
+ PlsrAccelCurveCalculatePhasePulses(start_frequency_hz, peak_frequency_hz, end_frequency_hz, accel_rate_hz_per_s, decel_rate_hz_per_s, curve_mode,
+ accel_pulses, decel_pulses);
- guard = 0U;
- while ((*acc_n + *dec_n) > total_pulses && (guard < 100000U))
+ iteration_guard = 0U;
+ while ((*accel_pulses + *decel_pulses) > total_pulses && (iteration_guard < 100000U))
{
- guard++;
- if (f_want >= f_cur)
+ iteration_guard++;
+ if (requested_target_frequency_hz >= start_frequency_hz)
{
- if (f_peak <= f_cur)
+ if (peak_frequency_hz <= start_frequency_hz)
{
break;
}
- f_peak--;
+ peak_frequency_hz--;
}
else
{
- if (f_peak >= f_cur)
+ if (peak_frequency_hz >= start_frequency_hz)
{
break;
}
- f_peak++;
+ peak_frequency_hz++;
}
- PlsrAccelCurveRecalcRampNs(f_cur, f_peak, f_end, a_acc, a_dec, mode,
- acc_n, dec_n);
+ PlsrAccelCurveCalculatePhasePulses(start_frequency_hz, peak_frequency_hz, end_frequency_hz, accel_rate_hz_per_s, decel_rate_hz_per_s, curve_mode,
+ accel_pulses, decel_pulses);
}
- return f_peak;
+ return peak_frequency_hz;
}
/**
* @brief 规划一整段脉冲域(见 plsr_accel_curve.h)
*
- * 【输入】total_pulses=N, f_cur, f_tgt, f_end, default_spd, accel/decel_ms, mode
- * 【输出】plan 里填 acc_n, const_n, dec_n, f_cur, f_tgt(可能被降峰), f_end, a_acc, a_dec
+ * 【输入】total_pulses=N, start_frequency_hz, target_frequency_hz, end_frequency_hz, default_speed_hz, accel/deceleration_time_ms, curve_mode
+ * 【输出】plan 里填 accel_pulses, constant_pulses, decel_pulses, start_frequency_hz, target_frequency_hz(可能被降峰), end_frequency_hz, accel_rate_hz_per_s, decel_rate_hz_per_s
*
* 步骤概要:
- * 1) 钳频;f_cur/f_end<1 时用 ResolveStart/EndHz 补起跳/落地
- * 2) 算 a_acc、a_dec(default 为 0 时回退为 |频差|*1000/时间)
- * 3) 估 acc_n(f_cur→f_peak)、dec_n(f_peak→f_end);选 a_acc 还是 a_dec 看升降方向
- * 4) 分配 const_n 或 FitPeak 三角波
+ * 1) 钳频;start_frequency_hz/end_frequency_hz<1 时用 ResolveStart/EndHz 补起跳/落地
+ * 2) 算 accel_rate_hz_per_s、decel_rate_hz_per_s(default 为 0 时回退为 |频差|*1000/时间)
+ * 3) 估 accel_pulses(start_frequency_hz→peak_frequency_hz)、decel_pulses(peak_frequency_hz→end_frequency_hz);选 accel_rate_hz_per_s 还是 decel_rate_hz_per_s 看升降方向
+ * 4) 分配 constant_pulses 或 FitPeak 三角波
*
* 波形形状记忆:
- * f_tgt(f_peak) ───── const ─────┐
+ * target_frequency_hz(peak_frequency_hz) ───── const ─────┐
* / \\ dec
- * f_cur f_end
- * acc_n const_n dec_n
+ * start_frequency_hz end_frequency_hz
+ * accel_pulses constant_pulses decel_pulses
*/
void PlsrAccelCurvePlan(PlsrAccelPlan_t *plan,
uint32_t total_pulses,
- uint32_t f_cur,
- uint32_t f_tgt,
- uint32_t f_end,
- uint32_t default_spd,
- uint32_t accel_ms,
- uint32_t decel_ms,
- PlsrAccelMode_e mode)
+ uint32_t start_frequency_hz,
+ uint32_t target_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t default_speed_hz,
+ uint32_t acceleration_time_ms,
+ uint32_t deceleration_time_ms,
+ PlsrAccelMode_e curve_mode)
{
- uint32_t acc_n;
- uint32_t dec_n;
- uint32_t f_peak;
- uint32_t a_acc;
- uint32_t a_dec;
- PlsrAccelMode_e m;
+ uint32_t accel_pulses;
+ uint32_t decel_pulses;
+ uint32_t peak_frequency_hz;
+ uint32_t accel_rate_hz_per_s;
+ uint32_t decel_rate_hz_per_s;
+ PlsrAccelMode_e selected_mode;
if (plan == (PlsrAccelPlan_t *)0)
{
return;
}
- f_cur = PlsrAccelCurveClampFreq(f_cur);
- f_tgt = PlsrAccelCurveClampFreq(f_tgt);
- f_end = PlsrAccelCurveClampFreq(f_end);
+ start_frequency_hz = PlsrAccelCurveClampFrequencyHz(start_frequency_hz);
+ target_frequency_hz = PlsrAccelCurveClampFrequencyHz(target_frequency_hz);
+ end_frequency_hz = PlsrAccelCurveClampFrequencyHz(end_frequency_hz);
- m = (mode > PLSR_ACCEL_SINE) ? PLSR_ACCEL_LINEAR : mode;
+ selected_mode = (curve_mode > PLSR_ACCEL_SINE) ? PLSR_ACCEL_LINEAR : curve_mode;
- if (f_cur < 1U)
+ if (start_frequency_hz < 1U)
{
- f_cur = PlsrAccelCurveResolveStartHz(0U, f_tgt, default_spd,
- accel_ms, decel_ms);
+ start_frequency_hz = PlsrAccelCurveResolveStartHz(0U, target_frequency_hz, default_speed_hz,
+ acceleration_time_ms, deceleration_time_ms);
}
- if (f_end < 1U)
+ if (end_frequency_hz < 1U)
{
- f_end = PlsrAccelCurveResolveEndHz(0U, f_tgt, default_spd,
- accel_ms, decel_ms);
+ end_frequency_hz = PlsrAccelCurveResolveEndHz(0U, target_frequency_hz, default_speed_hz,
+ acceleration_time_ms, deceleration_time_ms);
}
- a_acc = PlsrAccelCurveAccelHzS(default_spd, accel_ms);
- a_dec = PlsrAccelCurveAccelHzS(default_spd, decel_ms);
- /* 升降方向用对应斜率;无默认速度时用频差/时间回退 */
- if ((a_acc == 0U) && (accel_ms > 0U))
- {
- uint32_t df = PlsrAccelCurveAbsDiff(f_cur, f_tgt);
- if (df > 0U)
- {
- a_acc = (df * 1000UL) / accel_ms;
- }
- }
- if ((a_dec == 0U) && (decel_ms > 0U))
- {
- uint32_t df = PlsrAccelCurveAbsDiff(f_tgt, f_end);
- if (df > 0U)
- {
- a_dec = (df * 1000UL) / decel_ms;
- }
- }
+ accel_rate_hz_per_s =
+ PlsrAccelCurveCalculateRate(default_speed_hz,
+ start_frequency_hz,
+ target_frequency_hz,
+ acceleration_time_ms);
+ decel_rate_hz_per_s =
+ PlsrAccelCurveCalculateRate(default_speed_hz,
+ target_frequency_hz,
+ end_frequency_hz,
+ deceleration_time_ms);
- f_peak = f_tgt;
+ peak_frequency_hz = target_frequency_hz;
- plan->f_cur = f_cur;
- plan->f_end = f_end;
- plan->mode = m;
- plan->a_acc = a_acc;
- plan->a_dec = a_dec;
+ plan->start_frequency_hz = start_frequency_hz;
+ plan->end_frequency_hz = end_frequency_hz;
+ plan->curve_mode = selected_mode;
+ plan->accel_rate_hz_per_s = accel_rate_hz_per_s;
+ plan->decel_rate_hz_per_s = decel_rate_hz_per_s;
- /*
- * --- 估 acc_n:入口 → 峰值 ---
- * f_cur > f_peak:入口比目标高,第一段是「减到目标」(用 a_dec)
- * 否则:正常加速段(用 a_acc)
- */
- if (f_cur > f_peak)
- {
- acc_n = PlsrAccelCurvePulsesForModeRamp(f_cur, f_peak, a_dec, m);
- }
- else
- {
- acc_n = PlsrAccelCurvePulsesForModeRamp(f_cur, f_peak, a_acc, m);
- }
- /*
- * --- 估 dec_n:峰值 → 出口 ---
- * f_end > f_peak:出口比峰值高(谷底右侧再爬升,用 a_acc)
- * 否则:正常减速段(用 a_dec)
- */
- if (f_end > f_peak)
- {
- dec_n = PlsrAccelCurvePulsesForModeRamp(f_peak, f_end, a_acc, m);
- }
- else
- {
- dec_n = PlsrAccelCurvePulsesForModeRamp(f_peak, f_end, a_dec, m);
- }
+ PlsrAccelCurveCalculatePhasePulses(start_frequency_hz,
+ peak_frequency_hz,
+ end_frequency_hz,
+ accel_rate_hz_per_s,
+ decel_rate_hz_per_s,
+ selected_mode,
+ &accel_pulses,
+ &decel_pulses);
/* --- 特例:本段 0 脉冲 --- */
if (total_pulses == 0U)
{
- plan->const_n = 0U;
- plan->f_tgt = f_peak;
- plan->acc_n = 0U;
- plan->dec_n = 0U;
+ plan->constant_pulses = 0U;
+ plan->target_frequency_hz = peak_frequency_hz;
+ plan->accel_pulses = 0U;
+ plan->decel_pulses = 0U;
return;
}
@@ -856,230 +859,224 @@ void PlsrAccelCurvePlan(PlsrAccelPlan_t *plan,
* --- 特例:出口=目标 且 光加速就要用光 N 个脉冲 ---
* 整段当纯加速/纯减,无 dec、无 const(例如短段只爬到目标就停)
*/
- if ((f_end == f_tgt) && (acc_n > total_pulses))
+ if ((end_frequency_hz == target_frequency_hz) && (accel_pulses > total_pulses))
{
- plan->const_n = 0U;
- plan->f_tgt = f_peak;
- plan->acc_n = total_pulses;
- plan->dec_n = 0U;
+ plan->constant_pulses = 0U;
+ plan->target_frequency_hz = peak_frequency_hz;
+ plan->accel_pulses = total_pulses;
+ plan->decel_pulses = 0U;
return;
}
/*
* --- 主分支:脉冲够不够装下 acc + dec + const ---
- * 够:const_n = 余量(标准梯形)
- * 不够:const_n=0,FitPeak 降低 f_peak 直到 acc_n+dec_n <= N(三角波,可能报 0x02)
+ * 够:constant_pulses = 余量(标准梯形)
+ * 不够:constant_pulses=0,FitPeak 降低 peak_frequency_hz 直到 accel_pulses+decel_pulses <= N(三角波,可能报 0x02)
*/
- if (acc_n + dec_n <= total_pulses)
+ if (accel_pulses + decel_pulses <= total_pulses)
{
- plan->const_n = total_pulses - acc_n - dec_n;
- plan->f_tgt = f_peak;
- plan->acc_n = acc_n;
- plan->dec_n = dec_n;
+ plan->constant_pulses = total_pulses - accel_pulses - decel_pulses;
}
else
{
/*
* 脉冲不够:先砍掉匀速段,保证加减速按完整剖面预算;
- * 仍超出则降峰成三角,禁止 dec_n=total-acc_n 式截断。
+ * 仍超出则降峰成三角,禁止 decel_pulses=total-accel_pulses 式截断。
*/
- plan->const_n = 0U;
- f_peak = PlsrAccelCurveFitPeakToBudget(total_pulses, f_cur, f_tgt, f_end,
- a_acc, a_dec, m,
- &acc_n, &dec_n);
- plan->f_tgt = f_peak;
- plan->acc_n = acc_n;
- plan->dec_n = dec_n;
+ plan->constant_pulses = 0U;
+ peak_frequency_hz = PlsrAccelCurveFitTargetToPulseBudget(total_pulses, start_frequency_hz, target_frequency_hz, end_frequency_hz,
+ accel_rate_hz_per_s, decel_rate_hz_per_s, selected_mode,
+ &accel_pulses, &decel_pulses);
}
/*
- * --- 补丁:峰值 > 出口 但 dec_n 算出来为 0 ---
+ * --- 补丁:峰值 > 出口 但 decel_pulses 算出来为 0 ---
* 强制留 1 个脉冲做收尾,从 acc 或 const 里挪 1 个给 dec
*/
- if ((f_peak > f_end) && (total_pulses > 1U) && (dec_n == 0U))
+ if ((peak_frequency_hz > end_frequency_hz) && (total_pulses > 1U) && (decel_pulses == 0U))
{
- dec_n = 1U;
- if (acc_n >= total_pulses)
+ decel_pulses = 1U;
+ if (accel_pulses >= total_pulses)
{
- acc_n = total_pulses - 1U;
+ accel_pulses = total_pulses - 1U;
}
- if (plan->const_n > 0U)
+ if (plan->constant_pulses > 0U)
{
- if (plan->const_n >= 1U)
- {
- plan->const_n -= 1U;
- }
- else
- {
- plan->const_n = 0U;
- }
+ plan->constant_pulses--;
}
else
{
- plan->const_n = total_pulses - acc_n - dec_n;
+ plan->constant_pulses = total_pulses - accel_pulses - decel_pulses;
}
}
- plan->f_tgt = f_peak;
- plan->acc_n = acc_n;
- plan->dec_n = dec_n;
+ plan->target_frequency_hz = peak_frequency_hz;
+ plan->accel_pulses = accel_pulses;
+ plan->decel_pulses = decel_pulses;
+}
+
+/** 按 S/正弦时间曲线计算指定脉冲位置的频率。 */
+static uint32_t PlsrAccelCurveTimedFrequencyAtPulse(
+ uint32_t start_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t rate_hz_per_s,
+ PlsrAccelMode_e curve_mode,
+ uint32_t completed_pulses)
+{
+ uint32_t jerk_time_us = 0U;
+ uint32_t constant_accel_time_us = 0U;
+ uint32_t ramp_time_us = 0U;
+ uint32_t elapsed_time_us = 0U;
+ uint32_t current_frequency_hz = start_frequency_hz;
+ uint32_t pulse_index;
+
+ if (curve_mode == PLSR_ACCEL_S)
+ {
+ PlsrAccelCurveCalculateSCurveTimes(start_frequency_hz,
+ end_frequency_hz,
+ rate_hz_per_s,
+ &jerk_time_us,
+ &constant_accel_time_us,
+ &ramp_time_us);
+ }
+ else
+ {
+ PlsrAccelCurveCalculateSineCurveTime(start_frequency_hz,
+ end_frequency_hz,
+ rate_hz_per_s,
+ &ramp_time_us);
+ }
+
+ for (pulse_index = 0U; pulse_index < completed_pulses; pulse_index++)
+ {
+ if (current_frequency_hz < 1U)
+ {
+ current_frequency_hz = 1U;
+ }
+ elapsed_time_us += 1000000UL / current_frequency_hz;
+
+ if (curve_mode == PLSR_ACCEL_S)
+ {
+ current_frequency_hz =
+ PlsrAccelCurveSCurveFrequencyAtTime(start_frequency_hz,
+ end_frequency_hz,
+ rate_hz_per_s,
+ jerk_time_us,
+ constant_accel_time_us,
+ ramp_time_us,
+ elapsed_time_us);
+ }
+ else
+ {
+ current_frequency_hz =
+ PlsrAccelCurveSineFrequencyAtTime(start_frequency_hz,
+ end_frequency_hz,
+ ramp_time_us,
+ elapsed_time_us);
+ }
+ }
+ return current_frequency_hz;
}
/**
- * @brief 按已完成脉冲数取频(任务侧;ISR 用 PulseRtStep)
+ * @brief 按已完成脉冲数取频(任务侧;ISR 用 PlsrAccelNextFrequency)
*
- * 【分段逻辑 — 按 pulse_done 落在哪一段】
+ * 【分段逻辑 — 按 completed_segment_pulses 落在哪一段】
*
- * pulse_done ∈ [0, acc_n) → 加速相(f_cur → f_tgt)
- * pulse_done ∈ [acc_n, acc_n+const_n) → 匀速 f_tgt
- * pulse_done ∈ [acc_n+const_n, …) → 减速相(f_tgt → f_end)
+ * completed_segment_pulses ∈ [0, accel_pulses) → 加速相(start_frequency_hz → target_frequency_hz)
+ * completed_segment_pulses ∈ [accel_pulses, accel_pulses+constant_pulses) → 匀速 target_frequency_hz
+ * completed_segment_pulses ∈ [accel_pulses+constant_pulses, …) → 减速相(target_frequency_hz → end_frequency_hz)
*
- * 注意 pulse_done 是「已经发完的个数」:
- * Start 后第 1 拍进行中时 done 仍为 0,FreqAtPulse(0)=f_cur。
+ * 注意 completed_segment_pulses 是「已经发完的个数」:
+ * Start 后第 1 拍进行中时 done 仍为 0,FreqAtPulse(0)=start_frequency_hz。
*/
uint32_t PlsrAccelCurveFreqAtPulse(const PlsrAccelPlan_t *plan,
- uint32_t pulse_done)
+ uint32_t completed_segment_pulses)
{
- uint32_t const_end;
- uint32_t n;
- uint32_t f;
- uint8_t rising;
+ uint32_t constant_phase_end;
+ uint32_t pulse_count;
+ uint32_t frequency_hz;
+ uint8_t frequency_rising;
if (plan == (PlsrAccelPlan_t *)0)
{
return 0U;
}
- const_end = plan->acc_n + plan->const_n;
+ constant_phase_end = plan->accel_pulses + plan->constant_pulses;
- /* 加速相:0 .. acc_n-1 完成后仍在加速;pulse_done 为已完成数 */
- if ((plan->acc_n > 0U) && (pulse_done < plan->acc_n) &&
- (plan->f_cur != plan->f_tgt))
+ /* 加速相:0 .. accel_pulses-1 完成后仍在加速;completed_segment_pulses 为已完成数 */
+ if ((plan->accel_pulses > 0U) && (completed_segment_pulses < plan->accel_pulses) &&
+ (plan->start_frequency_hz != plan->target_frequency_hz))
{
- rising = (plan->f_tgt >= plan->f_cur) ? 1U : 0U;
- if (plan->mode == PLSR_ACCEL_LINEAR)
+ frequency_rising = (plan->target_frequency_hz >= plan->start_frequency_hz) ? 1U : 0U;
+ if (plan->curve_mode == PLSR_ACCEL_LINEAR)
{
- uint32_t a_use = (rising != 0U) ? plan->a_acc : plan->a_dec;
+ uint32_t selected_rate_hz_per_s = (frequency_rising != 0U) ? plan->accel_rate_hz_per_s : plan->decel_rate_hz_per_s;
- f = PlsrAccelCurveFreqKinematic(plan->f_cur, a_use,
- pulse_done, rising, plan->f_tgt);
+ frequency_hz = PlsrAccelCurveLinearFrequencyAtPulse(plan->start_frequency_hz, selected_rate_hz_per_s,
+ completed_segment_pulses, frequency_rising, plan->target_frequency_hz);
}
else
{
- uint32_t tj = 0U;
- uint32_t ta = 0U;
- uint32_t tramp = 0U;
- uint32_t t_us = 0U;
- uint32_t a_use = (rising != 0U) ? plan->a_acc : plan->a_dec;
- uint32_t i;
-
- f = plan->f_cur;
- if (plan->mode == PLSR_ACCEL_S)
- {
- PlsrAccelCurveSTimeParams(plan->f_cur, plan->f_tgt, a_use,
- &tj, &ta, &tramp);
- }
- else
- {
- PlsrAccelCurveSineTimeParams(plan->f_cur, plan->f_tgt, a_use,
- &tramp);
- }
- for (i = 0U; i < pulse_done; i++)
- {
- if (f < 1U)
- {
- f = 1U;
- }
- t_us += 1000000UL / f;
- if (plan->mode == PLSR_ACCEL_S)
- {
- f = PlsrAccelCurveSFreqAtTime(plan->f_cur, plan->f_tgt, a_use,
- tj, ta, tramp, t_us);
- }
- else
- {
- f = PlsrAccelCurveSineFreqAtTime(plan->f_cur, plan->f_tgt,
- tramp, t_us);
- }
- }
+ uint32_t selected_rate_hz_per_s = (frequency_rising != 0U) ? plan->accel_rate_hz_per_s : plan->decel_rate_hz_per_s;
+
+ frequency_hz = PlsrAccelCurveTimedFrequencyAtPulse(
+ plan->start_frequency_hz,
+ plan->target_frequency_hz,
+ selected_rate_hz_per_s,
+ plan->curve_mode,
+ completed_segment_pulses);
}
- if ((f < 1U) && (plan->f_tgt >= 1U))
+ if ((frequency_hz < 1U) && (plan->target_frequency_hz >= 1U))
{
- f = 1U;
+ frequency_hz = 1U;
}
- return PlsrAccelCurveClampFreq(f);
+ return PlsrAccelCurveClampFrequencyHz(frequency_hz);
}
/* 匀速 */
- if (pulse_done < const_end)
+ if (completed_segment_pulses < constant_phase_end)
{
- return PlsrAccelCurveClampFreq(plan->f_tgt);
+ return PlsrAccelCurveClampFrequencyHz(plan->target_frequency_hz);
}
/* 减速 / 无减速 */
- if ((plan->dec_n == 0U) || (plan->f_tgt == plan->f_end))
+ if ((plan->decel_pulses == 0U) || (plan->target_frequency_hz == plan->end_frequency_hz))
{
- return PlsrAccelCurveClampFreq(plan->f_end);
+ return PlsrAccelCurveClampFrequencyHz(plan->end_frequency_hz);
}
- n = pulse_done - const_end;
- if (n >= plan->dec_n)
+ pulse_count = completed_segment_pulses - constant_phase_end;
+ if (pulse_count >= plan->decel_pulses)
{
- return PlsrAccelCurveClampFreq(plan->f_end);
+ return PlsrAccelCurveClampFrequencyHz(plan->end_frequency_hz);
}
- rising = (plan->f_end >= plan->f_tgt) ? 1U : 0U;
- if (plan->mode == PLSR_ACCEL_LINEAR)
+ frequency_rising = (plan->end_frequency_hz >= plan->target_frequency_hz) ? 1U : 0U;
+ if (plan->curve_mode == PLSR_ACCEL_LINEAR)
{
- uint32_t a_use = (rising != 0U) ? plan->a_acc : plan->a_dec;
+ uint32_t selected_rate_hz_per_s = (frequency_rising != 0U) ? plan->accel_rate_hz_per_s : plan->decel_rate_hz_per_s;
- f = PlsrAccelCurveFreqKinematic(plan->f_tgt, a_use,
- n, rising, plan->f_end);
+ frequency_hz = PlsrAccelCurveLinearFrequencyAtPulse(plan->target_frequency_hz, selected_rate_hz_per_s,
+ pulse_count, frequency_rising, plan->end_frequency_hz);
}
else
{
- uint32_t tj = 0U;
- uint32_t ta = 0U;
- uint32_t tramp = 0U;
- uint32_t t_us = 0U;
- uint32_t i;
- uint32_t a_use = (rising != 0U) ? plan->a_acc : plan->a_dec;
+ uint32_t selected_rate_hz_per_s = (frequency_rising != 0U) ? plan->accel_rate_hz_per_s : plan->decel_rate_hz_per_s;
- f = plan->f_tgt;
- if (plan->mode == PLSR_ACCEL_S)
- {
- PlsrAccelCurveSTimeParams(plan->f_tgt, plan->f_end, a_use,
- &tj, &ta, &tramp);
- }
- else
- {
- PlsrAccelCurveSineTimeParams(plan->f_tgt, plan->f_end, a_use,
- &tramp);
- }
- for (i = 0U; i < n; i++)
- {
- if (f < 1U)
- {
- f = 1U;
- }
- t_us += 1000000UL / f;
- if (plan->mode == PLSR_ACCEL_S)
- {
- f = PlsrAccelCurveSFreqAtTime(plan->f_tgt, plan->f_end,
- a_use, tj, ta, tramp, t_us);
- }
- else
- {
- f = PlsrAccelCurveSineFreqAtTime(plan->f_tgt, plan->f_end,
- tramp, t_us);
- }
- }
+ frequency_hz = PlsrAccelCurveTimedFrequencyAtPulse(
+ plan->target_frequency_hz,
+ plan->end_frequency_hz,
+ selected_rate_hz_per_s,
+ plan->curve_mode,
+ pulse_count);
}
- if (f < 1U)
+ if (frequency_hz < 1U)
{
- f = 1U;
+ frequency_hz = 1U;
}
- return PlsrAccelCurveClampFreq(f);
+ return PlsrAccelCurveClampFrequencyHz(frequency_hz);
}
/*============================================================================*/
@@ -1089,576 +1086,573 @@ uint32_t PlsrAccelCurveFreqAtPulse(const PlsrAccelPlan_t *plan,
/**
* @brief 为 S/正弦准备时间剖面(加速度梯形 / raised-cosine)
*/
-static uint32_t PlsrAccelPulseRtTimeStep(PlsrAccelPulseRt_t *rt);
+static uint32_t PlsrAccelNextFrequencyTimed(PlsrAccelRuntime_t *runtime);
/* S/正弦频率预计算表:PlanSeg 时填好;ISR 只切换/查表。匀速不改频。 */
#define PLSR_RAMP_TBL_MAX 4096U
-static uint32_t s_acc_tbl[PLSR_RAMP_TBL_MAX];
-static uint32_t s_dec_tbl[PLSR_RAMP_TBL_MAX];
-static uint32_t s_acc_tbl_len;
-static uint32_t s_acc_tbl_stride;
-static uint32_t s_acc_tbl_n;//加速真实总脉冲数 acc_n
-static uint32_t s_dec_tbl_len;
-static uint32_t s_dec_tbl_stride;
-static uint32_t s_dec_tbl_n;//减速真实总脉冲数 dec_n
-static uint32_t *s_rt_tbl; /* ISR 当前相使用的表 */
-
-static void PlsrAccelPulseRtSetupTimeProfile(PlsrAccelPulseRt_t *rt)
+static uint32_t s_acceleration_frequency_table[PLSR_RAMP_TBL_MAX];
+static uint32_t s_deceleration_frequency_table[PLSR_RAMP_TBL_MAX];
+static uint32_t s_acceleration_table_length;
+static uint32_t s_acceleration_table_stride;
+static uint32_t s_deceleration_table_length;
+static uint32_t s_deceleration_table_stride;
+
+static void PlsrAccelRuntimeCalculateTimes(PlsrAccelRuntime_t *runtime)
{
- rt->t_us = 0U;
- rt->tj_us = 0U;
- rt->ta_us = 0U;
- rt->tramp_us = 0U;
+ runtime->elapsed_time_us = 0U;
+ runtime->jerk_time_us = 0U;
+ runtime->constant_accel_time_us = 0U;
+ runtime->ramp_time_us = 0U;
- if ((rt->a < 1U) || (rt->f0 == rt->f1))
+ if ((runtime->acceleration_hz_per_s < 1U) || (runtime->start_frequency_hz == runtime->end_frequency_hz))
{
return;
}
- if (rt->mode == PLSR_ACCEL_S)
+ if (runtime->curve_mode == PLSR_ACCEL_S)
{
- PlsrAccelCurveSTimeParams(rt->f0, rt->f1, rt->a,
- &rt->tj_us, &rt->ta_us, &rt->tramp_us);
+ PlsrAccelCurveCalculateSCurveTimes(runtime->start_frequency_hz, runtime->end_frequency_hz, runtime->acceleration_hz_per_s,
+ &runtime->jerk_time_us, &runtime->constant_accel_time_us, &runtime->ramp_time_us);
}
- else if (rt->mode == PLSR_ACCEL_SINE)
+ else if (runtime->curve_mode == PLSR_ACCEL_SINE)
{
- PlsrAccelCurveSineTimeParams(rt->f0, rt->f1, rt->a, &rt->tramp_us);
+ PlsrAccelCurveCalculateSineCurveTime(runtime->start_frequency_hz, runtime->end_frequency_hz, runtime->acceleration_hz_per_s, &runtime->ramp_time_us);
}
}
+/** 填写一个加速或减速相的运行数据。 */
+static void PlsrAccelRuntimeBeginRamp(PlsrAccelRuntime_t *runtime,
+ uint32_t start_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t total_pulses,
+ uint32_t accel_rate_hz_per_s,
+ uint32_t decel_rate_hz_per_s,
+ PlsrAccelMode_e curve_mode)
+{
+ runtime->start_frequency_hz = start_frequency_hz;
+ runtime->end_frequency_hz = end_frequency_hz;
+ runtime->current_frequency_hz = start_frequency_hz;
+ runtime->completed_pulses = 0U;
+ runtime->total_pulses = total_pulses;
+ runtime->frequency_rising =
+ (end_frequency_hz >= start_frequency_hz) ? 1U : 0U;
+ runtime->acceleration_hz_per_s =
+ (runtime->frequency_rising != 0U) ?
+ accel_rate_hz_per_s : decel_rate_hz_per_s;
+ runtime->curve_mode = curve_mode;
+ runtime->is_active = ((total_pulses > 0U) &&
+ (start_frequency_hz != end_frequency_hz)) ? 1U : 0U;
+ runtime->frequency_table_id = 0U;
+ runtime->table_length = 0U;
+ runtime->table_stride = 1U;
+ PlsrAccelRuntimeCalculateTimes(runtime);
+}
+
/** 离散仿真一步:与建表 / 脉冲预算共用 */
-static void PlsrAccelPulseRtSimOne(PlsrAccelPulseRt_t *rt)
+static void PlsrAccelRuntimeSimulateOnePulse(PlsrAccelRuntime_t *runtime)
{
- if (rt->n < 0xFFFFFFFFUL)
+ if (runtime->completed_pulses < 0xFFFFFFFFUL)
{
- rt->n++;
+ runtime->completed_pulses++;
}
- rt->f = PlsrAccelPulseRtTimeStep(rt);
- if ((rt->tramp_us > 0U) && (rt->t_us >= rt->tramp_us))
+ runtime->current_frequency_hz = PlsrAccelNextFrequencyTimed(runtime);
+ if ((runtime->ramp_time_us > 0U) && (runtime->elapsed_time_us >= runtime->ramp_time_us))
{
- rt->f = rt->f1;
- rt->active = 0U;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
+ runtime->is_active = 0U;
}
- else if (rt->rising != 0U)
+ else if (runtime->frequency_rising != 0U)
{
- if (rt->f >= rt->f1)
+ if (runtime->current_frequency_hz >= runtime->end_frequency_hz)
{
- rt->f = rt->f1;
- rt->active = 0U;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
+ runtime->is_active = 0U;
}
}
else
{
- if (rt->f <= rt->f1)
+ if (runtime->current_frequency_hz <= runtime->end_frequency_hz)
{
- rt->f = rt->f1;
- rt->active = 0U;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
+ runtime->is_active = 0U;
}
}
}
/**
- * 将本相离散剖面写入 dst[],返回写入长度;*stride_out 为抽样步长。
+ * 将本相离散剖面写入 frequency_table[],返回写入长度;*table_stride_out 为抽样步长。
*/
-static uint32_t PlsrAccelPulseRtFillTable(PlsrAccelPulseRt_t *rt,
- uint32_t *dst,
- uint32_t dst_max,
- uint32_t *stride_out)
+static uint32_t PlsrAccelRuntimeBuildFrequencyTable(PlsrAccelRuntime_t *runtime,
+ uint32_t *frequency_table,
+ uint32_t table_capacity,
+ uint32_t *table_stride_out)
{
- PlsrAccelPulseRt_t sim;
- uint32_t i;
- uint32_t idx;
- uint32_t stride;
- uint32_t len;
+ PlsrAccelRuntime_t simulation;
+ uint32_t loop_index;
+ uint32_t table_index;
+ uint32_t table_stride;
+ uint32_t table_length;
- *stride_out = 1U;
- if ((rt->active == 0U) || (rt->n_total < 1U) ||
- (rt->mode == PLSR_ACCEL_LINEAR) || (dst == (uint32_t *)0) ||
- (dst_max < 1U))
+ *table_stride_out = 1U;
+ if ((runtime->is_active == 0U) || (runtime->total_pulses < 1U) ||
+ (runtime->curve_mode == PLSR_ACCEL_LINEAR) || (frequency_table == (uint32_t *)0) ||
+ (table_capacity < 1U))
{
return 0U;
}
- stride = 1U;
- if (rt->n_total > dst_max)
+ table_stride = 1U;
+ if (runtime->total_pulses > table_capacity)
{
- stride = (rt->n_total + dst_max - 1U) / dst_max;
+ table_stride = (runtime->total_pulses + table_capacity - 1U) / table_capacity;
}
- *stride_out = stride;
+ *table_stride_out = table_stride;
- sim = *rt;
- sim.n = 0U;
- sim.f = rt->f0;
- sim.active = 1U;
- PlsrAccelPulseRtSetupTimeProfile(&sim);
- if (sim.tramp_us < 1U)
+ simulation = *runtime;
+ simulation.completed_pulses = 0U;
+ simulation.current_frequency_hz = runtime->start_frequency_hz;
+ simulation.is_active = 1U;
+ PlsrAccelRuntimeCalculateTimes(&simulation);
+ if (simulation.ramp_time_us < 1U)
{
- dst[0] = rt->f1;
+ frequency_table[0] = runtime->end_frequency_hz;
return 1U;
}
- len = 0U;
- for (i = 0U; i < rt->n_total; i++)
+ table_length = 0U;
+ for (loop_index = 0U; loop_index < runtime->total_pulses; loop_index++)
{
- PlsrAccelPulseRtSimOne(&sim);
- idx = (sim.n - 1U) / stride;
- if (idx >= dst_max)
+ PlsrAccelRuntimeSimulateOnePulse(&simulation);
+ table_index = (simulation.completed_pulses - 1U) / table_stride;
+ if (table_index >= table_capacity)
{
- idx = dst_max - 1U;
+ table_index = table_capacity - 1U;
}
- dst[idx] = sim.f;
- if ((idx + 1U) > len)
+ frequency_table[table_index] = simulation.current_frequency_hz;
+ if ((table_index + 1U) > table_length)
{
- len = idx + 1U;
+ table_length = table_index + 1U;
}
- if (sim.active == 0U)
+ if (simulation.is_active == 0U)
{
- while ((i + 1U) < rt->n_total)
+ while ((loop_index + 1U) < runtime->total_pulses)
{
- i++;
- idx = i / stride;
- if (idx >= dst_max)
+ loop_index++;
+ table_index = loop_index / table_stride;
+ if (table_index >= table_capacity)
{
- idx = dst_max - 1U;
+ table_index = table_capacity - 1U;
}
- dst[idx] = rt->f1;
- if ((idx + 1U) > len)
+ frequency_table[table_index] = runtime->end_frequency_hz;
+ if ((table_index + 1U) > table_length)
{
- len = idx + 1U;
+ table_length = table_index + 1U;
}
}
break;
}
}
- if (len > 0U)
+ if (table_length > 0U)
{
- dst[len - 1U] = rt->f1;
+ frequency_table[table_length - 1U] = runtime->end_frequency_hz;
}
- return len;
+ return table_length;
}
/**
* PlanSeg 后预建加/减速表(任务上下文,勿在 ISR 里做)。
*/
-void PlsrAccelPulseRtPrebuild(const PlsrAccelPlan_t *plan)
+void PlsrAccelPrebuildFrequencyTables(const PlsrAccelPlan_t *plan)
{
- PlsrAccelPulseRt_t tmp;
+ PlsrAccelRuntime_t temporary_runtime;
- s_acc_tbl_len = 0U;
- s_dec_tbl_len = 0U;
- s_acc_tbl_stride = 1U;
- s_dec_tbl_stride = 1U;
- s_acc_tbl_n = 0U;//加速真实总脉冲数 acc_n
- s_dec_tbl_n = 0U;//减速真实总脉冲数 dec_n
- s_rt_tbl = (uint32_t *)0;
+ s_acceleration_table_length = 0U;
+ s_deceleration_table_length = 0U;
+ s_acceleration_table_stride = 1U;
+ s_deceleration_table_stride = 1U;
if ((plan == (const PlsrAccelPlan_t *)0) ||
- (plan->mode == PLSR_ACCEL_LINEAR))
+ (plan->curve_mode == PLSR_ACCEL_LINEAR))
{
return;
}
- if ((plan->acc_n > 0U) && (plan->f_cur != plan->f_tgt))
- {
- tmp.f0 = plan->f_cur;
- tmp.f1 = plan->f_tgt;
- tmp.f = plan->f_cur;
- tmp.n = 0U;
- tmp.n_total = plan->acc_n;
- tmp.rising = (plan->f_tgt >= plan->f_cur) ? 1U : 0U;
- tmp.a = (tmp.rising != 0U) ? plan->a_acc : plan->a_dec;
- tmp.mode = plan->mode;
- tmp.active = 1U;
- tmp.use_tbl = 0U;
- s_acc_tbl_n = plan->acc_n;
- s_acc_tbl_len = PlsrAccelPulseRtFillTable(&tmp, s_acc_tbl,
+ if ((plan->accel_pulses > 0U) && (plan->start_frequency_hz != plan->target_frequency_hz))
+ {
+ PlsrAccelRuntimeBeginRamp(&temporary_runtime,
+ plan->start_frequency_hz,
+ plan->target_frequency_hz,
+ plan->accel_pulses,
+ plan->accel_rate_hz_per_s,
+ plan->decel_rate_hz_per_s,
+ plan->curve_mode);
+ s_acceleration_table_length = PlsrAccelRuntimeBuildFrequencyTable(&temporary_runtime, s_acceleration_frequency_table,
PLSR_RAMP_TBL_MAX,
- &s_acc_tbl_stride);
- }
-
- if ((plan->dec_n > 0U) && (plan->f_tgt != plan->f_end))
- {
- tmp.f0 = plan->f_tgt;
- tmp.f1 = plan->f_end;
- tmp.f = plan->f_tgt;
- tmp.n = 0U;
- tmp.n_total = plan->dec_n;
- tmp.rising = (plan->f_end >= plan->f_tgt) ? 1U : 0U;
- tmp.a = (tmp.rising != 0U) ? plan->a_acc : plan->a_dec;
- tmp.mode = plan->mode;
- tmp.active = 1U;
- tmp.use_tbl = 0U;
- s_dec_tbl_n = plan->dec_n;
- s_dec_tbl_len = PlsrAccelPulseRtFillTable(&tmp, s_dec_tbl,
+ &s_acceleration_table_stride);
+ }
+
+ if ((plan->decel_pulses > 0U) && (plan->target_frequency_hz != plan->end_frequency_hz))
+ {
+ PlsrAccelRuntimeBeginRamp(&temporary_runtime,
+ plan->target_frequency_hz,
+ plan->end_frequency_hz,
+ plan->decel_pulses,
+ plan->accel_rate_hz_per_s,
+ plan->decel_rate_hz_per_s,
+ plan->curve_mode);
+ s_deceleration_table_length = PlsrAccelRuntimeBuildFrequencyTable(&temporary_runtime, s_deceleration_frequency_table,
PLSR_RAMP_TBL_MAX,
- &s_dec_tbl_stride);
+ &s_deceleration_table_stride);
}
}
-/*把已经预构建完成的抽样频率表,挂载到运行时剖面结构体 PlsrAccelPulseRt_t。
- *前面 PlsrAccelPulseRtPrebuild() 已经生成好s_acc_tbl/s_dec_tbl
- *本函数完成:表指针、表长度、抽样步长赋值,设置标志位use_tbl,告诉运行时仿真逻辑:
- *优先查表,不再跑逐脉冲仿真循环。
- */
-static void PlsrAccelPulseRtAttachTable(PlsrAccelPulseRt_t *rt,
- uint32_t *tbl,
- uint32_t tbl_len,
- uint32_t tbl_stride,
- uint32_t built_n)
+/** 选择当前相使用的加速表或减速表,并记录表长度和抽样步长。 */
+static void PlsrAccelRuntimeSelectFrequencyTable(PlsrAccelRuntime_t *runtime,
+ uint8_t frequency_table_id,
+ uint32_t table_length,
+ uint32_t table_stride)
{
- (void)built_n;
- s_rt_tbl = tbl;
- rt->tbl_len = tbl_len;
- rt->tbl_stride = (tbl_stride < 1U) ? 1U : tbl_stride;
- rt->use_tbl = ((tbl != (uint32_t *)0) && (tbl_len > 0U)) ? 1U : 0U;
+ runtime->table_length = table_length;
+ runtime->table_stride = (table_stride < 1U) ? 1U : table_stride;
+ runtime->frequency_table_id = (table_length > 0U) ? frequency_table_id : 0U;
}
/** @brief 进入加速相(见 plsr_accel_curve.h) */
-void PlsrAccelPulseRtBeginAcc(PlsrAccelPulseRt_t *rt,
+void PlsrAccelBeginAcceleration(PlsrAccelRuntime_t *runtime,
const PlsrAccelPlan_t *plan)
{
- if ((rt == (PlsrAccelPulseRt_t *)0) || (plan == (const PlsrAccelPlan_t *)0))
+ if ((runtime == (PlsrAccelRuntime_t *)0) || (plan == (const PlsrAccelPlan_t *)0))
{
return;
}
- rt->f0 = plan->f_cur;
- rt->f1 = plan->f_tgt;
- rt->f = plan->f_cur;
- rt->n = 0U;
- rt->n_total = plan->acc_n;
- rt->rising = (plan->f_tgt >= plan->f_cur) ? 1U : 0U;
- rt->a = (rt->rising != 0U) ? plan->a_acc : plan->a_dec;
- rt->mode = plan->mode;
- rt->active = (plan->acc_n > 0U) && (plan->f_cur != plan->f_tgt) ? 1U : 0U;
- PlsrAccelPulseRtSetupTimeProfile(rt);
- PlsrAccelPulseRtAttachTable(rt, s_acc_tbl, s_acc_tbl_len,
- s_acc_tbl_stride, s_acc_tbl_n);
+ PlsrAccelRuntimeBeginRamp(runtime,
+ plan->start_frequency_hz,
+ plan->target_frequency_hz,
+ plan->accel_pulses,
+ plan->accel_rate_hz_per_s,
+ plan->decel_rate_hz_per_s,
+ plan->curve_mode);
+ PlsrAccelRuntimeSelectFrequencyTable(runtime, 1U, s_acceleration_table_length,
+ s_acceleration_table_stride);
}
/** @brief 进入减速相(见 plsr_accel_curve.h) */
-void PlsrAccelPulseRtBeginDec(PlsrAccelPulseRt_t *rt,
+void PlsrAccelBeginDeceleration(PlsrAccelRuntime_t *runtime,
const PlsrAccelPlan_t *plan)
{
- if ((rt == (PlsrAccelPulseRt_t *)0) || (plan == (const PlsrAccelPlan_t *)0))
+ if ((runtime == (PlsrAccelRuntime_t *)0) || (plan == (const PlsrAccelPlan_t *)0))
{
return;
}
- rt->f0 = plan->f_tgt;
- rt->f1 = plan->f_end;
- rt->f = plan->f_tgt;
- rt->n = 0U;
- rt->n_total = plan->dec_n;
- rt->rising = (plan->f_end >= plan->f_tgt) ? 1U : 0U;
- /* 谷底右侧爬升用 a_acc,正常减速用 a_dec */
- rt->a = (rt->rising != 0U) ? plan->a_acc : plan->a_dec;
- rt->mode = plan->mode;
- rt->active = (plan->dec_n > 0U) && (plan->f_tgt != plan->f_end) ? 1U : 0U;
- PlsrAccelPulseRtSetupTimeProfile(rt);
+ PlsrAccelRuntimeBeginRamp(runtime,
+ plan->target_frequency_hz,
+ plan->end_frequency_hz,
+ plan->decel_pulses,
+ plan->accel_rate_hz_per_s,
+ plan->decel_rate_hz_per_s,
+ plan->curve_mode);
/* 表已在 PlanSeg/Prebuild 填好;ISR 内禁止再建表 */
- PlsrAccelPulseRtAttachTable(rt, s_dec_tbl, s_dec_tbl_len,
- s_dec_tbl_stride, s_dec_tbl_n);
+ PlsrAccelRuntimeSelectFrequencyTable(runtime, 2U, s_deceleration_table_length,
+ s_deceleration_table_stride);
}
/** @brief 进入匀速相(见 plsr_accel_curve.h) */
-void PlsrAccelPulseRtBeginConst(PlsrAccelPulseRt_t *rt,
+void PlsrAccelBeginConstantSpeed(PlsrAccelRuntime_t *runtime,
const PlsrAccelPlan_t *plan)
{
- if ((rt == (PlsrAccelPulseRt_t *)0) || (plan == (const PlsrAccelPlan_t *)0))
+ if ((runtime == (PlsrAccelRuntime_t *)0) || (plan == (const PlsrAccelPlan_t *)0))
{
return;
}
- rt->f0 = plan->f_tgt;
- rt->f1 = plan->f_tgt;
- rt->f = plan->f_tgt;
- rt->a = 0U;
- rt->n = 0U;
- rt->n_total = plan->const_n;
- rt->rising = 1U;
- rt->mode = plan->mode;
- rt->active = 0U; /* 匀速:ISR 不改频 */
- rt->use_tbl = 0U;
- rt->tbl_len = 0U;
- rt->tbl_stride = 1U;
- rt->t_us = 0U;
- rt->tj_us = 0U;
- rt->ta_us = 0U;
- rt->tramp_us = 0U;
+ runtime->start_frequency_hz = plan->target_frequency_hz;
+ runtime->end_frequency_hz = plan->target_frequency_hz;
+ runtime->current_frequency_hz = plan->target_frequency_hz;
+ runtime->acceleration_hz_per_s = 0U;
+ runtime->completed_pulses = 0U;
+ runtime->total_pulses = plan->constant_pulses;
+ runtime->frequency_rising = 1U;
+ runtime->curve_mode = plan->curve_mode;
+ runtime->is_active = 0U; /* 匀速:ISR 不改频 */
+ runtime->frequency_table_id = 0U;
+ runtime->table_length = 0U;
+ runtime->table_stride = 1U;
+ runtime->elapsed_time_us = 0U;
+ runtime->jerk_time_us = 0U;
+ runtime->constant_accel_time_us = 0U;
+ runtime->ramp_time_us = 0U;
}
/**
- * 直线:用上一拍 f ±1 逼近 target_sq,不全量开方。
- * 低频 df/dn 大时循环次数多,但周期也长,ISR 仍可承受。
+ * 直线:用上一拍 frequency_hz ±1 逼近 target_frequency_squared,不全量开方。
+ * 低频 frequency_difference_hz/dn 大时循环次数多,但周期也长,ISR 仍可承受。
*/
-static uint32_t PlsrAccelPulseRtSquareStep(PlsrAccelPulseRt_t *rt)
+static uint32_t PlsrAccelNextFrequencyLinear(PlsrAccelRuntime_t *runtime)
{
- uint64_t target_sq;
- uint64_t f_sq;
- uint64_t f0_sq;
- uint32_t f;
- uint32_t guard;
+ uint64_t target_frequency_squared;
+ uint64_t current_frequency_squared;
+ uint64_t start_frequency_squared;
+ uint32_t frequency_hz;
+ uint32_t iteration_guard;
- f0_sq = (uint64_t)rt->f0 * (uint64_t)rt->f0;
- if (rt->rising != 0U)
+ start_frequency_squared = (uint64_t)runtime->start_frequency_hz * (uint64_t)runtime->start_frequency_hz;
+ if (runtime->frequency_rising != 0U)
{
- target_sq = f0_sq + (2ULL * (uint64_t)rt->a * (uint64_t)rt->n);
+ target_frequency_squared = start_frequency_squared + (2ULL * (uint64_t)runtime->acceleration_hz_per_s * (uint64_t)runtime->completed_pulses);
}
else
{
- uint64_t drop = 2ULL * (uint64_t)rt->a * (uint64_t)rt->n;
- target_sq = (drop >= f0_sq) ? 0ULL : (f0_sq - drop);
+ uint64_t frequency_drop = 2ULL * (uint64_t)runtime->acceleration_hz_per_s * (uint64_t)runtime->completed_pulses;
+ target_frequency_squared = (frequency_drop >= start_frequency_squared) ? 0ULL : (start_frequency_squared - frequency_drop);
}
- f = rt->f;
- if (f < 1U)
+ frequency_hz = runtime->current_frequency_hz;
+ if (frequency_hz < 1U)
{
- f = 1U;
+ frequency_hz = 1U;
}
- for (guard = 0U; guard < 2048U; guard++)
+ for (iteration_guard = 0U; iteration_guard < 2048U; iteration_guard++)
{
- f_sq = (uint64_t)f * (uint64_t)f;
- if (rt->rising != 0U)
+ current_frequency_squared = (uint64_t)frequency_hz * (uint64_t)frequency_hz;
+ if (runtime->frequency_rising != 0U)
{
- if ((f < rt->f1) && (((uint64_t)(f + 1U) * (uint64_t)(f + 1U)) <= target_sq))
+ if ((frequency_hz < runtime->end_frequency_hz) && (((uint64_t)(frequency_hz + 1U) * (uint64_t)(frequency_hz + 1U)) <= target_frequency_squared))
{
- f++;
+ frequency_hz++;
continue;
}
- if ((f > 1U) && (f_sq > target_sq))
+ if ((frequency_hz > 1U) && (current_frequency_squared > target_frequency_squared))
{
- f--;
+ frequency_hz--;
continue;
}
break;
}
else
{
- if ((f > rt->f1) && (f_sq > target_sq))
+ if ((frequency_hz > runtime->end_frequency_hz) && (current_frequency_squared > target_frequency_squared))
{
- f--;
+ frequency_hz--;
continue;
}
- if ((f < 100000U) &&
- (((uint64_t)(f + 1U) * (uint64_t)(f + 1U)) < target_sq))
+ if ((frequency_hz < 100000U) &&
+ (((uint64_t)(frequency_hz + 1U) * (uint64_t)(frequency_hz + 1U)) < target_frequency_squared))
{
- f++;
+ frequency_hz++;
continue;
}
break;
}
}
- if (rt->rising != 0U)
+ if (runtime->frequency_rising != 0U)
{
- if (f > rt->f1)
+ if (frequency_hz > runtime->end_frequency_hz)
{
- f = rt->f1;
+ frequency_hz = runtime->end_frequency_hz;
}
}
else
{
- if (f < rt->f1)
+ if (frequency_hz < runtime->end_frequency_hz)
{
- f = rt->f1;
+ frequency_hz = runtime->end_frequency_hz;
}
}
- if (f < 1U)
+ if (frequency_hz < 1U)
{
- f = 1U;
+ frequency_hz = 1U;
}
- return PlsrAccelCurveClampFreq(f);
+ return PlsrAccelCurveClampFrequencyHz(frequency_hz);
}
/**
* S/正弦时间域步进:上一拍周期推进 t,再按剖面取下一拍频率。
*/
-static uint32_t PlsrAccelPulseRtTimeStep(PlsrAccelPulseRt_t *rt)
+static uint32_t PlsrAccelNextFrequencyTimed(PlsrAccelRuntime_t *runtime)
{
- uint32_t f_prev;
- uint32_t dt_us;
- uint32_t f;
+ uint32_t previous_frequency_hz;
+ uint32_t pulse_period_us;
+ uint32_t frequency_hz;
- if ((rt->tramp_us < 1U) || (rt->a < 1U))
+ if ((runtime->ramp_time_us < 1U) || (runtime->acceleration_hz_per_s < 1U))
{
- return PlsrAccelCurveClampFreq(rt->f1);
+ return PlsrAccelCurveClampFrequencyHz(runtime->end_frequency_hz);
}
- f_prev = rt->f;
- if (f_prev < 1U)
+ previous_frequency_hz = runtime->current_frequency_hz;
+ if (previous_frequency_hz < 1U)
{
- f_prev = 1U;
+ previous_frequency_hz = 1U;
}
- dt_us = 1000000UL / f_prev;
+ pulse_period_us = 1000000UL / previous_frequency_hz;
- if (rt->t_us < (0xFFFFFFFFUL - dt_us))
+ if (runtime->elapsed_time_us < (0xFFFFFFFFUL - pulse_period_us))
{
- rt->t_us += dt_us;
+ runtime->elapsed_time_us += pulse_period_us;
}
else
{
- rt->t_us = 0xFFFFFFFFUL;
+ runtime->elapsed_time_us = 0xFFFFFFFFUL;
}
- if (rt->t_us >= rt->tramp_us)
+ if (runtime->elapsed_time_us >= runtime->ramp_time_us)
{
- return PlsrAccelCurveClampFreq(rt->f1);
+ return PlsrAccelCurveClampFrequencyHz(runtime->end_frequency_hz);
}
- if (rt->mode == PLSR_ACCEL_S)
+ if (runtime->curve_mode == PLSR_ACCEL_S)
{
- f = PlsrAccelCurveSFreqAtTime(rt->f0, rt->f1, rt->a,
- rt->tj_us, rt->ta_us, rt->tramp_us,
- rt->t_us);
+ frequency_hz = PlsrAccelCurveSCurveFrequencyAtTime(runtime->start_frequency_hz, runtime->end_frequency_hz, runtime->acceleration_hz_per_s,
+ runtime->jerk_time_us, runtime->constant_accel_time_us, runtime->ramp_time_us,
+ runtime->elapsed_time_us);
}
else
{
- f = PlsrAccelCurveSineFreqAtTime(rt->f0, rt->f1, rt->tramp_us, rt->t_us);
+ frequency_hz = PlsrAccelCurveSineFrequencyAtTime(runtime->start_frequency_hz, runtime->end_frequency_hz, runtime->ramp_time_us, runtime->elapsed_time_us);
}
- return f;
+ return frequency_hz;
}
/*仿真离散脉冲剖面,算出该段加减速一共需要输出多少个脉冲*/
-static uint32_t PlsrAccelCurvePulsesForDiscreteProfile(uint32_t f0, uint32_t f1,
- uint32_t a_hz_s,
- PlsrAccelMode_e mode)
+static uint32_t PlsrAccelCurveSimulateRampPulses(uint32_t start_frequency_hz, uint32_t end_frequency_hz,
+ uint32_t acceleration_hz_per_s,
+ PlsrAccelMode_e curve_mode)
{
- PlsrAccelPulseRt_t rt;
- uint32_t guard;
+ PlsrAccelRuntime_t runtime;
+ uint32_t iteration_guard;
- if (f0 == f1 || a_hz_s == 0U)
+ if (start_frequency_hz == end_frequency_hz || acceleration_hz_per_s == 0U)
{
return 0U;
}
- rt.f0 = f0;
- rt.f1 = f1;
- rt.f = f0;
- rt.n = 0U;
- rt.rising = (f1 >= f0) ? 1U : 0U;
- rt.a = a_hz_s;
- rt.mode = mode;
- rt.active = 1U;
- rt.t_us = 0U;
- rt.tj_us = 0U;
- rt.ta_us = 0U;
- rt.tramp_us = 0U;
- rt.use_tbl = 0U;
- rt.tbl_len = 0U;
- rt.tbl_stride = 1U;
- PlsrAccelPulseRtSetupTimeProfile(&rt);
- if (rt.tramp_us < 1U)
+ PlsrAccelRuntimeBeginRamp(&runtime,
+ start_frequency_hz,
+ end_frequency_hz,
+ 0xFFFFFFFFUL,
+ acceleration_hz_per_s,
+ acceleration_hz_per_s,
+ curve_mode);
+ if (runtime.ramp_time_us < 1U)
{
return 1U;
}
- guard = 0U;
- while ((rt.active != 0U) && (guard < 5000000U))
+ iteration_guard = 0U;
+ while ((runtime.is_active != 0U) && (iteration_guard < 5000000U))
{
- guard++;
- PlsrAccelPulseRtSimOne(&rt);
+ iteration_guard++;
+ PlsrAccelRuntimeSimulateOnePulse(&runtime);
}
- if (rt.n == 0U)
+ if (runtime.completed_pulses == 0U)
{
return 1U;
}
- return rt.n;
+ return runtime.completed_pulses;
}
/**
* @brief ISR 热路径:本相再前进 1 脉冲,返回「下一拍应写入 ARR 的频率」
*
- * 调用时机:每个 PWM UPDATE 中断里(run_control OnPulseIsr),在 s_done++ 之后。
+ * 调用时机:每个 PWM UPDATE 中断里,在本段已发脉冲数加一之后。
*
* 模式分支:
- * LINEAR → SquareStep:用 f±1 逼近 sqrt(f0^2±2an),不全量开方
- * S/SINE+表 → 查 s_acc_tbl / s_dec_tbl(Prebuild 填好),idx=(n-1)/stride
+ * LINEAR → SquareStep:用 frequency_hz±1 逼近 sqrt(start_frequency_hz^2±2an),不全量开方
+ * S/SINE+表 → 查 s_acceleration_frequency_table / s_deceleration_frequency_table(Prebuild 填好),table_index=(pulse_count-1)/table_stride
* S/SINE无表 → 兜底 TimeStep(不应出现在正常路径)
*
- * n 含义:本相已 Step 次数;BeginAcc 后第 1 次 Step 时 n 变为 1,对应「第 2 拍」频率。
+ * pulse_count 含义:本相已 Step 次数;BeginAcc 后第 1 次 Step 时 pulse_count 变为 1,对应「第 2 拍」频率。
*/
-uint32_t PlsrAccelPulseRtStep(PlsrAccelPulseRt_t *rt)
+uint32_t PlsrAccelNextFrequency(PlsrAccelRuntime_t *runtime)
{
- uint32_t idx;
+ const uint32_t *frequency_table;
+ uint32_t table_index;
- if (rt == (PlsrAccelPulseRt_t *)0)
+ if (runtime == (PlsrAccelRuntime_t *)0)
{
return 0U;
}
- if (rt->active == 0U)
+ if (runtime->is_active == 0U)
{
- return PlsrAccelCurveClampFreq(rt->f);
+ return PlsrAccelCurveClampFrequencyHz(runtime->current_frequency_hz);
}
- if (rt->n < 0xFFFFFFFFUL)
+ if (runtime->completed_pulses < 0xFFFFFFFFUL)
{
- rt->n++;
+ runtime->completed_pulses++;
}
- if (rt->mode == PLSR_ACCEL_LINEAR)
+ if (runtime->curve_mode == PLSR_ACCEL_LINEAR)
{
- if (rt->a == 0U)
+ if (runtime->acceleration_hz_per_s == 0U)
{
- rt->f = rt->f1;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
}
else
{
- rt->f = PlsrAccelPulseRtSquareStep(rt);
+ runtime->current_frequency_hz = PlsrAccelNextFrequencyLinear(runtime);
}
}
- else if ((rt->use_tbl != 0U) && (s_rt_tbl != (uint32_t *)0))
+ else if (runtime->frequency_table_id != 0U)
{
/* ISR 热路径:只查表,不做 S/正弦实时积分 */
- if (rt->tbl_len < 1U)
+ if (runtime->table_length < 1U)
{
- rt->f = rt->f1;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
}
else
{
- uint32_t stride = (rt->tbl_stride < 1U) ? 1U : rt->tbl_stride;
- idx = (rt->n - 1U) / stride;
- if (idx >= rt->tbl_len)
+ uint32_t table_stride = (runtime->table_stride < 1U) ?
+ 1U : runtime->table_stride;
+
+ table_index = (runtime->completed_pulses - 1U) / table_stride;
+ if (table_index >= runtime->table_length)
{
- idx = rt->tbl_len - 1U;
+ table_index = runtime->table_length - 1U;
}
- rt->f = s_rt_tbl[idx];
+ frequency_table = (runtime->frequency_table_id == 1U) ?
+ s_acceleration_frequency_table :
+ s_deceleration_frequency_table;
+ runtime->current_frequency_hz = frequency_table[table_index];
}
}
else
{
/* 建表失败兜底:仍走时间步进 */
- rt->f = PlsrAccelPulseRtTimeStep(rt);
+ runtime->current_frequency_hz = PlsrAccelNextFrequencyTimed(runtime);
}
- if ((rt->n_total > 0U) && (rt->n >= rt->n_total))
+ if ((runtime->total_pulses > 0U) && (runtime->completed_pulses >= runtime->total_pulses))
{
- rt->f = rt->f1;
- rt->active = 0U;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
+ runtime->is_active = 0U;
}
- else if (rt->mode == PLSR_ACCEL_LINEAR)
+ else if (runtime->curve_mode == PLSR_ACCEL_LINEAR)
{
/* 直线由 SquareStep 钳位 */
}
- else if (rt->use_tbl == 0U)
+ else if (runtime->frequency_table_id == 0U)
{
- if ((rt->tramp_us > 0U) && (rt->t_us >= rt->tramp_us))
+ if ((runtime->ramp_time_us > 0U) && (runtime->elapsed_time_us >= runtime->ramp_time_us))
{
- rt->f = rt->f1;
- rt->active = 0U;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
+ runtime->is_active = 0U;
}
- else if (rt->rising != 0U)
+ else if (runtime->frequency_rising != 0U)
{
- if (rt->f >= rt->f1)
+ if (runtime->current_frequency_hz >= runtime->end_frequency_hz)
{
- rt->f = rt->f1;
- rt->active = 0U;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
+ runtime->is_active = 0U;
}
}
- else if (rt->f <= rt->f1)
+ else if (runtime->current_frequency_hz <= runtime->end_frequency_hz)
{
- rt->f = rt->f1;
- rt->active = 0U;
+ runtime->current_frequency_hz = runtime->end_frequency_hz;
+ runtime->is_active = 0U;
}
}
- return PlsrAccelCurveClampFreq(rt->f);
+ return PlsrAccelCurveClampFrequencyHz(runtime->current_frequency_hz);
}
diff --git a/plsr/accel_curve/plsr_accel_curve.h b/plsr/accel_curve/plsr_accel_curve.h
index 7e507e8..0f32beb 100644
--- a/plsr/accel_curve/plsr_accel_curve.h
+++ b/plsr/accel_curve/plsr_accel_curve.h
@@ -5,14 +5,13 @@
* @details 按起/峰/止频率、斜率时间与总脉冲规划三相脉冲预算,并在脉冲序号上取频。
* 不读 wait_type,不碰 TIM/GPIO。
*
- * 直线:f_n = sqrt(f0^2 ± 2 a n)(脉冲域,ISR 增量逼近)。
+ * 直线:下一频率由起点频率、变化率和已完成脉冲数计算(ISR 增量逼近)。
* S/正弦:开相时预计算频率表;ISR 只按脉冲序号查表(匀速相不改频)。
- * acc_n/dec_n 与建表同一套离散逐拍仿真。
+ * 规划脉冲数与建表使用同一套离散逐拍仿真。
*
* 术语(全模块统一):
- * acc_n / dec_n / const_n — 加速/减速/匀速相各需的脉冲个数(规划预算,非 ms)
- * f_cur / f_tgt / f_end — 段入口频率、规划峰值、段出口频率(Hz)
- * a_acc / a_dec — 加/减速度(Hz/s),≈ default_speed*1000/accel_ms
+ * 字段使用完整名称和单位,例如 accel_pulses、start_frequency_hz,
+ * 避免阅读代码时反复猜测 acc_n、f_cur、a_acc 等数学缩写。
*/
#ifndef PLSR_ACCEL_CURVE_H
#define PLSR_ACCEL_CURVE_H
@@ -22,87 +21,91 @@
/**
* 单段脉冲域规划结果(PlsrAccelCurvePlan 输出)
- * EnterDecel 可能改写 dec_n,诊断用 run_control 另存 s_plan_dec_n。
+ * run_control 进入减速时使用局部规划副本,不会改写这里的整段规划预算。
*/
typedef struct {
- uint32_t acc_n; /* 加速相脉冲数:从 f_cur 爬到 f_tgt */
- uint32_t const_n; /* 匀速相脉冲数:保持 f_tgt */
- uint32_t dec_n; /* 减速相脉冲数:从 f_tgt 到 f_end */
- uint32_t f_cur; /* 段入口频率 Hz(规划后实际起点,>=1) */
- uint32_t f_tgt; /* 规划峰值 Hz(FitPeak 后可能低于段表目标) */
- uint32_t f_end; /* 段出口频率 Hz */
- uint32_t a_acc; /* 加速相加速度 Hz/s */
- uint32_t a_dec; /* 减速相加速度 Hz/s */
- PlsrAccelMode_e mode; /* 直线 / S / 正弦 */
+ uint32_t accel_pulses; /* 入口到目标频率需要的脉冲数 */
+ uint32_t constant_pulses; /* 保持目标频率的脉冲数 */
+ uint32_t decel_pulses; /* 目标到出口频率需要的脉冲数 */
+ uint32_t start_frequency_hz; /* 本段实际入口频率 */
+ uint32_t target_frequency_hz; /* 实际目标频率,短段可能被降低 */
+ uint32_t end_frequency_hz; /* 本段出口频率 */
+ uint32_t accel_rate_hz_per_s; /* 升高频率时使用的变化率 */
+ uint32_t decel_rate_hz_per_s; /* 降低频率时使用的变化率 */
+ PlsrAccelMode_e curve_mode; /* 直线 / S / 正弦 */
} PlsrAccelPlan_t;
/** 配置起速 → 规划入口:起速>目标用起速;否则目标与起跳比较取其一 */
-uint32_t PlsrAccelCurveResolveStartHz(uint32_t f_cfg,
- uint32_t f_tgt,
- uint32_t default_spd,
- uint32_t accel_ms,
- uint32_t decel_ms);
+uint32_t PlsrAccelCurveResolveStartHz(uint32_t configured_frequency_hz,
+ uint32_t target_frequency_hz,
+ uint32_t default_speed_hz,
+ uint32_t acceleration_time_ms,
+ uint32_t deceleration_time_ms);
/** 配置止速 → 规划出口:止速>目标用止速;否则目标与起跳比较取其一(不默认到 0) */
-uint32_t PlsrAccelCurveResolveEndHz(uint32_t f_cfg,
- uint32_t f_tgt,
- uint32_t default_spd,
- uint32_t accel_ms,
- uint32_t decel_ms);
+uint32_t PlsrAccelCurveResolveEndHz(uint32_t configured_frequency_hz,
+ uint32_t target_frequency_hz,
+ uint32_t default_speed_hz,
+ uint32_t acceleration_time_ms,
+ uint32_t deceleration_time_ms);
/**
* 规划一整段脉冲域三相预算与实际峰值
- * 脉冲不够爬到 f_tgt 时先 const_n=0,再 FitPeak 降峰(调用方可能写故障 0x02)
+ * 脉冲不够到达目标频率时取消匀速段,再降低实际目标频率。
*/
void PlsrAccelCurvePlan(PlsrAccelPlan_t *plan,
uint32_t total_pulses,
- uint32_t f_cur,
- uint32_t f_tgt,
- uint32_t f_end,
- uint32_t default_spd,
- uint32_t accel_ms,
- uint32_t decel_ms,
- PlsrAccelMode_e mode);
+ uint32_t start_frequency_hz,
+ uint32_t target_frequency_hz,
+ uint32_t end_frequency_hz,
+ uint32_t default_speed_hz,
+ uint32_t acceleration_time_ms,
+ uint32_t deceleration_time_ms,
+ PlsrAccelMode_e curve_mode);
-/** 按已完成脉冲数取频(任务/预览;ISR 热路径用 PulseRtStep) */
+/** 按已完成脉冲数取频(任务/预览;ISR 热路径用 PlsrAccelNextFrequency) */
uint32_t PlsrAccelCurveFreqAtPulse(const PlsrAccelPlan_t *plan,
- uint32_t pulse_done);
+ uint32_t completed_segment_pulses);
/**
* 单相逐脉冲运行态(ISR 热路径,每来一个 UPDATE 调 Step 一次)
- * 直线:±1Hz 逼近 sqrt(f0^2±2an)
+ * 直线:每次按目标平方值逐步逼近下一频率
* S/正弦:查预计算频率表(开相 BeginAcc/BeginDec 时填好)
*/
typedef struct {
- uint32_t f; /* 当前输出频率 Hz */
- uint32_t f0; /* 本相起点频率 Hz */
- uint32_t f1; /* 本相终点频率 Hz */
- uint32_t a; /* 本相加速度 Hz/s */
- uint32_t n; /* 本相已步进脉冲数 */
- uint32_t n_total; /* 本相总步进预算(= plan 里 acc_n 或 dec_n) */
- uint32_t t_us; /* 建表用:累计时间 us */
- uint32_t tj_us; /* 建表用:S jerk 段 us */
- uint32_t ta_us; /* 建表用:S 恒加速段 us */
- uint32_t tramp_us; /* 建表用:斜坡总时长 us */
- uint32_t tbl_stride; /* 查表:每 stride 个脉冲对应 1 个表项 */
- uint32_t tbl_len; /* 表有效长度 */
- uint8_t rising; /* 1=频率升高,0=降低 */
- uint8_t active; /* 1=本相仍在步进;0=已到 f1 */
- uint8_t use_tbl; /* 1=S/正弦走查表 */
- PlsrAccelMode_e mode;
-} PlsrAccelPulseRt_t;
+ uint32_t current_frequency_hz; /* 当前输出频率 */
+ uint32_t start_frequency_hz; /* 当前相起点频率 */
+ uint32_t end_frequency_hz; /* 当前相终点频率 */
+ uint32_t acceleration_hz_per_s; /* 当前相使用的变化率 */
+ uint32_t completed_pulses; /* 当前相已经步进的脉冲数 */
+ uint32_t total_pulses; /* 当前相计划步进的脉冲数 */
+ uint32_t elapsed_time_us; /* 时间曲线已经经过的时间 */
+ uint32_t jerk_time_us; /* S 曲线单个 jerk 阶段时间 */
+ uint32_t constant_accel_time_us; /* S 曲线恒加速阶段时间 */
+ uint32_t ramp_time_us; /* 整个斜坡时间 */
+ uint32_t table_stride; /* 每几个脉冲读取一个表项 */
+ uint32_t table_length; /* 表中有效项数 */
+ uint8_t frequency_rising; /* 1=频率升高,0=降低 */
+ uint8_t is_active; /* 1=当前相仍在运行 */
+ uint8_t frequency_table_id; /* 0=不用表,1=加速表,2=减速表 */
+ PlsrAccelMode_e curve_mode;
+} PlsrAccelRuntime_t;
+
+/* 当前段唯一的曲线规划和逐拍状态,run_control 直接使用,不再另存副本。 */
+extern PlsrAccelPlan_t g_plsr_accel_plan;
+extern PlsrAccelRuntime_t g_plsr_accel_runtime;
/** PlanSeg 后调用:预建 S/正弦加减速频率表(勿在 ISR) */
-void PlsrAccelPulseRtPrebuild(const PlsrAccelPlan_t *plan);
+void PlsrAccelPrebuildFrequencyTables(const PlsrAccelPlan_t *plan);
-void PlsrAccelPulseRtBeginAcc(PlsrAccelPulseRt_t *pulse_rt,
- const PlsrAccelPlan_t *plan);
-void PlsrAccelPulseRtBeginDec(PlsrAccelPulseRt_t *pulse_rt,
- const PlsrAccelPlan_t *plan);
-void PlsrAccelPulseRtBeginConst(PlsrAccelPulseRt_t *pulse_rt,
+void PlsrAccelBeginAcceleration(PlsrAccelRuntime_t *runtime,
+ const PlsrAccelPlan_t *plan);
+void PlsrAccelBeginDeceleration(PlsrAccelRuntime_t *runtime,
+ const PlsrAccelPlan_t *plan);
+void PlsrAccelBeginConstantSpeed(PlsrAccelRuntime_t *runtime,
const PlsrAccelPlan_t *plan);
/** 本相前进 1 脉冲,返回下一拍命令频率 */
-uint32_t PlsrAccelPulseRtStep(PlsrAccelPulseRt_t *pulse_rt);
+uint32_t PlsrAccelNextFrequency(PlsrAccelRuntime_t *runtime);
#endif
diff --git a/plsr/command/plsr_command.c b/plsr/command/plsr_command.c
index 99b1824..3ad42e7 100644
--- a/plsr/command/plsr_command.c
+++ b/plsr/command/plsr_command.c
@@ -19,6 +19,7 @@
#include "plsr_command.h"
#include "plsr_param.h"
#include "plsr_run_control.h"
+#include "plsr_pulse_driver.h"
#include "plsr.h"
#include "plsr_persist.h"
#include "modbus_rtu.h"
@@ -52,14 +53,14 @@ static void PlsrCommandWriteDWord(uint16_t addr, uint32_t value)
*/
static void PlsrCommandPublishMonitor(void)
{
- PlsrCommandWriteDWord(PLSR_MON_ACC_PULSE_L, (uint32_t)PlsrGetAccPulse());
+ PlsrCommandWriteDWord(PLSR_MON_ACC_PULSE_L, (uint32_t)g_plsr_accumulated_pulses);
WriteHoldReg(PLSR_MON_ERR, s_fault);
- if (PlsrIsBusy() != 0U)
+ if (g_plsr_busy != 0U)
{
- PlsrCommandWriteDWord(PLSR_MON_FREQ_L, PlsrRunControlGetCurFreq());
+ PlsrCommandWriteDWord(PLSR_MON_FREQ_L, g_plsr_output_frequency_hz);
WriteHoldReg(PLSR_MON_RUN_STATUS, 1U);
- WriteHoldReg(PLSR_MON_CUR_SEG, PlsrRunControlGetCurSeg());
+ WriteHoldReg(PLSR_MON_CUR_SEG, (uint16_t)(g_plsr_current_segment_index + 1U));
}
else
{
@@ -122,13 +123,12 @@ void PlsrCommandOnSegFreqHoldWrite(uint16_t start_addr, uint16_t quantity)
uint16_t seg0;
uint16_t off;
uint32_t f;
- PlsrSeg_t *seg;
if (quantity != 2U)
{
return;
}
- if (PlsrIsBusy() == 0U)
+ if (g_plsr_busy == 0U)
{
return;
}
@@ -148,7 +148,7 @@ void PlsrCommandOnSegFreqHoldWrite(uint16_t start_addr, uint16_t quantity)
return;
}
- cur1 = PlsrRunControlGetCurSeg();
+ cur1 = (uint16_t)(g_plsr_current_segment_index + 1U);
if ((cur1 < 1U) || ((uint16_t)(cur1 - 1U) != seg0))
{
return;
@@ -163,13 +163,9 @@ void PlsrCommandOnSegFreqHoldWrite(uint16_t start_addr, uint16_t quantity)
return;
}
- seg = PlsrParamGetSeg(seg0);
- if (seg != (PlsrSeg_t *)0)
- {
- seg->freq_hz = (int32_t)f;
- /* 运行中改频:立即只把该段频率双字写入 BKP,不等整包参数落盘 */
- PlsrPersistSaveSegFreqToBkp(seg0, f);
- }
+ g_plsr_segments[seg0].freq_hz = (int32_t)f;
+ /* 运行中改频:立即只把该段频率双字写入 BKP,不等整包参数落盘 */
+ PlsrPersistSaveSegFreqToBkp(seg0, f);
s_live_freq_hz = f;
s_live_freq_req = 1U;
@@ -209,7 +205,7 @@ void PlsrCommandPoll(void)
if (((ctrl & PLSR_CTRL_BIT_START) != 0U) &&
((ctrl & PLSR_CTRL_BIT_STOP) == 0U))
{
- if (PlsrIsBusy() != 0U)
+ if (g_plsr_busy != 0U)
{
/* 0x0C:运行中重复 START,启动无效 */
PlsrCommandSetFault(PLSR_ERR_DUP_START);
diff --git a/plsr/param/plsr_param.c b/plsr/param/plsr_param.c
index 7b2bd9a..618d7aa 100644
--- a/plsr/param/plsr_param.c
+++ b/plsr/param/plsr_param.c
@@ -3,11 +3,13 @@
* @brief 参数块管理实现:运行映像 + 分帧导入/导出 + ParamBlockTask
*
* @details 模块职责
- * 维护静态映像 s_cfg / s_seg[],实现寄存器 ↔ 结构体双向转换,以及
+ * 维护公共参数 g_plsr_config 和段参数 g_plsr_segments[],实现寄存器与
+ * 运行参数之间的双向转换,以及
* 「5+N 分帧」收齐后的异步 Apply(信号量唤醒本任务)。
*
* 静态状态说明
- * s_cfg / s_seg[] — 运行唯一参数源
+ * g_plsr_config — 公共运行参数
+ * g_plsr_segments[] — 10 段运行参数
* s_param_sem — 收齐分帧后 Post,Task Pend 后 Apply
* s_expect_frames — 期望总帧 = 5 + 公共帧1 中的段数
* s_recv_frames — 已收帧计数(公共帧1 起算)
@@ -23,91 +25,27 @@
#include "plsr_command.h"
#include "modbus_rtu.h"
#include "ucos_ii.h"
-#include
-static PlsrCfg_t s_cfg; /* 公共运行参数映像 */
-static PlsrSeg_t s_seg[PLSR_SEG_MAX]; /* 段表映像(最多 PLSR_SEG_MAX 段) */
+PlsrCfg_t g_plsr_config;
+PlsrSeg_t g_plsr_segments[PLSR_SEG_MAX];
static OS_EVENT *s_param_sem; /* 分帧收齐后唤醒 ParamBlockTask */
static volatile uint16_t s_expect_frames; /* 本批期望总帧数 = 5 + 段数 */
static volatile uint16_t s_recv_frames; /* 已收帧计数 */
static volatile uint8_t s_xfer_active; /* 1=正在接收一批分帧 */
-/*============================================================================*/
-/* 运行映像 */
-/*============================================================================*/
-
-/**
- * @brief 出厂默认参数(见 plsr_param.h)
- * @note 与上位机 initCommonDefaults 约定一致,便于未写 PLC 时行为可预期
- */
-//void PlsrParamInitDefault(void)
-//{
-// uint16_t i;
-//
-// memset(&s_cfg, 0, sizeof(s_cfg));
-// memset(s_seg, 0, sizeof(s_seg));
-//
-// /* 与上位机默认约定一致;真正运行参数由 ApplyFromHold / PersistLoad 覆盖 */
-// s_cfg.pulse_y = 0U;
-// s_cfg.dir_y = 3U;
-// s_cfg.wait_x_sel = 0U;
-// s_cfg.ext_x_sel = 0U;
-// s_cfg.send_mode = PLSR_SEND_COMPLETE;
-// s_cfg.dir_delay_ms = 10U;
-// s_cfg.dir_logic = PLSR_DIR_LOGIC_POS;
-// s_cfg.accel_mode = PLSR_ACCEL_LINEAR;
-// s_cfg.run_mode = PLSR_POS_RELATIVE;
-// s_cfg.seg_count = 0U;
-// s_cfg.start_seg = 1U;
-// s_cfg.default_speed = 1000UL;
-// s_cfg.start_speed = 0UL;
-// s_cfg.end_speed = 0UL;
-// s_cfg.accel_ms = 100U;
-// s_cfg.decel_ms = 100U;
-//
-// for (i = 0U; i < PLSR_SEG_MAX; i++)
-// {
-// s_seg[i].freq_hz = 0;
-// s_seg[i].pulse_cnt = 0;
-// s_seg[i].wait_type = PLSR_WAIT_TIME;
-// s_seg[i].wait_ms = 0U;
-// s_seg[i].act_ms = 0U;
-// s_seg[i].jump_seg = 0U;
-// }
-//}
-
-/** @return 公共参数映像指针(见 plsr_param.h) */
-PlsrCfg_t *PlsrParamGetCfg(void)
-{
- return &s_cfg;
-}
-
-/**
- * @brief 取段参数指针(见 plsr_param.h)
- * @note 越界钳到段 0,避免空指针
- */
-PlsrSeg_t *PlsrParamGetSeg(uint16_t seg_0based)
-{
- if (seg_0based >= PLSR_SEG_MAX)
- {
- seg_0based = 0U;
- }
- return &s_seg[seg_0based];
-}
-
/** @return 有效段数,钳制到 [0, PLSR_SEG_MAX](见 plsr_param.h) */
uint16_t PlsrParamGetSegCount(void)
{
- if (s_cfg.seg_count < 1U)
+ if (g_plsr_config.seg_count < 1U)
{
return 0U;
}
- if (s_cfg.seg_count > PLSR_SEG_MAX)
+ if (g_plsr_config.seg_count > PLSR_SEG_MAX)
{
return (uint16_t)PLSR_SEG_MAX;
}
- return s_cfg.seg_count;
+ return g_plsr_config.seg_count;
}
/**
@@ -122,16 +60,16 @@ uint16_t PlsrParamGetStartSeg(void)
{
return 1U;
}
- if (s_cfg.start_seg < 1U)
+ if (g_plsr_config.start_seg < 1U)
{
return 1U;
}
/* TODO:起始段非法时输出故障码 */
- if (s_cfg.start_seg > n)
+ if (g_plsr_config.start_seg > n)
{
return n;
}
- return s_cfg.start_seg;
+ return g_plsr_config.start_seg;
}
/*============================================================================*/
@@ -153,12 +91,6 @@ static void PlsrParamWriteDWord(uint16_t addr, uint32_t value)
WriteHoldReg((uint16_t)(addr + 1U), (uint16_t)((value >> 16) & 0xFFFFU));
}
-/** 按有符号 32 位解释双字(频率/脉冲补码) */
-static int32_t PlsrParamReadSignedDWord(uint16_t addr)
-{
- return (int32_t)PlsrParamReadDWord(addr);
-}
-
/**
* @brief 判断本次 FC10 是否为公共帧 2~5(双字速度/加减速)
* @return 1=是;0=否
@@ -222,12 +154,6 @@ static void PlsrParamSetXferStatus(uint16_t st, uint16_t fail_frame)
#define PLSR_PARAM_SPD_MIN_HZ 1U
#define PLSR_PARAM_SPD_MAX_HZ 100000U
-/** 记录「最后一个」故障码(校验顺序决定多错时保留末项) */
-static void PlsrParamFaultLast(uint16_t *fault, uint16_t code)
-{
- *fault = code;
-}
-
static uint8_t PlsrParamIsSpeedHzValid(uint32_t hz)
{
return ((hz >= PLSR_PARAM_SPD_MIN_HZ) && (hz <= PLSR_PARAM_SPD_MAX_HZ)) ? 1U : 0U;
@@ -288,93 +214,97 @@ uint8_t PlsrParamBlockApplyFromHold(void)
uint16_t n;
uint16_t base;
uint16_t fault = PLSR_ERR_NONE;
- PlsrSeg_t *seg;
- s_cfg.pulse_y = ReadHoldReg(PLSR_REG_PULSE_Y);
- if (s_cfg.pulse_y > 2U)
+ g_plsr_config.pulse_y = ReadHoldReg(PLSR_REG_PULSE_Y);
+ if (g_plsr_config.pulse_y > 2U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_PULSE_Y);
+ fault = PLSR_ERR_PULSE_Y;
}
- s_cfg.dir_y = ReadHoldReg(PLSR_REG_DIR_Y);
- if (s_cfg.dir_y != 3U)
+ g_plsr_config.dir_y = ReadHoldReg(PLSR_REG_DIR_Y);
+ if (g_plsr_config.dir_y != 3U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_DIR_Y);
+ fault = PLSR_ERR_DIR_Y;
}
- s_cfg.wait_x_sel = ReadHoldReg(PLSR_REG_WAIT_X) ? 1U : 0U;
- s_cfg.ext_x_sel = ReadHoldReg(PLSR_REG_EXT_X) ? 1U : 0U;
- s_cfg.send_mode = (PlsrSendMode_e)(ReadHoldReg(PLSR_REG_SEND_MODE) ? 1U : 0U);
- s_cfg.dir_delay_ms = ReadHoldReg(PLSR_REG_DIR_DELAY);
- s_cfg.dir_logic = (ReadHoldReg(PLSR_REG_DIR_LOGIC) != 0U) ?
+ g_plsr_config.wait_x_sel = ReadHoldReg(PLSR_REG_WAIT_X) ? 1U : 0U;
+ g_plsr_config.ext_x_sel = ReadHoldReg(PLSR_REG_EXT_X) ? 1U : 0U;
+ g_plsr_config.send_mode = (PlsrSendMode_e)(ReadHoldReg(PLSR_REG_SEND_MODE) ? 1U : 0U);
+ g_plsr_config.dir_delay_ms = ReadHoldReg(PLSR_REG_DIR_DELAY);
+ g_plsr_config.dir_logic = (ReadHoldReg(PLSR_REG_DIR_LOGIC) != 0U) ?
PLSR_DIR_LOGIC_NEG : PLSR_DIR_LOGIC_POS;
- s_cfg.accel_mode = (PlsrAccelMode_e)ReadHoldReg(PLSR_REG_ACCEL_MODE);
- s_cfg.run_mode = (ReadHoldReg(PLSR_REG_RUN_MODE) != 0U) ?
+ g_plsr_config.accel_mode = (PlsrAccelMode_e)ReadHoldReg(PLSR_REG_ACCEL_MODE);
+ g_plsr_config.run_mode = (ReadHoldReg(PLSR_REG_RUN_MODE) != 0U) ?
PLSR_POS_ABSOLUTE : PLSR_POS_RELATIVE;
n = ReadHoldReg(PLSR_REG_SEG_COUNT);
- s_cfg.seg_count = n;
+ g_plsr_config.seg_count = n;
if ((n < 1U) || (n > PLSR_SEG_MAX))
{
- PlsrParamFaultLast(&fault, PLSR_ERR_SEG_COUNT);
+ fault = PLSR_ERR_SEG_COUNT;
}
- s_cfg.start_seg = ReadHoldReg(PLSR_REG_START_SEG);
+ g_plsr_config.start_seg = ReadHoldReg(PLSR_REG_START_SEG);
if ((n >= 1U) && (n <= PLSR_SEG_MAX))
{
- if ((s_cfg.start_seg < 1U) || (s_cfg.start_seg > n))
+ if ((g_plsr_config.start_seg < 1U) || (g_plsr_config.start_seg > n))
{
- PlsrParamFaultLast(&fault, PLSR_ERR_START_SEG);
+ fault = PLSR_ERR_START_SEG;
}
}
- else if (s_cfg.start_seg < 1U)
+ else if (g_plsr_config.start_seg < 1U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_START_SEG);
+ fault = PLSR_ERR_START_SEG;
}
- s_cfg.default_speed = PlsrParamReadDWord(PLSR_REG_DEFAULT_SPD_L);
- if (PlsrParamIsSpeedHzValid(s_cfg.default_speed) == 0U)
+ g_plsr_config.default_speed = PlsrParamReadDWord(PLSR_REG_DEFAULT_SPD_L);
+ if (PlsrParamIsSpeedHzValid(g_plsr_config.default_speed) == 0U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_DEFAULT_SPD);
+ fault = PLSR_ERR_DEFAULT_SPD;
}
- s_cfg.start_speed = PlsrParamReadDWord(PLSR_REG_START_SPD_L);
- if (PlsrParamIsStartEndSpeedValid(s_cfg.start_speed) == 0U)
+ g_plsr_config.start_speed = PlsrParamReadDWord(PLSR_REG_START_SPD_L);
+ if (PlsrParamIsStartEndSpeedValid(g_plsr_config.start_speed) == 0U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_START_END_SPD);
+ fault = PLSR_ERR_START_END_SPD;
}
- s_cfg.end_speed = PlsrParamReadDWord(PLSR_REG_END_SPD_L);
- if (PlsrParamIsStartEndSpeedValid(s_cfg.end_speed) == 0U)
+ g_plsr_config.end_speed = PlsrParamReadDWord(PLSR_REG_END_SPD_L);
+ if (PlsrParamIsStartEndSpeedValid(g_plsr_config.end_speed) == 0U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_START_END_SPD);
+ fault = PLSR_ERR_START_END_SPD;
}
- s_cfg.accel_ms = ReadHoldReg(PLSR_REG_ACCEL_MS);
- s_cfg.decel_ms = ReadHoldReg(PLSR_REG_DECEL_MS);
+ g_plsr_config.accel_ms = ReadHoldReg(PLSR_REG_ACCEL_MS);
+ g_plsr_config.decel_ms = ReadHoldReg(PLSR_REG_DECEL_MS);
if ((n >= 1U) && (n <= PLSR_SEG_MAX))
{
for (i = 0U; i < n; i++)
{
- seg = &s_seg[i];
base = (uint16_t)(PLSR_REG_SEG1_BASE + i * PLSR_SEG_STRIDE);
- seg->freq_hz = PlsrParamReadSignedDWord((uint16_t)(base + PLSR_SEG_OFF_FREQ_L));
- if (PlsrParamIsSegFreqValid(seg->freq_hz) == 0U)
+ g_plsr_segments[i].freq_hz =
+ (int32_t)PlsrParamReadDWord((uint16_t)(base + PLSR_SEG_OFF_FREQ_L));
+ if (PlsrParamIsSegFreqValid(g_plsr_segments[i].freq_hz) == 0U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_FREQ_ILLEGAL);
+ fault = PLSR_ERR_FREQ_ILLEGAL;
}
- seg->pulse_cnt = PlsrParamReadSignedDWord((uint16_t)(base + PLSR_SEG_OFF_PULSE_L));
- if (PlsrParamIsPulseCntValid(seg->pulse_cnt) == 0U)
+ g_plsr_segments[i].pulse_cnt =
+ (int32_t)PlsrParamReadDWord((uint16_t)(base + PLSR_SEG_OFF_PULSE_L));
+ if (PlsrParamIsPulseCntValid(g_plsr_segments[i].pulse_cnt) == 0U)
{
- PlsrParamFaultLast(&fault, PLSR_ERR_PULSE_RANGE);
+ fault = PLSR_ERR_PULSE_RANGE;
}
- seg->wait_type = (PlsrWaitType_e)ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT));
- seg->wait_ms = ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT_MS));
- seg->act_ms = ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_ACT_MS));
- seg->jump_seg = ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_JUMP));
+ g_plsr_segments[i].wait_type =
+ (PlsrWaitType_e)ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT));
+ g_plsr_segments[i].wait_ms =
+ ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT_MS));
+ g_plsr_segments[i].act_ms =
+ ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_ACT_MS));
+ g_plsr_segments[i].jump_seg =
+ ReadHoldReg((uint16_t)(base + PLSR_SEG_OFF_JUMP));
}
}
@@ -392,7 +322,7 @@ uint8_t PlsrParamBlockApplyFromHold(void)
*
* @details 用途(与落 BKP 无关)
* 1. Apply 钳位后摊回 hold,使「读 PLC」与运行结构体一致;
- * 2. ModbusDataInit() memset 清 hold 后,把已 Apply 的 s_cfg/s_seg 填回,
+ * 2. ModbusDataInit() 清 hold 后,把已 Apply 的运行参数填回,
* 否则上位机读公共/段参数全 0,START 也会用空 hold 再次 Apply 冲掉结构体。
*
* @note 0x100F 保留字写 0;段表写满 PLSR_SEG_MAX 槽,避免读回脏数据
@@ -402,36 +332,40 @@ void PlsrParamBlockExportToHold(void)
{
uint16_t i;
uint16_t base;
- PlsrSeg_t *seg;
-
- WriteHoldReg(PLSR_REG_PULSE_Y, s_cfg.pulse_y);
- WriteHoldReg(PLSR_REG_DIR_Y, s_cfg.dir_y);
- WriteHoldReg(PLSR_REG_WAIT_X, s_cfg.wait_x_sel);
- WriteHoldReg(PLSR_REG_EXT_X, s_cfg.ext_x_sel);
- WriteHoldReg(PLSR_REG_SEND_MODE, (uint16_t)s_cfg.send_mode);
- WriteHoldReg(PLSR_REG_DIR_DELAY, s_cfg.dir_delay_ms);
- WriteHoldReg(PLSR_REG_DIR_LOGIC, (uint16_t)s_cfg.dir_logic);
- WriteHoldReg(PLSR_REG_ACCEL_MODE, (uint16_t)s_cfg.accel_mode);
- WriteHoldReg(PLSR_REG_RUN_MODE, (uint16_t)s_cfg.run_mode);
- WriteHoldReg(PLSR_REG_SEG_COUNT, s_cfg.seg_count);
- WriteHoldReg(PLSR_REG_START_SEG, s_cfg.start_seg);
- PlsrParamWriteDWord(PLSR_REG_DEFAULT_SPD_L, s_cfg.default_speed);
- PlsrParamWriteDWord(PLSR_REG_START_SPD_L, s_cfg.start_speed);
+
+ WriteHoldReg(PLSR_REG_PULSE_Y, g_plsr_config.pulse_y);
+ WriteHoldReg(PLSR_REG_DIR_Y, g_plsr_config.dir_y);
+ WriteHoldReg(PLSR_REG_WAIT_X, g_plsr_config.wait_x_sel);
+ WriteHoldReg(PLSR_REG_EXT_X, g_plsr_config.ext_x_sel);
+ WriteHoldReg(PLSR_REG_SEND_MODE, (uint16_t)g_plsr_config.send_mode);
+ WriteHoldReg(PLSR_REG_DIR_DELAY, g_plsr_config.dir_delay_ms);
+ WriteHoldReg(PLSR_REG_DIR_LOGIC, (uint16_t)g_plsr_config.dir_logic);
+ WriteHoldReg(PLSR_REG_ACCEL_MODE, (uint16_t)g_plsr_config.accel_mode);
+ WriteHoldReg(PLSR_REG_RUN_MODE, (uint16_t)g_plsr_config.run_mode);
+ WriteHoldReg(PLSR_REG_SEG_COUNT, g_plsr_config.seg_count);
+ WriteHoldReg(PLSR_REG_START_SEG, g_plsr_config.start_seg);
+ PlsrParamWriteDWord(PLSR_REG_DEFAULT_SPD_L, g_plsr_config.default_speed);
+ PlsrParamWriteDWord(PLSR_REG_START_SPD_L, g_plsr_config.start_speed);
WriteHoldReg(0x100FU, 0U);
- PlsrParamWriteDWord(PLSR_REG_END_SPD_L, s_cfg.end_speed);
- WriteHoldReg(PLSR_REG_ACCEL_MS, s_cfg.accel_ms);
- WriteHoldReg(PLSR_REG_DECEL_MS, s_cfg.decel_ms);
+ PlsrParamWriteDWord(PLSR_REG_END_SPD_L, g_plsr_config.end_speed);
+ WriteHoldReg(PLSR_REG_ACCEL_MS, g_plsr_config.accel_ms);
+ WriteHoldReg(PLSR_REG_DECEL_MS, g_plsr_config.decel_ms);
for (i = 0U; i < PLSR_SEG_MAX; i++)
{
- seg = &s_seg[i];
base = (uint16_t)(PLSR_REG_SEG1_BASE + i * PLSR_SEG_STRIDE);
- PlsrParamWriteDWord((uint16_t)(base + PLSR_SEG_OFF_FREQ_L), (uint32_t)seg->freq_hz);
- PlsrParamWriteDWord((uint16_t)(base + PLSR_SEG_OFF_PULSE_L), (uint32_t)seg->pulse_cnt);
- WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT), (uint16_t)seg->wait_type);
- WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT_MS), seg->wait_ms);
- WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_ACT_MS), seg->act_ms);
- WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_JUMP), seg->jump_seg);
+ PlsrParamWriteDWord((uint16_t)(base + PLSR_SEG_OFF_FREQ_L),
+ (uint32_t)g_plsr_segments[i].freq_hz);
+ PlsrParamWriteDWord((uint16_t)(base + PLSR_SEG_OFF_PULSE_L),
+ (uint32_t)g_plsr_segments[i].pulse_cnt);
+ WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT),
+ (uint16_t)g_plsr_segments[i].wait_type);
+ WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_WAIT_MS),
+ g_plsr_segments[i].wait_ms);
+ WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_ACT_MS),
+ g_plsr_segments[i].act_ms);
+ WriteHoldReg((uint16_t)(base + PLSR_SEG_OFF_JUMP),
+ g_plsr_segments[i].jump_seg);
}
}
diff --git a/plsr/param/plsr_param.h b/plsr/param/plsr_param.h
index 9ae13eb..80c368f 100644
--- a/plsr/param/plsr_param.h
+++ b/plsr/param/plsr_param.h
@@ -4,13 +4,13 @@
*
* @details 模块职责
* 1. 定义公共参数区 0x1000~0x1013、段表区 0x1100+i*0x10 的地址与字段语义;
- * 2. 维护运行侧唯一映像 s_cfg / s_seg[](运动规划只读此映像,不直接啃寄存器);
+ * 2. 维护 g_plsr_config / g_plsr_segments[](运动规划只读,不直接读寄存器);
* 3. 支持上位机「5 公共帧 + N 段帧」分帧 FC10 写入:收齐后 ApplyFromHold;
* 4. 上电由 PersistLoad 填 hold;ExportToHold 仅保留作调试接口。
*
* 与其它模块关系
* - modbus_rtu / modbus_data :ReadHoldReg / WriteHoldReg
- * - plsr_command :启动前 ApplyFromHold;运行中写频改 s_seg[].freq_hz
+ * - plsr_command :启动前 ApplyFromHold;运行中修改当前段 freq_hz
* - plsr_run_control :GetCfg / GetSeg / GetSegCount / GetStartSeg
* - plsr_persist :Apply 成功后 SaveParamsFromHold;动态改频 SaveSegFreqToBkp
* - PlsrParamBlockTask :独立 uC/OS 任务,等信号量后 Apply + 整包落 BKP
@@ -177,22 +177,18 @@ typedef struct {
uint16_t jump_seg; /* 0=顺序/末段结束;1~N=跳转 */
} PlsrSeg_t;
-/* ---------- 运行映像访问 ---------- */
+/* ---------- 运行参数 ---------- */
-/**
- * @brief 填出厂默认 s_cfg / s_seg(随后可被 PersistLoad / Apply 覆盖)
- * @note 调用时机:PlsrInit 最先调用
- */
-void PlsrParamInitDefault(void);
-
-/** @return 公共参数映像指针(非空) */
-PlsrCfg_t *PlsrParamGetCfg(void);
-
-/**
- * @param seg_0based 段索引 0-based;越界钳到 0
- * @return 段参数指针
+/*
+ * 所有 PLSR 模块都直接读取这两份数据。
+ * g_plsr_config :公共参数,只有一份。
+ * g_plsr_segments[i] :第 i+1 段参数,i 的范围是 0~9。
+ *
+ * 参数任务负责从保持寄存器更新它们;运动过程中其它模块只读取,
+ * 只有“运行中改频”会修改当前段的 freq_hz。
*/
-PlsrSeg_t *PlsrParamGetSeg(uint16_t seg_0based);
+extern PlsrCfg_t g_plsr_config;
+extern PlsrSeg_t g_plsr_segments[PLSR_SEG_MAX];
/** @return 有效段数,钳制到 [0, PLSR_SEG_MAX] */
uint16_t PlsrParamGetSegCount(void);
@@ -211,7 +207,6 @@ uint16_t PlsrParamGetStartSeg(void);
*/
void PlsrParamBlockInit(void);
-/**
/**
* @brief 参数块任务:阻塞等信号量 → ApplyFromHold(校验)→ 通过则 SaveParamsFromHold
* @param pArg 未使用
@@ -228,13 +223,13 @@ void PlsrParamBlockTask(void *pArg);
void PlsrParamBlockOnHoldWrite(uint16_t start_addr, uint16_t quantity);
/**
- * @brief 保持寄存器 → s_cfg / s_seg,边拷贝边校验
+ * @brief 保持寄存器 → g_plsr_config / g_plsr_segments,边拷贝边校验
* @return 1=全部通过(写 0x2006=0);0=存在门禁故障(写对应码,不落 BKP)
*/
uint8_t PlsrParamBlockApplyFromHold(void);
/**
- * @brief s_cfg / s_seg → 保持寄存器(调试/特殊用途;正常运行路径不再调用)
+ * @brief g_plsr_config / g_plsr_segments → 保持寄存器(调试/特殊用途)
* @note 上电参数由 BKP→hold(PersistLoad);非法参数保留 hold 原值供上位机读回修正
*/
void PlsrParamBlockExportToHold(void);
diff --git a/plsr/plsr.c b/plsr/plsr.c
index b1f4af7..cbc845c 100644
--- a/plsr/plsr.c
+++ b/plsr/plsr.c
@@ -1,10 +1,10 @@
/**
* @file plsr.c
- * @brief PLSR 门面实现:初始化编排与周期任务
+ * @brief PLSR 顶层初始化和周期任务
*
* @details 模块职责
- * 按固定顺序调用各子模块 Init,并在 PlsrTask 中串联指令轮询、持久化与
- * 运行控制节拍。对外 API 均为薄转发,不含业务逻辑。
+ * 本文件只做两件事:按顺序初始化各模块,以及运行 PlsrTask 周期任务。
+ * 启停和中断函数直接实现在 run_control.c,这里不再做重复转发。
*
* 与其它模块关系
* 本文件仅依赖 plsr.h 及各子模块头文件,不被其它 plsr 模块反向引用。
@@ -32,10 +32,9 @@
*/
void PlsrInit(void)
{
- //PlsrParamInitDefault();
PlsrPersistInit(); /* 使能 BKPSRAM 写访问,否则落盘无效 */
PlsrPersistLoad(); /* BKPSRAM → g_hold_reg */
- (void)PlsrParamBlockApplyFromHold(); /* hold → s_cfg / s_seg[] + 校验 */
+ (void)PlsrParamBlockApplyFromHold(); /* hold → 运行参数 + 校验 */
PlsrPulseDriverInit();
PlsrSignalIoInit();
PlsrRunControlInit();
@@ -45,54 +44,6 @@ void PlsrInit(void)
PlsrPersistTickMonitor(); /* 监控区 hold+BKP 与运行态对齐 */
}
-/**
- * @brief 启动多段脉冲(见 plsr.h)
- */
-uint8_t PlsrStart(uint16_t start_seg)
-{
- if (start_seg == 0U)
- {
- start_seg = PlsrParamGetStartSeg();
- }
- return PlsrRunControlStart(start_seg);
-}
-
-/** @brief 急停(见 plsr.h) */
-void PlsrStop(void)
-{
- PlsrRunControlStop();
-}
-
-/** @brief 运行中改频(见 plsr.h) */
-uint8_t PlsrChangeFreq(uint32_t new_tgt_hz)
-{
- return PlsrRunControlChangeFreq(new_tgt_hz);
-}
-
-/** @brief 忙闲查询(见 plsr.h) */
-uint8_t PlsrIsBusy(void)
-{
- return PlsrRunControlIsBusy();
-}
-
-/** @brief 累计脉冲(见 plsr.h) */
-int32_t PlsrGetAccPulse(void)
-{
- return PlsrRunControlGetAccPulse();
-}
-
-/** @brief 清零累计(见 plsr.h) */
-void PlsrClearAccPulse(void)
-{
- PlsrRunControlClearAccPulse();
-}
-
-/** @brief 脉冲 ISR 入口(见 plsr.h) */
-void PlsrOnPulseIsr(void)
-{
- PlsrRunControlOnPulseIsr();
-}
-
/**
* @brief PLSR 主周期任务
* @param pArg 未使用
diff --git a/plsr/plsr.h b/plsr/plsr.h
index c37208b..78935fc 100644
--- a/plsr/plsr.h
+++ b/plsr/plsr.h
@@ -1,11 +1,10 @@
/**
* @file plsr.h
- * @brief PLSR 多段脉冲输出子系统对外门面
+ * @brief PLSR 多段脉冲输出子系统公共接口
*
* @details 模块职责
- * 本文件定义上位机/应用层唯一可见的 PLSR 入口,封装初始化、周期任务、
- * 启停控制、运行状态查询与脉冲中断回调。内部实现全部委托给子模块,
- * 本层不做运动规划与硬件寄存器操作。
+ * 本文件只声明公共入口与共享运行状态。初始化和周期任务实现在 plsr.c;
+ * 启停和脉冲中断直接实现在 run_control.c,不再经过 plsr.c 转发。
*
* 与其它模块关系
* - plsr_param :运行参数映像(公共 + 段表),Modbus 保持寄存器 ↔ 结构体
@@ -24,6 +23,11 @@
#define PLSR_H
#include
+
+/* run_control 拥有的共享运行状态;段下标从 0 开始。 */
+extern volatile uint8_t g_plsr_busy;
+extern volatile uint16_t g_plsr_current_segment_index;
+extern volatile int32_t g_plsr_accumulated_pulses;
#include "plsr_param.h"
/*
@@ -75,29 +79,17 @@ void PlsrStop(void);
*/
uint8_t PlsrChangeFreq(uint32_t new_tgt_hz);
-/**
- * @brief 查询是否运动中
- * @return 1=busy(段执行或等待中);0=空闲
- */
-uint8_t PlsrIsBusy(void);
-
-/**
- * @brief 读取累计脉冲计数(有符号,正=正向累计)
- * @return 自系统运行以来的净脉冲数,供绝对坐标与监控 0x2000 使用
- */
-int32_t PlsrGetAccPulse(void);
-
/**
* @brief 清零累计脉冲与绝对坐标原点
* @note 调用时机:CommandPoll 收到 CLR 控制位
- * @note 副作用:s_acc_pulse=0、s_abs_origin=0,下次 Start 重新锁定原点
+ * @note 同时清除累计脉冲和绝对模式原点,下次 Start 重新锁定原点
*/
void PlsrClearAccPulse(void);
/**
* @brief 脉冲 TIM UPDATE 中断入口
* @note 调用时机:每发出一个脉冲边沿,由 stm32f4xx_it 中对应 TIM 回调转发
- * @note 副作用:s_done++/累计坐标更新、逐拍加减速改频、段末/ACT 边界切段
+ * @note 副作用:累计本段脉冲和坐标、逐拍改频、处理段末/ACT 边界
*/
void PlsrOnPulseIsr(void);
diff --git a/plsr/pulse_driver/plsr_pulse_driver.c b/plsr/pulse_driver/plsr_pulse_driver.c
index 8bdb98b..564dacf 100644
--- a/plsr/pulse_driver/plsr_pulse_driver.c
+++ b/plsr/pulse_driver/plsr_pulse_driver.c
@@ -11,7 +11,7 @@
*
* 关键数据流
* PlanSeg → LockPscRange → DIR_WAIT → Start → ISR SetFreqIsr(只改 ARR)
- * 段末 ArmOnePulseStop → AfterSegDone Stop / FOLLOW ClearOnePulseStop
+ * 段末 ArmSegEndStop → AfterSegDone Stop / FOLLOW ClearOnePulseStop
*/
#include "plsr_pulse_driver.h"
#include "plsr_param.h"
@@ -35,12 +35,15 @@ TIM_HandleTypeDef htim13;
/*
* ---------- 模块静态状态 ----------
- * s_last_freq/psc/arr — 上次量化结果;匀速热路径比较后可跳过写寄存器
+ * g_plsr_output_frequency_hz/psc/arr — 上次量化结果;匀速热路径比较后可跳过写寄存器
* s_active_htim — 当前选中脉冲路 HAL 句柄
* s_psc_locked / locked_psc — 段内 PSC 锁;跨度过大时 locked=0
* s_req_freq / pending — ISR 无法换 PSC 时的挂起改频
*/
-static uint32_t s_last_freq;
+volatile uint32_t g_plsr_output_frequency_hz;
+volatile uint8_t g_plsr_pwm_running;
+uint8_t g_plsr_direction_forward;
+uint8_t g_plsr_direction_valid;
static uint32_t s_last_psc = 0xFFFFFFFFUL;
static uint32_t s_last_arr = 0xFFFFFFFFUL;
static uint32_t s_last_ccr;
@@ -89,8 +92,7 @@ static TIM_HandleTypeDef *PlsrPulseDriverHtimByY(uint16_t pulse_y)
/** @brief 从公共参数取脉冲端子,越界钳到 Y0 */
static uint8_t PlsrPulseDriverSelectY(void)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
- uint16_t y = cfg->pulse_y;
+ uint16_t y = g_plsr_config.pulse_y;
if (y > 2U)
{
@@ -271,7 +273,10 @@ static void PlsrPulseDriverTimInitOne(TIM_HandleTypeDef *htim, TIM_TypeDef *inst
/** @brief 驱动初始化(见 plsr_pulse_driver.h) */
void PlsrPulseDriverInit(void)
{
- s_last_freq = 0U;
+ g_plsr_output_frequency_hz = 0U;
+ g_plsr_pwm_running = 0U;
+ g_plsr_direction_forward = 0U;
+ g_plsr_direction_valid = 0U;
s_last_psc = 0xFFFFFFFFUL;
s_last_arr = 0xFFFFFFFFUL;
s_last_ccr = 0U;
@@ -293,10 +298,9 @@ void PlsrPulseDriverInit(void)
/** @brief 写方向脚(见 plsr_pulse_driver.h) */
void PlsrPulseDriverSetDir(uint8_t forward)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
uint8_t level;
- if (cfg->dir_logic == PLSR_DIR_LOGIC_POS)
+ if (g_plsr_config.dir_logic == PLSR_DIR_LOGIC_POS)
{
level = (forward != 0U) ? 1U : 0U;
}
@@ -306,12 +310,16 @@ void PlsrPulseDriverSetDir(uint8_t forward)
}
HAL_GPIO_WritePin(PLSR_Y3_PORT, PLSR_Y3_PIN,
level ? GPIO_PIN_SET : GPIO_PIN_RESET);
+ g_plsr_direction_forward = (forward != 0U) ? 1U : 0U;
+ g_plsr_direction_valid = 1U;
}
/** @brief 方向脚拉低(见 plsr_pulse_driver.h) */
void PlsrPulseDriverClearDir(void)
{
HAL_GPIO_WritePin(PLSR_Y3_PORT, PLSR_Y3_PIN, GPIO_PIN_RESET);
+ g_plsr_direction_forward = 0U;
+ g_plsr_direction_valid = 0U;
}
/** @brief 是否脉冲 TIM(见 plsr_pulse_driver.h) */
@@ -547,7 +555,8 @@ static void PlsrPulseDriverLoadRegs(uint32_t freq_hz)
if (freq_hz == 0U)
{
PlsrPulseDriverStopHtim(htim);
- s_last_freq = 0U;
+ g_plsr_output_frequency_hz = 0U;
+ g_plsr_pwm_running = 0U;
s_last_psc = 0xFFFFFFFFUL;
s_last_arr = 0xFFFFFFFFUL;
s_last_ccr = 0U;
@@ -570,7 +579,7 @@ static void PlsrPulseDriverLoadRegs(uint32_t freq_hz)
ccr = 1U;
}
- s_last_freq = freq_hz;
+ g_plsr_output_frequency_hz = freq_hz;
s_last_psc = psc;
s_last_arr = arr;
s_last_ccr = ccr;
@@ -623,6 +632,17 @@ static void PlsrPulseDriverCommitOutput(void)
htim->Instance->ARR = s_last_arr;
htim->Instance->CCR1 = ccr;
+ /*
+ * 先把 CNT 放到周期末端,再切回 PWM 模式。
+ *
+ * ACT 在周期中间打断时,CNT 可能仍停在旧周期的任意位置。
+ * 如果先切 PWM1,输出比较器会立刻按这个旧 CNT 判断电平,
+ * 随后再写 CNT=ARR 就会形成一个几微秒的假脉冲。
+ * 先写 CNT=ARR 并保持 Forced inactive,再切 PWM1,模式切换期间
+ * 输出始终为低;真正的首个上升沿只会由后续 UPDATE 产生。
+ */
+ htim->Instance->CNT = s_last_arr;
+
ccmr = htim->Instance->CCMR1;
ccmr &= (uint32_t)(~TIM_CCMR1_OC1M);
ccmr |= TIM_OCMODE_PWM1;
@@ -638,11 +658,12 @@ static void PlsrPulseDriverCommitOutput(void)
htim->Instance->ARR = s_last_arr;
htim->Instance->CCR1 = ccr;
- htim->Instance->CNT = s_last_arr;
+ /* CNT 已在切换 PWM 模式前归位,下面仅清状态并开表。 */
__HAL_TIM_CLEAR_FLAG(htim, TIM_FLAG_UPDATE);
__HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);
__HAL_TIM_ENABLE_IT(htim, TIM_IT_UPDATE);
__HAL_TIM_ENABLE(htim);
+ g_plsr_pwm_running = 1U;
/* 记录起跳工作寄存器,供首拍 ISR 保护当前周期 */
s_protect_arr = s_last_arr;
@@ -657,7 +678,7 @@ static void PlsrPulseDriverCommitOutput(void)
*/
static void PlsrPulseDriverStartCommon(uint32_t freq_hz)
{
- if ((s_regs_prepared == 0U) || (freq_hz != s_last_freq) || (freq_hz == 0U))
+ if ((s_regs_prepared == 0U) || (freq_hz != g_plsr_output_frequency_hz) || (freq_hz == 0U))
{
PlsrPulseDriverLoadRegs(freq_hz);
}
@@ -682,7 +703,7 @@ void PlsrPulseDriverSetFreq(uint32_t freq_hz)
uint32_t clk_hz;
TIM_HandleTypeDef *htim;
- if (freq_hz == s_last_freq)
+ if (freq_hz == g_plsr_output_frequency_hz)
{
return;
}
@@ -695,7 +716,8 @@ void PlsrPulseDriverSetFreq(uint32_t freq_hz)
if (freq_hz == 0U)
{
PlsrPulseDriverStopHtim(htim);
- s_last_freq = 0U;
+ g_plsr_output_frequency_hz = 0U;
+ g_plsr_pwm_running = 0U;
s_last_psc = 0xFFFFFFFFUL;
s_last_arr = 0xFFFFFFFFUL;
return;
@@ -713,7 +735,7 @@ void PlsrPulseDriverSetFreq(uint32_t freq_hz)
if ((psc == s_last_psc) && (arr == s_last_arr))
{
- s_last_freq = freq_hz;
+ g_plsr_output_frequency_hz = freq_hz;
return;
}
@@ -739,7 +761,7 @@ void PlsrPulseDriverSetFreq(uint32_t freq_hz)
__HAL_TIM_ENABLE_IT(htim, TIM_IT_UPDATE);
}
- s_last_freq = freq_hz;
+ g_plsr_output_frequency_hz = freq_hz;
s_last_psc = psc;
s_last_arr = arr;
}
@@ -792,7 +814,7 @@ void PlsrPulseDriverSetFreqIsr(uint32_t freq_hz)
}
/* 匀速热路径:频率未变 → 不算量化、不写寄存器 */
- if (freq_hz == s_last_freq)
+ if (freq_hz == g_plsr_output_frequency_hz)
{
return;
}
@@ -825,7 +847,7 @@ void PlsrPulseDriverSetFreqIsr(uint32_t freq_hz)
if ((psc == s_last_psc) && (arr == s_last_arr))
{
- s_last_freq = freq_hz;
+ g_plsr_output_frequency_hz = freq_hz;
return;
}
@@ -838,7 +860,7 @@ void PlsrPulseDriverSetFreqIsr(uint32_t freq_hz)
__HAL_TIM_SET_AUTORELOAD(htim, arr);
__HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_1, ccr);
- s_last_freq = freq_hz;
+ g_plsr_output_frequency_hz = freq_hz;
s_last_psc = psc;
s_last_arr = arr;
s_last_ccr = ccr;
@@ -890,24 +912,56 @@ void PlsrPulseDriverStop(void)
PlsrPulseDriverStopHtim(&htim10);
PlsrPulseDriverStopHtim(&htim11);
PlsrPulseDriverStopHtim(&htim13);
- s_last_freq = 0U;
+ g_plsr_output_frequency_hz = 0U;
+ g_plsr_pwm_running = 0U;
s_last_psc = 0xFFFFFFFFUL;
s_last_arr = 0xFFFFFFFFUL;
}
/**
- * @brief 武装 OPM 段末停表(见 plsr_pulse_driver.h)
+ * @brief ACT 到期:收完当前高电平后锁低,并在周期末停表
*/
-void PlsrPulseDriverArmOnePulseStop(void)
+void PlsrPulseDriverArmActStop(void)
{
TIM_HandleTypeDef *htim = s_active_htim;
+ uint32_t cnt;
+ uint32_t ccr;
- if (htim == (TIM_HandleTypeDef *)0)
+ if ((htim == (TIM_HandleTypeDef *)0) || (htim->Instance == (TIM_TypeDef *)0))
{
return;
}
- /* 下一 UPDATE 后计数器停止;须在「已计入末拍上升沿」时武装(见 run_control ISR) */
+
+ /* OPM 先武装:当前周期结束的 UPDATE 到来时自动关 CEN。 */
htim->Instance->CR1 |= TIM_CR1_OPM;
+
+ cnt = htim->Instance->CNT;
+ ccr = htim->Instance->CCR1;
+ if (((htim->Instance->CR1 & TIM_CR1_CEN) != 0U) &&
+ (cnt < ccr))
+ {
+ /* 当前仍为高电平:等本拍 CC1 下降沿后再锁低。 */
+ s_seg_end_fall_armed = 1U;
+ __HAL_TIM_CLEAR_FLAG(htim, TIM_FLAG_CC1);
+ __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
+
+ /*
+ * 读取到高电平后,CC1 可能恰好在开中断前已经过去。
+ * 再检查一次;若已进入低电平或 OPM 已停表,立即锁低。
+ */
+ cnt = htim->Instance->CNT;
+ if (((htim->Instance->CR1 & TIM_CR1_CEN) == 0U) || (cnt >= ccr))
+ {
+ PlsrPulseDriverClearSegEndFallArm(htim);
+ PlsrPulseDriverOcForceLowKeepRun(htim);
+ }
+ }
+ else
+ {
+ /* ACT 落在低电平阶段(或边界已停表):无需再等 CC1。 */
+ PlsrPulseDriverClearSegEndFallArm(htim);
+ PlsrPulseDriverOcForceLowKeepRun(htim);
+ }
}
/**
@@ -965,4 +1019,5 @@ void PlsrPulseDriverHoldOutputLow(void)
return;
}
PlsrPulseDriverStopHtim(htim);
+ g_plsr_pwm_running = 0U;
}
diff --git a/plsr/pulse_driver/plsr_pulse_driver.h b/plsr/pulse_driver/plsr_pulse_driver.h
index 8c30da3..2831339 100644
--- a/plsr/pulse_driver/plsr_pulse_driver.h
+++ b/plsr/pulse_driver/plsr_pulse_driver.h
@@ -34,6 +34,12 @@ extern TIM_HandleTypeDef htim10;
extern TIM_HandleTypeDef htim11;
extern TIM_HandleTypeDef htim13;
+/* 驱动拥有的真实输出状态,run_control 直接读取,不再保存第二份。 */
+extern volatile uint32_t g_plsr_output_frequency_hz;
+extern volatile uint8_t g_plsr_pwm_running;
+extern uint8_t g_plsr_direction_forward;
+extern uint8_t g_plsr_direction_valid;
+
/**
* @brief 初始化三路脉冲 TIM + 方向 GPIO
* @note 调用时机:PlsrInit,在 RunControl 之前
@@ -106,14 +112,14 @@ void PlsrPulseDriverClearStartPeriodProtect(void);
void PlsrPulseDriverStop(void);
/**
- * @brief 当前拍结束后停止计数(CR1.OPM),避免段末多出一个上升沿
- * @note 调用时机:已计入末拍上升沿的 ISR;本周期结束后 OPM 停表
+ * @brief ACT 到期后收完当前脉冲、锁低输出,并在本周期末停止计数
+ * @note 可在周期任意位置调用:高电平等下降沿,低电平立即 Forced inactive
*/
-void PlsrPulseDriverArmOnePulseStop(void);
+void PlsrPulseDriverArmActStop(void);
/**
* @brief 段末停表:OPM 等周期结束 + CC1 下降沿立刻 Forced 拉低
- * @note 仅非 FOLLOW-keep 段末使用;ACT 切段仍用 ArmOnePulseStop
+ * @note 在已计入末拍上升沿的 UPDATE ISR 中调用
*/
void PlsrPulseDriverArmSegEndStop(void);
diff --git a/plsr/run_control/plsr_run_control.c b/plsr/run_control/plsr_run_control.c
index 5732d84..170ba6e 100644
--- a/plsr/run_control/plsr_run_control.c
+++ b/plsr/run_control/plsr_run_control.c
@@ -24,17 +24,17 @@
* → [DIR_WAIT?] → OnPulseIsr 循环
*
* 关键变量:
- * s_done / s_target 本段已发 / 目标脉冲数
+ * s_segment_pulses_done / s_segment_pulse_target 本段已发 / 目标脉冲数
* remain = target - done(还剩几拍)
* s_phase 段内 APPROACH/CONST/DECEL
- * s_seg_end_opm 1=段末停表(非 FOLLOW 无缝);0=到点立刻跳下段
+ * s_stop_after_last_pulse 1=段末停表(非 FOLLOW 无缝);0=到点立刻跳下段
*
* OnPulseIsr 决策顺序(自上而下,命中 return):
* 1) 非 RC_RUN → 直接 return
- * 2) s_last_period_wait → 末拍周期结束,停表,AfterSegDone
- * 3) s_done++,累计 s_acc_pulse
- * 4) s_act_cut_pending → ACT 到期,任务侧切段
- * 5) s_done >= target → OPM 末拍 or 立刻 AfterSegDone
+ * 2) s_waiting_for_last_period → 末拍周期结束,停表,AfterSegDone
+ * 3) s_segment_pulses_done++,累计 g_plsr_accumulated_pulses
+ * 4) s_act_waiting_for_pulse_boundary → ACT 到期,任务侧切段
+ * 5) s_segment_pulses_done >= target → OPM 末拍 or 立刻 AfterSegDone
* 6) 按 s_phase 改频:CONST 只进减速;APPROACH Step;DECEL Step
*
* ARPE 补偿(为何 remain==dec_n+1 才进减速):
@@ -57,23 +57,23 @@
* 4) PlanSeg / ChangeFreq 共用规划入口,便于后期动态改频
*
* 【运行节拍】纯脉冲计数:
- * UPDATE ISR:s_done++;倒数第二拍尽早 ArmOnePulseStop(OPM);
- * 加/减速逐拍 PlsrAccelPulseRtStep + SetFreqIsr;
+ * UPDATE ISR:s_segment_pulses_done++;末拍用 ArmSegEndStop 完整收尾;
+ * 加/减速逐拍 PlsrAccelNextFrequency + SetFreqIsr;
* 匀速复用 ARR(不改频);remain<=dec_n+1 进减速(补偿 ARR 预装载晚一拍)。
* 任务 TickMs:ACT(OS 节拍)/ EXT / ApplyPending;
- * TIM5 one-shot:换向/WAIT/ACT/ACT剩余;ACT 到期只置 cut_pending,等脉冲边界再切段。
+ * TIM5 one-shot:换向/WAIT/ACT/ACT剩余;ACT 到期收完当前脉冲并锁低,周期边界再切段。
* PlsrTask:DebouncePoll + TickMs + WakePend。
*
* 【段末频率 / ARPE】预装载开启时,本拍写的 ARR 要到再下一拍才生效;
* 若不超前,末拍实际是 f(N-1)≈sqrt(f_end^2+2a),示波器偶发「末频偏高」。
* 减速在 remain==dec_n+1 切入;纯减速开表再预装一拍。
*
- * 【段末停表】非 FOLLOW-keep 时开段锁 s_seg_end_opm:
- * UPDATE≈上升沿;s_done 到 target 时 ArmSegEndStop(OPM+CC1 末拍下降沿拉低),
+ * 【段末停表】非 FOLLOW-keep 时开段锁 s_stop_after_last_pulse:
+ * UPDATE≈上升沿;s_segment_pulses_done 到 target 时 ArmSegEndStop(OPM+CC1 末拍下降沿拉低),
* 周期 UPDATE 再 HoldOutputLow + AfterSegDone 且不再 ++。FOLLOW-keep 到点立刻衔接。
*
* 【故障诊断 0x2006】(PlsrCommandSetFault,告警码 1~3 不停机;4 禁止启动)
- * 0x01 段结束 AfterSegDone:s_done != s_target
+ * 0x01 段结束 AfterSegDone:s_segment_pulses_done != s_segment_pulse_target
* 0x02 PlanSeg 后:规划峰值达不到设定 f_tgt(典型三角)
* 0x03 加速离开 APPROACH / 减速段末:相内脉冲 ≠ 规划预算
* 0x04 目标频率 ∉ [1,100000]:Start / BeginSeg / ChangeFreq / 运行中写频
@@ -81,12 +81,13 @@
* 符号约定(与 accel_curve / param 对齐)
* seg_idx0 — 段下标 0-based(寄存器/界面段号为 1-based)
* f_tgt — 段表目标频率 Hz(规划输入,可能与规划峰值不同)
- * s_done — 本段已发脉冲数;s_target — 本段目标脉冲数
- * s_plan_acc_n — PlanSeg 锁定的加速相脉冲预算(0x03 诊断用)
- * s_decel_budget — 进入减速相时锁定的步进预算(可能因 ARPE 缩短)
- * remain — 本段剩余脉冲 = s_target - s_done
+ * s_segment_pulses_done — 本段已发脉冲数;s_segment_pulse_target — 本段目标脉冲数
+ * g_plsr_accel_plan.accel_pulses — PlanSeg 锁定的加速相脉冲预算(0x03 诊断用)
+ * g_plsr_accel_runtime.total_pulses — 进入减速相时锁定的步进预算(可能因 ARPE 缩短)
+ * remain — 本段剩余脉冲 = s_segment_pulse_target - s_segment_pulses_done
*/
#include "plsr_run_control.h"
+#include "plsr.h"
#include "plsr_accel_curve.h"
#include "plsr_param.h"
#include "plsr_pulse_driver.h"
@@ -121,62 +122,31 @@ typedef enum {
PH_DECEL
} RunPhase_e;
-/*
- * ---------- 模块静态状态(按功能分组) ----------
- *
- * 段进度:s_state, s_busy, s_cur_seg, s_done, s_target, s_forward
- * 频率链:s_cur_freq, s_chain_freq, s_chain_valid, s_follow_cont, s_pwm_on
- * 坐标 :s_acc_pulse(全局累计), s_abs_origin(首次 Start 锁定,绝对模式用)
- * 曲线 :s_accel_plan, s_pulse_rt, s_phase, s_plan_acc_n, s_decel_budget
- * ACT :s_act_*(TIM5 计时;到期 cut_pending → 脉冲边界 ActExpire)
- * WAIT :s_wait_is_signal / expire_req
- * 换向 :s_dir_expire_req / s_dir_out / s_dir_valid
- * 段参数:s_run_accel_ms, s_run_decel_ms(PlanSeg 锁定,ChangeFreq 复用)
- */
-static volatile RcState_e s_state; /* 主状态机:IDLE/DIR_WAIT/RUN/WAIT_COND */
-static volatile uint8_t s_busy; /* 1=整趟运行未结束(含等待) */
-static volatile uint8_t s_forward; /* 1=当前段正向,0=反向 */
-static volatile uint16_t s_cur_seg; /* 当前段下标 0-based */
-static volatile uint32_t s_cur_freq; /* 当前输出频率 Hz */
-static volatile int32_t s_done; /* 本段已发脉冲计数 */
-static volatile int32_t s_target; /* 本段目标脉冲数(相对=位移,绝对=差值) */
-static volatile int32_t s_acc_pulse; /* 全局累计脉冲(有符号,正=正向) */
-static int32_t s_abs_origin; /* 绝对模式:首次 Start 时 s_acc_pulse 快照 */
-static uint8_t s_abs_origin_locked;
-
-static volatile uint8_t s_dir_expire_req; /* 1=方向延时 TIM5 到期,任务侧处理 */
-static uint8_t s_dir_out; /* 上次已输出到 Y3 的方向 */
-static uint8_t s_dir_valid; /* 1=本趟已建立方向,可判下一段同向/反向 */
-static OS_EVENT *s_wake_sem; /* ISR/延时到期唤醒 PlsrTask */
-static uint16_t s_act_time_ms; /* 本段 ACT 设定时长 ms */
-static volatile uint8_t s_act_armed; /* 1=ACT 计时器已武装 */
-static volatile uint8_t s_act_expire_req; /* 1=脉冲边界已处理 ACT 到期,任务切段 */
-static volatile uint8_t s_act_cut_pending; /* 1=ACT 墙钟到,等 UPDATE 边界再切段 */
-static volatile uint8_t s_act_handoff_keep; /* ACT 边界停表后仍用当前频衔接下一段 */
-static volatile uint8_t s_wait_expire_req; /* 保留:时间 WAIT 到期标志 */
-static uint8_t s_wait_is_signal; /* WAIT_COND:1=等信号沿,0=等时间 */
-
-static PlsrAccelPlan_t s_accel_plan; /* 本段曲线规划结果 */
-static PlsrAccelPulseRt_t s_pulse_rt; /* ISR 逐拍改频状态 */
-static volatile RunPhase_e s_phase; /* 段内相:APPROACH/CONST/DECEL */
-static uint8_t s_follow_cont; /* 1=下一段从当前频率无缝衔接 */
-
-static uint32_t s_chain_freq; /* 段末停表前的落地频率,供下段 f_from */
-static uint8_t s_chain_valid; /* 1=s_chain_freq 有效 */
-static uint8_t s_pwm_on; /* 1=PWM 正在输出 */
-static uint8_t s_seg_end_opm; /* 1=本段末拍用 OPM 单脉冲停表 */
-static volatile uint8_t s_last_period_wait; /* 1=已计满 target,等末拍周期结束再 AfterSegDone */
-
-static uint16_t s_run_accel_ms; /* 本段锁定加速时间 ms(ChangeFreq 复用) */
-static uint16_t s_run_decel_ms; /* 本段锁定减速时间 ms */
-
-static uint32_t s_plan_acc_n; /* PlanSeg 锁定加速脉冲预算(0x03) */
-static uint32_t s_plan_dec_n; /* PlanSeg 锁定减速脉冲预算 */
-static uint32_t s_decel_budget; /* EnterDecel 时锁定的减速步进预算 */
-
-/** 本次 Start 的启动段(0-based);仅该段首次冷启动可套用「起速>目标」入口规则 */
-static uint16_t s_run_entry_seg0;
-static uint8_t s_run_first_entry;
+/* 其它 PLSR 模块需要读取的运行结果只保存这一份。 */
+volatile uint8_t g_plsr_busy;
+volatile uint16_t g_plsr_current_segment_index;
+volatile int32_t g_plsr_accumulated_pulses;
+
+/* 运行控制内部状态保持一层变量,避免 s_run.xxx 的结构体嵌套。 */
+static volatile RcState_e s_state;
+static volatile uint8_t s_forward;
+static volatile int32_t s_segment_pulses_done;
+static volatile int32_t s_segment_pulse_target;
+static int32_t s_absolute_origin;
+static uint8_t s_absolute_origin_locked;
+static volatile uint8_t s_act_timer_armed;
+static volatile uint8_t s_act_expired;
+static volatile uint8_t s_act_waiting_for_pulse_boundary;
+static volatile uint8_t s_keep_frequency_after_act;
+static volatile uint8_t s_wait_time_expired;
+static uint8_t s_waiting_for_input_signal;
+static volatile RunPhase_e s_phase;
+static uint8_t s_continue_without_stopping;
+static uint32_t s_next_segment_start_frequency_hz;
+static uint8_t s_next_segment_start_frequency_valid;
+static uint8_t s_stop_after_last_pulse;
+static volatile uint8_t s_waiting_for_last_period;
+static OS_EVENT *s_wake_sem;
/**
* 策略层解析后交给 PlanSeg 的段端点(不含 wait_type,仅频率与时间)
@@ -196,12 +166,9 @@ static void PlsrRunControlArmActExtOnPulseStart(void);
static void PlsrRunControlCutSegToNext(void);
static void PlsrRunControlActExpire(void);
static void PlsrRunControlEnterPostWaitOrNext(void);
-static uint16_t PlsrRunControlActTimeMs(const PlsrSeg_t *seg);
static uint8_t PlsrRunControlBlocksFollowKeep(uint16_t cur_seg);
-//static uint8_t PlsrRunControlWillFollowKeep(uint16_t cur_seg);
static uint8_t PlsrRunControlResolveSegPlanEndpoints(uint16_t seg_idx0, uint32_t f_tgt,
PlsrSegPlanEndpoints_t *endpoints);
-static uint16_t PlsrRunControlWaitTimeMs(const PlsrSeg_t *seg);
static void PlsrRunControlPlanSeg(uint32_t total, uint32_t f_from,
uint32_t f_tgt, uint32_t f_end,
uint16_t accel_ms, uint16_t decel_ms);
@@ -210,7 +177,6 @@ static void PlsrRunControlCheckApproachCurveFault(uint8_t by_pulse_budget);
static void PlsrRunControlOnApproachDone(void);
static void PlsrRunControlCheckDecelCurveFault(void);
static int32_t PlsrRunControlAbsLocalPos(void);
-static uint32_t PlsrRunControlClampSpeed(uint32_t spd);
static uint8_t PlsrRunControlGetSegTargetFreq(int32_t freq_hz,
uint32_t default_spd,
uint32_t *out_hz);
@@ -227,9 +193,8 @@ static void PlsrRunControlWakeDrain(void);
*/
static int16_t PlsrRunControlNextSeg(uint16_t cur_seg_0based)
{
- PlsrSeg_t *seg = PlsrParamGetSeg(cur_seg_0based);
uint16_t n = PlsrParamGetSegCount();
- uint16_t jump = seg->jump_seg;
+ uint16_t jump = g_plsr_segments[cur_seg_0based].jump_seg;
if (jump == 0U)
{
@@ -251,9 +216,8 @@ static int16_t PlsrRunControlNextSeg(uint16_t cur_seg_0based)
*/
static uint8_t PlsrRunControlIsEmptyPlaceholderSeg(uint16_t seg_0based)
{
- PlsrSeg_t *seg = PlsrParamGetSeg(seg_0based);
-
- return ((seg->freq_hz == 0) && (seg->pulse_cnt == 0)) ? 1U : 0U;
+ return ((g_plsr_segments[seg_0based].freq_hz == 0) &&
+ (g_plsr_segments[seg_0based].pulse_cnt == 0)) ? 1U : 0U;
}
/**
@@ -282,17 +246,15 @@ static int16_t PlsrRunControlNextEffectiveSeg(uint16_t cur_seg_0based)
*/
static uint8_t PlsrRunControlIsForward(uint16_t seg_0based, int32_t acc_pulse)
{
- PlsrSeg_t *seg = PlsrParamGetSeg(seg_0based);
- PlsrCfg_t *cfg = PlsrParamGetCfg();
int32_t move;
- if (cfg->run_mode == PLSR_POS_ABSOLUTE)
+ if (g_plsr_config.run_mode == PLSR_POS_ABSOLUTE)
{
- move = seg->pulse_cnt - acc_pulse;
+ move = g_plsr_segments[seg_0based].pulse_cnt - acc_pulse;
}
else
{
- move = seg->pulse_cnt;
+ move = g_plsr_segments[seg_0based].pulse_cnt;
}
return (move >= 0) ? 1U : 0U;
}
@@ -303,16 +265,14 @@ static uint8_t PlsrRunControlIsForward(uint16_t seg_0based, int32_t acc_pulse)
static void PlsrRunControlClearChainAndStop(void)
{
PlsrPulseDriverStop();
- s_follow_cont = 0U;
- s_pwm_on = 0U;
- s_chain_valid = 0U;
- s_chain_freq = 0U;
- s_cur_freq = 0U;
+ s_continue_without_stopping = 0U;
+ s_next_segment_start_frequency_valid = 0U;
+ s_next_segment_start_frequency_hz = 0U;
}
/**
* @brief 中途切段 handoff:同向且有有效频率则不停表衔接,否则停表清链
- * @param allow_act_handoff 1=允许 s_act_handoff_keep(边界停表后仍衔接)
+ * @param allow_act_handoff 1=允许 s_keep_frequency_after_act(边界停表后仍衔接)
*/
static void PlsrRunControlApplyKeepOrStop(uint8_t allow_act_handoff)
{
@@ -320,11 +280,11 @@ static void PlsrRunControlApplyKeepOrStop(uint8_t allow_act_handoff)
uint8_t keep;
uint8_t pwm_ok;
- next_seg_idx = PlsrRunControlNextSeg(s_cur_seg);
- pwm_ok = (s_pwm_on != 0U) ||
- ((allow_act_handoff != 0U) && (s_act_handoff_keep != 0U));
+ next_seg_idx = PlsrRunControlNextSeg(g_plsr_current_segment_index);
+ pwm_ok = (g_plsr_pwm_running != 0U) ||
+ ((allow_act_handoff != 0U) && (s_keep_frequency_after_act != 0U));
keep = 0U;
- if ((next_seg_idx >= 0) && (pwm_ok != 0U) && (s_cur_freq >= 1U) &&
+ if ((next_seg_idx >= 0) && (pwm_ok != 0U) && (g_plsr_output_frequency_hz >= 1U) &&
(PlsrRunControlIsForward((uint16_t)next_seg_idx, PlsrRunControlAbsLocalPos()) ==
s_forward))
{
@@ -334,9 +294,9 @@ static void PlsrRunControlApplyKeepOrStop(uint8_t allow_act_handoff)
if (keep != 0U)
{
PlsrPulseDriverClearOnePulseStop();
- s_follow_cont = 1U;
- s_chain_valid = 1U;
- s_chain_freq = s_cur_freq;
+ s_continue_without_stopping = 1U;
+ s_next_segment_start_frequency_valid = 1U;
+ s_next_segment_start_frequency_hz = g_plsr_output_frequency_hz;
}
else
{
@@ -352,27 +312,35 @@ static void PlsrRunControlApplyKeepOrStop(uint8_t allow_act_handoff)
*/
static void PlsrRunControlArmActExtOnPulseStart(void)
{
- PlsrSeg_t *seg = PlsrParamGetSeg(s_cur_seg);
+ uint16_t act_time_ms;
/*
* EXT 中途切段:开跑时丢掉旧沿,避免上一段的 WAIT 沿立刻切段。
* WAIT 信号不在这里清:段中落地的下降沿要留给※2。
*/
- if ((seg->wait_type == PLSR_WAIT_EXT) ||
- (seg->wait_type == PLSR_WAIT_EXT_OR_DONE))
+ if ((g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_EXT) ||
+ (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_EXT_OR_DONE))
{
PlsrSignalIoClearEdges();
}
- s_act_armed = 0U;
- s_act_expire_req = 0U;
- s_act_cut_pending = 0U;
- s_act_handoff_keep = 0U;
- s_wait_expire_req = 0U;
- if (seg->wait_type == PLSR_WAIT_ACT)
+ s_act_timer_armed = 0U;
+ s_act_expired = 0U;
+ s_act_waiting_for_pulse_boundary = 0U;
+ s_keep_frequency_after_act = 0U;
+ s_wait_time_expired = 0U;
+ if (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_ACT)
{
- s_act_time_ms = PlsrRunControlActTimeMs(seg);
- s_act_armed = 1U;
- PlsrSignalIoScheduleDelayMs((uint32_t)s_act_time_ms);
+ act_time_ms = g_plsr_segments[g_plsr_current_segment_index].act_ms;
+ if (act_time_ms == 0U)
+ {
+ act_time_ms = g_plsr_segments[g_plsr_current_segment_index].wait_ms;
+ }
+ if (act_time_ms == 0U)
+ {
+ act_time_ms = 1U;
+ }
+ s_act_timer_armed = 1U;
+ PlsrSignalIoScheduleDelayMs((uint32_t)act_time_ms);
}
}
@@ -386,14 +354,14 @@ static void PlsrRunControlCutSegToNext(void)
{
PlsrSignalIoCancelDelay();
s_state = RC_IDLE;
- s_act_armed = 0U;
- s_act_expire_req = 0U;
- s_act_cut_pending = 0U;
- s_act_handoff_keep = 0U;
- s_wait_expire_req = 0U;
+ s_act_timer_armed = 0U;
+ s_act_expired = 0U;
+ s_act_waiting_for_pulse_boundary = 0U;
+ s_keep_frequency_after_act = 0U;
+ s_wait_time_expired = 0U;
PlsrRunControlApplyKeepOrStop(0U);
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
}
/**
@@ -405,15 +373,15 @@ static void PlsrRunControlCutSegToNext(void)
*/
static void PlsrRunControlActExpire(void)
{
- s_act_armed = 0U;
- s_act_expire_req = 0U;
- s_wait_expire_req = 0U;
+ s_act_timer_armed = 0U;
+ s_act_expired = 0U;
+ s_wait_time_expired = 0U;
s_state = RC_IDLE;
PlsrRunControlApplyKeepOrStop(1U);
- s_act_handoff_keep = 0U;
+ s_keep_frequency_after_act = 0U;
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
}
/**
@@ -424,7 +392,6 @@ static void PlsrRunControlActExpire(void)
*/
static void PlsrRunControlEnterPostWaitOrNext(void)
{
- PlsrSeg_t *seg = PlsrParamGetSeg(s_cur_seg);
uint16_t wms;
/*
@@ -432,17 +399,21 @@ static void PlsrRunControlEnterPostWaitOrNext(void)
* WAIT时间/信号 → 停表清链后等待,再 BeginSeg(下一段从起速/起跳开跑)
* 其它 → 立即跳转下一段
*/
- if (seg->wait_type == PLSR_WAIT_TIME)
+ if (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_TIME)
{
- wms = PlsrRunControlWaitTimeMs(seg);
+ wms = g_plsr_segments[g_plsr_current_segment_index].wait_ms;
+ if (wms == 0U)
+ {
+ wms = 1U;
+ }
PlsrRunControlClearChainAndStop();
- s_wait_is_signal = 0U;
+ s_waiting_for_input_signal = 0U;
PlsrRunControlWakeDrain();
s_state = RC_WAIT_COND;
PlsrSignalIoScheduleDelayMs((uint32_t)wms);
return;
}
- if (seg->wait_type == PLSR_WAIT_SIGNAL)
+ if (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_SIGNAL)
{
/*
* 与 WAIT 时间相同:本段发完停表,再等 EXTI 确认后的下降沿。
@@ -451,15 +422,15 @@ static void PlsrRunControlEnterPostWaitOrNext(void)
PlsrRunControlClearChainAndStop();
if (PlsrSignalIoTakeWaitFalling() != 0U)
{
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
return;
}
- s_wait_is_signal = 1U;
+ s_waiting_for_input_signal = 1U;
s_state = RC_WAIT_COND;
return;
}
- if (seg->wait_type == PLSR_WAIT_EXT)
+ if (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_EXT)
{
/*
* 纯 EXT:脉冲发完后仍要等 EXT 沿才跳转。
@@ -470,10 +441,10 @@ static void PlsrRunControlEnterPostWaitOrNext(void)
PlsrSignalIoClearPending();
if (PlsrSignalIoTakeExtFalling() != 0U)
{
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
return;
}
- s_wait_is_signal = 1U;
+ s_waiting_for_input_signal = 1U;
s_state = RC_WAIT_COND;
return;
}
@@ -482,7 +453,7 @@ static void PlsrRunControlEnterPostWaitOrNext(void)
* EXT_OR_DONE:脉冲先发完 = 条件已满足,立刻下一段(不再等 EXT)。
* EXT 先到:RUN 里已 CutSegToNext,走不到这里。
*/
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
}
/**
@@ -507,12 +478,12 @@ static void PlsrRunControlGotoNextOrFinish(uint16_t cur_seg)
/**
* 0x01 脉冲个数诊断
* 时机:段正常结束进入 AfterSegDone 时。
- * 条件:本段目标 s_target>0 且实际发出 s_done 与目标不等。
+ * 条件:本段目标 s_segment_pulse_target>0 且实际发出 s_segment_pulses_done 与目标不等。
* 处理:告警,不中断后续切段/收尾逻辑。
*/
static void PlsrRunControlCheckPulseCntFault(void)
{
- if ((s_target > 0) && (s_done != s_target))
+ if ((s_segment_pulse_target > 0) && (s_segment_pulses_done != s_segment_pulse_target))
{
PlsrCommandSetFault(PLSR_ERR_PULSE_CNT);
}
@@ -521,24 +492,24 @@ static void PlsrRunControlCheckPulseCntFault(void)
/**
* 0x03 加速曲线诊断(离开 APPROACH → 匀速/减速前调用)
* @param by_pulse_budget
- * 1:因相内脉冲走到规划 acc_n 而收尾 → 要求 s_pulse_rt.n == s_plan_acc_n
+ * 1:因相内脉冲走到规划 acc_n 而收尾 → 要求 g_plsr_accel_runtime.completed_pulses == g_plsr_accel_plan.accel_pulses
* 0:因频率已提前到达目标而收尾 → 仅当 n 超过规划预算时报故障
- * 对照量用 PlanSeg 时锁定的 s_plan_acc_n(运行中 plan.acc_n 可能被改写)。
+ * 对照量直接使用 PlanSeg 写入的 g_plsr_accel_plan.accel_pulses。
*/
static void PlsrRunControlCheckApproachCurveFault(uint8_t by_pulse_budget)
{
- if (s_plan_acc_n == 0U)
+ if (g_plsr_accel_plan.accel_pulses == 0U)
{
return;
}
if (by_pulse_budget != 0U)
{
- if (s_pulse_rt.n != s_plan_acc_n)
+ if (g_plsr_accel_runtime.completed_pulses != g_plsr_accel_plan.accel_pulses)
{
PlsrCommandSetFault(PLSR_ERR_CURVE_MISMATCH);
}
}
- else if (s_pulse_rt.n > s_plan_acc_n)
+ else if (g_plsr_accel_runtime.completed_pulses > g_plsr_accel_plan.accel_pulses)
{
PlsrCommandSetFault(PLSR_ERR_CURVE_MISMATCH);
}
@@ -551,8 +522,8 @@ static void PlsrRunControlCheckApproachCurveFault(uint8_t by_pulse_budget)
*/
static void PlsrRunControlCheckDecelCurveFault(void)
{
- if ((s_phase == PH_DECEL) && (s_decel_budget > 0U) &&
- (s_pulse_rt.n < s_decel_budget))
+ if ((s_phase == PH_DECEL) && (g_plsr_accel_runtime.total_pulses > 0U) &&
+ (g_plsr_accel_runtime.completed_pulses < g_plsr_accel_runtime.total_pulses))
{
PlsrCommandSetFault(PLSR_ERR_CURVE_MISMATCH);
}
@@ -563,8 +534,6 @@ static void PlsrRunControlCheckDecelCurveFault(void)
*/
static void PlsrRunControlAfterSegDone(void)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
- PlsrSeg_t *seg = PlsrParamGetSeg(s_cur_seg);
uint8_t keep_pwm;
/* 段末诊断:0x01 脉冲个数;若在减速相再核 0x03 */
@@ -578,25 +547,23 @@ static void PlsrRunControlAfterSegDone(void)
* ACT ※4:脉冲已发完但 ACT 时间未到 → 停表,等到到期再开下一段。
* 不从当前频率衔接(本段已经走完停表)。
*/
- if (seg->wait_type == PLSR_WAIT_ACT)
+ if (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_ACT)
{
PlsrPulseDriverStop();
PlsrPulseDriverClearOnePulseStop();
- s_follow_cont = 0U;
- s_pwm_on = 0U;
- s_cur_freq = 0U;
- s_chain_valid = 0U;
- s_chain_freq = 0U;
- s_act_expire_req = 0U;
- if (s_act_armed != 0U)
+ s_continue_without_stopping = 0U;
+ s_next_segment_start_frequency_valid = 0U;
+ s_next_segment_start_frequency_hz = 0U;
+ s_act_expired = 0U;
+ if (s_act_timer_armed != 0U)
{
uint32_t remain_ms = PlsrSignalIoDelayRemainMs();
PlsrSignalIoCancelDelay();
- s_act_armed = 0U;
+ s_act_timer_armed = 0U;
if (remain_ms >= 1U)
{
- s_wait_is_signal = 0U;
+ s_waiting_for_input_signal = 0U;
PlsrRunControlWakeDrain();
s_state = RC_WAIT_COND;
PlsrSignalIoScheduleDelayMs(remain_ms);
@@ -607,39 +574,37 @@ static void PlsrRunControlAfterSegDone(void)
{
PlsrSignalIoCancelDelay();
}
- s_act_armed = 0U;
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ s_act_timer_armed = 0U;
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
return;
}
- s_act_armed = 0U;
- s_act_expire_req = 0U;
- s_wait_expire_req = 0U;
+ s_act_timer_armed = 0U;
+ s_act_expired = 0U;
+ s_wait_time_expired = 0U;
- keep_pwm = (s_seg_end_opm == 0U) ? 1U : 0U;
+ keep_pwm = (s_stop_after_last_pulse == 0U) ? 1U : 0U;
- if (cfg->send_mode == PLSR_SEND_COMPLETE)
+ if (g_plsr_config.send_mode == PLSR_SEND_COMPLETE)
{
/* 段正常结束:下一段起速优先用本段落地频(EXT_OR_DONE 完成时常为峰值) */
- s_chain_freq = s_accel_plan.f_end;
- s_chain_valid = 1U;
+ s_next_segment_start_frequency_hz = g_plsr_accel_plan.end_frequency_hz;
+ s_next_segment_start_frequency_valid = 1U;
}
if (keep_pwm != 0U)
{
/* 后续同向且无门禁:不停表直接 BeginSeg(仅衔接策略,不影响本段波形) */
- s_follow_cont = 1U;
+ s_continue_without_stopping = 1U;
}
else
{
PlsrPulseDriverStop();
PlsrPulseDriverClearOnePulseStop();
- s_follow_cont = 0U;
- s_pwm_on = 0U;
- s_cur_freq = 0U;
- if (cfg->send_mode == PLSR_SEND_FOLLOW)
+ s_continue_without_stopping = 0U;
+ if (g_plsr_config.send_mode == PLSR_SEND_FOLLOW)
{
- s_chain_valid = 0U;
+ s_next_segment_start_frequency_valid = 0U;
}
}
@@ -652,22 +617,19 @@ static void PlsrRunControlAfterSegDone(void)
*/
static uint8_t PlsrRunControlBlocksFollowKeep(uint16_t cur_seg)
{
- PlsrSeg_t *seg = PlsrParamGetSeg(cur_seg);
-
/*
* WAIT时间/信号/ACT:发完后停表等条件,禁止后续无缝衔接。
* EXT:发完后仍等 EXT 沿,必须停表。
* EXT_OR_DONE:脉冲先完则条件已满足,允许后续衔接;
* EXT 先到由 CutSegToNext 自行判断 keep。
*/
- if ((seg->wait_type == PLSR_WAIT_TIME) ||
- (seg->wait_type == PLSR_WAIT_SIGNAL) ||
- (seg->wait_type == PLSR_WAIT_ACT) ||
- (seg->wait_type == PLSR_WAIT_EXT))
+ if ((g_plsr_segments[cur_seg].wait_type == PLSR_WAIT_TIME) ||
+ (g_plsr_segments[cur_seg].wait_type == PLSR_WAIT_SIGNAL) ||
+ (g_plsr_segments[cur_seg].wait_type == PLSR_WAIT_ACT) ||
+ (g_plsr_segments[cur_seg].wait_type == PLSR_WAIT_EXT))
{
return 1U;
}
- (void)cur_seg;
return 0U;
}
@@ -687,11 +649,8 @@ static uint8_t PlsrRunControlBlocksFollowKeep(uint16_t cur_seg)
static uint8_t PlsrRunControlResolveSegPlanEndpoints(uint16_t seg_idx0, uint32_t f_tgt,
PlsrSegPlanEndpoints_t *endpoints)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
- PlsrSeg_t *seg = PlsrParamGetSeg(seg_idx0);
-
- endpoints->accel_ms = cfg->accel_ms;
- endpoints->decel_ms = cfg->decel_ms;
+ endpoints->accel_ms = g_plsr_config.accel_ms;
+ endpoints->decel_ms = g_plsr_config.decel_ms;
/* ---------- 起始频率 ----------
* 中途切段(ACT/EXT)会置 follow_cont:用打断瞬间的频率衔接下一段。
@@ -699,20 +658,20 @@ static uint8_t PlsrRunControlResolveSegPlanEndpoints(uint16_t seg_idx0, uint32_t
* 不能当成「段后停表」去走起跳。
* 真正段后停表:follow_cont/chain 已清,从配置起速(0 则起跳)开跑。
*/
- if ((s_follow_cont != 0U) && (s_cur_freq >= 1U))
+ if ((s_continue_without_stopping != 0U) && (g_plsr_output_frequency_hz >= 1U))
{
- endpoints->freq_start_hz = s_cur_freq;
+ endpoints->freq_start_hz = g_plsr_output_frequency_hz;
}
- else if ((s_pwm_on != 0U) && (s_cur_freq >= 1U))
+ else if ((g_plsr_pwm_running != 0U) && (g_plsr_output_frequency_hz >= 1U))
{
- endpoints->freq_start_hz = s_cur_freq;
+ endpoints->freq_start_hz = g_plsr_output_frequency_hz;
}
- else if ((s_chain_valid != 0U) && (s_chain_freq >= 1U))
+ else if ((s_next_segment_start_frequency_valid != 0U) && (s_next_segment_start_frequency_hz >= 1U))
{
/* 完成模式段末停表后:用本段落地频作起速(如 EXT_OR_DONE 的匀速峰值) */
- endpoints->freq_start_hz = s_chain_freq;
- s_chain_valid = 0U;
- s_chain_freq = 0U;
+ endpoints->freq_start_hz = s_next_segment_start_frequency_hz;
+ s_next_segment_start_frequency_valid = 0U;
+ s_next_segment_start_frequency_hz = 0U;
}
else
{
@@ -720,13 +679,9 @@ static uint8_t PlsrRunControlResolveSegPlanEndpoints(uint16_t seg_idx0, uint32_t
* 停表后冷启动:入口由 ResolveStartHz 按起速/目标/起跳三分支决定
* (起速>目标→起速减速;否则与起跳比较取目标或起跳)。
*/
- if ((s_run_first_entry != 0U) && (seg_idx0 == s_run_entry_seg0))
- {
- s_run_first_entry = 0U;
- }
- endpoints->freq_start_hz = PlsrAccelCurveResolveStartHz(cfg->start_speed,
+ endpoints->freq_start_hz = PlsrAccelCurveResolveStartHz(g_plsr_config.start_speed,
f_tgt,
- cfg->default_speed,
+ g_plsr_config.default_speed,
endpoints->accel_ms,
endpoints->decel_ms);
}
@@ -741,29 +696,30 @@ static uint8_t PlsrRunControlResolveSegPlanEndpoints(uint16_t seg_idx0, uint32_t
{
int16_t next_eff = PlsrRunControlNextEffectiveSeg(seg_idx0);
- if ((seg->wait_type == PLSR_WAIT_EXT_OR_DONE) && (next_eff >= 0))
+ if ((g_plsr_segments[seg_idx0].wait_type == PLSR_WAIT_EXT_OR_DONE) &&
+ (next_eff >= 0))
{
int32_t end_pos = PlsrRunControlAbsLocalPos();
uint8_t next_fwd;
if (s_forward != 0U)
{
- end_pos += s_target;
+ end_pos += s_segment_pulse_target;
}
else
{
- end_pos -= s_target;
+ end_pos -= s_segment_pulse_target;
}
next_fwd = PlsrRunControlIsForward((uint16_t)next_eff, end_pos);
/* 与下一有效段同向 → FOLLOW/COMPLETE 衔接(换向才落到下方止速) */
if (next_fwd == s_forward)
{
- if (cfg->send_mode == PLSR_SEND_FOLLOW)
+ if (g_plsr_config.send_mode == PLSR_SEND_FOLLOW)
{
- PlsrSeg_t *nseg = PlsrParamGetSeg((uint16_t)next_eff);
- if (PlsrRunControlGetSegTargetFreq(nseg->freq_hz,
- cfg->default_speed,
+ if (PlsrRunControlGetSegTargetFreq(
+ g_plsr_segments[(uint16_t)next_eff].freq_hz,
+ g_plsr_config.default_speed,
&endpoints->freq_end_hz) != 0U)
{
return 1U;
@@ -778,39 +734,14 @@ static uint8_t PlsrRunControlResolveSegPlanEndpoints(uint16_t seg_idx0, uint32_t
}
}
- endpoints->freq_end_hz = PlsrAccelCurveResolveEndHz(cfg->end_speed,
+ endpoints->freq_end_hz = PlsrAccelCurveResolveEndHz(g_plsr_config.end_speed,
f_tgt,
- cfg->default_speed,
+ g_plsr_config.default_speed,
endpoints->accel_ms,
endpoints->decel_ms);
return 1U;
}
-/** 手册:WAIT 时间为 0 时按 1ms 处理 */
-static uint16_t PlsrRunControlWaitTimeMs(const PlsrSeg_t *seg)
-{
- if (seg->wait_ms == 0U)
- {
- return 1U;
- }
- return seg->wait_ms;
-}
-
-/** ACT 时间:优先 act_ms;0 则回退 wait_ms(旧上位机曾把 ACT 写在 WAIT 列) */
-static uint16_t PlsrRunControlActTimeMs(const PlsrSeg_t *seg)
-{
- uint16_t ms = seg->act_ms;
- if (ms == 0U)
- {
- ms = seg->wait_ms;
- }
- if (ms == 0U)
- {
- return 1U;
- }
- return ms;
-}
-
/**
* @brief 段末是否可不停表衔接下一段
* @param local_pos 用于判下一段方向的局部坐标(应用「本段结束后」的位置)
@@ -818,10 +749,9 @@ static uint16_t PlsrRunControlActTimeMs(const PlsrSeg_t *seg)
*/
static uint8_t PlsrRunControlWillFollowKeepAt(uint16_t cur_seg, int32_t local_pos)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
int16_t next_eff;
- if (cfg->send_mode != PLSR_SEND_FOLLOW)
+ if (g_plsr_config.send_mode != PLSR_SEND_FOLLOW)
{
return 0U;
}
@@ -849,14 +779,6 @@ static uint8_t PlsrRunControlWillFollowKeepAt(uint16_t cur_seg, int32_t local_po
return 1U;
}
-///**
-// * @brief 段末是否可不停表衔接下一段(用当前累计位置)
-// */
-//static uint8_t PlsrRunControlWillFollowKeep(uint16_t cur_seg)
-//{
-// return PlsrRunControlWillFollowKeepAt(cur_seg, PlsrRunControlAbsLocalPos());
-//}
-
/**
* 解析段目标频率。
* freq_hz==0 用公共默认速度;结果须落在 [1, 100000],否则返回 0(调用方写 0x04)。
@@ -888,36 +810,23 @@ static uint8_t PlsrRunControlGetSegTargetFreq(int32_t freq_hz,
return 1U;
}
-static uint32_t PlsrRunControlClampSpeed(uint32_t spd)
-{
- if (spd > 100000U)
- {
- spd = 100000U;
- }
- return spd;
-}
-
/** 运行输出:0=停表;任务上下文 SetFreq / Start */
static void PlsrRunControlApplyOutFreq(uint32_t profile_freq, uint8_t do_start)
{
if (profile_freq == 0U)
{
PlsrPulseDriverStop();
- s_pwm_on = 0U;
- s_cur_freq = 0U;
return;
}
- if ((do_start != 0U) || (s_pwm_on == 0U))
+ if ((do_start != 0U) || (g_plsr_pwm_running == 0U))
{
PlsrPulseDriverStart(profile_freq);
- s_pwm_on = 1U;
}
- else if (profile_freq != s_cur_freq)
+ else if (profile_freq != g_plsr_output_frequency_hz)
{
PlsrPulseDriverSetFreq(profile_freq);
}
- s_cur_freq = profile_freq;
}
/** 脉冲 ISR:只走 ARR 预装载路径 */
@@ -928,7 +837,6 @@ static void PlsrRunControlApplyOutFreqIsr(uint32_t profile_freq)
profile_freq = 1U;
}
PlsrPulseDriverSetFreqIsr(profile_freq);
- s_cur_freq = profile_freq;
}
static uint8_t PlsrRunControlHasDecel(void)
@@ -938,14 +846,14 @@ static uint8_t PlsrRunControlHasDecel(void)
* 谷底形(起/止速 > 目标):第二相是从目标再加速回止速,f_end > f_tgt,
* 不可再用「f_tgt==f_end 则无减速」这种假定。
*/
- return (s_plan_dec_n > 0U) ? 1U : 0U;
+ return (g_plsr_accel_plan.decel_pulses > 0U) ? 1U : 0U;
}
static uint32_t PlsrRunControlRemainPulses(void)
{
- if (s_target > s_done)
+ if (s_segment_pulse_target > s_segment_pulses_done)
{
- return (uint32_t)(s_target - s_done);
+ return (uint32_t)(s_segment_pulse_target - s_segment_pulses_done);
}
return 0U;
}
@@ -961,12 +869,12 @@ static uint8_t PlsrRunControlShouldEnterDecel(uint32_t remain)
{
return 0U;
}
- return (remain <= (s_plan_dec_n + 1U)) ? 1U : 0U;
+ return (remain <= (g_plsr_accel_plan.decel_pulses + 1U)) ? 1U : 0U;
}
static uint32_t PlsrRunControlDecelEnterBudget(uint32_t remain)
{
- uint32_t planned = s_plan_dec_n;
+ uint32_t planned = g_plsr_accel_plan.decel_pulses;
if (planned < 1U)
{
@@ -986,7 +894,7 @@ static uint32_t PlsrRunControlDecelEnterBudget(uint32_t remain)
/** 绝对模式:相对本次启动原点的位置 */
static int32_t PlsrRunControlAbsLocalPos(void)
{
- return s_acc_pulse - s_abs_origin;
+ return g_plsr_accumulated_pulses - s_absolute_origin;
}
/**
@@ -994,19 +902,20 @@ static int32_t PlsrRunControlAbsLocalPos(void)
*/
static void PlsrRunControlEnterDecel(uint32_t from_hz, uint32_t budget)
{
+ PlsrAccelPlan_t decel_plan = g_plsr_accel_plan;
+
if (budget < 1U)
{
budget = 1U;
}
s_phase = PH_DECEL;
- s_decel_budget = budget;
- s_accel_plan.acc_n = 0U;
- s_accel_plan.const_n = 0U;
- s_accel_plan.dec_n = budget;
- s_accel_plan.f_tgt = from_hz;
- PlsrAccelPulseRtBeginDec(&s_pulse_rt, &s_accel_plan);
- s_pulse_rt.f = from_hz;
+ decel_plan.accel_pulses = 0U;
+ decel_plan.constant_pulses = 0U;
+ decel_plan.decel_pulses = budget;
+ decel_plan.target_frequency_hz = from_hz;
+ PlsrAccelBeginDeceleration(&g_plsr_accel_runtime, &decel_plan);
+ g_plsr_accel_runtime.current_frequency_hz = from_hz;
}
/**
@@ -1016,13 +925,12 @@ static void PlsrRunControlPrimeDecelOnStart(void)
{
uint32_t next;
- next = PlsrAccelPulseRtStep(&s_pulse_rt);
+ next = PlsrAccelNextFrequency(&g_plsr_accel_runtime);
PlsrRunControlApplyOutFreq(next, 1U);
- if (s_pulse_rt.n_total > 1U)
+ if (g_plsr_accel_runtime.total_pulses > 1U)
{
- next = PlsrAccelPulseRtStep(&s_pulse_rt);
+ next = PlsrAccelNextFrequency(&g_plsr_accel_runtime);
PlsrPulseDriverSetFreq(next);
- s_cur_freq = next;
}
}
@@ -1036,7 +944,7 @@ static void PlsrRunControlOnApproachDone(void)
return;
}
/* n 已走到预算 → 按「预算收尾」精确比对;否则按「提前到频」只查超额 */
- by_budget = ((s_plan_acc_n > 0U) && (s_pulse_rt.n >= s_plan_acc_n)) ? 1U : 0U;
+ by_budget = ((g_plsr_accel_plan.accel_pulses > 0U) && (g_plsr_accel_runtime.completed_pulses >= g_plsr_accel_plan.accel_pulses)) ? 1U : 0U;
PlsrRunControlCheckApproachCurveFault(by_budget);
}
@@ -1045,14 +953,14 @@ static void PlsrRunControlOnApproachDone(void)
*/
static void PlsrRunControlEnterConstHold(uint8_t do_start)
{
- uint32_t f_hold = s_accel_plan.f_tgt;
+ uint32_t f_hold = g_plsr_accel_plan.target_frequency_hz;
if (f_hold < 1U)
{
f_hold = 1U;
}
s_phase = PH_CONST;
- PlsrAccelPulseRtBeginConst(&s_pulse_rt, &s_accel_plan);
+ PlsrAccelBeginConstantSpeed(&g_plsr_accel_runtime, &g_plsr_accel_plan);
PlsrPulseDriverClearPending();
PlsrPulseDriverClearStartPeriodProtect();
PlsrRunControlApplyOutFreq(f_hold, do_start);
@@ -1060,14 +968,14 @@ static void PlsrRunControlEnterConstHold(uint8_t do_start)
static void PlsrRunControlEnterConstHoldIsr(void)
{
- uint32_t f_hold = s_accel_plan.f_tgt;
+ uint32_t f_hold = g_plsr_accel_plan.target_frequency_hz;
if (f_hold < 1U)
{
f_hold = 1U;
}
s_phase = PH_CONST;
- PlsrAccelPulseRtBeginConst(&s_pulse_rt, &s_accel_plan);
+ PlsrAccelBeginConstantSpeed(&g_plsr_accel_runtime, &g_plsr_accel_plan);
PlsrPulseDriverClearPending();
PlsrPulseDriverClearStartPeriodProtect();
PlsrRunControlApplyOutFreqIsr(f_hold);
@@ -1092,24 +1000,24 @@ static void PlsrRunControlRefreshProfile(uint8_t do_start)
uint32_t remain;
done_n = 0U;
- if (s_done > 0)
+ if (s_segment_pulses_done > 0)
{
- done_n = (uint32_t)s_done;
+ done_n = (uint32_t)s_segment_pulses_done;
}
remain = PlsrRunControlRemainPulses();
if ((s_phase == PH_CONST) &&
(PlsrRunControlShouldEnterDecel(remain) != 0U))
{
- PlsrRunControlEnterDecel(s_accel_plan.f_tgt,
+ PlsrRunControlEnterDecel(g_plsr_accel_plan.target_frequency_hz,
PlsrRunControlDecelEnterBudget(remain));
}
if (s_phase == PH_CONST)
{
- if ((do_start != 0U) || (s_pwm_on == 0U))
+ if ((do_start != 0U) || (g_plsr_pwm_running == 0U))
{
- PlsrRunControlApplyOutFreq(s_accel_plan.f_tgt, do_start);
+ PlsrRunControlApplyOutFreq(g_plsr_accel_plan.target_frequency_hz, do_start);
}
return;
}
@@ -1117,19 +1025,19 @@ static void PlsrRunControlRefreshProfile(uint8_t do_start)
/* 纯减速开表:超前预装,避免末拍停在 f(N-1) */
if ((s_phase == PH_DECEL) &&
(do_start != 0U) &&
- (s_done == 0) &&
- (s_pulse_rt.n == 0U))
+ (s_segment_pulses_done == 0) &&
+ (g_plsr_accel_runtime.completed_pulses == 0U))
{
PlsrRunControlPrimeDecelOnStart();
return;
}
- next = PlsrAccelCurveFreqAtPulse(&s_accel_plan, done_n);
+ next = PlsrAccelCurveFreqAtPulse(&g_plsr_accel_plan, done_n);
if (next < 1U)
{
next = 1U;
}
- s_pulse_rt.f = next;
+ g_plsr_accel_runtime.current_frequency_hz = next;
if (s_phase == PH_APPROACH)
{
@@ -1141,14 +1049,14 @@ static void PlsrRunControlRefreshProfile(uint8_t do_start)
* next >= f_tgt 升频且下一拍频率已达/超过目标
* next <= f_tgt 降频且下一拍频率已达/低于目标
*/
- if ((s_accel_plan.acc_n == 0U) ||
- (done_n >= s_accel_plan.acc_n) ||
- ((s_accel_plan.f_tgt >= s_accel_plan.f_cur) &&
- (next >= s_accel_plan.f_tgt)) ||
- ((s_accel_plan.f_tgt < s_accel_plan.f_cur) &&
- (next <= s_accel_plan.f_tgt)))
+ if ((g_plsr_accel_plan.accel_pulses == 0U) ||
+ (done_n >= g_plsr_accel_plan.accel_pulses) ||
+ ((g_plsr_accel_plan.target_frequency_hz >= g_plsr_accel_plan.start_frequency_hz) &&
+ (next >= g_plsr_accel_plan.target_frequency_hz)) ||
+ ((g_plsr_accel_plan.target_frequency_hz < g_plsr_accel_plan.start_frequency_hz) &&
+ (next <= g_plsr_accel_plan.target_frequency_hz)))
{
- next = s_accel_plan.f_tgt;
+ next = g_plsr_accel_plan.target_frequency_hz;
PlsrRunControlOnApproachDone();
if (PlsrRunControlShouldEnterDecel(remain) != 0U)
{
@@ -1163,7 +1071,7 @@ static void PlsrRunControlRefreshProfile(uint8_t do_start)
}
}
- if ((next != s_cur_freq) || (do_start != 0U) || (s_pwm_on == 0U))
+ if ((next != g_plsr_output_frequency_hz) || (do_start != 0U) || (g_plsr_pwm_running == 0U))
{
PlsrRunControlApplyOutFreq(next, do_start);
}
@@ -1176,68 +1084,57 @@ static void PlsrRunControlRefreshProfile(uint8_t do_start)
* 0x02:规划峰值达不到段表 f_tgt 时置故障(三角波),仍按压低后的峰运行。
*/
static void PlsrRunControlPlanSeg(uint32_t total, uint32_t f_from,
- uint32_t f_tgt, uint32_t f_end,
- uint16_t accel_ms, uint16_t decel_ms)
+ uint32_t f_tgt, uint32_t f_end,
+ uint16_t accel_ms, uint16_t decel_ms)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
uint32_t f_start;
uint32_t f_lo;
uint32_t f_hi;
- /* 段内只吃传入端点与加减速时间,不感知 wait */
- s_run_accel_ms = accel_ms;
- s_run_decel_ms = decel_ms;
-
/*
* 曲线估 acc_n / dec_n,const_n = total − acc − dec。
* f_from/f_end 已由策略层解析为真实频率;配置起止=0 时已换成起跳/落地。
*/
- PlsrAccelCurvePlan(&s_accel_plan,
+ PlsrAccelCurvePlan(&g_plsr_accel_plan,
total,
f_from,
f_tgt,
f_end,
- cfg->default_speed,
+ g_plsr_config.default_speed,
accel_ms,
decel_ms,
- cfg->accel_mode);
+ g_plsr_config.accel_mode);
/*
* 0x02 频率可达性诊断
* AccelCurvePlan 后:若脉冲不够爬升/下降到设定目标,规划会压低/抬高实际峰值
* (典型为三角波)。此时写故障码 2,仍按压后的规划继续运行。
*/
- if ((f_tgt > f_from) && (s_accel_plan.f_tgt < f_tgt))
+ if ((f_tgt > f_from) && (g_plsr_accel_plan.target_frequency_hz < f_tgt))
{
PlsrCommandSetFault(PLSR_ERR_FREQ_UNREACH);
}
- else if ((f_tgt < f_from) && (s_accel_plan.f_tgt > f_tgt))
+ else if ((f_tgt < f_from) && (g_plsr_accel_plan.target_frequency_hz > f_tgt))
{
PlsrCommandSetFault(PLSR_ERR_FREQ_UNREACH);
}
- /*
- * 锁定本段规划预算,供 0x03 对照与 ARPE 超前进减速。
- * EnterDecel 会改写 s_accel_plan.dec_n,故 acc/dec 预算另存。
- */
- s_plan_acc_n = s_accel_plan.acc_n;
- s_plan_dec_n = s_accel_plan.dec_n;
- s_decel_budget = 0U;
+ g_plsr_accel_runtime.total_pulses = 0U;
/* S/正弦:在任务上下文预建频率表,ISR 只查表 */
- PlsrAccelPulseRtPrebuild(&s_accel_plan);
+ PlsrAccelPrebuildFrequencyTables(&g_plsr_accel_plan);
/* 运行层使用规划后的实际起始频率。 */
- f_start = s_accel_plan.f_cur;
+ f_start = g_plsr_accel_plan.start_frequency_hz;
/*
- * 脉冲域:ISR 用 PulseRtStep(直线现场算 / S·正弦查预建表)。
+ * 脉冲域:ISR 用 PlsrAccelNextFrequency(直线现场算 / S·正弦查预建表)。
* FreqAtPulse 仅任务侧 RefreshProfile 对齐用,勿再做时间轴二次拟合。
*/
/* 本段频率范围锁 PSC,升降只改 ARR;跨度过大则 LockPscRange 自动不锁 */
- f_lo = s_accel_plan.f_tgt;
- f_hi = s_accel_plan.f_tgt;
+ f_lo = g_plsr_accel_plan.target_frequency_hz;
+ f_hi = g_plsr_accel_plan.target_frequency_hz;
if (f_start > f_hi)
{
f_hi = f_start;
@@ -1253,15 +1150,15 @@ static void PlsrRunControlPlanSeg(uint32_t total, uint32_t f_from,
{
f_lo = 1U;
}
- if (s_accel_plan.f_end > f_hi)
+ if (g_plsr_accel_plan.end_frequency_hz > f_hi)
{
- f_hi = s_accel_plan.f_end;
+ f_hi = g_plsr_accel_plan.end_frequency_hz;
}
- if (s_accel_plan.f_end >= 1U)
+ if (g_plsr_accel_plan.end_frequency_hz >= 1U)
{
- if (s_accel_plan.f_end < f_lo)
+ if (g_plsr_accel_plan.end_frequency_hz < f_lo)
{
- f_lo = s_accel_plan.f_end;
+ f_lo = g_plsr_accel_plan.end_frequency_hz;
}
}
else
@@ -1282,18 +1179,13 @@ static void PlsrRunControlPlanSeg(uint32_t total, uint32_t f_from,
/*
* 后续同向不停表时 PWM 仍在跑:禁止重锁 PSC。
*/
- if (s_pwm_on == 0U)
+ if (g_plsr_pwm_running == 0U)
{
PlsrPulseDriverLockPscRange(f_lo, f_hi);
}
- if (s_pwm_on == 0U)
- {
- s_cur_freq = f_start;
- }
-
/*
- * 保持 AccelCurvePlan 算出的脉冲预算;运行时逐拍 PulseRtStep。
+ * 保持 AccelCurvePlan 算出的脉冲预算;运行时逐拍计算下一频率。
*/
/*
* 进入段内初始相(决定 RefreshProfile / ISR 从哪开始):
@@ -1301,22 +1193,22 @@ static void PlsrRunControlPlanSeg(uint32_t total, uint32_t f_from,
* 入口=目标 → PH_CONST(无加速)
* 否则 → PH_APPROACH
*/
- if ((s_accel_plan.dec_n >= total) &&
+ if ((g_plsr_accel_plan.decel_pulses >= total) &&
(total > 0U) &&
- (s_accel_plan.f_end != s_accel_plan.f_tgt) &&
- (f_start >= s_accel_plan.f_tgt))
+ (g_plsr_accel_plan.end_frequency_hz != g_plsr_accel_plan.target_frequency_hz) &&
+ (f_start >= g_plsr_accel_plan.target_frequency_hz))
{
- PlsrRunControlEnterDecel(f_start, s_plan_dec_n);
+ PlsrRunControlEnterDecel(f_start, g_plsr_accel_plan.decel_pulses);
}
- else if (f_start == s_accel_plan.f_tgt)
+ else if (f_start == g_plsr_accel_plan.target_frequency_hz)
{
s_phase = PH_CONST;
- PlsrAccelPulseRtBeginConst(&s_pulse_rt, &s_accel_plan);
+ PlsrAccelBeginConstantSpeed(&g_plsr_accel_runtime, &g_plsr_accel_plan);
}
else
{
s_phase = PH_APPROACH;
- PlsrAccelPulseRtBeginAcc(&s_pulse_rt, &s_accel_plan);
+ PlsrAccelBeginAcceleration(&g_plsr_accel_runtime, &g_plsr_accel_plan);
}
}
@@ -1329,23 +1221,17 @@ static void PlsrRunControlFinishAll(void)
PlsrPulseDriverStop();
PlsrPulseDriverUnlockPsc();
PlsrPulseDriverClearDir();
- s_busy = 0U;
+ g_plsr_busy = 0U;
s_state = RC_IDLE;
- s_cur_freq = 0U;
- s_pwm_on = 0U;
- s_follow_cont = 0U;
- s_chain_valid = 0U;
- s_chain_freq = 0U;
- s_dir_valid = 0U;
- s_dir_expire_req = 0U;
- s_act_armed = 0U;
- s_act_expire_req = 0U;
- s_act_cut_pending = 0U;
- s_act_handoff_keep = 0U;
- s_wait_expire_req = 0U;
- s_act_time_ms = 0U;
- s_last_period_wait = 0U;
- s_run_first_entry = 0U;
+ s_continue_without_stopping = 0U;
+ s_next_segment_start_frequency_valid = 0U;
+ s_next_segment_start_frequency_hz = 0U;
+ s_act_timer_armed = 0U;
+ s_act_expired = 0U;
+ s_act_waiting_for_pulse_boundary = 0U;
+ s_keep_frequency_after_act = 0U;
+ s_wait_time_expired = 0U;
+ s_waiting_for_last_period = 0U;
}
/**
@@ -1358,8 +1244,6 @@ static void PlsrRunControlFinishAll(void)
*/
static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
{
- PlsrSeg_t *seg;
- PlsrCfg_t *cfg;
int32_t cnt;
int32_t move;
uint32_t f_tgt;
@@ -1372,13 +1256,11 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
return;
}
- seg = PlsrParamGetSeg(seg_idx0);
- cfg = PlsrParamGetCfg();
- s_cur_seg = seg_idx0;
- s_last_period_wait = 0U;
- cnt = seg->pulse_cnt;
+ g_plsr_current_segment_index = seg_idx0;
+ s_waiting_for_last_period = 0U;
+ cnt = g_plsr_segments[seg_idx0].pulse_cnt;
- if (cfg->run_mode == PLSR_POS_ABSOLUTE)
+ if (g_plsr_config.run_mode == PLSR_POS_ABSOLUTE)
{
/* 以首次启动锁定原点:move = 段目标 − 相对原点位置 */
move = cnt - PlsrRunControlAbsLocalPos();
@@ -1391,9 +1273,9 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
if (move == 0)
{
/* 相对 0 脉冲 / 无效占位(频率0且脉冲0) / 绝对已在目标:立刻段后逻辑 */
- s_busy = 1U;
- s_target = 0;
- s_done = 0;
+ g_plsr_busy = 1U;
+ s_segment_pulse_target = 0;
+ s_segment_pulses_done = 0;
PlsrRunControlAfterSegDone();
return;
}
@@ -1401,14 +1283,14 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
if (move >= 0)
{
s_forward = 1U;
- s_target = move;
+ s_segment_pulse_target = move;
}
else
{
/*
* 反向位移目标 = -move。move==INT_MIN(如上位机写入 2147483648
- * 被解读为 -2147483648)时取反溢出,s_target 仍为负数,
- * 首拍后 s_done>=s_target 恒真,会误判段结束且累计每启一次减 1。
+ * 被解读为 -2147483648)时取反溢出,s_segment_pulse_target 仍为负数,
+ * 首拍后 s_segment_pulses_done>=s_segment_pulse_target 恒真,会误判段结束且累计每启一次减 1。
*/
if (move == (int32_t)(-2147483647L - 1L))
{
@@ -1417,10 +1299,11 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
return;
}
s_forward = 0U;
- s_target = -move;
+ s_segment_pulse_target = -move;
}
- if (PlsrRunControlGetSegTargetFreq(seg->freq_hz, cfg->default_speed, &f_tgt) == 0U)
+ if (PlsrRunControlGetSegTargetFreq(g_plsr_segments[seg_idx0].freq_hz,
+ g_plsr_config.default_speed, &f_tgt) == 0U)
{
/*
* 0x04:本段(或默认速度)频率非法。
@@ -1434,24 +1317,24 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
/* 策略层解析起/止速与加减速;段内只跑 PlanSeg */
(void)PlsrRunControlResolveSegPlanEndpoints(seg_idx0, f_tgt, &endpoints);
- total = (uint32_t)s_target;
+ total = (uint32_t)s_segment_pulse_target;
PlsrRunControlPlanSeg(total, endpoints.freq_start_hz, f_tgt, endpoints.freq_end_hz,
endpoints.accel_ms, endpoints.decel_ms);
- s_done = 0;
- s_busy = 1U;
+ s_segment_pulses_done = 0;
+ g_plsr_busy = 1U;
{
- /* 用本段结束后的坐标判 keep,与 AfterSegDone 一致;结果锁进 s_seg_end_opm */
+ /* 用本段结束后的坐标判 keep,与 AfterSegDone 一致;结果锁进 s_stop_after_last_pulse */
int32_t end_pos = PlsrRunControlAbsLocalPos();
if (s_forward != 0U)
{
- end_pos += s_target;
+ end_pos += s_segment_pulse_target;
}
else
{
- end_pos -= s_target;
+ end_pos -= s_segment_pulse_target;
}
- s_seg_end_opm =
+ s_stop_after_last_pulse =
(PlsrRunControlWillFollowKeepAt(seg_idx0, end_pos) == 0U) ? 1U : 0U;
}
@@ -1461,20 +1344,20 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
return;
}
- if (s_follow_cont != 0U)
+ if (s_continue_without_stopping != 0U)
{
/* 分支 A:段间无缝(FOLLOW 或 ACT handoff) */
PlsrPulseDriverClearOnePulseStop();
/*
* FOLLOW 真不停表:do_start=0 只改频。
- * ACT 经 OPM 边界停表后 s_pwm_on 已为 0:须 Start 重开,否则无脉冲卡死。
+ * ACT 经 OPM 边界停表后 g_plsr_pwm_running 已为 0:须 Start 重开,否则无脉冲卡死。
*/
- PlsrRunControlRefreshProfile((s_pwm_on == 0U) ? 1U : 0U);
+ PlsrRunControlRefreshProfile((g_plsr_pwm_running == 0U) ? 1U : 0U);
s_state = RC_RUN;
- s_follow_cont = 0U;
+ s_continue_without_stopping = 0U;
PlsrRunControlArmActExtOnPulseStart();
}
- else if ((s_dir_valid != 0U) && (s_forward == s_dir_out))
+ else if ((g_plsr_direction_valid != 0U) && (s_forward == g_plsr_direction_forward))
{
/* 分支 B:真换向但本段与上一段同向,方向脚已正确,跳过延时 */
PlsrPulseDriverSetDir(s_forward);
@@ -1486,10 +1369,7 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
{
/* 分支 C:需要换向或首次开跑 — 先打方向,再决定立刻开或 DIR_WAIT */
PlsrPulseDriverSetDir(s_forward);
- s_dir_out = s_forward;
- s_dir_valid = 1U;
- s_dir_expire_req = 0U;
- if (cfg->dir_delay_ms == 0U)
+ if (g_plsr_config.dir_delay_ms == 0U)
{
s_state = RC_RUN;
PlsrRunControlRefreshProfile(1U);
@@ -1502,10 +1382,10 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
*/
s_state = RC_DIR_WAIT;
PlsrRunControlWakeDrain();
- PlsrSignalIoScheduleDelayMs((uint32_t)cfg->dir_delay_ms);
- if (s_cur_freq >= 1U)
+ PlsrSignalIoScheduleDelayMs((uint32_t)g_plsr_config.dir_delay_ms);
+ if (g_plsr_accel_runtime.current_frequency_hz >= 1U)
{
- PlsrPulseDriverPrepare(s_cur_freq);
+ PlsrPulseDriverPrepare(g_plsr_accel_runtime.current_frequency_hz);
}
}
}
@@ -1515,37 +1395,29 @@ static void PlsrRunControlBeginSeg(uint16_t seg_idx0)
void PlsrRunControlInit(void)
{
s_state = RC_IDLE;
- s_busy = 0U;
+ g_plsr_busy = 0U;
s_forward = 1U;
- s_cur_seg = 0U;
- s_cur_freq = 0U;
- s_pwm_on = 0U;
- s_done = 0;
- s_target = 0;
- s_acc_pulse = 0;
- s_abs_origin = 0;
- s_abs_origin_locked = 0U;
- s_follow_cont = 0U;
- s_chain_freq = 0U;
- s_chain_valid = 0U;
- s_dir_valid = 0U;
- s_dir_out = 0U;
- s_dir_expire_req = 0U;
- s_run_accel_ms = 0U;
- s_run_decel_ms = 0U;
- s_plan_acc_n = 0U;
- s_plan_dec_n = 0U;
- s_decel_budget = 0U;
- s_seg_end_opm = 0U;
- s_last_period_wait = 0U;
+ g_plsr_current_segment_index = 0U;
+ s_segment_pulses_done = 0;
+ s_segment_pulse_target = 0;
+ g_plsr_accumulated_pulses = 0;
+ s_absolute_origin = 0;
+ s_absolute_origin_locked = 0U;
+ s_continue_without_stopping = 0U;
+ s_next_segment_start_frequency_hz = 0U;
+ s_next_segment_start_frequency_valid = 0U;
+ g_plsr_accel_plan.accel_pulses = 0U;
+ g_plsr_accel_plan.decel_pulses = 0U;
+ g_plsr_accel_runtime.total_pulses = 0U;
+ s_stop_after_last_pulse = 0U;
+ s_waiting_for_last_period = 0U;
s_phase = PH_CONST;
- s_act_armed = 0U;
- s_act_expire_req = 0U;
- s_act_cut_pending = 0U;
- s_act_handoff_keep = 0U;
- s_wait_expire_req = 0U;
- s_act_time_ms = 0U;
- s_wait_is_signal = 0U;
+ s_act_timer_armed = 0U;
+ s_act_expired = 0U;
+ s_act_waiting_for_pulse_boundary = 0U;
+ s_keep_frequency_after_act = 0U;
+ s_wait_time_expired = 0U;
+ s_waiting_for_input_signal = 0U;
/* s_wake_sem 在 OSInit 后由 WakeInit 创建 */
}
@@ -1611,7 +1483,7 @@ uint8_t PlsrRunControlIsPreciseWait(void)
{
return 1U;
}
- if ((s_state == RC_WAIT_COND) && (s_wait_is_signal == 0U))
+ if ((s_state == RC_WAIT_COND) && (s_waiting_for_input_signal == 0U))
{
return 1U;
}
@@ -1619,12 +1491,13 @@ uint8_t PlsrRunControlIsPreciseWait(void)
}
/** @brief 启动多段序列(见 plsr_run_control.h) */
-uint8_t PlsrRunControlStart(uint16_t start_seg_1based)
+uint8_t PlsrStart(uint16_t start_seg_1based)
{
uint16_t n;
- PlsrCfg_t *cfg;
+ uint16_t first_seg;
+ uint32_t f_chk;
- if (s_busy != 0U)
+ if (g_plsr_busy != 0U)
{
return 0U;
}
@@ -1639,72 +1512,54 @@ uint8_t PlsrRunControlStart(uint16_t start_seg_1based)
start_seg_1based = PlsrParamGetStartSeg();
}
- cfg = PlsrParamGetCfg();
+ first_seg = (uint16_t)(start_seg_1based - 1U);
+ /* 启动前先检查首段频率,非法时不置忙、不开定时器。 */
+ if (PlsrRunControlGetSegTargetFreq(g_plsr_segments[first_seg].freq_hz,
+ g_plsr_config.default_speed,
+ &f_chk) == 0U)
{
- PlsrSeg_t *seg = PlsrParamGetSeg((uint16_t)(start_seg_1based - 1U));
- uint32_t f_chk;
-
- /*
- * 启动前门禁(0x04):首段目标频率须在 1~100000。
- * 非法则写故障码并返回 0,不置忙、不开段。
- * (启动前 CommandPoll 已 ClearFault,此处再写 4 覆盖为异常。)
- */
- if (PlsrRunControlGetSegTargetFreq(seg->freq_hz,
- cfg->default_speed,
- &f_chk) == 0U)
- {
- PlsrCommandSetFault(PLSR_ERR_FREQ_ILLEGAL);
- return 0U;
- }
+ PlsrCommandSetFault(PLSR_ERR_FREQ_ILLEGAL);
+ return 0U;
}
- s_follow_cont = 0U;
- s_chain_valid = 0U;
- s_chain_freq = 0U;
- s_run_entry_seg0 = (uint16_t)(start_seg_1based - 1U);
- s_run_first_entry = 1U;
- s_cur_freq = PlsrRunControlClampSpeed(cfg->start_speed);
+ s_continue_without_stopping = 0U;
+ s_next_segment_start_frequency_valid = 0U;
+ s_next_segment_start_frequency_hz = 0U;
/*
* 绝对原点:仅在首次 Start(或 ClearAccPulse 之后的第一次)锁定。
* 相对跑完再切绝对,仍相对「第一次启动时刻」坐标,不以当前位置重定原点。
*/
- if (s_abs_origin_locked == 0U)
+ if (s_absolute_origin_locked == 0U)
{
- s_abs_origin = s_acc_pulse;
- s_abs_origin_locked = 1U;
+ s_absolute_origin = g_plsr_accumulated_pulses;
+ s_absolute_origin_locked = 1U;
}
PlsrSignalIoClearEdges();
- PlsrRunControlBeginSeg((uint16_t)(start_seg_1based - 1U));
+ PlsrRunControlBeginSeg(first_seg);
return 1U;
}
/** @brief 急停(见 plsr_run_control.h) */
-void PlsrRunControlStop(void)
+void PlsrStop(void)
{
PlsrSignalIoCancelDelay();
PlsrPulseDriverStop();
PlsrPulseDriverUnlockPsc();
PlsrPulseDriverClearDir();
- s_busy = 0U;
+ g_plsr_busy = 0U;
s_state = RC_IDLE;
- s_cur_freq = 0U;
- s_pwm_on = 0U;
- s_follow_cont = 0U; /*连续运行标志*/
- s_chain_valid = 0U;/*衔接频率是否有效*/
- s_chain_freq = 0U; /*段间衔接频率*/
- s_dir_valid = 0U;/*方向是否有效*/
- s_dir_expire_req = 0U;/*换向延时到期请求标志*/
- s_act_armed = 0U;/*ACT定时器是否已启动*/
- s_act_expire_req = 0U;/*ACT到期请求标志*/
- s_act_cut_pending = 0U;/*ACT 时间到,等待脉冲边界切段*/
- s_act_handoff_keep = 0U;/*ACT 切段后是否保持当前频率衔接*/
- s_wait_expire_req = 0U;/*段后等待到期请求标志*/
- s_act_time_ms = 0U;/*本段 ACT 定时时长*/
- s_last_period_wait = 0U;
- s_run_first_entry = 0U;
+ s_continue_without_stopping = 0U; /*连续运行标志*/
+ s_next_segment_start_frequency_valid = 0U;/*衔接频率是否有效*/
+ s_next_segment_start_frequency_hz = 0U; /*段间衔接频率*/
+ s_act_timer_armed = 0U;/*ACT定时器是否已启动*/
+ s_act_expired = 0U;/*ACT到期请求标志*/
+ s_act_waiting_for_pulse_boundary = 0U;/*ACT 时间到,等待脉冲边界切段*/
+ s_keep_frequency_after_act = 0U;/*ACT 切段后是否保持当前频率衔接*/
+ s_wait_time_expired = 0U;/*段后等待到期请求标志*/
+ s_waiting_for_last_period = 0U;
}
/** @brief 运行中改频(见 plsr_run_control.h) */
-uint8_t PlsrRunControlChangeFreq(uint32_t new_tgt_hz)
+uint8_t PlsrChangeFreq(uint32_t new_tgt_hz)
{
uint32_t remain;
uint32_t f_end;
@@ -1719,17 +1574,17 @@ uint8_t PlsrRunControlChangeFreq(uint32_t new_tgt_hz)
PlsrCommandSetFault(PLSR_ERR_FREQ_ILLEGAL);
return 0U;
}
- if (s_done >= s_target)
+ if (s_segment_pulses_done >= s_segment_pulse_target)
{
return 0U;
}
- remain = (uint32_t)(s_target - s_done);
- f_end = s_accel_plan.f_end;
- PlsrRunControlPlanSeg(remain, s_cur_freq, new_tgt_hz, f_end,
- s_run_accel_ms, s_run_decel_ms);
- s_target = (int32_t)remain;
- s_done = 0;
+ remain = (uint32_t)(s_segment_pulse_target - s_segment_pulses_done);
+ f_end = g_plsr_accel_plan.end_frequency_hz;
+ PlsrRunControlPlanSeg(remain, g_plsr_output_frequency_hz, new_tgt_hz, f_end,
+ g_plsr_config.accel_ms, g_plsr_config.decel_ms);
+ s_segment_pulse_target = (int32_t)remain;
+ s_segment_pulses_done = 0;
PlsrRunControlRefreshProfile(0U);
return 1U;
}
@@ -1737,32 +1592,24 @@ uint8_t PlsrRunControlChangeFreq(uint32_t new_tgt_hz)
/** @brief 毫秒任务节拍(见 plsr_run_control.h) */
void PlsrRunControlTickMs(void)
{
- PlsrSeg_t *seg;
-
- if (s_act_expire_req != 0U)
+ if (s_act_expired != 0U)
{
- s_act_expire_req = 0U;
- if ((s_state == RC_RUN) || (s_act_handoff_keep != 0U))
+ s_act_expired = 0U;
+ if ((s_state == RC_RUN) || (s_keep_frequency_after_act != 0U))
{
PlsrRunControlActExpire();
}
return;
}
- if (s_wait_expire_req != 0U)
+ if (s_wait_time_expired != 0U)
{
- s_wait_expire_req = 0U;
+ s_wait_time_expired = 0U;
if (s_state == RC_WAIT_COND)
{
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
}
return;
}
- if (s_dir_expire_req != 0U)
- {
- s_dir_expire_req = 0U;
- return;
- }
-
if (s_state == RC_DIR_WAIT)
{
/* 精确延时只靠 TIM5;此处占位,避免任务空转改状态 */
@@ -1773,10 +1620,8 @@ void PlsrRunControlTickMs(void)
{
PlsrPulseDriverApplyPending();
- seg = PlsrParamGetSeg(s_cur_seg);
-
- if ((seg->wait_type == PLSR_WAIT_EXT) ||
- (seg->wait_type == PLSR_WAIT_EXT_OR_DONE))
+ if ((g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_EXT) ||
+ (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_EXT_OR_DONE))
{
if (PlsrSignalIoTakeExtFalling() != 0U)
{
@@ -1789,21 +1634,20 @@ void PlsrRunControlTickMs(void)
if (s_state == RC_WAIT_COND)
{
- if (s_wait_is_signal != 0U)
+ if (s_waiting_for_input_signal != 0U)
{
- seg = PlsrParamGetSeg(s_cur_seg);
- if (seg->wait_type == PLSR_WAIT_EXT)
+ if (g_plsr_segments[g_plsr_current_segment_index].wait_type == PLSR_WAIT_EXT)
{
if (PlsrSignalIoTakeExtFalling() != 0U)
{
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
}
}
else
{
if (PlsrSignalIoTakeWaitFalling() != 0U)
{
- PlsrRunControlGotoNextOrFinish(s_cur_seg);
+ PlsrRunControlGotoNextOrFinish(g_plsr_current_segment_index);
}
}
}
@@ -1813,7 +1657,7 @@ void PlsrRunControlTickMs(void)
/**
* @brief TIM5 one-shot 到期
- * @note ACT:OPM 收当前拍 + cut_pending;不加减速脉冲数预测
+ * @note ACT:收完当前脉冲并锁低输出,OPM 在周期末停表;不预测加减速脉冲数
*/
void PlsrRunControlOnDelayTimer(void)
{
@@ -1822,29 +1666,28 @@ void PlsrRunControlOnDelayTimer(void)
s_state = RC_RUN;
PlsrRunControlRefreshProfile(1U);
PlsrRunControlArmActExtOnPulseStart();
- s_dir_expire_req = 1U;
PlsrRunControlWakePost();
return;
}
- if ((s_state == RC_RUN) && (s_act_armed != 0U))
+ if ((s_state == RC_RUN) && (s_act_timer_armed != 0U))
{
- /* 到点:当前拍发完就停(OPM);周期多长算多长 */
- s_act_armed = 0U;
- s_act_cut_pending = 1U;
- PlsrPulseDriverArmOnePulseStop();
+ /* 到点:当前脉冲下降沿后锁低,周期结束时 OPM 停表。 */
+ s_act_timer_armed = 0U;
+ s_act_waiting_for_pulse_boundary = 1U;
+ PlsrPulseDriverArmActStop();
return;
}
- if ((s_state == RC_WAIT_COND) && (s_wait_is_signal == 0U))
+ if ((s_state == RC_WAIT_COND) && (s_waiting_for_input_signal == 0U))
{
- s_wait_expire_req = 1U;
+ s_wait_time_expired = 1U;
PlsrRunControlWakePost();
}
}
/** @brief 脉冲 UPDATE ISR — 本文件最核心、if 最多的函数 */
-void PlsrRunControlOnPulseIsr(void)
+void PlsrOnPulseIsr(void)
{
uint32_t remain;
uint32_t next;
@@ -1857,12 +1700,12 @@ void PlsrRunControlOnPulseIsr(void)
/*
* 末拍整周期已跑完:本 UPDATE 由 OPM 停表产生,不再计入脉冲。
- * 先于 s_done++,保证个数 = target 且示波器末拍完整。
+ * 先于 s_segment_pulses_done++,保证个数 = target 且示波器末拍完整。
*/
- if (s_last_period_wait != 0U)
+ if (s_waiting_for_last_period != 0U)
{
- s_last_period_wait = 0U;
- s_act_cut_pending = 0U;
+ s_waiting_for_last_period = 0U;
+ s_act_waiting_for_pulse_boundary = 0U;
/*
* 末拍下降沿已在 CC1 中断拉低;本 UPDATE 为 OPM 周期结束,不再 ++。
* 再 HoldOutputLow 完整停表,交 AfterSegDone。
@@ -1872,14 +1715,14 @@ void PlsrRunControlOnPulseIsr(void)
return;
}
- s_done++;
+ s_segment_pulses_done++;
if (s_forward != 0U)
{
- s_acc_pulse++;
+ g_plsr_accumulated_pulses++;
}
else
{
- s_acc_pulse--;
+ g_plsr_accumulated_pulses--;
}
/*
@@ -1887,33 +1730,33 @@ void PlsrRunControlOnPulseIsr(void)
* 到点由 TIM5 置 cut_pending 并 OPM;此处收尾切段。
* 加减速下周期长短不定,不按脉冲个数预测,墙钟可能多出「当前这一拍」的剩余。
*/
- if (s_act_cut_pending != 0U)
+ if (s_act_waiting_for_pulse_boundary != 0U)
{
- s_act_cut_pending = 0U;
- s_act_handoff_keep = 1U;
+ s_act_waiting_for_pulse_boundary = 0U;
+ s_keep_frequency_after_act = 1U;
/*
- * TIM5 已 ArmOnePulseStop:本拍 UPDATE 后计数器会停。
- * 必须清 s_pwm_on,否则 ActExpire 同向衔接走 RefreshProfile(0)
+ * TIM5 已 ArmActStop:输出在本拍下降沿后保持低,UPDATE 后计数器会停。
+ * 必须清 g_plsr_pwm_running,否则 ActExpire 同向衔接走 RefreshProfile(0)
* 时误判「表仍在跑」而不 Start,卡死在下一段入口。
*/
- s_pwm_on = 0U;
+ PlsrPulseDriverHoldOutputLow();
s_state = RC_IDLE;
- s_act_expire_req = 1U;
+ s_act_expired = 1U;
PlsrRunControlWakePost();
return;
}
- if (s_done >= s_target)
+ if (s_segment_pulses_done >= s_segment_pulse_target)
{
- if (s_seg_end_opm != 0U)
+ if (s_stop_after_last_pulse != 0U)
{
/*
- * 段末停表模式:本 UPDATE 是「最后一拍」的上升沿(s_done 已等于 target)。
- * 武装 OPM+CC1:下降沿拉低,下一 UPDATE 进 s_last_period_wait 再 AfterSegDone。
- * FOLLOW-keep 时 s_seg_end_opm=0,走 else 立刻切段不停表。
+ * 段末停表模式:本 UPDATE 是「最后一拍」的上升沿(s_segment_pulses_done 已等于 target)。
+ * 武装 OPM+CC1:下降沿拉低,下一 UPDATE 进 s_waiting_for_last_period 再 AfterSegDone。
+ * FOLLOW-keep 时 s_stop_after_last_pulse=0,走 else 立刻切段不停表。
*/
PlsrPulseDriverArmSegEndStop();
- s_last_period_wait = 1U;
+ s_waiting_for_last_period = 1U;
return;
}
/* FOLLOW 不停表衔接:立刻切段,PWM 连续 */
@@ -1936,32 +1779,32 @@ void PlsrRunControlOnPulseIsr(void)
PlsrPulseDriverClearStartPeriodProtect();
if (PlsrRunControlShouldEnterDecel(remain) != 0U)
{
- PlsrRunControlEnterDecel(s_accel_plan.f_tgt,
+ PlsrRunControlEnterDecel(g_plsr_accel_plan.target_frequency_hz,
PlsrRunControlDecelEnterBudget(remain));
- next = PlsrAccelPulseRtStep(&s_pulse_rt);
+ next = PlsrAccelNextFrequency(&g_plsr_accel_runtime);
PlsrRunControlApplyOutFreqIsr(next);
}
}
else if (s_phase == PH_APPROACH)
{
/* 每拍 Step 得下一频;若加速相结束则进 CONST 或 DECEL(条件同 RefreshProfile) */
- next = PlsrAccelPulseRtStep(&s_pulse_rt);
-
- if ((s_accel_plan.acc_n == 0U) ||
- (s_pulse_rt.active == 0U) ||
- (s_pulse_rt.n >= s_accel_plan.acc_n) ||
- ((s_accel_plan.f_tgt >= s_accel_plan.f_cur) &&
- (next >= s_accel_plan.f_tgt)) ||
- ((s_accel_plan.f_tgt < s_accel_plan.f_cur) &&
- (next <= s_accel_plan.f_tgt)))
+ next = PlsrAccelNextFrequency(&g_plsr_accel_runtime);
+
+ if ((g_plsr_accel_plan.accel_pulses == 0U) ||
+ (g_plsr_accel_runtime.is_active == 0U) ||
+ (g_plsr_accel_runtime.completed_pulses >= g_plsr_accel_plan.accel_pulses) ||
+ ((g_plsr_accel_plan.target_frequency_hz >= g_plsr_accel_plan.start_frequency_hz) &&
+ (next >= g_plsr_accel_plan.target_frequency_hz)) ||
+ ((g_plsr_accel_plan.target_frequency_hz < g_plsr_accel_plan.start_frequency_hz) &&
+ (next <= g_plsr_accel_plan.target_frequency_hz)))
{
- next = s_accel_plan.f_tgt;
+ next = g_plsr_accel_plan.target_frequency_hz;
PlsrRunControlOnApproachDone();
if (PlsrRunControlShouldEnterDecel(remain) != 0U)
{
PlsrRunControlEnterDecel(next,
PlsrRunControlDecelEnterBudget(remain));
- next = PlsrAccelPulseRtStep(&s_pulse_rt);
+ next = PlsrAccelNextFrequency(&g_plsr_accel_runtime);
PlsrRunControlApplyOutFreqIsr(next);
}
else
@@ -1981,10 +1824,10 @@ void PlsrRunControlOnPulseIsr(void)
* 以免 n 超过 budget 误触 0x03。
*/
if ((remain <= 1U) &&
- (s_pulse_rt.n_total > 0U) &&
- (s_pulse_rt.n >= s_pulse_rt.n_total))
+ (g_plsr_accel_runtime.total_pulses > 0U) &&
+ (g_plsr_accel_runtime.completed_pulses >= g_plsr_accel_runtime.total_pulses))
{
- next = s_accel_plan.f_end;
+ next = g_plsr_accel_plan.end_frequency_hz;
if (next < 1U)
{
next = 1U;
@@ -1992,60 +1835,24 @@ void PlsrRunControlOnPulseIsr(void)
}
else
{
- next = PlsrAccelPulseRtStep(&s_pulse_rt);
+ next = PlsrAccelNextFrequency(&g_plsr_accel_runtime);
}
PlsrRunControlApplyOutFreqIsr(next);
}
}
-/** @return 1=运动中(见 plsr_run_control.h) */
-uint8_t PlsrRunControlIsBusy(void)
-{
- return s_busy;
-}
-
-/** @return 累计脉冲(见 plsr_run_control.h) */
-int32_t PlsrRunControlGetAccPulse(void)
-{
- return s_acc_pulse;
-}
-
/** @brief 清累计与绝对原点(见 plsr_run_control.h) */
-void PlsrRunControlClearAccPulse(void)
+void PlsrClearAccPulse(void)
{
- s_acc_pulse = 0;
- s_abs_origin = 0;
- s_abs_origin_locked = 0U; /* 下次 Start 重新锁定原点 */
+ g_plsr_accumulated_pulses = 0;
+ s_absolute_origin = 0;
+ s_absolute_origin_locked = 0U; /* 下次 Start 重新锁定原点 */
}
/** @brief 上电恢复累计(见 plsr_run_control.h) */
void PlsrRunControlRestoreAccPulse(int32_t acc_pulse)
{
- s_acc_pulse = acc_pulse;
- s_abs_origin = 0;
- s_abs_origin_locked = 0U; /* 下次 Start 以当前累计为绝对原点 */
-}
-
-/**
- * @return 当前段号 1-based;空闲为 0(见 plsr_run_control.h)
- */
-uint16_t PlsrRunControlGetCurSeg(void)
-{
- if (s_busy == 0U)
- {
- return 0U;
- }
- return (uint16_t)(s_cur_seg + 1U);
-}
-
-/** @return 当前输出频率 Hz(见 plsr_run_control.h) */
-uint32_t PlsrRunControlGetCurFreq(void)
-{
- return s_cur_freq;
-}
-
-/** @return 主状态机枚举值(见 plsr_run_control.h) */
-uint16_t PlsrRunControlGetState(void)
-{
- return (uint16_t)s_state;
+ g_plsr_accumulated_pulses = acc_pulse;
+ s_absolute_origin = 0;
+ s_absolute_origin_locked = 0U; /* 下次 Start 以当前累计为绝对原点 */
}
diff --git a/plsr/run_control/plsr_run_control.h b/plsr/run_control/plsr_run_control.h
index f4c23f1..ea6d1a0 100644
--- a/plsr/run_control/plsr_run_control.h
+++ b/plsr/run_control/plsr_run_control.h
@@ -6,7 +6,7 @@
* pulse_driver / signal_io / param。状态:IDLE / DIR_WAIT / RUN / WAIT_COND。
*
* 与 accel_curve 对齐的符号:
- * f_tgt — 段表目标频率 Hz;s_done/s_target — 本段已发/目标脉冲数
+ * f_tgt — 段表目标频率 Hz;segment_pulses_done/target — 已发/目标脉冲数
*/
#ifndef PLSR_RUN_CONTROL_H
#define PLSR_RUN_CONTROL_H
@@ -14,22 +14,11 @@
#include
void PlsrRunControlInit(void);
-uint8_t PlsrRunControlStart(uint16_t start_seg_1based);
-void PlsrRunControlStop(void);
-uint8_t PlsrRunControlIsBusy(void);
-uint16_t PlsrRunControlGetCurSeg(void);
-int32_t PlsrRunControlGetAccPulse(void);
-void PlsrRunControlClearAccPulse(void);
/** @brief 上电从 BKPSRAM 恢复累计脉冲(不清绝对原点锁以外的运行态) */
void PlsrRunControlRestoreAccPulse(int32_t acc_pulse);
-uint32_t PlsrRunControlGetCurFreq(void);
-/** @return 主状态机 RC_IDLE/RC_DIR_WAIT/RC_RUN/RC_WAIT_COND(供监控/BKP) */
-uint16_t PlsrRunControlGetState(void);
void PlsrRunControlTickMs(void);
/** @brief TIM5 单次延时到期(换向 / WAIT / ACT 剩余) */
void PlsrRunControlOnDelayTimer(void);
-void PlsrRunControlOnPulseIsr(void);
-uint8_t PlsrRunControlChangeFreq(uint32_t freq_hz);
/**
* @brief 创建任务唤醒信号量(须在 OSInit 之后、首次 Pend/Post 之前)
diff --git a/plsr/signal_io/plsr_signal_io.c b/plsr/signal_io/plsr_signal_io.c
index c9157ce..ba71b43 100644
--- a/plsr/signal_io/plsr_signal_io.c
+++ b/plsr/signal_io/plsr_signal_io.c
@@ -293,20 +293,20 @@ void PlsrSignalIoClearPending(void)
s_db_x5.stamp_ok = 0U;
}
-/** wait_x_sel / ext_x_sel:0→X4,非 0→X5 */
-static PlsrEdge_t *PlsrSignalIoDbBySel(uint16_t sel_01)
-{
- return (sel_01 != 0U) ? &s_db_x5 : &s_db_x4;
-}
-
uint8_t PlsrSignalIoTakeWaitFalling(void)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
- PlsrEdge_t *db = PlsrSignalIoDbBySel(cfg->wait_x_sel);
-
- if (db->fell != 0U)
+ /* wait_x_sel:0 代表 X4,1 代表 X5。读取后立即清掉该下降沿。 */
+ if (g_plsr_config.wait_x_sel == 0U)
{
- db->fell = 0U;
+ if (s_db_x4.fell != 0U)
+ {
+ s_db_x4.fell = 0U;
+ return 1U;
+ }
+ }
+ else if (s_db_x5.fell != 0U)
+ {
+ s_db_x5.fell = 0U;
return 1U;
}
return 0U;
@@ -314,12 +314,18 @@ uint8_t PlsrSignalIoTakeWaitFalling(void)
uint8_t PlsrSignalIoTakeExtFalling(void)
{
- PlsrCfg_t *cfg = PlsrParamGetCfg();
- PlsrEdge_t *db = PlsrSignalIoDbBySel(cfg->ext_x_sel);
-
- if (db->fell != 0U)
+ /* ext_x_sel:0 代表 X4,1 代表 X5。读取后立即清掉该下降沿。 */
+ if (g_plsr_config.ext_x_sel == 0U)
+ {
+ if (s_db_x4.fell != 0U)
+ {
+ s_db_x4.fell = 0U;
+ return 1U;
+ }
+ }
+ else if (s_db_x5.fell != 0U)
{
- db->fell = 0U;
+ s_db_x5.fell = 0U;
return 1U;
}
return 0U;