Compare commits

...

No commits in common. "main" and "test" have entirely different histories.
main ... test

416 changed files with 48979 additions and 135628 deletions

15
.gitignore vendored
View File

@ -7,7 +7,7 @@
# Test binary, built with `go test -c`
*.test
*.log
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
.VSCodeCounter
@ -23,15 +23,8 @@ dist
/MDK-ARM/.vscode/settings.json
/MDK-ARM/.vscode/tasks.json
/MDK-ARM/.clang-format
/MDK-ARM/.vscode/uv4.log.lock
/MDK-ARM/*.hex
/MDK-ARM/*.bin
/MDK-ARM/.pack
MDK-ARM/controller-v2/uc_gui.lib
MDK-ARM/controller-v2/*.hex
Public/出厂文件/output/*.bin
Public/出厂文件/output/*.hex
Public/SIL认证/*
MDK-ARM/controller-v2/controller.hex
MDK-ARM/controller-v4/*.lib
.vs/*

View File

@ -1,5 +1,5 @@
[PreviousLibFiles]
LibFiles=Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_gpio.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_system.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_adc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dma.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dmamux.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_bus.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_cortex.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_rcc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_crs.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_utils.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_exti.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_pwr.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dac.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_spi.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_tim.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_usart.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_gpio.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_system.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_adc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dma.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dmamux.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_bus.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_cortex.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_rcc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_crs.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_utils.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_exti.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_pwr.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dac.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_spi.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_tim.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l476xx.h;Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h;Drivers\CMSIS\Device\ST\STM32L4xx\Include\system_stm32l4xx.h;Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_armclang_ltm.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv81mml.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm35p.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
LibFiles=Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_gpio.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_system.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_adc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dma.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dmamux.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_bus.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_cortex.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_rcc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_crs.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_utils.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_exti.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_pwr.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dac.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_i2c.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_spi.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_tim.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_usart.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_i2c.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_gpio.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_system.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_adc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dma.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dmamux.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_bus.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_cortex.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_rcc.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_crs.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_utils.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_exti.h;Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_pwr.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_dac.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_i2c.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_spi.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_tim.h;Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l476xx.h;Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h;Drivers\CMSIS\Device\ST\STM32L4xx\Include\system_stm32l4xx.h;Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_armclang_ltm.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv81mml.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm35p.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
[PreviousUsedIarFiles]
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\adc.c;..\Core\Src\dac.c;..\Core\Src\dma.c;..\Core\Src\i2c.c;..\Core\Src\iwdg.c;..\Core\Src\spi.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32l4xx_it.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_i2c.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_i2c.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;;;
@ -7,39 +7,41 @@ HeaderPath=..\Drivers\STM32L4xx_HAL_Driver\Inc;..\Drivers\CMSIS\Device\ST\STM32L
CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:4000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L476xx;USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:4000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;
[PreviousUsedKeilFiles]
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\adc.c;..\Core\Src\dac.c;..\Core\Src\dma.c;..\Core\Src\spi.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32l4xx_it.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;;;
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\adc.c;..\Core\Src\dac.c;..\Core\Src\dma.c;..\Core\Src\i2c.c;..\Core\Src\spi.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32l4xx_it.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_i2c.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_i2c.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;;;
HeaderPath=..\Drivers\STM32L4xx_HAL_Driver\Inc;..\Drivers\CMSIS\Device\ST\STM32L4xx\Include;..\Drivers\CMSIS\Include;..\Middlewares\ST\ARM\DSP\Inc;..\Core\Inc;
CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:11059200;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L476xx;USE_FULL_LL_DRIVER;HSE_VALUE:11059200;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;
CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L476xx;USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;
[]
SourceFiles=;;
[PreviousGenFiles]
AdvancedFolderStructure=true
HeaderFileListSize=10
HeaderFileListSize=11
HeaderFiles#0=..\Core\Inc\gpio.h
HeaderFiles#1=..\Core\Inc\adc.h
HeaderFiles#2=..\Core\Inc\dac.h
HeaderFiles#3=..\Core\Inc\dma.h
HeaderFiles#4=..\Core\Inc\spi.h
HeaderFiles#5=..\Core\Inc\tim.h
HeaderFiles#6=..\Core\Inc\usart.h
HeaderFiles#7=..\Core\Inc\stm32l4xx_it.h
HeaderFiles#8=..\Core\Inc\stm32_assert.h
HeaderFiles#9=..\Core\Inc\main.h
HeaderFiles#4=..\Core\Inc\i2c.h
HeaderFiles#5=..\Core\Inc\spi.h
HeaderFiles#6=..\Core\Inc\tim.h
HeaderFiles#7=..\Core\Inc\usart.h
HeaderFiles#8=..\Core\Inc\stm32l4xx_it.h
HeaderFiles#9=..\Core\Inc\stm32_assert.h
HeaderFiles#10=..\Core\Inc\main.h
HeaderFolderListSize=1
HeaderPath#0=..\Core\Inc
HeaderFiles=;
SourceFileListSize=9
SourceFileListSize=10
SourceFiles#0=..\Core\Src\gpio.c
SourceFiles#1=..\Core\Src\adc.c
SourceFiles#2=..\Core\Src\dac.c
SourceFiles#3=..\Core\Src\dma.c
SourceFiles#4=..\Core\Src\spi.c
SourceFiles#5=..\Core\Src\tim.c
SourceFiles#6=..\Core\Src\usart.c
SourceFiles#7=..\Core\Src\stm32l4xx_it.c
SourceFiles#8=..\Core\Src\main.c
SourceFiles#4=..\Core\Src\i2c.c
SourceFiles#5=..\Core\Src\spi.c
SourceFiles#6=..\Core\Src\tim.c
SourceFiles#7=..\Core\Src\usart.c
SourceFiles#8=..\Core\Src\stm32l4xx_it.c
SourceFiles#9=..\Core\Src\main.c
SourceFolderListSize=1
SourcePath#0=..\Core\Src
SourceFiles=;

3
.vs/ProjectSettings.json Normal file
View File

@ -0,0 +1,3 @@
{
"CurrentProjectSetting": "\u65E0\u914D\u7F6E"
}

12
.vs/VSWorkspaceState.json Normal file
View File

@ -0,0 +1,12 @@
{
"ExpandedNodes": [
"",
"\\Core",
"\\User",
"\\User\\application",
"\\User\\application\\inc",
"\\User\\application\\src"
],
"SelectedNode": "\\User\\application\\inc\\convert.h",
"PreviewInSolutionExplorer": false
}

BIN
.vs/controller-hd/v17/.wsuo Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.vs/slnx.sqlite Normal file

Binary file not shown.

View File

@ -5,15 +5,13 @@
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/TDM-GCC-64/bin/gcc.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64"
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4

4
.vscode/launch.json vendored
View File

@ -8,8 +8,8 @@
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "e:/work/stm32/不经常用的代码/controller-hd/User/system/bsp",
"program": "e:/work/stm32/不经常用的代码/controller-hd/User/system/bsp/build/Debug/outDebug",
"cwd": "e:/work/stm32/controller-hd/User/lib/control/src",
"program": "e:/work/stm32/controller-hd/User/lib/control/src/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [

27
.vscode/settings.json vendored
View File

@ -1,26 +1,10 @@
{
"C_Cpp.errorSquiggles": "disabled",
"files.associations": {
"cmath": "c",
"pid_hd.h": "c",
"array": "c",
"*.tcc": "c",
"string": "c",
"vector": "c",
"exception": "c",
"functional": "c",
"istream": "c",
"limits": "c",
"ostream": "c",
"sstream": "c",
"streambuf": "c"
},
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
@ -71,5 +55,12 @@
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
"C_Cpp_Runner.msvcSecureNoWarnings": false,
"files.associations": {
"pid_g.h": "c",
"mode_pwmp.h": "c",
"eeprom_m95.h": "c",
"sys.h": "c"
},
"C_Cpp.errorSquiggles": "disabled"
}

View File

@ -37,6 +37,7 @@ extern "C" {
/* USER CODE END Private defines */
void MX_ADC1_Init(void);
void MX_ADC2_Init(void);
/* USER CODE BEGIN Prototypes */

50
Core/Inc/i2c.h Normal file
View File

@ -0,0 +1,50 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file i2c.h
* @brief This file contains all the function prototypes for
* the i2c.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __I2C_H__
#define __I2C_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_I2C1_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __I2C_H__ */

View File

@ -31,6 +31,7 @@ extern "C" {
#include "stm32l4xx_ll_adc.h"
#include "stm32l4xx_ll_dac.h"
#include "stm32l4xx_ll_dma.h"
#include "stm32l4xx_ll_i2c.h"
#include "stm32l4xx_ll_crs.h"
#include "stm32l4xx_ll_rcc.h"
#include "stm32l4xx_ll_bus.h"
@ -77,8 +78,8 @@ void Error_Handler(void);
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define DAC161P997_Pin LL_GPIO_PIN_5
#define DAC161P997_GPIO_Port GPIOE
#define PWM_OUT_Pin LL_GPIO_PIN_5
#define PWM_OUT_GPIO_Port GPIOE
#define RTC_SCL_Pin LL_GPIO_PIN_0
#define RTC_SCL_GPIO_Port GPIOC
#define RTC_SDA_Pin LL_GPIO_PIN_1
@ -87,30 +88,28 @@ void Error_Handler(void);
#define SWO1_GPIO_Port GPIOC
#define SWO2_Pin LL_GPIO_PIN_3
#define SWO2_GPIO_Port GPIOC
#define ADC_LOOP_CHANNEL_Pin LL_GPIO_PIN_0
#define ADC_LOOP_CHANNEL_GPIO_Port GPIOA
#define ADC_PSB_CHANNEL_Pin LL_GPIO_PIN_1
#define ADC_PSB_CHANNEL_GPIO_Port GPIOA
#define ADC_BP_CHANNEL_Pin LL_GPIO_PIN_2
#define ADC_BP_CHANNEL_GPIO_Port GPIOA
#define ADC_IPSB_CHANNEL_Pin LL_GPIO_PIN_3
#define ADC_IPSB_CHANNEL_GPIO_Port GPIOA
#define ADC_NTC_CHANNEL_Pin LL_GPIO_PIN_4
#define ADC_NTC_CHANNEL_GPIO_Port GPIOA
#define AD1_LOOP_IN_Pin LL_GPIO_PIN_0
#define AD1_LOOP_IN_GPIO_Port GPIOA
#define AD1_BP_S_IN_Pin LL_GPIO_PIN_2
#define AD1_BP_S_IN_GPIO_Port GPIOA
#define AD1_IPSB_IN_Pin LL_GPIO_PIN_3
#define AD1_IPSB_IN_GPIO_Port GPIOA
#define AD1_NTC_Pin LL_GPIO_PIN_4
#define AD1_NTC_GPIO_Port GPIOA
#define DAC_CONTROL_Pin LL_GPIO_PIN_5
#define DAC_CONTROL_GPIO_Port GPIOA
#define ADC_VIP_CHANNEL_Pin LL_GPIO_PIN_6
#define ADC_VIP_CHANNEL_GPIO_Port GPIOA
#define ADC_DCDC_CHANNEL_Pin LL_GPIO_PIN_7
#define ADC_DCDC_CHANNEL_GPIO_Port GPIOA
#define ADC_BPA_CHANNEL_Pin LL_GPIO_PIN_4
#define ADC_BPA_CHANNEL_GPIO_Port GPIOC
#define ADC_BPB_CHANNEL_Pin LL_GPIO_PIN_5
#define ADC_BPB_CHANNEL_GPIO_Port GPIOC
#define AD1_IP_IN_Pin LL_GPIO_PIN_6
#define AD1_IP_IN_GPIO_Port GPIOA
#define AD1_DC_3_3_Pin LL_GPIO_PIN_7
#define AD1_DC_3_3_GPIO_Port GPIOA
#define AD1_BP_A_IN_Pin LL_GPIO_PIN_4
#define AD1_BP_A_IN_GPIO_Port GPIOC
#define AD1_BP_B_IN_Pin LL_GPIO_PIN_5
#define AD1_BP_B_IN_GPIO_Port GPIOC
#define HART_PWR_Pin LL_GPIO_PIN_0
#define HART_PWR_GPIO_Port GPIOB
#define ADC_VDD_CHANNEL_Pin LL_GPIO_PIN_1
#define ADC_VDD_CHANNEL_GPIO_Port GPIOB
#define IP_PWR_Pin LL_GPIO_PIN_1
#define IP_PWR_GPIO_Port GPIOB
#define IP_H_PWR_Pin LL_GPIO_PIN_2
#define IP_H_PWR_GPIO_Port GPIOB
#define BP_A_PWR_Pin LL_GPIO_PIN_7
@ -129,8 +128,6 @@ void Error_Handler(void);
#define LCD_CS_GPIO_Port GPIOB
#define LCD_SCK_Pin LL_GPIO_PIN_13
#define LCD_SCK_GPIO_Port GPIOB
#define LCD_EXTCOMIN_Pin LL_GPIO_PIN_14
#define LCD_EXTCOMIN_GPIO_Port GPIOB
#define LCD_MOSI_Pin LL_GPIO_PIN_15
#define LCD_MOSI_GPIO_Port GPIOB
#define LCD_DISP_Pin LL_GPIO_PIN_8
@ -167,11 +164,8 @@ void Error_Handler(void);
#define BLE_TX_GPIO_Port GPIOC
#define HART_CD_Pin LL_GPIO_PIN_0
#define HART_CD_GPIO_Port GPIOD
#define HART_CD_EXTI_IRQn EXTI0_IRQn
#define BLE_RX_Pin LL_GPIO_PIN_2
#define BLE_RX_GPIO_Port GPIOD
#define EE3_CS_Pin LL_GPIO_PIN_4
#define EE3_CS_GPIO_Port GPIOD
#define EE2_CS_Pin LL_GPIO_PIN_5
#define EE2_CS_GPIO_Port GPIOD
#define EE1_CS_Pin LL_GPIO_PIN_6
@ -192,6 +186,10 @@ void Error_Handler(void);
#define I2C1_SCL_GPIO_Port GPIOB
#define I2C1_SDA_Pin LL_GPIO_PIN_9
#define I2C1_SDA_GPIO_Port GPIOB
#define I2C2_SCL_Pin LL_GPIO_PIN_0
#define I2C2_SCL_GPIO_Port GPIOE
#define I2C2_SDA_Pin LL_GPIO_PIN_1
#define I2C2_SDA_GPIO_Port GPIOE
#ifndef NVIC_PRIORITYGROUP_0
#define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bit for pre-emption priority,
4 bits for subpriority */

View File

@ -55,12 +55,14 @@ void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void EXTI0_IRQHandler(void);
void DMA1_Channel1_IRQHandler(void);
void DMA1_Channel2_IRQHandler(void);
void DMA1_Channel5_IRQHandler(void);
void DMA1_Channel6_IRQHandler(void);
void DMA1_Channel7_IRQHandler(void);
void ADC1_2_IRQHandler(void);
void TIM1_UP_TIM16_IRQHandler(void);
void TIM1_TRG_COM_TIM17_IRQHandler(void);
void TIM4_IRQHandler(void);
void I2C1_EV_IRQHandler(void);
void USART1_IRQHandler(void);
void UART5_IRQHandler(void);
void TIM6_DAC_IRQHandler(void);

View File

@ -38,10 +38,9 @@ extern "C" {
void MX_TIM2_Init(void);
void MX_TIM3_Init(void);
void MX_TIM4_Init(void);
void MX_TIM6_Init(void);
void MX_TIM7_Init(void);
void MX_TIM16_Init(void);
void MX_TIM17_Init(void);
/* USER CODE BEGIN Prototypes */

View File

@ -45,7 +45,6 @@ void MX_ADC1_Init(void)
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOA);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOC);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB);
/**ADC1 GPIO Configuration
PA0 ------> ADC1_IN5
PA1 ------> ADC1_IN6
@ -56,30 +55,22 @@ void MX_ADC1_Init(void)
PA7 ------> ADC1_IN12
PC4 ------> ADC1_IN13
PC5 ------> ADC1_IN14
PB1 ------> ADC1_IN16
*/
GPIO_InitStruct.Pin = ADC_LOOP_CHANNEL_Pin|ADC_PSB_CHANNEL_Pin|ADC_BP_CHANNEL_Pin|ADC_IPSB_CHANNEL_Pin
|ADC_NTC_CHANNEL_Pin|ADC_VIP_CHANNEL_Pin|ADC_DCDC_CHANNEL_Pin;
GPIO_InitStruct.Pin = AD1_LOOP_IN_Pin|LL_GPIO_PIN_1|AD1_BP_S_IN_Pin|AD1_IPSB_IN_Pin
|AD1_NTC_Pin|AD1_IP_IN_Pin|AD1_DC_3_3_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = ADC_BPA_CHANNEL_Pin|ADC_BPB_CHANNEL_Pin;
GPIO_InitStruct.Pin = AD1_BP_A_IN_Pin|AD1_BP_B_IN_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = ADC_VDD_CHANNEL_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(ADC_VDD_CHANNEL_GPIO_Port, &GPIO_InitStruct);
LL_GPIO_EnablePinAnalogControl(GPIOA, AD1_LOOP_IN_Pin|LL_GPIO_PIN_1|AD1_BP_S_IN_Pin|AD1_IPSB_IN_Pin
|AD1_NTC_Pin|AD1_IP_IN_Pin|AD1_DC_3_3_Pin);
LL_GPIO_EnablePinAnalogControl(GPIOA, ADC_LOOP_CHANNEL_Pin|ADC_PSB_CHANNEL_Pin|ADC_BP_CHANNEL_Pin|ADC_IPSB_CHANNEL_Pin
|ADC_NTC_CHANNEL_Pin|ADC_VIP_CHANNEL_Pin|ADC_DCDC_CHANNEL_Pin);
LL_GPIO_EnablePinAnalogControl(GPIOC, ADC_BPA_CHANNEL_Pin|ADC_BPB_CHANNEL_Pin);
LL_GPIO_EnablePinAnalogControl(ADC_VDD_CHANNEL_GPIO_Port, ADC_VDD_CHANNEL_Pin);
LL_GPIO_EnablePinAnalogControl(GPIOC, AD1_BP_A_IN_Pin|AD1_BP_B_IN_Pin);
/* ADC1 DMA Init */
@ -101,7 +92,7 @@ void MX_ADC1_Init(void)
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_1, LL_DMA_MDATAALIGN_HALFWORD);
/* ADC1 interrupt Init */
NVIC_SetPriority(ADC1_2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_SetPriority(ADC1_2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),14, 0));
NVIC_EnableIRQ(ADC1_2_IRQn);
/* USER CODE BEGIN ADC1_Init 1 */
@ -115,7 +106,7 @@ void MX_ADC1_Init(void)
ADC_InitStruct.LowPowerMode = LL_ADC_LP_MODE_NONE;
LL_ADC_Init(ADC1, &ADC_InitStruct);
ADC_REG_InitStruct.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
ADC_REG_InitStruct.SequencerLength = LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS;
ADC_REG_InitStruct.SequencerLength = LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS;
ADC_REG_InitStruct.SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
ADC_REG_InitStruct.ContinuousMode = LL_ADC_REG_CONV_CONTINUOUS;
ADC_REG_InitStruct.DMATransfer = LL_ADC_REG_DMA_TRANSFER_UNLIMITED;
@ -146,78 +137,173 @@ void MX_ADC1_Init(void)
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_1, LL_ADC_CHANNEL_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_5, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_5, LL_ADC_SAMPLINGTIME_247CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_5, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_2, LL_ADC_CHANNEL_6);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_6, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_6, LL_ADC_SAMPLINGTIME_47CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_6, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_3, LL_ADC_CHANNEL_7);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_7, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_7, LL_ADC_SAMPLINGTIME_47CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_7, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_4, LL_ADC_CHANNEL_8);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_8, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_8, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_8, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_5, LL_ADC_CHANNEL_9);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_9, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_9, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_9, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_6, LL_ADC_CHANNEL_11);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_11, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_11, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_11, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_7, LL_ADC_CHANNEL_12);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_12, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_12, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_12, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_8, LL_ADC_CHANNEL_13);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_13, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_13, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_13, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_9, LL_ADC_CHANNEL_14);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_14, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_14, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_14, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_10, LL_ADC_CHANNEL_16);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_16, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_16, LL_ADC_SINGLE_ENDED);
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_10, LL_ADC_CHANNEL_VREFINT);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_VREFINT, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_VREFINT, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_11, LL_ADC_CHANNEL_TEMPSENSOR);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_TEMPSENSOR, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_TEMPSENSOR, LL_ADC_SAMPLINGTIME_640CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_TEMPSENSOR, LL_ADC_SINGLE_ENDED);
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_12, LL_ADC_CHANNEL_VREFINT);
LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_VREFINT, LL_ADC_SAMPLINGTIME_12CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC1, LL_ADC_CHANNEL_VREFINT, LL_ADC_SINGLE_ENDED);
/* USER CODE BEGIN ADC1_Init 2 */
/* USER CODE END ADC1_Init 2 */
}
/* ADC2 init function */
void MX_ADC2_Init(void)
{
/* USER CODE BEGIN ADC2_Init 0 */
/* USER CODE END ADC2_Init 0 */
LL_ADC_InitTypeDef ADC_InitStruct = {0};
LL_ADC_REG_InitTypeDef ADC_REG_InitStruct = {0};
LL_ADC_CommonInitTypeDef ADC_CommonInitStruct = {0};
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
LL_RCC_SetADCClockSource(LL_RCC_ADC_CLKSOURCE_PLLSAI1);
/* Peripheral clock enable */
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_ADC);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOA);
/**ADC2 GPIO Configuration
PA1 ------> ADC2_IN6
*/
GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
LL_GPIO_EnablePinAnalogControl(GPIOA, LL_GPIO_PIN_1);
/* ADC2 DMA Init */
/* ADC2 Init */
LL_DMA_SetPeriphRequest(DMA1, LL_DMA_CHANNEL_2, LL_DMA_REQUEST_0);
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_2, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PRIORITY_LOW);
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MODE_CIRCULAR);
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PERIPH_NOINCREMENT);
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MEMORY_INCREMENT);
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PDATAALIGN_HALFWORD);
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MDATAALIGN_HALFWORD);
/* ADC2 interrupt Init */
NVIC_SetPriority(ADC1_2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),14, 0));
NVIC_EnableIRQ(ADC1_2_IRQn);
/* USER CODE BEGIN ADC2_Init 1 */
/* USER CODE END ADC2_Init 1 */
/** Common config
*/
ADC_InitStruct.Resolution = LL_ADC_RESOLUTION_12B;
ADC_InitStruct.DataAlignment = LL_ADC_DATA_ALIGN_RIGHT;
ADC_InitStruct.LowPowerMode = LL_ADC_LP_MODE_NONE;
LL_ADC_Init(ADC2, &ADC_InitStruct);
ADC_REG_InitStruct.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
ADC_REG_InitStruct.SequencerLength = LL_ADC_REG_SEQ_SCAN_DISABLE;
ADC_REG_InitStruct.SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
ADC_REG_InitStruct.ContinuousMode = LL_ADC_REG_CONV_CONTINUOUS;
ADC_REG_InitStruct.DMATransfer = LL_ADC_REG_DMA_TRANSFER_UNLIMITED;
ADC_REG_InitStruct.Overrun = LL_ADC_REG_OVR_DATA_PRESERVED;
LL_ADC_REG_Init(ADC2, &ADC_REG_InitStruct);
ADC_CommonInitStruct.CommonClock = LL_ADC_CLOCK_ASYNC_DIV16;
LL_ADC_CommonInit(__LL_ADC_COMMON_INSTANCE(ADC2), &ADC_CommonInitStruct);
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC2), LL_ADC_PATH_INTERNAL_NONE);
/* Disable ADC deep power down (enabled by default after reset state) */
LL_ADC_DisableDeepPowerDown(ADC2);
/* Enable ADC internal voltage regulator */
LL_ADC_EnableInternalRegulator(ADC2);
/* Delay for ADC internal voltage regulator stabilization. */
/* Compute number of CPU cycles to wait for, from delay in us. */
/* Note: Variable divided by 2 to compensate partially */
/* CPU processing cycles (depends on compilation optimization). */
/* Note: If system core clock frequency is below 200kHz, wait time */
/* is only a few CPU processing cycles. */
uint32_t wait_loop_index;
wait_loop_index = ((LL_ADC_DELAY_INTERNAL_REGUL_STAB_US * (SystemCoreClock / (100000 * 2))) / 10);
while(wait_loop_index != 0)
{
wait_loop_index--;
}
/** Configure Regular Channel
*/
LL_ADC_REG_SetSequencerRanks(ADC2, LL_ADC_REG_RANK_1, LL_ADC_CHANNEL_6);
LL_ADC_SetChannelSamplingTime(ADC2, LL_ADC_CHANNEL_6, LL_ADC_SAMPLINGTIME_2CYCLES_5);
LL_ADC_SetChannelSingleDiff(ADC2, LL_ADC_CHANNEL_6, LL_ADC_SINGLE_ENDED);
/* USER CODE BEGIN ADC2_Init 2 */
/* USER CODE END ADC2_Init 2 */
}
/* USER CODE BEGIN 1 */

View File

@ -46,22 +46,31 @@ void MX_DMA_Init(void)
/* DMA interrupt init */
/* DMA1_Channel1_IRQn interrupt configuration */
NVIC_SetPriority(DMA1_Channel1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_SetPriority(DMA1_Channel1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),14, 0));
NVIC_EnableIRQ(DMA1_Channel1_IRQn);
/* DMA1_Channel2_IRQn interrupt configuration */
NVIC_SetPriority(DMA1_Channel2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(DMA1_Channel2_IRQn);
/* DMA1_Channel5_IRQn interrupt configuration */
NVIC_SetPriority(DMA1_Channel5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_SetPriority(DMA1_Channel5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),14, 0));
NVIC_EnableIRQ(DMA1_Channel5_IRQn);
/* DMA1_Channel6_IRQn interrupt configuration */
NVIC_SetPriority(DMA1_Channel6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(DMA1_Channel6_IRQn);
/* DMA1_Channel7_IRQn interrupt configuration */
NVIC_SetPriority(DMA1_Channel7_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(DMA1_Channel7_IRQn);
/* DMA2_Channel1_IRQn interrupt configuration */
NVIC_SetPriority(DMA2_Channel1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_SetPriority(DMA2_Channel1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(DMA2_Channel1_IRQn);
/* DMA2_Channel2_IRQn interrupt configuration */
NVIC_SetPriority(DMA2_Channel2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_SetPriority(DMA2_Channel2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(DMA2_Channel2_IRQn);
/* DMA2_Channel6_IRQn interrupt configuration */
NVIC_SetPriority(DMA2_Channel6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_SetPriority(DMA2_Channel6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(DMA2_Channel6_IRQn);
/* DMA2_Channel7_IRQn interrupt configuration */
NVIC_SetPriority(DMA2_Channel7_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_SetPriority(DMA2_Channel7_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(DMA2_Channel7_IRQn);
}

View File

@ -44,7 +44,6 @@
void MX_GPIO_Init(void)
{
LL_EXTI_InitTypeDef EXTI_InitStruct = {0};
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
@ -55,20 +54,20 @@ void MX_GPIO_Init(void)
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOD);
/**/
LL_GPIO_ResetOutputPin(GPIOE, DAC161P997_Pin|BP_A_PWR_Pin|BP_S_PWR_Pin|BP_B_PWR_Pin);
/**/
LL_GPIO_ResetOutputPin(GPIOC, RTC_SCL_Pin|RTC_SDA_Pin|SWO1_Pin|SWO2_Pin
|HART_RST_Pin);
/**/
LL_GPIO_ResetOutputPin(GPIOB, HART_PWR_Pin|IP_H_PWR_Pin|LCD_PWR_Pin|LCD_CS_Pin
|I2C1_SCL_Pin|I2C1_SDA_Pin);
LL_GPIO_ResetOutputPin(GPIOB, HART_PWR_Pin|IP_PWR_Pin|IP_H_PWR_Pin|LCD_PWR_Pin
|LCD_CS_Pin);
/**/
LL_GPIO_ResetOutputPin(GPIOD, LCD_DISP_Pin|EE3_CS_Pin|EE2_CS_Pin|EE1_CS_Pin
|BLE_PWR_Pin);
LL_GPIO_ResetOutputPin(GPIOE, BP_A_PWR_Pin|BP_S_PWR_Pin|BP_B_PWR_Pin|I2C2_SCL_Pin
|I2C2_SDA_Pin);
/**/
LL_GPIO_ResetOutputPin(GPIOD, LCD_DISP_Pin|EE2_CS_Pin|EE1_CS_Pin|BLE_PWR_Pin);
/**/
LL_GPIO_ResetOutputPin(GPIOA, HART_RTS_Pin|BLE_RST_Pin);
@ -78,21 +77,13 @@ void MX_GPIO_Init(void)
|LED5_Pin);
/**/
GPIO_InitStruct.Pin = LL_GPIO_PIN_2|LL_GPIO_PIN_3|LL_GPIO_PIN_6|LL_GPIO_PIN_10
|LL_GPIO_PIN_11|LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_14
|LL_GPIO_PIN_0|LL_GPIO_PIN_1;
GPIO_InitStruct.Pin = LL_GPIO_PIN_2|LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_6
|LL_GPIO_PIN_10|LL_GPIO_PIN_11|LL_GPIO_PIN_12|LL_GPIO_PIN_13
|LL_GPIO_PIN_14;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOE, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = DAC161P997_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.Pull = LL_GPIO_PULL_DOWN;
LL_GPIO_Init(DAC161P997_GPIO_Port, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15|LL_GPIO_PIN_11;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
@ -116,12 +107,12 @@ void MX_GPIO_Init(void)
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = HART_PWR_Pin;
GPIO_InitStruct.Pin = HART_PWR_Pin|IP_PWR_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(HART_PWR_GPIO_Port, &GPIO_InitStruct);
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = IP_H_PWR_Pin|LCD_PWR_Pin;
@ -142,7 +133,7 @@ void MX_GPIO_Init(void)
/**/
GPIO_InitStruct.Pin = KEY_AUTO_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(KEY_AUTO_GPIO_Port, &GPIO_InitStruct);
/**/
@ -154,13 +145,14 @@ void MX_GPIO_Init(void)
LL_GPIO_Init(LCD_CS_GPIO_Port, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LCD_EXTCOMIN_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(LCD_EXTCOMIN_GPIO_Port, &GPIO_InitStruct);
GPIO_InitStruct.Pin = LL_GPIO_PIN_14;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LCD_DISP_Pin|EE3_CS_Pin|EE2_CS_Pin|BLE_PWR_Pin;
GPIO_InitStruct.Pin = LCD_DISP_Pin|LED1_Pin|LED2_Pin|LED3_Pin
|LED4_Pin|LED5_Pin|EE2_CS_Pin|BLE_PWR_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
@ -168,24 +160,15 @@ void MX_GPIO_Init(void)
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin|LED3_Pin|LED4_Pin
|LED5_Pin|EE1_CS_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = KEY6_Pin|KEY5_Pin;
GPIO_InitStruct.Pin = KEY6_Pin|KEY5_Pin|HART_CD_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = KEY4_Pin|KEY3_Pin|KEY2_Pin|KEY1_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/**/
@ -211,39 +194,26 @@ void MX_GPIO_Init(void)
LL_GPIO_Init(HART_RST_GPIO_Port, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = LL_GPIO_PIN_1|LL_GPIO_PIN_3;
GPIO_InitStruct.Pin = LL_GPIO_PIN_1|LL_GPIO_PIN_3|LL_GPIO_PIN_4;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = I2C1_SCL_Pin|I2C1_SDA_Pin;
GPIO_InitStruct.Pin = EE1_CS_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(EE1_CS_GPIO_Port, &GPIO_InitStruct);
/**/
GPIO_InitStruct.Pin = I2C2_SCL_Pin|I2C2_SDA_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/**/
LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTD, LL_SYSCFG_EXTI_LINE0);
/**/
EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_0;
EXTI_InitStruct.Line_32_63 = LL_EXTI_LINE_NONE;
EXTI_InitStruct.LineCommand = ENABLE;
EXTI_InitStruct.Mode = LL_EXTI_MODE_IT;
EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_FALLING;
LL_EXTI_Init(&EXTI_InitStruct);
/**/
LL_GPIO_SetPinPull(HART_CD_GPIO_Port, HART_CD_Pin, LL_GPIO_PULL_UP);
/**/
LL_GPIO_SetPinMode(HART_CD_GPIO_Port, HART_CD_Pin, LL_GPIO_MODE_INPUT);
/* EXTI interrupt init*/
NVIC_SetPriority(EXTI0_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(EXTI0_IRQn);
LL_GPIO_Init(GPIOE, &GPIO_InitStruct);
}

124
Core/Src/i2c.c Normal file
View File

@ -0,0 +1,124 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file i2c.c
* @brief This file provides code for the configuration
* of the I2C instances.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "i2c.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/* I2C1 init function */
void MX_I2C1_Init(void)
{
/* USER CODE BEGIN I2C1_Init 0 */
/* USER CODE END I2C1_Init 0 */
LL_I2C_InitTypeDef I2C_InitStruct = {0};
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
LL_RCC_SetI2CClockSource(LL_RCC_I2C1_CLKSOURCE_PCLK1);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB);
/**I2C1 GPIO Configuration
PB8 ------> I2C1_SCL
PB9 ------> I2C1_SDA
*/
GPIO_InitStruct.Pin = I2C1_SCL_Pin|I2C1_SDA_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* Peripheral clock enable */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C1);
/* I2C1 DMA Init */
/* I2C1_RX Init */
LL_DMA_SetPeriphRequest(DMA1, LL_DMA_CHANNEL_7, LL_DMA_REQUEST_3);
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_7, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_7, LL_DMA_PRIORITY_LOW);
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_7, LL_DMA_MODE_NORMAL);
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_7, LL_DMA_PERIPH_NOINCREMENT);
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_7, LL_DMA_MEMORY_INCREMENT);
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_7, LL_DMA_PDATAALIGN_BYTE);
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_7, LL_DMA_MDATAALIGN_BYTE);
/* I2C1_TX Init */
LL_DMA_SetPeriphRequest(DMA1, LL_DMA_CHANNEL_6, LL_DMA_REQUEST_3);
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_6, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_6, LL_DMA_PRIORITY_LOW);
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_6, LL_DMA_MODE_NORMAL);
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_6, LL_DMA_PERIPH_NOINCREMENT);
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_6, LL_DMA_MEMORY_INCREMENT);
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_6, LL_DMA_PDATAALIGN_BYTE);
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_6, LL_DMA_MDATAALIGN_BYTE);
/* I2C1 interrupt Init */
NVIC_SetPriority(I2C1_EV_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(I2C1_EV_IRQn);
/* USER CODE BEGIN I2C1_Init 1 */
/* USER CODE END I2C1_Init 1 */
/** I2C Initialization
*/
LL_I2C_EnableAutoEndMode(I2C1);
LL_I2C_DisableOwnAddress2(I2C1);
LL_I2C_DisableGeneralCall(I2C1);
LL_I2C_EnableClockStretching(I2C1);
I2C_InitStruct.PeripheralMode = LL_I2C_MODE_I2C;
I2C_InitStruct.Timing = 0x00000E14;
I2C_InitStruct.AnalogFilter = LL_I2C_ANALOGFILTER_ENABLE;
I2C_InitStruct.DigitalFilter = 0;
I2C_InitStruct.OwnAddress1 = 0;
I2C_InitStruct.TypeAcknowledge = LL_I2C_ACK;
I2C_InitStruct.OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT;
LL_I2C_Init(I2C1, &I2C_InitStruct);
LL_I2C_SetOwnAddress2(I2C1, 0, LL_I2C_OWNADDRESS2_NOMASK);
/* USER CODE BEGIN I2C1_Init 2 */
/* USER CODE END I2C1_Init 2 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */

View File

@ -21,6 +21,7 @@
#include "adc.h"
#include "dac.h"
#include "dma.h"
#include "i2c.h"
#include "spi.h"
#include "tim.h"
#include "usart.h"
@ -28,13 +29,11 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include "bsp.h"
#include "delay.h"
#include "board.h"
#include "app.h"
#include "test.h"
#include "diagnosis.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -68,21 +67,6 @@ void PeriphCommonClock_Config(void);
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/**
* @brief Write a character to a file stream, used for FLASHDB printf
*
* Writes the specified character to the given file stream and returns the written character.
*
* @param ch The character to be written
* @param stream Pointer to the file stream
*
* @return The written character
*/
int fputc(int ch, FILE *stream)
{
return ch;
}
/* USER CODE END 0 */
/**
@ -92,6 +76,7 @@ int fputc(int ch, FILE *stream)
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
@ -107,7 +92,6 @@ int main(void)
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0));
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
@ -117,8 +101,8 @@ int main(void)
PeriphCommonClock_Config();
/* USER CODE BEGIN SysInit */
delay_init((SystemCoreClock / 1000000));
// delay_ms(500); // wait for power stable
delay_init(4);
delay_ms(200); // wait for power stable
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
@ -134,19 +118,16 @@ int main(void)
MX_USART1_UART_Init();
MX_TIM6_Init();
MX_TIM7_Init();
MX_TIM17_Init();
MX_TIM16_Init();
MX_I2C1_Init();
MX_ADC2_Init();
MX_TIM4_Init();
/* USER CODE BEGIN 2 */
hart_uart_dinit(); // HART serial port Deinitialization
hart_ble_dinit(); // Bluetooth Deinitialization
leds_dinit(); // LED Deinitialization
lcd_dinit(); // LCD screen Deinitialization
DISABLE_TIM(PDCTRL_PWM_TIM);
my_mem_init(SRAMIN); // Initialize internal memory pool 1
my_mem_init(SRAMEX); // Initialize external memory pool 2
my_mem_init(SRAMIN); // Initialize internal memory pool
my_mem_init(SRAMEX); // Initialize internal memory pool
board_init(); // Initialize board
app_init(); // Initialize application
@ -183,31 +164,20 @@ void SystemClock_Config(void)
/* Wait till HSE is ready */
while (LL_RCC_HSE_IsReady() != 1)
{
}
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 12, LL_RCC_PLLR_DIV_6);
LL_RCC_PLL_EnableDomain_SYS();
LL_RCC_PLL_Enable();
/* Wait till PLL is ready */
while(LL_RCC_PLL_IsReady() != 1)
{
}
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE);
/* Wait till System clock is ready */
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE)
{
}
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_2);
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
LL_Init1msTick(5529600);
LL_Init1msTick(4000000);
LL_SetSystemCoreClock(5529600);
LL_SetSystemCoreClock(4000000);
}
/**
@ -216,14 +186,13 @@ void SystemClock_Config(void)
*/
void PeriphCommonClock_Config(void)
{
LL_RCC_PLLSAI1_ConfigDomain_ADC(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 12, LL_RCC_PLLSAI1R_DIV_8);
LL_RCC_PLLSAI1_ConfigDomain_ADC(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_1, 8, LL_RCC_PLLSAI1R_DIV_2);
LL_RCC_PLLSAI1_EnableDomain_ADC();
LL_RCC_PLLSAI1_Enable();
/* Wait till PLLSAI1 is ready */
while (LL_RCC_PLLSAI1_IsReady() != 1)
{
}
}

View File

@ -130,7 +130,7 @@ void MX_SPI2_Init(void)
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE;
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4;
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2;
SPI_InitStruct.BitOrder = LL_SPI_LSB_FIRST;
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
SPI_InitStruct.CRCPoly = 7;

View File

@ -27,7 +27,7 @@
#include "bsp.h"
#include "sys.h"
#include "app.h"
#include "diagnosis.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -58,6 +58,7 @@
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
extern uart_t *uarts[APP_UART_MAX];
extern i2c_t *eeprom_fm24_i2c;
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
@ -90,13 +91,11 @@ void NMI_Handler(void)
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
leds_off_all();
leds_on(LEDS_RED);
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
DBG_ASSERT(FALSE __DBG_LINE);
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
@ -206,27 +205,6 @@ void SysTick_Handler(void)
/* please refer to the startup file (startup_stm32l4xx.s). */
/******************************************************************************/
/**
* @brief This function handles EXTI line0 interrupt.
*/
void EXTI0_IRQHandler(void)
{
/* USER CODE BEGIN EXTI0_IRQn 0 */
/* USER CODE END EXTI0_IRQn 0 */
if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_0) != RESET)
{
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_0);
/* USER CODE BEGIN LL_EXTI_LINE_0 */
uart_rx_cd_callback(uarts[APP_UART_1]); // HART CD
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_0);
/* USER CODE END LL_EXTI_LINE_0 */
}
/* USER CODE BEGIN EXTI0_IRQn 1 */
/* USER CODE END EXTI0_IRQn 1 */
}
/**
* @brief This function handles DMA1 channel1 global interrupt.
*/
@ -241,6 +219,20 @@ void DMA1_Channel1_IRQHandler(void)
/* USER CODE END DMA1_Channel1_IRQn 1 */
}
/**
* @brief This function handles DMA1 channel2 global interrupt.
*/
void DMA1_Channel2_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Channel2_IRQn 0 */
/* USER CODE END DMA1_Channel2_IRQn 0 */
/* USER CODE BEGIN DMA1_Channel2_IRQn 1 */
adc_dma_callback(ADCS_2);
/* USER CODE END DMA1_Channel2_IRQn 1 */
}
/**
* @brief This function handles DMA1 channel5 global interrupt.
*/
@ -255,6 +247,34 @@ void DMA1_Channel5_IRQHandler(void)
/* USER CODE END DMA1_Channel5_IRQn 1 */
}
/**
* @brief This function handles DMA1 channel6 global interrupt.
*/
void DMA1_Channel6_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Channel6_IRQn 0 */
/* USER CODE END DMA1_Channel6_IRQn 0 */
/* USER CODE BEGIN DMA1_Channel6_IRQn 1 */
i2c_dma_callback(eeprom_fm24_i2c);
/* USER CODE END DMA1_Channel6_IRQn 1 */
}
/**
* @brief This function handles DMA1 channel7 global interrupt.
*/
void DMA1_Channel7_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Channel7_IRQn 0 */
/* USER CODE END DMA1_Channel7_IRQn 0 */
/* USER CODE BEGIN DMA1_Channel7_IRQn 1 */
i2c_dma_callback(eeprom_fm24_i2c);
/* USER CODE END DMA1_Channel7_IRQn 1 */
}
/**
* @brief This function handles ADC1 and ADC2 interrupts.
*/
@ -270,44 +290,30 @@ void ADC1_2_IRQHandler(void)
}
/**
* @brief This function handles TIM1 update interrupt and TIM16 global interrupt.
* @brief This function handles TIM4 global interrupt.
*/
void TIM1_UP_TIM16_IRQHandler(void)
void TIM4_IRQHandler(void)
{
/* USER CODE BEGIN TIM1_UP_TIM16_IRQn 0 */
/* USER CODE BEGIN TIM4_IRQn 0 */
/* USER CODE END TIM1_UP_TIM16_IRQn 0 */
/* USER CODE BEGIN TIM1_UP_TIM16_IRQn 1 */
if (IS_TIM_IT_FLAG(HART_TIM))
{
TIM_IRQ_HANDLER(HART_TIM);
hart_timer_interupt_cb();
}
/* USER CODE END TIM1_UP_TIM16_IRQn 1 */
/* USER CODE END TIM4_IRQn 0 */
/* USER CODE BEGIN TIM4_IRQn 1 */
TIM_IRQ_HANDLER(TIM4);
/* USER CODE END TIM4_IRQn 1 */
}
/**
* @brief This function handles TIM1 trigger and commutation interrupts and TIM17 global interrupt.
* @brief This function handles I2C1 event interrupt.
*/
void TIM1_TRG_COM_TIM17_IRQHandler(void)
void I2C1_EV_IRQHandler(void)
{
/* USER CODE BEGIN TIM1_TRG_COM_TIM17_IRQn 0 */
/* USER CODE BEGIN I2C1_EV_IRQn 0 */
/* USER CODE END TIM1_TRG_COM_TIM17_IRQn 0 */
/* USER CODE END I2C1_EV_IRQn 0 */
/* USER CODE BEGIN TIM1_TRG_COM_TIM17_IRQn 1 */
if (IS_TIM_IT_FLAG(MODE_GATHE_TIM))
{
TIM_IRQ_HANDLER(MODE_GATHE_TIM);
mode_ctrl_gather();
mode_ctrl_output();
if (rt_data.flag.bits.app_init_over == TRUE)
{
scheduler_time_1s_irqhandler(100);
}
}
/* USER CODE END TIM1_TRG_COM_TIM17_IRQn 1 */
/* USER CODE BEGIN I2C1_EV_IRQn 1 */
i2c_ev_callback(eeprom_fm24_i2c);
/* USER CODE END I2C1_EV_IRQn 1 */
}
/**
@ -320,14 +326,6 @@ void USART1_IRQHandler(void)
/* USER CODE END USART1_IRQn 0 */
/* USER CODE BEGIN USART1_IRQn 1 */
uart_reception_callback(uarts[APP_UART_1]);
if (uarts[APP_UART_1]->rx_index > 1)
{
if (hart_timeout_compare() == FALSE)
{
uart_data_storage_reset(uarts[APP_UART_1]);
}
}
hart_timer_start(HART_BYTE_INTERVAL_TIME);
/* USER CODE END USART1_IRQn 1 */
}
@ -354,17 +352,11 @@ void TIM6_DAC_IRQHandler(void)
/* USER CODE END TIM6_DAC_IRQn 0 */
/* USER CODE BEGIN TIM6_DAC_IRQn 1 */
if (IS_TIM_IT_FLAG(TASK_TIM))
{
TIM_IRQ_HANDLER(TASK_TIM);
LL_IncTick();
if (rt_data.flag.bits.app_init_over == TRUE)
if (IS_TIM_IT_FLAG(TIM6))
{
TIM_IRQ_HANDLER(TIM6);
FLOW_TICK_UPDATE();
#if HART_SOFTWARE_TEST_ENABLE == FALSE
button_ticks();
#endif
}
LL_IncTick();
}
/* USER CODE END TIM6_DAC_IRQn 1 */
}
@ -378,13 +370,10 @@ void TIM7_IRQHandler(void)
/* USER CODE END TIM7_IRQn 0 */
/* USER CODE BEGIN TIM7_IRQn 1 */
if (IS_TIM_IT_FLAG(MODE_TIM))
if (IS_TIM_IT_FLAG(TIM7))
{
TIM_IRQ_HANDLER(MODE_TIM);
if (rt_data.flag.bits.app_init_over == TRUE)
{
mode_ctrl_process();
}
TIM_IRQ_HANDLER(TIM7);
alog_control_module();
}
/* USER CODE END TIM7_IRQn 1 */

View File

@ -44,7 +44,7 @@ void MX_TIM2_Init(void)
/* USER CODE END TIM2_Init 1 */
TIM_InitStruct.Prescaler = 0;
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct.Autoreload = 5529;
TIM_InitStruct.Autoreload = 3999;
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
LL_TIM_Init(TIM2, &TIM_InitStruct);
LL_TIM_EnableARRPreload(TIM2);
@ -56,7 +56,7 @@ void MX_TIM2_Init(void)
TIM_OC_InitStruct.CompareValue = 0;
TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;
LL_TIM_OC_Init(TIM2, LL_TIM_CHANNEL_CH4, &TIM_OC_InitStruct);
LL_TIM_OC_EnableFast(TIM2, LL_TIM_CHANNEL_CH4);
LL_TIM_OC_DisableFast(TIM2, LL_TIM_CHANNEL_CH4);
LL_TIM_SetOCRefClearInputSource(TIM2, LL_TIM_OCREF_CLR_INT_NC);
LL_TIM_DisableExternalClock(TIM2);
LL_TIM_ConfigETR(TIM2, LL_TIM_ETR_POLARITY_NONINVERTED, LL_TIM_ETR_PRESCALER_DIV1, LL_TIM_ETR_FILTER_FDIV1);
@ -98,19 +98,19 @@ void MX_TIM3_Init(void)
/* USER CODE END TIM3_Init 1 */
TIM_InitStruct.Prescaler = 0;
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct.Autoreload = 11;
TIM_InitStruct.Autoreload = 3999;
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
LL_TIM_Init(TIM3, &TIM_InitStruct);
LL_TIM_EnableARRPreload(TIM3);
LL_TIM_SetClockSource(TIM3, LL_TIM_CLOCKSOURCE_INTERNAL);
LL_TIM_OC_EnablePreload(TIM3, LL_TIM_CHANNEL_CH2);
LL_TIM_OC_EnablePreload(TIM3, LL_TIM_CHANNEL_CH3);
TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_PWM1;
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;
TIM_OC_InitStruct.OCNState = LL_TIM_OCSTATE_DISABLE;
TIM_OC_InitStruct.CompareValue = 0;
TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;
LL_TIM_OC_Init(TIM3, LL_TIM_CHANNEL_CH2, &TIM_OC_InitStruct);
LL_TIM_OC_DisableFast(TIM3, LL_TIM_CHANNEL_CH2);
LL_TIM_OC_Init(TIM3, LL_TIM_CHANNEL_CH3, &TIM_OC_InitStruct);
LL_TIM_OC_DisableFast(TIM3, LL_TIM_CHANNEL_CH3);
LL_TIM_SetOCRefClearInputSource(TIM3, LL_TIM_OCREF_CLR_INT_NC);
LL_TIM_DisableExternalClock(TIM3);
LL_TIM_ConfigETR(TIM3, LL_TIM_ETR_POLARITY_NONINVERTED, LL_TIM_ETR_PRESCALER_DIV1, LL_TIM_ETR_FILTER_FDIV1);
@ -121,15 +121,49 @@ void MX_TIM3_Init(void)
/* USER CODE END TIM3_Init 2 */
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOE);
/**TIM3 GPIO Configuration
PE4 ------> TIM3_CH2
PE5 ------> TIM3_CH3
*/
GPIO_InitStruct.Pin = LL_GPIO_PIN_4;
GPIO_InitStruct.Pin = PWM_OUT_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
GPIO_InitStruct.Alternate = LL_GPIO_AF_2;
LL_GPIO_Init(GPIOE, &GPIO_InitStruct);
LL_GPIO_Init(PWM_OUT_GPIO_Port, &GPIO_InitStruct);
}
/* TIM4 init function */
void MX_TIM4_Init(void)
{
/* USER CODE BEGIN TIM4_Init 0 */
/* USER CODE END TIM4_Init 0 */
LL_TIM_InitTypeDef TIM_InitStruct = {0};
/* Peripheral clock enable */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM4);
/* TIM4 interrupt Init */
NVIC_SetPriority(TIM4_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(TIM4_IRQn);
/* USER CODE BEGIN TIM4_Init 1 */
/* USER CODE END TIM4_Init 1 */
TIM_InitStruct.Prescaler = 999;
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct.Autoreload = 3999;
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
LL_TIM_Init(TIM4, &TIM_InitStruct);
LL_TIM_EnableARRPreload(TIM4);
LL_TIM_SetClockSource(TIM4, LL_TIM_CLOCKSOURCE_INTERNAL);
LL_TIM_SetTriggerOutput(TIM4, LL_TIM_TRGO_UPDATE);
LL_TIM_DisableMasterSlaveMode(TIM4);
/* USER CODE BEGIN TIM4_Init 2 */
/* USER CODE END TIM4_Init 2 */
}
/* TIM6 init function */
@ -152,7 +186,7 @@ void MX_TIM6_Init(void)
/* USER CODE BEGIN TIM6_Init 1 */
/* USER CODE END TIM6_Init 1 */
TIM_InitStruct.Prescaler = 552;
TIM_InitStruct.Prescaler = 399;
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct.Autoreload = 99;
LL_TIM_Init(TIM6, &TIM_InitStruct);
@ -184,9 +218,9 @@ void MX_TIM7_Init(void)
/* USER CODE BEGIN TIM7_Init 1 */
/* USER CODE END TIM7_Init 1 */
TIM_InitStruct.Prescaler = 552;
TIM_InitStruct.Prescaler = 399;
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct.Autoreload = 249;
TIM_InitStruct.Autoreload = 99;
LL_TIM_Init(TIM7, &TIM_InitStruct);
LL_TIM_EnableARRPreload(TIM7);
LL_TIM_SetTriggerOutput(TIM7, LL_TIM_TRGO_RESET);
@ -195,70 +229,6 @@ void MX_TIM7_Init(void)
/* USER CODE END TIM7_Init 2 */
}
/* TIM16 init function */
void MX_TIM16_Init(void)
{
/* USER CODE BEGIN TIM16_Init 0 */
/* USER CODE END TIM16_Init 0 */
LL_TIM_InitTypeDef TIM_InitStruct = {0};
/* Peripheral clock enable */
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM16);
/* TIM16 interrupt Init */
NVIC_SetPriority(TIM1_UP_TIM16_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),15, 0));
NVIC_EnableIRQ(TIM1_UP_TIM16_IRQn);
/* USER CODE BEGIN TIM16_Init 1 */
/* USER CODE END TIM16_Init 1 */
TIM_InitStruct.Prescaler = 552;
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct.Autoreload = 24;
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
TIM_InitStruct.RepetitionCounter = 0;
LL_TIM_Init(TIM16, &TIM_InitStruct);
LL_TIM_EnableARRPreload(TIM16);
/* USER CODE BEGIN TIM16_Init 2 */
/* USER CODE END TIM16_Init 2 */
}
/* TIM17 init function */
void MX_TIM17_Init(void)
{
/* USER CODE BEGIN TIM17_Init 0 */
/* USER CODE END TIM17_Init 0 */
LL_TIM_InitTypeDef TIM_InitStruct = {0};
/* Peripheral clock enable */
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM17);
/* TIM17 interrupt Init */
NVIC_SetPriority(TIM1_TRG_COM_TIM17_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));
NVIC_EnableIRQ(TIM1_TRG_COM_TIM17_IRQn);
/* USER CODE BEGIN TIM17_Init 1 */
/* USER CODE END TIM17_Init 1 */
TIM_InitStruct.Prescaler = 552;
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct.Autoreload = 999;
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
TIM_InitStruct.RepetitionCounter = 0;
LL_TIM_Init(TIM17, &TIM_InitStruct);
LL_TIM_EnableARRPreload(TIM17);
/* USER CODE BEGIN TIM17_Init 2 */
/* USER CODE END TIM17_Init 2 */
}
/* USER CODE BEGIN 1 */

View File

@ -100,13 +100,13 @@ void MX_UART5_Init(void)
LL_DMA_SetMemorySize(DMA2, LL_DMA_CHANNEL_1, LL_DMA_MDATAALIGN_BYTE);
/* UART5 interrupt Init */
NVIC_SetPriority(UART5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),3, 0));
NVIC_SetPriority(UART5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),14, 0));
NVIC_EnableIRQ(UART5_IRQn);
/* USER CODE BEGIN UART5_Init 1 */
/* USER CODE END UART5_Init 1 */
UART_InitStruct.BaudRate = 115200;
UART_InitStruct.BaudRate = 9600;
UART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
UART_InitStruct.StopBits = LL_USART_STOPBITS_1;
UART_InitStruct.Parity = LL_USART_PARITY_NONE;
@ -189,7 +189,7 @@ void MX_USART1_UART_Init(void)
LL_DMA_SetMemorySize(DMA2, LL_DMA_CHANNEL_6, LL_DMA_MDATAALIGN_BYTE);
/* USART1 interrupt Init */
NVIC_SetPriority(USART1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_SetPriority(USART1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),1, 0));
NVIC_EnableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_Init 1 */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,244 @@
/**
******************************************************************************
* @file stm32l4xx_ll_i2c.c
* @author MCD Application Team
* @brief I2C LL module driver.
******************************************************************************
* @attention
*
* Copyright (c) 2017 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_ll_i2c.h"
#include "stm32l4xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif /* USE_FULL_ASSERT */
/** @addtogroup STM32L4xx_LL_Driver
* @{
*/
#if defined (I2C1) || defined (I2C2) || defined (I2C3) || defined (I2C4)
/** @defgroup I2C_LL I2C
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup I2C_LL_Private_Macros
* @{
*/
#define IS_LL_I2C_PERIPHERAL_MODE(__VALUE__) (((__VALUE__) == LL_I2C_MODE_I2C) || \
((__VALUE__) == LL_I2C_MODE_SMBUS_HOST) || \
((__VALUE__) == LL_I2C_MODE_SMBUS_DEVICE) || \
((__VALUE__) == LL_I2C_MODE_SMBUS_DEVICE_ARP))
#define IS_LL_I2C_ANALOG_FILTER(__VALUE__) (((__VALUE__) == LL_I2C_ANALOGFILTER_ENABLE) || \
((__VALUE__) == LL_I2C_ANALOGFILTER_DISABLE))
#define IS_LL_I2C_DIGITAL_FILTER(__VALUE__) ((__VALUE__) <= 0x0000000FU)
#define IS_LL_I2C_OWN_ADDRESS1(__VALUE__) ((__VALUE__) <= 0x000003FFU)
#define IS_LL_I2C_TYPE_ACKNOWLEDGE(__VALUE__) (((__VALUE__) == LL_I2C_ACK) || \
((__VALUE__) == LL_I2C_NACK))
#define IS_LL_I2C_OWN_ADDRSIZE(__VALUE__) (((__VALUE__) == LL_I2C_OWNADDRESS1_7BIT) || \
((__VALUE__) == LL_I2C_OWNADDRESS1_10BIT))
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup I2C_LL_Exported_Functions
* @{
*/
/** @addtogroup I2C_LL_EF_Init
* @{
*/
/**
* @brief De-initialize the I2C registers to their default reset values.
* @param I2Cx I2C Instance.
* @retval An ErrorStatus enumeration value:
* - SUCCESS: I2C registers are de-initialized
* - ERROR: I2C registers are not de-initialized
*/
ErrorStatus LL_I2C_DeInit(const I2C_TypeDef *I2Cx)
{
ErrorStatus status = SUCCESS;
/* Check the I2C Instance I2Cx */
assert_param(IS_I2C_ALL_INSTANCE(I2Cx));
if (I2Cx == I2C1)
{
/* Force reset of I2C clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C1);
/* Release reset of I2C clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C1);
}
#if defined(I2C2)
else if (I2Cx == I2C2)
{
/* Force reset of I2C clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C2);
/* Release reset of I2C clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C2);
}
#endif /* I2C2 */
else if (I2Cx == I2C3)
{
/* Force reset of I2C clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C3);
/* Release reset of I2C clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C3);
}
#if defined(I2C4)
else if (I2Cx == I2C4)
{
/* Force reset of I2C clock */
LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_I2C4);
/* Release reset of I2C clock */
LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_I2C4);
}
#endif /* I2C4 */
else
{
status = ERROR;
}
return status;
}
/**
* @brief Initialize the I2C registers according to the specified parameters in I2C_InitStruct.
* @param I2Cx I2C Instance.
* @param I2C_InitStruct pointer to a @ref LL_I2C_InitTypeDef structure.
* @retval An ErrorStatus enumeration value:
* - SUCCESS: I2C registers are initialized
* - ERROR: Not applicable
*/
ErrorStatus LL_I2C_Init(I2C_TypeDef *I2Cx, const LL_I2C_InitTypeDef *I2C_InitStruct)
{
/* Check the I2C Instance I2Cx */
assert_param(IS_I2C_ALL_INSTANCE(I2Cx));
/* Check the I2C parameters from I2C_InitStruct */
assert_param(IS_LL_I2C_PERIPHERAL_MODE(I2C_InitStruct->PeripheralMode));
assert_param(IS_LL_I2C_ANALOG_FILTER(I2C_InitStruct->AnalogFilter));
assert_param(IS_LL_I2C_DIGITAL_FILTER(I2C_InitStruct->DigitalFilter));
assert_param(IS_LL_I2C_OWN_ADDRESS1(I2C_InitStruct->OwnAddress1));
assert_param(IS_LL_I2C_TYPE_ACKNOWLEDGE(I2C_InitStruct->TypeAcknowledge));
assert_param(IS_LL_I2C_OWN_ADDRSIZE(I2C_InitStruct->OwnAddrSize));
/* Disable the selected I2Cx Peripheral */
LL_I2C_Disable(I2Cx);
/*---------------------------- I2Cx CR1 Configuration ------------------------
* Configure the analog and digital noise filters with parameters :
* - AnalogFilter: I2C_CR1_ANFOFF bit
* - DigitalFilter: I2C_CR1_DNF[3:0] bits
*/
LL_I2C_ConfigFilters(I2Cx, I2C_InitStruct->AnalogFilter, I2C_InitStruct->DigitalFilter);
/*---------------------------- I2Cx TIMINGR Configuration --------------------
* Configure the SDA setup, hold time and the SCL high, low period with parameter :
* - Timing: I2C_TIMINGR_PRESC[3:0], I2C_TIMINGR_SCLDEL[3:0], I2C_TIMINGR_SDADEL[3:0],
* I2C_TIMINGR_SCLH[7:0] and I2C_TIMINGR_SCLL[7:0] bits
*/
LL_I2C_SetTiming(I2Cx, I2C_InitStruct->Timing);
/* Enable the selected I2Cx Peripheral */
LL_I2C_Enable(I2Cx);
/*---------------------------- I2Cx OAR1 Configuration -----------------------
* Disable, Configure and Enable I2Cx device own address 1 with parameters :
* - OwnAddress1: I2C_OAR1_OA1[9:0] bits
* - OwnAddrSize: I2C_OAR1_OA1MODE bit
*/
LL_I2C_DisableOwnAddress1(I2Cx);
LL_I2C_SetOwnAddress1(I2Cx, I2C_InitStruct->OwnAddress1, I2C_InitStruct->OwnAddrSize);
/* OwnAdress1 == 0 is reserved for General Call address */
if (I2C_InitStruct->OwnAddress1 != 0U)
{
LL_I2C_EnableOwnAddress1(I2Cx);
}
/*---------------------------- I2Cx MODE Configuration -----------------------
* Configure I2Cx peripheral mode with parameter :
* - PeripheralMode: I2C_CR1_SMBDEN and I2C_CR1_SMBHEN bits
*/
LL_I2C_SetMode(I2Cx, I2C_InitStruct->PeripheralMode);
/*---------------------------- I2Cx CR2 Configuration ------------------------
* Configure the ACKnowledge or Non ACKnowledge condition
* after the address receive match code or next received byte with parameter :
* - TypeAcknowledge: I2C_CR2_NACK bit
*/
LL_I2C_AcknowledgeNextData(I2Cx, I2C_InitStruct->TypeAcknowledge);
return SUCCESS;
}
/**
* @brief Set each @ref LL_I2C_InitTypeDef field to default value.
* @param I2C_InitStruct Pointer to a @ref LL_I2C_InitTypeDef structure.
* @retval None
*/
void LL_I2C_StructInit(LL_I2C_InitTypeDef *I2C_InitStruct)
{
/* Set I2C_InitStruct fields to default values */
I2C_InitStruct->PeripheralMode = LL_I2C_MODE_I2C;
I2C_InitStruct->Timing = 0U;
I2C_InitStruct->AnalogFilter = LL_I2C_ANALOGFILTER_ENABLE;
I2C_InitStruct->DigitalFilter = 0U;
I2C_InitStruct->OwnAddress1 = 0U;
I2C_InitStruct->TypeAcknowledge = LL_I2C_NACK;
I2C_InitStruct->OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* I2C1 || I2C2 || I2C3 || I2C4 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */

15
MDK-ARM/.gitignore vendored
View File

@ -1,15 +0,0 @@
# dot files
/.vscode/launch.json
/.settings
/.eide/log
/.eide.usr.ctx.json
# project out
/build
/bin
/obj
/out
# eide template
*.ept
*.eide-template

View File

@ -42,3 +42,5 @@ WrOverrideAndMask = 0xFFFFFFFF
WrOverrideAddr = 0xFFFFFFFF
[RAM]
VerifyDownload = 0x00
[DYN_MEM_MAP]
NumUserRegion = 0x00

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'bootload'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'bootload1'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v4'
* Target: 'common'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'controller-epm'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller'
* Target: 'controller-jlink'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller'
* Target: 'controller-stlink'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'controller-v2.5'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,6 +1,6 @@
/*
* Auto generated Run-Time-Environment Configuration File
* Auto generated Run-Time-Environment Component Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
@ -17,5 +17,4 @@
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'controller-v24'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'controller-v25'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'controller-v4'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'controller-v5'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller'
* Target: 'controller'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'gui'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v4'
* Target: 'hart'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'controller-v2'
* Target: 'update'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32l4xx.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,8 +0,0 @@
/*-----------------------------------------------------------------------------------*/
/* Auto generate by EIDE, don't modify this file, any changes will be overwritten ! */
/*-----------------------------------------------------------------------------------*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
#endif

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- !!! Embedded IDE: Cppcheck config template !!! -->
<project version="1">
<builddir>${cppcheck_build_folder}</builddir>
<platform>${platform}</platform>
<analyze-all-vs-configs>false</analyze-all-vs-configs>
<check-headers>true</check-headers>
<check-unused-templates>true</check-unused-templates>
<max-ctu-depth>2</max-ctu-depth>
<max-template-recursion>100</max-template-recursion>
<includedir>
<!-- !!! DON'T MODIFY THE FLOLLOWING CONTENTS !!! -->
${include_list}
</includedir>
<defines>
<!-- example: <define name="DEF=123"/> -->
${macro_list}
</defines>
<undefines>
<!-- example: <undefine>UNDEF</undefine> -->
</undefines>
<paths>
<!-- !!! DON'T MODIFY THE FLOLLOWING CONTENTS !!! -->
${source_list}
</paths>
<libraries>
<!-- example: <library>gnu</library> -->
${lib_list}
</libraries>
</project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,255 +0,0 @@
--create .\controller-v2\uc_gui.lib
.\controller-v2\debug.o
.\controller-v2\lib.o
.\controller-v2\malloc.o
.\controller-v2\flow_core.o
.\controller-v2\sqqueue.o
.\controller-v2\filter.o
.\controller-v2\clist.o
.\controller-v2\menu.o
.\controller-v2\cmac.o
.\controller-v2\aes.o
.\controller-v2\pid.o
.\controller-v2\pid_auto_tune.o
.\controller-v2\pid_fuzzy.o
.\controller-v2\pid_neural.o
.\controller-v2\guiaaarc.o
.\controller-v2\guiaachar.o
.\controller-v2\guiaachar2.o
.\controller-v2\guiaachar4.o
.\controller-v2\guiaacircle.o
.\controller-v2\guiaalib.o
.\controller-v2\guiaaline.o
.\controller-v2\guiaapoly.o
.\controller-v2\guiaapolyout.o
.\controller-v2\lcddummy.o
.\controller-v2\lcdnull.o
.\controller-v2\lcdwin.o
.\controller-v2\gui_x.o
.\controller-v2\lcdp0.o
.\controller-v2\lcdp2.o
.\controller-v2\lcdp4.o
.\controller-v2\gui__addspacehex.o
.\controller-v2\gui__calctextrect.o
.\controller-v2\gui__divideround.o
.\controller-v2\gui__divideround32.o
.\controller-v2\gui__getfontsizey.o
.\controller-v2\gui__getnumchars.o
.\controller-v2\gui__handleeoline.o
.\controller-v2\gui__intersectrect.o
.\controller-v2\gui__intersectrects.o
.\controller-v2\gui__memset.o
.\controller-v2\gui__memset16.o
.\controller-v2\gui__read.o
.\controller-v2\gui__reducerect.o
.\controller-v2\gui__settext.o
.\controller-v2\gui__strcmp.o
.\controller-v2\gui__strlen.o
.\controller-v2\gui__wrap.o
.\controller-v2\gui_addbin.o
.\controller-v2\gui_adddec.o
.\controller-v2\gui_adddecmin.o
.\controller-v2\gui_adddecshift.o
.\controller-v2\gui_addhex.o
.\controller-v2\gui_addkeymsghook.o
.\controller-v2\gui_alloc_allocinit.o
.\controller-v2\gui_alloc_alloczero.o
.\controller-v2\gui_bmp.o
.\controller-v2\gui_bmp_serialize.o
.\controller-v2\gui_calccolordist.o
.\controller-v2\gui_clearrectex.o
.\controller-v2\gui_color2viscolor.o
.\controller-v2\gui_cursorarrowl.o
.\controller-v2\gui_cursorarrowli.o
.\controller-v2\gui_cursorarrowlpx.o
.\controller-v2\gui_cursorarrowm.o
.\controller-v2\gui_cursorarrowmi.o
.\controller-v2\gui_cursorarrowmpx.o
.\controller-v2\gui_cursorarrows.o
.\controller-v2\gui_cursorarrowsi.o
.\controller-v2\gui_cursorarrowspx.o
.\controller-v2\gui_cursorcrossl.o
.\controller-v2\gui_cursorcrossli.o
.\controller-v2\gui_cursorcrosslpx.o
.\controller-v2\gui_cursorcrossm.o
.\controller-v2\gui_cursorcrossmi.o
.\controller-v2\gui_cursorcrossmpx.o
.\controller-v2\gui_cursorcrosss.o
.\controller-v2\gui_cursorcrosssi.o
.\controller-v2\gui_cursorcrossspx.o
.\controller-v2\gui_cursorheaderm.o
.\controller-v2\gui_cursorheadermi.o
.\controller-v2\gui_cursorheadermpx.o
.\controller-v2\gui_cursorpal.o
.\controller-v2\gui_cursorpali.o
.\controller-v2\gui_dispbin.o
.\controller-v2\gui_dispceol.o
.\controller-v2\gui_dispchar.o
.\controller-v2\gui_dispchars.o
.\controller-v2\gui_disphex.o
.\controller-v2\gui_dispstring.o
.\controller-v2\gui_dispstringat.o
.\controller-v2\gui_dispstringatceol.o
.\controller-v2\gui_dispstringhcenter.o
.\controller-v2\gui_dispstringinrect.o
.\controller-v2\gui_dispstringinrectex.o
.\controller-v2\gui_dispstringinrectmax.o
.\controller-v2\gui_dispstringlen.o
.\controller-v2\gui_drawbitmap.o
.\controller-v2\gui_drawbitmapex.o
.\controller-v2\gui_drawbitmapexp.o
.\controller-v2\gui_drawbitmapmag.o
.\controller-v2\gui_drawfocusrect.o
.\controller-v2\gui_drawgraph.o
.\controller-v2\gui_drawhline.o
.\controller-v2\gui_drawpie.o
.\controller-v2\gui_drawpixel.o
.\controller-v2\gui_drawpolyline.o
.\controller-v2\gui_drawrectex.o
.\controller-v2\gui_drawvline.o
.\controller-v2\gui_errorout.o
.\controller-v2\gui_exec.o
.\controller-v2\gui_fillpolygon.o
.\controller-v2\gui_fillrect.o
.\controller-v2\gui_fillrectex.o
.\controller-v2\gui_getbitmappixelcolor.o
.\controller-v2\gui_getbitmappixelindex.o
.\controller-v2\gui_getclientrect.o
.\controller-v2\gui_getcolor.o
.\controller-v2\gui_getdisppos.o
.\controller-v2\gui_getfont.o
.\controller-v2\gui_getfontinfo.o
.\controller-v2\gui_getfontsizey.o
.\controller-v2\gui_getlinestyle.o
.\controller-v2\gui_getstringdistx.o
.\controller-v2\gui_gettextalign.o
.\controller-v2\gui_gettextextend.o
.\controller-v2\gui_gettextmode.o
.\controller-v2\gui_getversionstring.o
.\controller-v2\gui_getysizeoffont.o
.\controller-v2\gui_goto.o
.\controller-v2\gui_initlut.o
.\controller-v2\gui_invertrect.o
.\controller-v2\gui_isinfont.o
.\controller-v2\gui_log.o
.\controller-v2\gui_mergerect.o
.\controller-v2\gui_mouse.o
.\controller-v2\gui_mouse_driverps2.o
.\controller-v2\gui_moverect.o
.\controller-v2\gui_onkey.o
.\controller-v2\gui_pen.o
.\controller-v2\gui_pid.o
.\controller-v2\gui_rectsintersect.o
.\controller-v2\gui_savecontext.o
.\controller-v2\gui_selectlayer.o
.\controller-v2\gui_selectlcd.o
.\controller-v2\gui_setcolor.o
.\controller-v2\gui_setcolorindex.o
.\controller-v2\gui_setdecchar.o
.\controller-v2\gui_setdefault.o
.\controller-v2\gui_setdrawmode.o
.\controller-v2\gui_setfont.o
.\controller-v2\gui_setlborder.o
.\controller-v2\gui_setlinestyle.o
.\controller-v2\gui_setlutcolor.o
.\controller-v2\gui_setlutcolorex.o
.\controller-v2\gui_setlutentry.o
.\controller-v2\gui_setorg.o
.\controller-v2\gui_setpixelindex.o
.\controller-v2\gui_settextalign.o
.\controller-v2\gui_settextmode.o
.\controller-v2\gui_settextstyle.o
.\controller-v2\gui_sif.o
.\controller-v2\gui_sif_prop.o
.\controller-v2\gui_touch.o
.\controller-v2\gui_touch_driveranalog.o
.\controller-v2\gui_touch_storestate.o
.\controller-v2\gui_touch_storeunstable.o
.\controller-v2\gui_uc.o
.\controller-v2\gui_uc_dispstring.o
.\controller-v2\gui_uc_encodenone.o
.\controller-v2\gui_uc_encodeutf8.o
.\controller-v2\gui_waitevent.o
.\controller-v2\gui_waitkey.o
.\controller-v2\gui_warn.o
.\controller-v2\gui2dlib.o
.\controller-v2\guialloc.o
.\controller-v2\guiarc.o
.\controller-v2\guichar.o
.\controller-v2\guicharline.o
.\controller-v2\guicharm.o
.\controller-v2\guicharp.o
.\controller-v2\guicirc.o
.\controller-v2\guicolor2index.o
.\controller-v2\guicore.o
.\controller-v2\guicurs.o
.\controller-v2\guiencjs.o
.\controller-v2\guiindex2color.o
.\controller-v2\guipolye.o
.\controller-v2\guipolym.o
.\controller-v2\guipolyr.o
.\controller-v2\guirealloc.o
.\controller-v2\guistream.o
.\controller-v2\guitask.o
.\controller-v2\guitime.o
.\controller-v2\guitimer.o
.\controller-v2\guiuc0.o
.\controller-v2\guival.o
.\controller-v2\guivalf.o
.\controller-v2\lcd.o
.\controller-v2\lcd_api.o
.\controller-v2\lcd_drawbitmap_565.o
.\controller-v2\lcd_drawbitmap_m565.o
.\controller-v2\lcd_drawvline.o
.\controller-v2\lcd_getcolorindex.o
.\controller-v2\lcd_getex.o
.\controller-v2\lcd_getnumdisplays.o
.\controller-v2\lcd_getpixelcolor.o
.\controller-v2\lcd_index2colorex.o
.\controller-v2\lcd_l0_generic.o
.\controller-v2\lcd_mirror.o
.\controller-v2\lcd_mixcolors256.o
.\controller-v2\lcd_rotate180.o
.\controller-v2\lcd_rotateccw.o
.\controller-v2\lcd_rotatecw.o
.\controller-v2\lcd_selectlcd.o
.\controller-v2\lcd_setapi.o
.\controller-v2\lcd_setcliprectex.o
.\controller-v2\lcd_updatecolorindices.o
.\controller-v2\lcdaa.o
.\controller-v2\lcdcolor.o
.\controller-v2\lcdgetp.o
.\controller-v2\lcdinfo.o
.\controller-v2\lcdinfo0.o
.\controller-v2\lcdinfo1.o
.\controller-v2\lcdl0delta.o
.\controller-v2\lcdl0mag.o
.\controller-v2\lcdp1.o
.\controller-v2\lcdp565_index2color.o
.\controller-v2\lcdpm565_index2color.o
.\controller-v2\lcdrle4.o
.\controller-v2\lcdrle8.o
.\controller-v2\lcdp111.o
.\controller-v2\lcdp222.o
.\controller-v2\lcdp233.o
.\controller-v2\lcdp323.o
.\controller-v2\lcdp332.o
.\controller-v2\lcdp444_12.o
.\controller-v2\lcdp444_12_1.o
.\controller-v2\lcdp444_16.o
.\controller-v2\lcdp555.o
.\controller-v2\lcdp556.o
.\controller-v2\lcdp565.o
.\controller-v2\lcdp655.o
.\controller-v2\lcdp8666.o
.\controller-v2\lcdp8666_1.o
.\controller-v2\lcdpm233.o
.\controller-v2\lcdpm323.o
.\controller-v2\lcdpm332.o
.\controller-v2\lcdpm444_12.o
.\controller-v2\lcdpm444_16.o
.\controller-v2\lcdpm555.o
.\controller-v2\lcdpm556.o
.\controller-v2\lcdpm565.o
.\controller-v2\lcdpm655.o
..\Middlewares\ST\ARM\DSP\Lib\arm_cortexM4l_math.lib

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
set filename=controller-bootload
set path=controller-v2
@echo off
copy %path%\%filename%.hex ..\Public\出厂文件\output
move .\%filename%.bin ..\Public\出厂文件\output

View File

@ -1,18 +0,0 @@
set project_name=controller-v2
set version=v2.4
set out_filename=controller
set output_file_name=%out_filename%_%version%
set path=controller-v2
@echo off
@REM 判断文件是否存在
set file_path=%path%\%project_name%.hex
if exist %file_path% (
move %file_path% ..\Public\出厂文件\output\%output_file_name%.hex
)
set file_path=.\%project_name%.bin
if exist %file_path% (
move %file_path% ..\Public\出厂文件\output\%output_file_name%.bin
)

View File

@ -1,4 +0,0 @@
set filename=uc_gui
set path=controller-v2
@echo off
copy %path%\%filename%.lib ..\User\lib\lcd

View File

@ -28,7 +28,7 @@
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x1200
Stack_Size EQU 0x1000
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
@ -39,7 +39,7 @@ __initial_sp
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x200
Heap_Size EQU 0x800
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base

View File

@ -1,25 +0,0 @@
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x08000000 0x0006E000 { ; load region size_region
ER_IROM1 0x08000000 0x0006E000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_RAM1 0x10007FF0 UNINIT 0x00000010 { ; RW data
.ANY (+RW +ZI)
}
RW_RAM2 0x10007000 UNINIT 0x00000FF0 { ; No init data
.ANY(NOINIT)
}
RW_IRAM1 0x20000000 0x00018000 {
.ANY (+RW +ZI)
}
RW_IRAM2 0x10000000 0x00007000 {
.ANY (+RW +ZI)
}
}

View File

@ -1,16 +1,15 @@
UIPATH=Tests/gui
current_time=$(shell date +%Y%m%d%H%M)
# 获得当前git的用户邮箱
current_user=$(shell git config user.email)
.PHONY:clean cc
all: clean
cc:
git rm -r --cached .
git add .
git commit -m "$(current_user) batch push $(current_time)"
git push origin develop
git push
clean:
cmd /c keilkill.bat

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1,9 +1,7 @@
# 项目简介
本项目是基于STM32L072开发的控制器。
# 目录说明
+---application 应用层,需要实现的功能
| +---inc
| \---src
@ -35,29 +33,6 @@
\---src 系统源文件
# 架构图
<img src="./Public/img/架构图.png" style="zoom:200%;"></img>
# 未处理问题
1. 开机通电时间
2. 全开全关时间
3. 蓝牙在手动模式下使用
4. 控制满足条件
a) 位置起动时间与信号给出时间的滞后不大于1s25%阶跃);
b) 最终定位与信号要求位置误差不大于±0.5%稳态时间小于2s
c) 调节过程位移过冲不大于1%
d) 动态误差带小于5%
e) 动态线性度小于1%
f) 满足振动(包括管道内波动)试验要求。
g) 需要考虑不同的摩擦力
# BUG清单

View File

@ -1,8 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CIDR" type="CPP_MODULE" version="4" />

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Tests.iml" filepath="$PROJECT_DIR$/.idea/Tests.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -1,61 +0,0 @@
BIN = run.exe
SO = lib.dll
SRC = \
../User/lib/src/malloc.c \
../User/lib/src/sqqueue.c \
../User/lib/src/mlist.c \
../User/lib/src/debug.c \
../User/lib/src/data_analysis.c \
../User/lib/src/filter.c \
../User/lib/src/clist.c \
../User/lib/src/aes.c \
../User/lib/src/cmac.c \
../User/lib/src/lib.c
EXAMPLE = \
./test_hart.c
CPLUS_INCLUDE_PATH= -I ../User/lib/inc -I ../User/lib/uthash
# 变量CC给定编译器名gcc
# 变量CFLAGS传给编译器的某些编译参数看需求添加
CC = gcc
CFLAGS = -m32 -std=c99
# 变量GDB给定debugger名gdb
# 变量RM给定删除文件方式用于后面删除所有编译所得的.o文件,linux下使用rm -rf
GDB = gdb
RM = rm -rf
# 变量OBJS将变量SRC中所有的.c文件替换成以.o结尾即将.c源文件编译成.o文件
OBJS = $(SRC:%.c=%.o)
EXAPMLES = $(EXAMPLE:%.c=%.o)
$(SO): $(OBJS) $(EXAPMLES)
# pull in dependencies for .o files
-include $(OBJS:.o=.d)
%.o: %.c
$(CC) $(CPLUS_INCLUDE_PATH) $(CFLAGS) -c $< -o $@
.PHONY: all clean clist data_analysis
all: $(SO)
rm:
$(RM) $(OBJS)
hart:$(SO)
$(CC) $(CPLUS_INCLUDE_PATH) $(CFLAGS) $(OBJS) ./test_hart.o -o $(BIN)
$(RM) $(OBJS) $(EXAPMLES)
run
#运行程序
run:
./run.exe
clean:
$(RM) $(OBJS) $(EXAPMLES) $(BIN)

View File

@ -1,41 +0,0 @@
#include "unity.h"
#include "eeprom_fm24.c"
void setUp(void)
{
// 这里可以进行每个测试用例开始前的设置
}
void tearDown(void)
{
// 这里可以进行每个测试用例结束后的清理
}
void test_eeprom_fm24_write(void)
{
// 测试写入数据
uint32_t write_addr = 0x0000;
uint8_t data[] = {0x01, 0x02, 0x03, 0x04, 0x05};
uint16_t length = sizeof(data);
TEST_ASSERT_TRUE(eeprom_fm24_write(write_addr, data, length));
}
void test_eeprom_fm24_read(void)
{
// 测试读取数据
uint32_t read_addr = 0x0000;
uint8_t data[5];
uint16_t length = sizeof(data);
TEST_ASSERT_TRUE(eeprom_fm24_read(read_addr, data, length));
TEST_ASSERT_EQUAL_HEX8_ARRAY((uint8_t[]){0x01, 0x02, 0x03, 0x04, 0x05}, data, length);
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_eeprom_fm24_write);
RUN_TEST(test_eeprom_fm24_read);
return UNITY_END();
}

View File

@ -1,113 +0,0 @@
#include "unity.h"
#include "eeprom_m95.h"
void setUp(void)
{
// Set up code here
}
void tearDown(void)
{
// Tear down code here
}
void test_eeprom_m95_read(void)
{
// Test case for eeprom_m95_read function
m95_number_e num = M95_1;
uint32_t read_addr = 0x0000;
uint8_t data[10];
uint16_t length = 10;
// Perform the read operation
eeprom_m95_read(num, read_addr, data, length);
// Add assertions here to verify the correctness of the read operation
TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_data, data, length);
}
void test_eeprom_m95_write(void)
{
// Test case for eeprom_m95_write function
m95_number_e num = M95_1;
uint32_t write_addr = 0x0000;
uint8_t data[10] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22, 0x33, 0x44};
uint16_t length = 10;
// Perform the write operation
eeprom_m95_write(num, write_addr, data, length);
// Add assertions here to verify the correctness of the write operation
// You can perform a subsequent read operation to verify the written data
}
void test_eeprom_m95_enable(void)
{
// Test case for eeprom_m95_enable function
// Perform the enable operation
eeprom_m95_enable();
// Add assertions here to verify the correctness of the enable operation
// You can check the status of the M95 EEPROM to ensure it is enabled
}
void test_eeprom_m95_disable(void)
{
// Test case for eeprom_m95_disable function
// Perform the disable operation
eeprom_m95_disable();
// Add assertions here to verify the correctness of the disable operation
// You can check the status of the M95 EEPROM to ensure it is disabled
}
void test_eeprom_m95_init(void)
{
// Test case for eeprom_m95_init function
m95_number_e num = M95_1;
// Perform the initialization
eeprom_m95_init(num);
// Add assertions here to verify the correctness of the initialization
// You can check the values of the initialized variables and perform any necessary checks
}
void test_eeprom_m95_dinit(void)
{
// Test case for eeprom_m95_dinit function
m95_number_e num = M95_1;
// Perform the deinitialization
eeprom_m95_dinit(num);
// Add assertions here to verify the correctness of the deinitialization
// You can check the status of the M95 EEPROM to ensure it is properly deinitialized
}
void test_eeprom_m95_test(void)
{
// Test case for eeprom_m95_test function
m95_number_e num = M95_1;
// Perform the test
eeprom_m95_test(num);
// Add assertions here to verify the correctness of the test
// You can check the results of the test and perform any necessary checks
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_eeprom_m95_read);
RUN_TEST(test_eeprom_m95_write);
RUN_TEST(test_eeprom_m95_enable);
RUN_TEST(test_eeprom_m95_disable);
RUN_TEST(test_eeprom_m95_init);
RUN_TEST(test_eeprom_m95_dinit);
RUN_TEST(test_eeprom_m95_test);
return UNITY_END();
}

Some files were not shown because too many files have changed in this diff Show More