Browse Source

update

master
zhaohe 2 years ago
parent
commit
395a63f112
  1. 98
      .vscode/c_cpp_properties.json
  2. 2
      .vscode/keil-assistant.log
  3. 5
      .vscode/settings.json
  4. 0
      .vscode/uv4.log.lock
  5. 34
      app/.mxproject
  6. 2
      app/Core/Inc/stm32f1xx_hal_conf.h
  7. 52
      app/Core/Inc/tim.h
  8. 2
      app/Core/Src/main.c
  9. 104
      app/Core/Src/tim.c
  10. 223
      app/MDK-ARM/app.uvprojx
  11. 12
      app/app.ioc
  12. 2
      dep/libiflytop_micro
  13. 61
      src/board/hardware.cpp
  14. 60
      src/board/hardware.hpp
  15. 10
      src/board/project_board.hpp
  16. 27
      src/umain.cpp
  17. 46
      src/umain.hpp

98
.vscode/c_cpp_properties.json

@ -0,0 +1,98 @@
{
"configurations": [
{
"name": "app",
"includePath": [
"./app\\Core\\Inc",
"./app\\Drivers\\STM32F1xx_HAL_Driver\\Inc",
"./app\\Drivers\\STM32F1xx_HAL_Driver\\Inc\\Legacy",
"./app\\Drivers\\CMSIS\\Device\\ST\\STM32F1xx\\Include",
"./app\\Drivers\\CMSIS\\Include",
"./dep",
"./src",
"./dep\\libtrinamic\\IFLYTOP-TMC-API",
"./app\\MDK-ARM",
"./app\\Core\\Src",
"./app\\Drivers\\STM32F1xx_HAL_Driver\\Src"
],
"defines": [
"USE_HAL_DRIVER",
"STM32F103xB",
"__CC_ARM",
"__arm__",
"__align(x)=",
"__ALIGNOF__(x)=",
"__alignof__(x)=",
"__asm(x)=",
"__forceinline=",
"__restrict=",
"__global_reg(n)=",
"__inline=",
"__int64=long long",
"__INTADDR__(expr)=0",
"__irq=",
"__packed=",
"__pure=",
"__smc(n)=",
"__svc(n)=",
"__svc_indirect(n)=",
"__svc_indirect_r7(n)=",
"__value_in_regs=",
"__weak=",
"__writeonly=",
"__declspec(x)=",
"__attribute__(x)=",
"__nonnull__(x)=",
"__register=",
"__breakpoint(x)=",
"__cdp(x,y,z)=",
"__clrex()=",
"__clz(x)=0U",
"__current_pc()=0U",
"__current_sp()=0U",
"__disable_fiq()=",
"__disable_irq()=",
"__dmb(x)=",
"__dsb(x)=",
"__enable_fiq()=",
"__enable_irq()=",
"__fabs(x)=0.0",
"__fabsf(x)=0.0f",
"__force_loads()=",
"__force_stores()=",
"__isb(x)=",
"__ldrex(x)=0U",
"__ldrexd(x)=0U",
"__ldrt(x)=0U",
"__memory_changed()=",
"__nop()=",
"__pld(...)=",
"__pli(...)=",
"__qadd(x,y)=0",
"__qdbl(x)=0",
"__qsub(x,y)=0",
"__rbit(x)=0U",
"__rev(x)=0U",
"__return_address()=0U",
"__ror(x,y)=0U",
"__schedule_barrier()=",
"__semihost(x,y)=0",
"__sev()=",
"__sqrt(x)=0.0",
"__sqrtf(x)=0.0f",
"__ssat(x,y)=0",
"__strex(x,y)=0U",
"__strexd(x,y)=0",
"__strt(x,y)=",
"__swp(x,y)=0U",
"__usat(x,y)=0U",
"__wfe()=",
"__wfi()=",
"__yield()=",
"__vfp_status(x,y)=0"
],
"intelliSenseMode": "${default}"
}
],
"version": 4
}

2
.vscode/keil-assistant.log

@ -0,0 +1,2 @@
[info] Log at : 2023/6/14|21:19:34|GMT+0800

5
.vscode/settings.json

@ -0,0 +1,5 @@
{
"files.associations": {
"compare": "cpp"
}
}

0
.vscode/uv4.log.lock

34
app/.mxproject

@ -1,36 +1,38 @@
[PreviousLibFiles]
LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_iwdg.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_iwdg.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.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;
LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_iwdg.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_iwdg.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.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;
[PreviousUsedIarFiles]
SourceFiles=..\Core\Src\main.c;..\Core\Src\stm32f1xx_it.c;..\Core\Src\stm32f1xx_hal_msp.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;;;
HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Core\Inc;
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;
[PreviousUsedKeilFiles]
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\iwdg.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32f1xx_it.c;..\Core\Src\stm32f1xx_hal_msp.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;;;
HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Core\Inc;
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;
[PreviousGenFiles]
AdvancedFolderStructure=true
HeaderFileListSize=6
HeaderFileListSize=7
HeaderFiles#0=..\Core\Inc\gpio.h
HeaderFiles#1=..\Core\Inc\iwdg.h
HeaderFiles#2=..\Core\Inc\usart.h
HeaderFiles#3=..\Core\Inc\stm32f1xx_it.h
HeaderFiles#4=..\Core\Inc\stm32f1xx_hal_conf.h
HeaderFiles#5=..\Core\Inc\main.h
HeaderFiles#2=..\Core\Inc\tim.h
HeaderFiles#3=..\Core\Inc\usart.h
HeaderFiles#4=..\Core\Inc\stm32f1xx_it.h
HeaderFiles#5=..\Core\Inc\stm32f1xx_hal_conf.h
HeaderFiles#6=..\Core\Inc\main.h
HeaderFolderListSize=1
HeaderPath#0=..\Core\Inc
HeaderFiles=;
SourceFileListSize=6
SourceFileListSize=7
SourceFiles#0=..\Core\Src\gpio.c
SourceFiles#1=..\Core\Src\iwdg.c
SourceFiles#2=..\Core\Src\usart.c
SourceFiles#3=..\Core\Src\stm32f1xx_it.c
SourceFiles#4=..\Core\Src\stm32f1xx_hal_msp.c
SourceFiles#5=..\Core\Src\main.c
SourceFiles#2=..\Core\Src\tim.c
SourceFiles#3=..\Core\Src\usart.c
SourceFiles#4=..\Core\Src\stm32f1xx_it.c
SourceFiles#5=..\Core\Src\stm32f1xx_hal_msp.c
SourceFiles#6=..\Core\Src\main.c
SourceFolderListSize=1
SourcePath#0=..\Core\Src
SourceFiles=;
[PreviousUsedKeilFiles]
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\iwdg.c;..\Core\Src\usart.c;..\Core\Src\stm32f1xx_it.c;..\Core\Src\stm32f1xx_hal_msp.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_iwdg.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;;;
HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Core\Inc;
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;

2
app/Core/Inc/stm32f1xx_hal_conf.h

@ -64,7 +64,7 @@
/*#define HAL_SMARTCARD_MODULE_ENABLED */
/*#define HAL_SPI_MODULE_ENABLED */
/*#define HAL_SRAM_MODULE_ENABLED */
/*#define HAL_TIM_MODULE_ENABLED */
#define HAL_TIM_MODULE_ENABLED
#define HAL_UART_MODULE_ENABLED
/*#define HAL_USART_MODULE_ENABLED */
/*#define HAL_WWDG_MODULE_ENABLED */

52
app/Core/Inc/tim.h

@ -0,0 +1,52 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file tim.h
* @brief This file contains all the function prototypes for
* the tim.c file
******************************************************************************
* @attention
*
* Copyright (c) 2023 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 __TIM_H__
#define __TIM_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern TIM_HandleTypeDef htim4;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_TIM4_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __TIM_H__ */

2
app/Core/Src/main.c

@ -19,6 +19,7 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "iwdg.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
@ -88,6 +89,7 @@ int main(void)
MX_GPIO_Init();
MX_IWDG_Init();
MX_USART2_UART_Init();
MX_TIM4_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */

104
app/Core/Src/tim.c

@ -0,0 +1,104 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file tim.c
* @brief This file provides code for the configuration
* of the TIM instances.
******************************************************************************
* @attention
*
* Copyright (c) 2023 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 "tim.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
TIM_HandleTypeDef htim4;
/* TIM4 init function */
void MX_TIM4_Init(void)
{
/* USER CODE BEGIN TIM4_Init 0 */
/* USER CODE END TIM4_Init 0 */
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
TIM_MasterConfigTypeDef sMasterConfig = {0};
/* USER CODE BEGIN TIM4_Init 1 */
/* USER CODE END TIM4_Init 1 */
htim4.Instance = TIM4;
htim4.Init.Prescaler = 63;
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = 65535;
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim4) != HAL_OK)
{
Error_Handler();
}
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
if (HAL_TIM_ConfigClockSource(&htim4, &sClockSourceConfig) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim4, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM4_Init 2 */
/* USER CODE END TIM4_Init 2 */
}
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
{
if(tim_baseHandle->Instance==TIM4)
{
/* USER CODE BEGIN TIM4_MspInit 0 */
/* USER CODE END TIM4_MspInit 0 */
/* TIM4 clock enable */
__HAL_RCC_TIM4_CLK_ENABLE();
/* USER CODE BEGIN TIM4_MspInit 1 */
/* USER CODE END TIM4_MspInit 1 */
}
}
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
{
if(tim_baseHandle->Instance==TIM4)
{
/* USER CODE BEGIN TIM4_MspDeInit 0 */
/* USER CODE END TIM4_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM4_CLK_DISABLE();
/* USER CODE BEGIN TIM4_MspDeInit 1 */
/* USER CODE END TIM4_MspDeInit 1 */
}
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */

223
app/MDK-ARM/app.uvprojx

@ -336,7 +336,7 @@
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls>--diag_suppress=381 --diag_suppress=1 --diag_suppress=177 --diag_suppress=111 --diag_suppress=1295</MiscControls>
<MiscControls>--diag_suppress=381 --diag_suppress=1 --diag_suppress=177 --diag_suppress=111 --diag_suppress=1295</MiscControls>
<Define>USE_HAL_DRIVER,STM32F103xB</Define>
<Undefine></Undefine>
<IncludePath>../Core/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include;../../dep;../../src;../../dep/libtrinamic/IFLYTOP-TMC-API</IncludePath>
@ -409,6 +409,62 @@
<FilePath>../Core/Src/iwdg.c</FilePath>
</File>
<File>
<FileName>tim.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/tim.c</FilePath>
<FileOption>
<CommonProperty>
<UseCPPCompiler>2</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>2</AlwaysBuild>
<GenerateAssemblyFile>2</GenerateAssemblyFile>
<AssembleAssemblyFile>2</AssembleAssemblyFile>
<PublicsOnly>2</PublicsOnly>
<StopOnExitCode>11</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<FileArmAds>
<Cads>
<interw>2</interw>
<Optim>0</Optim>
<oTime>2</oTime>
<SplitLS>2</SplitLS>
<OneElfS>2</OneElfS>
<Strict>2</Strict>
<EnumInt>2</EnumInt>
<PlainCh>2</PlainCh>
<Ropi>2</Ropi>
<Rwpi>2</Rwpi>
<wLevel>0</wLevel>
<uThumb>2</uThumb>
<uSurpInc>2</uSurpInc>
<uC99>2</uC99>
<uGnu>2</uGnu>
<useXO>2</useXO>
<v6Lang>0</v6Lang>
<v6LangP>0</v6LangP>
<vShortEn>2</vShortEn>
<vShortWch>2</vShortWch>
<v6Lto>2</v6Lto>
<v6WtE>2</v6WtE>
<v6Rtti>2</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Cads>
</FileArmAds>
</FileOption>
</File>
<File>
<FileName>usart.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/usart.c</FilePath>
@ -516,6 +572,171 @@
</Files>
</Group>
<Group>
<GroupName>dep/libiflytop_micro</GroupName>
<Files>
<File>
<FileName>basic.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\basic.c</FilePath>
</File>
<File>
<FileName>stm32_hal.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\stm32_hal.cpp</FilePath>
</File>
<File>
<FileName>zsignal.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\zsignal.cpp</FilePath>
</File>
<File>
<FileName>pid_ctrl.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\pid\pid_ctrl.c</FilePath>
</File>
<File>
<FileName>iflytop_can_slave.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\iflytop_can_slave_v1\iflytop_can_slave.cpp</FilePath>
</File>
<File>
<FileName>stm32_gpio.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\stm32_gpio.cpp</FilePath>
</File>
<File>
<FileName>iflytop_can_slave_controler_service.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\motor_control\iflytop_can_slave_controler_service.cpp</FilePath>
</File>
<File>
<FileName>i_iflytop_can_slave_module.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\iflytop_can_slave_module\i_iflytop_can_slave_module.cpp</FilePath>
</File>
<File>
<FileName>device_base_control_service.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\iflytop_can_slave_module\device_base_control_service.cpp</FilePath>
</File>
<File>
<FileName>single_axis_motor_control_v2.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\iflytop_can_slave_module\single_axis_motor_control_v2.cpp</FilePath>
</File>
<File>
<FileName>iflytop_micro_os.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\iflytop_micro_os.cpp</FilePath>
</File>
<File>
<FileName>queue.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\queue.cpp</FilePath>
</File>
<File>
<FileName>state_machine.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\state_machine.cpp</FilePath>
</File>
<File>
<FileName>stm32_uart.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\stm32_uart.cpp</FilePath>
</File>
<File>
<FileName>qy3235.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\gxservo\qy3235.cpp</FilePath>
</File>
<File>
<FileName>idcard_reader_service.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\iflytop_can_slave_module\idcard_reader_service.cpp</FilePath>
</File>
<File>
<FileName>m3078_code_scaner.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\m3078\m3078_code_scaner.cpp</FilePath>
</File>
<File>
<FileName>servo_motor_control.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\motor_control\servo_motor_control.cpp</FilePath>
</File>
<File>
<FileName>single_axis_motor_control.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\motor_control\single_axis_motor_control.cpp</FilePath>
</File>
<File>
<FileName>pwm.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\pwm\pwm.c</FilePath>
</File>
<File>
<FileName>TMC4361A.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmc\ic\TMC4361A\TMC4361A.c</FilePath>
</File>
<File>
<FileName>TMC5130.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmc\ic\TMC5130\TMC5130.c</FilePath>
</File>
<File>
<FileName>ztmc2160.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmc\ic\ztmc2160.cpp</FilePath>
</File>
<File>
<FileName>ztmc5130.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmc\ic\ztmc5130.cpp</FilePath>
</File>
<File>
<FileName>ztmc5160.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmc\ic\ztmc5160.cpp</FilePath>
</File>
<File>
<FileName>tmc4361A_stm32_channel.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmcutils\tmc4361A_stm32_channel.cpp</FilePath>
</File>
<File>
<FileName>tmp117.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmp117\tmp117.cpp</FilePath>
</File>
<File>
<FileName>ztmc4361A.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\component\tmc\ic\ztmc4361A.cpp</FilePath>
</File>
<File>
<FileName>stm32_tim.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\dep\libiflytop_micro\stm32\basic\stm32_tim.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>src</GroupName>
<Files>
<File>
<FileName>umain.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\src\umain.cpp</FilePath>
</File>
<File>
<FileName>hardware.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\src\board\hardware.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
</Groups>

12
app/app.ioc

@ -13,8 +13,9 @@ Mcu.IP0=IWDG
Mcu.IP1=NVIC
Mcu.IP2=RCC
Mcu.IP3=SYS
Mcu.IP4=USART2
Mcu.IPNb=5
Mcu.IP4=TIM4
Mcu.IP5=USART2
Mcu.IPNb=6
Mcu.Name=STM32F103C(8-B)Tx
Mcu.Package=LQFP48
Mcu.Pin0=PA2
@ -23,7 +24,8 @@ Mcu.Pin2=PA13
Mcu.Pin3=PA14
Mcu.Pin4=VP_IWDG_VS_IWDG
Mcu.Pin5=VP_SYS_VS_Systick
Mcu.PinsNb=6
Mcu.Pin6=VP_TIM4_VS_ClockSourceINT
Mcu.PinsNb=7
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F103C8Tx
@ -96,10 +98,14 @@ RCC.SYSCLKFreq_VALUE=64000000
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
RCC.TimSysFreq_Value=64000000
RCC.USBFreq_Value=64000000
TIM4.IPParameters=Prescaler
TIM4.Prescaler=63
USART2.IPParameters=VirtualMode
USART2.VirtualMode=VM_ASYNC
VP_IWDG_VS_IWDG.Mode=IWDG_Activate
VP_IWDG_VS_IWDG.Signal=IWDG_VS_IWDG
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM4_VS_ClockSourceINT.Mode=Internal
VP_TIM4_VS_ClockSourceINT.Signal=TIM4_VS_ClockSourceINT
board=custom

2
dep/libiflytop_micro

@ -1 +1 @@
Subproject commit 51100549ca3b283c5281efec0921a281910c56fc
Subproject commit 66cbc54d57a7a2d1b2e704e1042a98a44ce0959e

61
src/board/hardware.cpp

@ -0,0 +1,61 @@
#include "hardware.hpp"
using namespace iflytop;
#define TAG "hardware"
extern "C" {
int fputc(int ch, FILE* stream) {
uint8_t c = ch;
HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100);
return ch;
}
}
void Hardware::initialize() {
STM32_HAL::regListener(this);
}
void Hardware::periodicJob() {}
/*******************************************************************************
* *
*******************************************************************************/
void Hardware::debug_light_init() { DEBUG_LIGHT_GPIO.initAsOutput(STM32_GPIO::kOutput_nopull, false, false); }
void Hardware::debug_light_periodicJob() {
static uint32_t lastprocess = 0;
if (sys_haspassedms(lastprocess) > 300) {
lastprocess = HAL_GetTick();
DEBUG_LIGHT_GPIO.toggleState();
}
}
/*******************************************************************************
* INPUT SENSOR *
*******************************************************************************/
void Hardware::input_sensor_init() {}
uint32_t Hardware::input_sensor_get_table0() {
uint32_t val = 0;
return val;
}
void Hardware::input_sensor_table0_dump() {
uint32_t val = input_sensor_get_table0();
ZLOGI(TAG, "input_sensor_table0_dump:%d%d%d%d %d%d%d%d %d%d%d%d %d%d%d", (val >> 0) & 0x01, //
(val >> 1) & 0x01, //
(val >> 2) & 0x01, //
(val >> 3) & 0x01, //
(val >> 4) & 0x01, //
(val >> 5) & 0x01, //
(val >> 6) & 0x01, //
(val >> 7) & 0x01, //
(val >> 8) & 0x01, //
(val >> 9) & 0x01, //
(val >> 10) & 0x01, //
(val >> 11) & 0x01, //
(val >> 12) & 0x01, //
(val >> 13) & 0x01, //
(val >> 14) & 0x01);
// return val;
}

60
src/board/hardware.hpp

@ -0,0 +1,60 @@
#pragma once
#include "board/project_board.hpp"
#include "libiflytop_micro/stm32/basic/basic.h"
#include "libiflytop_micro\stm32\basic\iflytop_micro_os.hpp"
#include "libiflytop_micro\stm32\basic\stm32_hal.hpp"
#include "libiflytop_micro\stm32\component\tmcutils\tmc51x0_port_impl.hpp"
#include "main.h"
#include "usart.h"
namespace iflytop {
#define MAX_HARDWARE_LISTENER_NUM 5
class HardwareListener {
public:
virtual void Hardware_OnHardwareException(){};
virtual void Hardware_OnCanRxData(void *packet){};
virtual void Hardware_onHomeRefSwitchISR(){};
};
class Hardware : public STM32_HAL_LISTENER, //
public IflytopMicroOS,
public STM32_GPIO_LISTENER {
private:
public:
public:
Hardware(/* args */){};
~Hardware(){};
void initialize();
void periodicJob();
/*******************************************************************************
* *
*******************************************************************************/
void debug_light_init();
void debug_light_periodicJob();
public:
/*******************************************************************************
* INPUT SENSOR *
*******************************************************************************/
void input_sensor_init();
uint32_t input_sensor_get_table0();
void input_sensor_table0_dump();
public:
/*******************************************************************************
* OVERRIDE IflytopMicroOS *
*******************************************************************************/
virtual void sleepMS(int ms) { HAL_Delay(ms); };
virtual uint32_t hasPassedMS(uint32_t ticket) { return sys_haspassedms(ticket); };
virtual uint32_t getTicket() { return HAL_GetTick(); };
virtual uint32_t getNowMS() { return HAL_GetTick(); };
virtual void sleepus(uint32_t us) { sys_delay_us(&DELAY_US_TIMER, us); }
/*******************************************************************************
* STM32_GPIO_LISTENER *
*******************************************************************************/
private:
};
} // namespace iflytop

10
src/board/project_board.hpp

@ -0,0 +1,10 @@
#pragma once
#include "libiflytop_micro\stm32\basic\stm32_gpio.hpp"
#define VERSION "v1.0"
// 调试串口
#define DEBUG_UART huart2
// 调试指示灯
#define DEBUG_LIGHT_GPIO PA1
// 微秒延迟定时器,注意该延时定时器需要按照以下文档进行配置
// http://192.168.1.3:3000/zwikipedia/iflytop_wikipedia/src/branch/master/doc/stm32cubemx_us_timer.md
#define DELAY_US_TIMER htim4

27
src/umain.cpp

@ -0,0 +1,27 @@
#include "umain.hpp"
#include <limits.h>
#include <stdint.h>
using namespace iflytop;
using namespace std;
/*******************************************************************************
* CODE BEGIN *
*******************************************************************************/
#define TAG "umain"
int random(int max) { return SysTick->VAL % max; }
/*******************************************************************************
* MAIN *
*******************************************************************************/
void Main::main(int argc, char const *argv[]) {
sys_loggger_enable(true);
ZLOGI(TAG, "setup")
m_hardware.initialize();
m_hardware.debug_light_init();
m_hardware.input_sensor_init();
while (true) {
m_hardware.periodicJob();
m_hardware.debug_light_periodicJob();
}
}

46
src/umain.hpp

@ -0,0 +1,46 @@
#pragma once
#include <stdbool.h>
#include <stdio.h>
#include "board/project_board.hpp"
#include "libiflytop_micro\stm32\basic\basic.h"
#include "libiflytop_micro\stm32\component\tmc\ic\tmc4361A.hpp"
//
#include <stdlib.h>
#include "board/hardware.hpp"
#include "libiflytop_micro\stm32\basic\stm32_tim.hpp"
#include "libiflytop_micro\stm32\basic\zsignal.hpp"
#include "libiflytop_micro\stm32\component\iflytop_can_slave_module\device_base_control_service.hpp"
#include "libiflytop_micro\stm32\component\iflytop_can_slave_module\idcard_reader_service.hpp"
#include "libiflytop_micro\stm32\component\iflytop_can_slave_module\single_axis_motor_control_v2.hpp"
#include "libiflytop_micro\stm32\component\iflytop_can_slave_v1\iflytop_can_slave.hpp"
#include "libiflytop_micro\stm32\component\m3078\m3078_code_scaner.hpp"
#define UPDATE_REG(reg, value, periodms) \
{ \
static uint32_t lastReportTicket = 0; \
if (m_hardware.hasPassedMS(lastReportTicket) > (periodms + random(3))) { \
lastReportTicket = m_hardware.getTicket(); \
m_protocolStack.writeRegValue(reg, value, false); \
} \
}
namespace iflytop {
class Main {
public:
Hardware m_hardware;
Main() {}
void main(int argc, char const *argv[]);
public:
};
} // namespace iflytop
static iflytop::Main mainObject;
extern "C" {
int umain(int argc, char const *argv[]) {
mainObject.main(argc, argv);
return 0;
}
}
Loading…
Cancel
Save