diff --git a/.mxproject b/.mxproject
index 06ab073..2ea9b3c 100644
--- a/.mxproject
+++ b/.mxproject
@@ -2,46 +2,44 @@
LibFiles=Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_bus.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_system.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_utils.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dmamux.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_can.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_i2c.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_i2c.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_i2c_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usart.h;Middlewares\Third_Party\FreeRTOS\Source\include\croutine.h;Middlewares\Third_Party\FreeRTOS\Source\include\deprecated_definitions.h;Middlewares\Third_Party\FreeRTOS\Source\include\event_groups.h;Middlewares\Third_Party\FreeRTOS\Source\include\FreeRTOS.h;Middlewares\Third_Party\FreeRTOS\Source\include\list.h;Middlewares\Third_Party\FreeRTOS\Source\include\message_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_prototypes.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h;Middlewares\Third_Party\FreeRTOS\Source\include\portable.h;Middlewares\Third_Party\FreeRTOS\Source\include\projdefs.h;Middlewares\Third_Party\FreeRTOS\Source\include\queue.h;Middlewares\Third_Party\FreeRTOS\Source\include\semphr.h;Middlewares\Third_Party\FreeRTOS\Source\include\stack_macros.h;Middlewares\Third_Party\FreeRTOS\Source\include\StackMacros.h;Middlewares\Third_Party\FreeRTOS\Source\include\stream_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\task.h;Middlewares\Third_Party\FreeRTOS\Source\include\timers.h;Middlewares\Third_Party\FreeRTOS\Source\include\atomic.h;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.h;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\portmacro.h;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_bus.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_system.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_utils.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dmamux.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_can.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_i2c.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_i2c.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_i2c_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usart.h;Middlewares\Third_Party\FreeRTOS\Source\include\croutine.h;Middlewares\Third_Party\FreeRTOS\Source\include\deprecated_definitions.h;Middlewares\Third_Party\FreeRTOS\Source\include\event_groups.h;Middlewares\Third_Party\FreeRTOS\Source\include\FreeRTOS.h;Middlewares\Third_Party\FreeRTOS\Source\include\list.h;Middlewares\Third_Party\FreeRTOS\Source\include\message_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_prototypes.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h;Middlewares\Third_Party\FreeRTOS\Source\include\portable.h;Middlewares\Third_Party\FreeRTOS\Source\include\projdefs.h;Middlewares\Third_Party\FreeRTOS\Source\include\queue.h;Middlewares\Third_Party\FreeRTOS\Source\include\semphr.h;Middlewares\Third_Party\FreeRTOS\Source\include\stack_macros.h;Middlewares\Third_Party\FreeRTOS\Source\include\StackMacros.h;Middlewares\Third_Party\FreeRTOS\Source\include\stream_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\task.h;Middlewares\Third_Party\FreeRTOS\Source\include\timers.h;Middlewares\Third_Party\FreeRTOS\Source\include\atomic.h;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.h;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\portmacro.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f407xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.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_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_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;
[PreviousUsedCubeIDEFiles]
-SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\freertos.c;Core\Src\adc.c;Core\Src\can.c;Core\Src\crc.c;Core\Src\dma.c;Core\Src\i2c.c;Core\Src\rng.c;Core\Src\spi.c;Core\Src\tim.c;Core\Src\usart.c;Core\Src\stm32f4xx_it.c;Core\Src\stm32f4xx_hal_msp.c;Core\Src\stm32f4xx_hal_timebase_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;;;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;
+SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\freertos.c;Core\Src\adc.c;Core\Src\can.c;Core\Src\crc.c;Core\Src\i2c.c;Core\Src\rng.c;Core\Src\spi.c;Core\Src\tim.c;Core\Src\usart.c;Core\Src\stm32f4xx_it.c;Core\Src\stm32f4xx_hal_msp.c;Core\Src\stm32f4xx_hal_timebase_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;;;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;
HeaderPath=Drivers\STM32F4xx_HAL_Driver\Inc;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;Middlewares\Third_Party\FreeRTOS\Source\include;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F;Drivers\CMSIS\Device\ST\STM32F4xx\Include;Drivers\CMSIS\Include;Core\Inc;
CDefines=USE_HAL_DRIVER;STM32F407xx;USE_HAL_DRIVER;USE_HAL_DRIVER;
[PreviousGenFiles]
AdvancedFolderStructure=true
-HeaderFileListSize=14
+HeaderFileListSize=13
HeaderFiles#0=..\Core\Inc\gpio.h
HeaderFiles#1=..\Core\Inc\FreeRTOSConfig.h
HeaderFiles#2=..\Core\Inc\adc.h
HeaderFiles#3=..\Core\Inc\can.h
HeaderFiles#4=..\Core\Inc\crc.h
-HeaderFiles#5=..\Core\Inc\dma.h
-HeaderFiles#6=..\Core\Inc\i2c.h
-HeaderFiles#7=..\Core\Inc\rng.h
-HeaderFiles#8=..\Core\Inc\spi.h
-HeaderFiles#9=..\Core\Inc\tim.h
-HeaderFiles#10=..\Core\Inc\usart.h
-HeaderFiles#11=..\Core\Inc\stm32f4xx_it.h
-HeaderFiles#12=..\Core\Inc\stm32f4xx_hal_conf.h
-HeaderFiles#13=..\Core\Inc\main.h
+HeaderFiles#5=..\Core\Inc\i2c.h
+HeaderFiles#6=..\Core\Inc\rng.h
+HeaderFiles#7=..\Core\Inc\spi.h
+HeaderFiles#8=..\Core\Inc\tim.h
+HeaderFiles#9=..\Core\Inc\usart.h
+HeaderFiles#10=..\Core\Inc\stm32f4xx_it.h
+HeaderFiles#11=..\Core\Inc\stm32f4xx_hal_conf.h
+HeaderFiles#12=..\Core\Inc\main.h
HeaderFolderListSize=1
HeaderPath#0=..\Core\Inc
HeaderFiles=;
-SourceFileListSize=15
+SourceFileListSize=14
SourceFiles#0=..\Core\Src\gpio.c
SourceFiles#1=..\Core\Src\freertos.c
SourceFiles#2=..\Core\Src\adc.c
SourceFiles#3=..\Core\Src\can.c
SourceFiles#4=..\Core\Src\crc.c
-SourceFiles#5=..\Core\Src\dma.c
-SourceFiles#6=..\Core\Src\i2c.c
-SourceFiles#7=..\Core\Src\rng.c
-SourceFiles#8=..\Core\Src\spi.c
-SourceFiles#9=..\Core\Src\tim.c
-SourceFiles#10=..\Core\Src\usart.c
-SourceFiles#11=..\Core\Src\stm32f4xx_it.c
-SourceFiles#12=..\Core\Src\stm32f4xx_hal_msp.c
-SourceFiles#13=..\Core\Src\stm32f4xx_hal_timebase_tim.c
-SourceFiles#14=..\Core\Src\main.c
+SourceFiles#5=..\Core\Src\i2c.c
+SourceFiles#6=..\Core\Src\rng.c
+SourceFiles#7=..\Core\Src\spi.c
+SourceFiles#8=..\Core\Src\tim.c
+SourceFiles#9=..\Core\Src\usart.c
+SourceFiles#10=..\Core\Src\stm32f4xx_it.c
+SourceFiles#11=..\Core\Src\stm32f4xx_hal_msp.c
+SourceFiles#12=..\Core\Src\stm32f4xx_hal_timebase_tim.c
+SourceFiles#13=..\Core\Src\main.c
SourceFolderListSize=1
SourcePath#0=..\Core\Src
SourceFiles=;
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 074afaa..48cb063 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/Core/Inc/stm32f4xx_it.h b/Core/Inc/stm32f4xx_it.h
index 3873247..21bc8b3 100644
--- a/Core/Inc/stm32f4xx_it.h
+++ b/Core/Inc/stm32f4xx_it.h
@@ -52,8 +52,6 @@ void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void DebugMon_Handler(void);
-void DMA1_Stream5_IRQHandler(void);
-void DMA1_Stream6_IRQHandler(void);
void CAN1_TX_IRQHandler(void);
void CAN1_RX0_IRQHandler(void);
void CAN1_RX1_IRQHandler(void);
diff --git a/Core/Inc/tim.h b/Core/Inc/tim.h
index d5c56a7..2766260 100644
--- a/Core/Inc/tim.h
+++ b/Core/Inc/tim.h
@@ -34,6 +34,8 @@ extern "C" {
extern TIM_HandleTypeDef htim1;
+extern TIM_HandleTypeDef htim2;
+
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim6;
@@ -45,6 +47,7 @@ extern TIM_HandleTypeDef htim7;
/* USER CODE END Private defines */
void MX_TIM1_Init(void);
+void MX_TIM2_Init(void);
void MX_TIM3_Init(void);
void MX_TIM6_Init(void);
void MX_TIM7_Init(void);
diff --git a/Core/Inc/usart.h b/Core/Inc/usart.h
index 600bc69..7b84d11 100644
--- a/Core/Inc/usart.h
+++ b/Core/Inc/usart.h
@@ -34,8 +34,6 @@ extern "C" {
extern UART_HandleTypeDef huart1;
-extern UART_HandleTypeDef huart2;
-
extern UART_HandleTypeDef huart3;
/* USER CODE BEGIN Private defines */
@@ -43,7 +41,6 @@ extern UART_HandleTypeDef huart3;
/* USER CODE END Private defines */
void MX_USART1_UART_Init(void);
-void MX_USART2_UART_Init(void);
void MX_USART3_UART_Init(void);
/* USER CODE BEGIN Prototypes */
diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c
index c8003a0..087071b 100644
--- a/Core/Src/gpio.c
+++ b/Core/Src/gpio.c
@@ -57,11 +57,11 @@ void MX_GPIO_Init(void)
/*Configure GPIO pins : PE2 PE3 PE4 PE5
PE6 PE7 PE8 PE10
- PE12 PE13 PE14 PE15
+ PE11 PE12 PE14 PE15
PE0 PE1 */
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_10
- |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
+ |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_14|GPIO_PIN_15
|GPIO_PIN_0|GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
@@ -85,10 +85,8 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
- /*Configure GPIO pins : PA0 PA1 PA4 PA8
- PA15 */
- GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_8
- |GPIO_PIN_15;
+ /*Configure GPIO pins : PA0 PA4 PA8 PA15 */
+ GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_4|GPIO_PIN_8|GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
diff --git a/Core/Src/main.c b/Core/Src/main.c
index b05b72f..cc9193a 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -22,7 +22,6 @@
#include "adc.h"
#include "can.h"
#include "crc.h"
-#include "dma.h"
#include "i2c.h"
#include "rng.h"
#include "spi.h"
@@ -99,7 +98,6 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
- MX_DMA_Init();
MX_USART1_UART_Init();
MX_TIM3_Init();
MX_CRC_Init();
@@ -109,10 +107,10 @@ int main(void)
MX_TIM6_Init();
MX_TIM1_Init();
MX_CAN1_Init();
- MX_USART2_UART_Init();
MX_USART3_UART_Init();
MX_I2C1_Init();
MX_ADC1_Init();
+ MX_TIM2_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
diff --git a/Core/Src/stm32f4xx_it.c b/Core/Src/stm32f4xx_it.c
index 6ac79a6..9b07d37 100644
--- a/Core/Src/stm32f4xx_it.c
+++ b/Core/Src/stm32f4xx_it.c
@@ -59,8 +59,6 @@ extern CAN_HandleTypeDef hcan1;
extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim6;
extern TIM_HandleTypeDef htim7;
-extern DMA_HandleTypeDef hdma_usart2_rx;
-extern DMA_HandleTypeDef hdma_usart2_tx;
extern UART_HandleTypeDef huart3;
extern TIM_HandleTypeDef htim11;
@@ -167,34 +165,6 @@ void DebugMon_Handler(void)
/******************************************************************************/
/**
- * @brief This function handles DMA1 stream5 global interrupt.
- */
-void DMA1_Stream5_IRQHandler(void)
-{
- /* USER CODE BEGIN DMA1_Stream5_IRQn 0 */
-
- /* USER CODE END DMA1_Stream5_IRQn 0 */
- HAL_DMA_IRQHandler(&hdma_usart2_rx);
- /* USER CODE BEGIN DMA1_Stream5_IRQn 1 */
-
- /* USER CODE END DMA1_Stream5_IRQn 1 */
-}
-
-/**
- * @brief This function handles DMA1 stream6 global interrupt.
- */
-void DMA1_Stream6_IRQHandler(void)
-{
- /* USER CODE BEGIN DMA1_Stream6_IRQn 0 */
-
- /* USER CODE END DMA1_Stream6_IRQn 0 */
- HAL_DMA_IRQHandler(&hdma_usart2_tx);
- /* USER CODE BEGIN DMA1_Stream6_IRQn 1 */
-
- /* USER CODE END DMA1_Stream6_IRQn 1 */
-}
-
-/**
* @brief This function handles CAN1 TX interrupts.
*/
void CAN1_TX_IRQHandler(void)
diff --git a/Core/Src/tim.c b/Core/Src/tim.c
index 224c3ea..9c53f14 100644
--- a/Core/Src/tim.c
+++ b/Core/Src/tim.c
@@ -25,6 +25,7 @@
/* USER CODE END 0 */
TIM_HandleTypeDef htim1;
+TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim3;
TIM_HandleTypeDef htim6;
TIM_HandleTypeDef htim7;
@@ -82,7 +83,7 @@ void MX_TIM1_Init(void)
{
Error_Handler();
}
- if (HAL_TIM_PWM_ConfigChannel(&htim1, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
+ if (HAL_TIM_PWM_ConfigChannel(&htim1, &sConfigOC, TIM_CHANNEL_3) != HAL_OK)
{
Error_Handler();
}
@@ -103,6 +104,58 @@ void MX_TIM1_Init(void)
HAL_TIM_MspPostInit(&htim1);
}
+/* TIM2 init function */
+void MX_TIM2_Init(void)
+{
+
+ /* USER CODE BEGIN TIM2_Init 0 */
+
+ /* USER CODE END TIM2_Init 0 */
+
+ TIM_MasterConfigTypeDef sMasterConfig = {0};
+ TIM_OC_InitTypeDef sConfigOC = {0};
+
+ /* USER CODE BEGIN TIM2_Init 1 */
+
+ /* USER CODE END TIM2_Init 1 */
+ htim2.Instance = TIM2;
+ htim2.Init.Prescaler = 0;
+ htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
+ htim2.Init.Period = 4294967295;
+ htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
+ htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
+ if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
+ {
+ Error_Handler();
+ }
+ sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
+ sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
+ if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
+ {
+ Error_Handler();
+ }
+ sConfigOC.OCMode = TIM_OCMODE_PWM1;
+ sConfigOC.Pulse = 0;
+ sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
+ sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
+ if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
+ {
+ Error_Handler();
+ }
+ if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_3) != HAL_OK)
+ {
+ Error_Handler();
+ }
+ if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
+ {
+ Error_Handler();
+ }
+ /* USER CODE BEGIN TIM2_Init 2 */
+
+ /* USER CODE END TIM2_Init 2 */
+ HAL_TIM_MspPostInit(&htim2);
+
+}
/* TIM3 init function */
void MX_TIM3_Init(void)
{
@@ -270,6 +323,22 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
/* USER CODE END TIM7_MspInit 1 */
}
}
+
+void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* tim_pwmHandle)
+{
+
+ if(tim_pwmHandle->Instance==TIM2)
+ {
+ /* USER CODE BEGIN TIM2_MspInit 0 */
+
+ /* USER CODE END TIM2_MspInit 0 */
+ /* TIM2 clock enable */
+ __HAL_RCC_TIM2_CLK_ENABLE();
+ /* USER CODE BEGIN TIM2_MspInit 1 */
+
+ /* USER CODE END TIM2_MspInit 1 */
+ }
+}
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
{
@@ -279,13 +348,12 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
/* USER CODE BEGIN TIM1_MspPostInit 0 */
/* USER CODE END TIM1_MspPostInit 0 */
-
__HAL_RCC_GPIOE_CLK_ENABLE();
/**TIM1 GPIO Configuration
PE9 ------> TIM1_CH1
- PE11 ------> TIM1_CH2
+ PE13 ------> TIM1_CH3
*/
- GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_11;
+ GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
@@ -296,6 +364,29 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
/* USER CODE END TIM1_MspPostInit 1 */
}
+ else if(timHandle->Instance==TIM2)
+ {
+ /* USER CODE BEGIN TIM2_MspPostInit 0 */
+
+ /* USER CODE END TIM2_MspPostInit 0 */
+
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ /**TIM2 GPIO Configuration
+ PA1 ------> TIM2_CH2
+ PA2 ------> TIM2_CH3
+ PA3 ------> TIM2_CH4
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+ GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ /* USER CODE BEGIN TIM2_MspPostInit 1 */
+
+ /* USER CODE END TIM2_MspPostInit 1 */
+ }
}
@@ -357,6 +448,22 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
}
}
+void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* tim_pwmHandle)
+{
+
+ if(tim_pwmHandle->Instance==TIM2)
+ {
+ /* USER CODE BEGIN TIM2_MspDeInit 0 */
+
+ /* USER CODE END TIM2_MspDeInit 0 */
+ /* Peripheral clock disable */
+ __HAL_RCC_TIM2_CLK_DISABLE();
+ /* USER CODE BEGIN TIM2_MspDeInit 1 */
+
+ /* USER CODE END TIM2_MspDeInit 1 */
+ }
+}
+
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
diff --git a/Core/Src/usart.c b/Core/Src/usart.c
index 284b650..bf00911 100644
--- a/Core/Src/usart.c
+++ b/Core/Src/usart.c
@@ -25,10 +25,7 @@
/* USER CODE END 0 */
UART_HandleTypeDef huart1;
-UART_HandleTypeDef huart2;
UART_HandleTypeDef huart3;
-DMA_HandleTypeDef hdma_usart2_rx;
-DMA_HandleTypeDef hdma_usart2_tx;
/* USART1 init function */
@@ -59,35 +56,6 @@ void MX_USART1_UART_Init(void)
/* USER CODE END USART1_Init 2 */
}
-/* USART2 init function */
-
-void MX_USART2_UART_Init(void)
-{
-
- /* USER CODE BEGIN USART2_Init 0 */
-
- /* USER CODE END USART2_Init 0 */
-
- /* USER CODE BEGIN USART2_Init 1 */
-
- /* USER CODE END USART2_Init 1 */
- huart2.Instance = USART2;
- huart2.Init.BaudRate = 115200;
- huart2.Init.WordLength = UART_WORDLENGTH_8B;
- huart2.Init.StopBits = UART_STOPBITS_1;
- huart2.Init.Parity = UART_PARITY_NONE;
- huart2.Init.Mode = UART_MODE_TX_RX;
- huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
- huart2.Init.OverSampling = UART_OVERSAMPLING_16;
- if (HAL_UART_Init(&huart2) != HAL_OK)
- {
- Error_Handler();
- }
- /* USER CODE BEGIN USART2_Init 2 */
-
- /* USER CODE END USART2_Init 2 */
-
-}
/* USART3 init function */
void MX_USART3_UART_Init(void)
@@ -146,67 +114,6 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
/* USER CODE END USART1_MspInit 1 */
}
- else if(uartHandle->Instance==USART2)
- {
- /* USER CODE BEGIN USART2_MspInit 0 */
-
- /* USER CODE END USART2_MspInit 0 */
- /* USART2 clock enable */
- __HAL_RCC_USART2_CLK_ENABLE();
-
- __HAL_RCC_GPIOA_CLK_ENABLE();
- /**USART2 GPIO Configuration
- PA2 ------> USART2_TX
- PA3 ------> USART2_RX
- */
- GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
- /* USART2 DMA Init */
- /* USART2_RX Init */
- hdma_usart2_rx.Instance = DMA1_Stream5;
- hdma_usart2_rx.Init.Channel = DMA_CHANNEL_4;
- hdma_usart2_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
- hdma_usart2_rx.Init.PeriphInc = DMA_PINC_DISABLE;
- hdma_usart2_rx.Init.MemInc = DMA_MINC_ENABLE;
- hdma_usart2_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
- hdma_usart2_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
- hdma_usart2_rx.Init.Mode = DMA_NORMAL;
- hdma_usart2_rx.Init.Priority = DMA_PRIORITY_LOW;
- hdma_usart2_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
- if (HAL_DMA_Init(&hdma_usart2_rx) != HAL_OK)
- {
- Error_Handler();
- }
-
- __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart2_rx);
-
- /* USART2_TX Init */
- hdma_usart2_tx.Instance = DMA1_Stream6;
- hdma_usart2_tx.Init.Channel = DMA_CHANNEL_4;
- hdma_usart2_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
- hdma_usart2_tx.Init.PeriphInc = DMA_PINC_DISABLE;
- hdma_usart2_tx.Init.MemInc = DMA_MINC_ENABLE;
- hdma_usart2_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
- hdma_usart2_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
- hdma_usart2_tx.Init.Mode = DMA_NORMAL;
- hdma_usart2_tx.Init.Priority = DMA_PRIORITY_LOW;
- hdma_usart2_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
- if (HAL_DMA_Init(&hdma_usart2_tx) != HAL_OK)
- {
- Error_Handler();
- }
-
- __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart2_tx);
-
- /* USER CODE BEGIN USART2_MspInit 1 */
-
- /* USER CODE END USART2_MspInit 1 */
- }
else if(uartHandle->Instance==USART3)
{
/* USER CODE BEGIN USART3_MspInit 0 */
@@ -257,27 +164,6 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* USER CODE END USART1_MspDeInit 1 */
}
- else if(uartHandle->Instance==USART2)
- {
- /* USER CODE BEGIN USART2_MspDeInit 0 */
-
- /* USER CODE END USART2_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_USART2_CLK_DISABLE();
-
- /**USART2 GPIO Configuration
- PA2 ------> USART2_TX
- PA3 ------> USART2_RX
- */
- HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
-
- /* USART2 DMA DeInit */
- HAL_DMA_DeInit(uartHandle->hdmarx);
- HAL_DMA_DeInit(uartHandle->hdmatx);
- /* USER CODE BEGIN USART2_MspDeInit 1 */
-
- /* USER CODE END USART2_MspDeInit 1 */
- }
else if(uartHandle->Instance==USART3)
{
/* USER CODE BEGIN USART3_MspDeInit 0 */
diff --git a/a8000_temperature_ctl.ioc b/a8000_temperature_ctl.ioc
index 29d2009..9f47017 100644
--- a/a8000_temperature_ctl.ioc
+++ b/a8000_temperature_ctl.ioc
@@ -21,29 +21,6 @@ CAN1.RFLM=ENABLE
CAN1.SJW=CAN_SJW_3TQ
CAN1.TTCM=ENABLE
CAN1.TXFP=DISABLE
-Dma.Request0=USART2_RX
-Dma.Request1=USART2_TX
-Dma.RequestsNb=2
-Dma.USART2_RX.0.Direction=DMA_PERIPH_TO_MEMORY
-Dma.USART2_RX.0.FIFOMode=DMA_FIFOMODE_DISABLE
-Dma.USART2_RX.0.Instance=DMA1_Stream5
-Dma.USART2_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
-Dma.USART2_RX.0.MemInc=DMA_MINC_ENABLE
-Dma.USART2_RX.0.Mode=DMA_NORMAL
-Dma.USART2_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
-Dma.USART2_RX.0.PeriphInc=DMA_PINC_DISABLE
-Dma.USART2_RX.0.Priority=DMA_PRIORITY_LOW
-Dma.USART2_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
-Dma.USART2_TX.1.Direction=DMA_MEMORY_TO_PERIPH
-Dma.USART2_TX.1.FIFOMode=DMA_FIFOMODE_DISABLE
-Dma.USART2_TX.1.Instance=DMA1_Stream6
-Dma.USART2_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
-Dma.USART2_TX.1.MemInc=DMA_MINC_ENABLE
-Dma.USART2_TX.1.Mode=DMA_NORMAL
-Dma.USART2_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
-Dma.USART2_TX.1.PeriphInc=DMA_PINC_DISABLE
-Dma.USART2_TX.1.Priority=DMA_PRIORITY_LOW
-Dma.USART2_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
FREERTOS.FootprintOK=true
FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_NEWLIB_REENTRANT,configUSE_RECURSIVE_MUTEXES,configUSE_COUNTING_SEMAPHORES,configRECORD_STACK_HIGH_ADDRESS,configENABLE_FPU
FREERTOS.Tasks01=defaultTask,-3,1024,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL
@@ -61,58 +38,58 @@ Mcu.CPN=STM32F407VET6
Mcu.Family=STM32F4
Mcu.IP0=ADC1
Mcu.IP1=CAN1
-Mcu.IP10=SYS
-Mcu.IP11=TIM1
+Mcu.IP10=TIM1
+Mcu.IP11=TIM2
Mcu.IP12=TIM3
Mcu.IP13=TIM6
Mcu.IP14=TIM7
Mcu.IP15=USART1
-Mcu.IP16=USART2
-Mcu.IP17=USART3
+Mcu.IP16=USART3
Mcu.IP2=CRC
-Mcu.IP3=DMA
-Mcu.IP4=FREERTOS
-Mcu.IP5=I2C1
-Mcu.IP6=NVIC
-Mcu.IP7=RCC
-Mcu.IP8=RNG
-Mcu.IP9=SPI1
-Mcu.IPNb=18
+Mcu.IP3=FREERTOS
+Mcu.IP4=I2C1
+Mcu.IP5=NVIC
+Mcu.IP6=RCC
+Mcu.IP7=RNG
+Mcu.IP8=SPI1
+Mcu.IP9=SYS
+Mcu.IPNb=17
Mcu.Name=STM32F407V(E-G)Tx
Mcu.Package=LQFP100
Mcu.Pin0=PH0-OSC_IN
Mcu.Pin1=PH1-OSC_OUT
-Mcu.Pin10=PB1
-Mcu.Pin11=PE9
-Mcu.Pin12=PE11
-Mcu.Pin13=PB10
-Mcu.Pin14=PB11
-Mcu.Pin15=PC9
-Mcu.Pin16=PA9
-Mcu.Pin17=PA10
-Mcu.Pin18=PA11
-Mcu.Pin19=PA12
+Mcu.Pin10=PB0
+Mcu.Pin11=PB1
+Mcu.Pin12=PE9
+Mcu.Pin13=PE13
+Mcu.Pin14=PB10
+Mcu.Pin15=PB11
+Mcu.Pin16=PC9
+Mcu.Pin17=PA9
+Mcu.Pin18=PA10
+Mcu.Pin19=PA11
Mcu.Pin2=PC0
-Mcu.Pin20=PA13
-Mcu.Pin21=PA14
-Mcu.Pin22=PB6
-Mcu.Pin23=PB7
-Mcu.Pin24=VP_CRC_VS_CRC
-Mcu.Pin25=VP_FREERTOS_VS_CMSIS_V1
-Mcu.Pin26=VP_RNG_VS_RNG
-Mcu.Pin27=VP_SYS_VS_tim11
-Mcu.Pin28=VP_TIM1_VS_ClockSourceINT
-Mcu.Pin29=VP_TIM3_VS_ClockSourceINT
-Mcu.Pin3=PA2
-Mcu.Pin30=VP_TIM6_VS_ClockSourceINT
-Mcu.Pin31=VP_TIM7_VS_ClockSourceINT
-Mcu.Pin4=PA3
-Mcu.Pin5=PA5
-Mcu.Pin6=PA6
-Mcu.Pin7=PA7
-Mcu.Pin8=PC4
-Mcu.Pin9=PB0
-Mcu.PinsNb=32
+Mcu.Pin20=PA12
+Mcu.Pin21=PA13
+Mcu.Pin22=PA14
+Mcu.Pin23=PB6
+Mcu.Pin24=PB7
+Mcu.Pin25=VP_CRC_VS_CRC
+Mcu.Pin26=VP_FREERTOS_VS_CMSIS_V1
+Mcu.Pin27=VP_RNG_VS_RNG
+Mcu.Pin28=VP_SYS_VS_tim11
+Mcu.Pin29=VP_TIM1_VS_ClockSourceINT
+Mcu.Pin3=PA1
+Mcu.Pin30=VP_TIM3_VS_ClockSourceINT
+Mcu.Pin31=VP_TIM6_VS_ClockSourceINT
+Mcu.Pin32=VP_TIM7_VS_ClockSourceINT
+Mcu.Pin4=PA2
+Mcu.Pin5=PA3
+Mcu.Pin6=PA5
+Mcu.Pin7=PA6
+Mcu.Pin8=PA7
+Mcu.Pin9=PC4
+Mcu.PinsNb=33
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F407VETx
@@ -123,8 +100,6 @@ NVIC.CAN1_RX0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
NVIC.CAN1_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
NVIC.CAN1_SCE_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
NVIC.CAN1_TX_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
-NVIC.DMA1_Stream5_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
-NVIC.DMA1_Stream6_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
@@ -144,6 +119,8 @@ NVIC.TimeBase=TIM1_TRG_COM_TIM11_IRQn
NVIC.TimeBaseIP=TIM11
NVIC.USART3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
+PA1.Locked=true
+PA1.Signal=S_TIM2_CH2
PA10.Mode=Asynchronous
PA10.Signal=USART1_RX
PA11.Locked=true
@@ -155,10 +132,10 @@ PA13.Mode=Serial_Wire
PA13.Signal=SYS_JTMS-SWDIO
PA14.Mode=Serial_Wire
PA14.Signal=SYS_JTCK-SWCLK
-PA2.Mode=Asynchronous
-PA2.Signal=USART2_TX
-PA3.Mode=Asynchronous
-PA3.Signal=USART2_RX
+PA2.Locked=true
+PA2.Signal=S_TIM2_CH3
+PA3.Locked=true
+PA3.Signal=S_TIM2_CH4
PA5.Locked=true
PA5.Mode=Full_Duplex_Master
PA5.Signal=SPI1_SCK
@@ -188,8 +165,7 @@ PC4.Signal=GPXTI4
PC9.Locked=true
PC9.Mode=Clock-out-2
PC9.Signal=RCC_MCO_2
-PE11.Locked=true
-PE11.Signal=S_TIM1_CH2
+PE13.Signal=S_TIM1_CH3
PE9.Locked=true
PE9.Signal=S_TIM1_CH1
PH0-OSC_IN.Mode=HSE-External-Oscillator
@@ -227,7 +203,7 @@ ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath=
ProjectManager.UnderRoot=true
-ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_CRC_Init-CRC-false-HAL-true,7-MX_RNG_Init-RNG-false-HAL-true,8-MX_TIM7_Init-TIM7-false-HAL-true,9-MX_SPI1_Init-SPI1-false-HAL-true,10-MX_TIM6_Init-TIM6-false-HAL-true,11-MX_TIM1_Init-TIM1-false-HAL-true,12-MX_CAN1_Init-CAN1-false-HAL-true,13-MX_USART2_UART_Init-USART2-false-HAL-true,14-MX_USART3_UART_Init-USART3-false-HAL-true,15-MX_I2C1_Init-I2C1-false-HAL-true
+ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_CRC_Init-CRC-false-HAL-true,6-MX_RNG_Init-RNG-false-HAL-true,7-MX_TIM7_Init-TIM7-false-HAL-true,8-MX_SPI1_Init-SPI1-false-HAL-true,9-MX_TIM6_Init-TIM6-false-HAL-true,10-MX_TIM1_Init-TIM1-false-HAL-true,11-MX_CAN1_Init-CAN1-false-HAL-true,12-MX_USART3_UART_Init-USART3-false-HAL-true,13-MX_I2C1_Init-I2C1-false-HAL-true,14-MX_ADC1_Init-ADC1-false-HAL-true,15-MX_TIM2_Init-TIM2-false-HAL-true
RCC.48MHZClocksFreq_Value=48000000
RCC.AHBFreq_Value=144000000
RCC.APB1CLKDivider=RCC_HCLK_DIV4
@@ -278,8 +254,14 @@ SH.GPXTI4.0=GPIO_EXTI4
SH.GPXTI4.ConfNb=1
SH.S_TIM1_CH1.0=TIM1_CH1,PWM Generation1 CH1
SH.S_TIM1_CH1.ConfNb=1
-SH.S_TIM1_CH2.0=TIM1_CH2,PWM Generation2 CH2
-SH.S_TIM1_CH2.ConfNb=1
+SH.S_TIM1_CH3.0=TIM1_CH3,PWM Generation3 CH3
+SH.S_TIM1_CH3.ConfNb=1
+SH.S_TIM2_CH2.0=TIM2_CH2,PWM Generation2 CH2
+SH.S_TIM2_CH2.ConfNb=1
+SH.S_TIM2_CH3.0=TIM2_CH3,PWM Generation3 CH3
+SH.S_TIM2_CH3.ConfNb=1
+SH.S_TIM2_CH4.0=TIM2_CH4,PWM Generation4 CH4
+SH.S_TIM2_CH4.ConfNb=1
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_32
SPI1.CalculateBaudRate=2.25 MBits/s
SPI1.Direction=SPI_DIRECTION_2LINES
@@ -287,10 +269,14 @@ SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler
SPI1.Mode=SPI_MODE_MASTER
SPI1.VirtualType=VM_MASTER
TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
-TIM1.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
-TIM1.IPParameters=Period,Prescaler,Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2
+TIM1.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
+TIM1.IPParameters=Period,Prescaler,Channel-PWM Generation1 CH1,Channel-PWM Generation3 CH3
TIM1.Period=9999
TIM1.Prescaler=143
+TIM2.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
+TIM2.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
+TIM2.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
+TIM2.IPParameters=Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4,Channel-PWM Generation2 CH2
TIM3.IPParameters=Prescaler,Period
TIM3.Period=9999
TIM3.Prescaler=71
@@ -301,8 +287,6 @@ TIM7.Prescaler=81
USART1.BaudRate=1000000
USART1.IPParameters=VirtualMode,BaudRate
USART1.VirtualMode=VM_ASYNC
-USART2.IPParameters=VirtualMode
-USART2.VirtualMode=VM_ASYNC
USART3.BaudRate=9600
USART3.IPParameters=VirtualMode,BaudRate
USART3.VirtualMode=VM_ASYNC
diff --git a/sdk b/sdk
index e09c90b..8d85f36 160000
--- a/sdk
+++ b/sdk
@@ -1 +1 @@
-Subproject commit e09c90bf63a6e083ccd53572a0b9f038ef3f42e8
+Subproject commit 8d85f36ae30cf0b05ee9c086a01d9216630a8459
diff --git a/usrc/main.cpp b/usrc/main.cpp
index c4eb238..cfadae8 100644
--- a/usrc/main.cpp
+++ b/usrc/main.cpp
@@ -9,6 +9,12 @@
//
#include "sdk\components\flash\znvs.hpp"
//
+#include "sdk\components\sensors\tmp117\tmp117.hpp"
+#include "sdk\components\ti\drv8710.hpp"
+#include "sdk\components\water_cooling_temperature_control_module\pwm_ctrl_module.hpp"
+#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module.hpp"
+#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module_factory.cpp"
+#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module_factory.hpp"
#define TAG "main"
using namespace iflytop;
@@ -56,6 +62,13 @@ void umain() {
uint8_t deviceId = getId();
ZLOGI(TAG, "motorId:%d", deviceId);
+ if (deviceId == 0) {
+ ZLOGE(TAG, "motorId can't be 0");
+ chip_set_error();
+ while (true) {
+ }
+ }
+
#if 0
/*******************************************************************************
* NVSINIT *
@@ -67,74 +80,127 @@ void umain() {
ZNVS::ins().alloc_config(MOTOR_CFG_FLASH_MARK, (uint8_t*)&cfg, sizeof(cfg));
}
ZNVS::ins().init_config();
- // Pin_t enn_pin;
- // Pin_t csn_pin;
- osDelay(1000);
- {
- TMC5130::cfg_t cfg = {
- .spi = &TMC_MOTOR_SPI, //
- .csgpio = MOTOR0_CSN, //
- .ennPin = MOTOR0_ENN, //
- .spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
- };
- g_motor.initialize(&cfg);
- g_motor.setMotorShaft(false);
- ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
- }
-
- g_motor.setAcceleration(100);
- g_motor.setDeceleration(100);
- g_motor.setIHOLD_IRUN(0, 8, 10);
- g_motor.rotate(0);
- // g_motor.enable(false);
- auto zcanCmder_cfg = g_zcanCmder.createCFG( deviceId);
- g_zcanCmder.init(zcanCmder_cfg);
+#endif
/*******************************************************************************
- * zcanBasicOrderModule *
+ * ·çÉÈÅäÖà *
*******************************************************************************/
+ PWMSpeedCtrlModule::config_t fan0cfg = {
+ .fanCtrlTim = &htim2,
+ .nfan = 2,
+ .fan0Channel = {3, 0, 0, 0},
+ .fanFBGpioCfg =
+ {
+ {.pin = PC10},
+ {.pin = PC11},
+ },
+ .fanPowerGpioCfg =
+ {
+ {.pin = PC4, .mode = ZGPIO::kMode_nopull, .mirror = false},
+ },
+ };
+ PWMSpeedCtrlModule::config_t fan1cfg = {
+ .fanCtrlTim = &htim2,
+ .nfan = 2,
+ .fan0Channel = {4, 0, 0, 0},
+ .fanFBGpioCfg =
+ {
+ {.pin = PC12},
+ {.pin = PC13},
+ },
+ .fanPowerGpioCfg =
+ {
+ {.pin = PC5, .mode = ZGPIO::kMode_nopull, .mirror = false},
+ },
+ };
/*******************************************************************************
- * zcanXYRobotCtrlModule *
+ * Ë®±ÃÅäÖà *
*******************************************************************************/
- static ZGPIO input[10];
- input[0].initAsInput(SENSOR_INT0, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[1].initAsInput(SENSOR_INT1, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[2].initAsInput(SENSOR_INT2, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[3].initAsInput(SENSOR_INT3, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[4].initAsInput(SENSOR_INT4, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[5].initAsInput(SENSOR_INT5, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[6].initAsInput(SENSOR_INT6, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[7].initAsInput(SENSOR_INT7, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[8].initAsInput(SENSOR_INT8, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[9].initAsInput(SENSOR_INT9, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
-
- OSDefaultSchduler::getInstance()->regPeriodJob(
- [](OSDefaultSchduler::Context& context) {
-#if 0
- ZLOGI(TAG, "[0]:%d [1]:%d [2]:%d [3]:%d [4]:%d [5]:%d [6]:%d [7]:%d [8]:%d [9]:%d", //
- input[0].getState(), //
- input[1].getState(), //
- input[2].getState(), //
- input[3].getState(), //
- input[4].getState(), //
- input[5].getState(), //
- input[6].getState(), //
- input[7].getState(), //
- input[8].getState(), //
- input[9].getState());
-#endif
- },
- 1000);
+ PWMSpeedCtrlModule::config_t pumpcfg = {
+ .fanCtrlTim = &htim2,
+ .nfan = 1,
+ .fan0Channel = {2, 0, 0, 0},
+ .fanFBGpioCfg =
+ {
+ {.pin = PC3},
+ },
+ .fanPowerGpioCfg =
+ {
+ {.pin = PC2, .mode = ZGPIO::kMode_nopull, .mirror = false},
+ },
+ };
+
+ DRV8710::config_t peltier_config0 = {
+ .tim = &htim1,
+ .in1_chnannel_index = 1,
+ .in2 = PE10,
+ .nsleep = PB2,
+ .nfault = PB3,
+ .shaft = false,
+ };
+
+ DRV8710::config_t peltier_config1 = {
+ .tim = &htim1,
+ .in1_chnannel_index = 3,
+ .in2 = PE14,
+ .nsleep = PB13,
+ .nfault = PB14,
+ .shaft = false,
+
+ };
+
+ static TMP117 temp[4];
+ static PWMSpeedCtrlModule fan0;
+ static PWMSpeedCtrlModule fan1;
+ static PWMSpeedCtrlModule pump;
+ static DRV8710 peltier0;
+ static DRV8710 peltier1;
+
+ static WaterCoolingTemperatureControlModule waterCoolingTemperatureControlModule;
+
+ fan0.initialize(&fan0cfg, true);
+ fan1.initialize(&fan1cfg, true);
+ pump.initialize(&pumpcfg, false);
+ peltier0.initialize(&peltier_config0);
+ peltier1.initialize(&peltier_config1);
+
+ temp[0].initializate(&hi2c1, TMP117::ID0);
+ temp[1].initializate(&hi2c1, TMP117::ID1);
+ temp[2].initializate(&hi2c1, TMP117::ID2);
+ temp[3].initializate(&hi2c1, TMP117::ID3);
+
+ WaterCoolingTemperatureControlModule::config_t temp_ctrl_config;
+ waterCoolingTemperatureControlModule.createDefaultConfig(&temp_ctrl_config);
+
+ WaterCoolingTemperatureControlModule::hardwared_config_t hardwared_config = //
+ {
+ .temperature_sensor = {&temp[0], &temp[1], &temp[2], &temp[3]},
+ .fanTable = {&fan0, &fan1},
+ .pump = &pump,
+ .peltier_ctrl = {&peltier0, &peltier1},
+ .ext_input =
+ {
+ {PC6, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true},
+ {PC7, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true},
+ },
+ .ext_output =
+ {
+ {PD0, ZGPIO::kMode_nopull, false, false},
+ } //
+ };
+
+ waterCoolingTemperatureControlModule.initialize(deviceId, &temp_ctrl_config, &hardwared_config);
+
+ auto zcanCmder_cfg = g_zcanCmder.createCFG(deviceId);
+ g_zcanCmder.init(zcanCmder_cfg);
- g_stepMotorCtrlModule.initialize(deviceId, &g_motor, input, ZARRAY_SIZE(input), "MOTOR_CFG_FLASH_MARK");
g_ziProtocolParser.initialize(&g_zcanCmder);
- g_ziProtocolParser.registerModule(&g_stepMotorCtrlModule);
-#endif
+ g_ziProtocolParser.registerModule(&waterCoolingTemperatureControlModule);
while (true) {
OSDefaultSchduler::getInstance()->loop();
g_zcanCmder.loop();
}
-}
+};