diff --git a/.cproject b/.cproject
deleted file mode 100644
index 50985a6..0000000
--- a/.cproject
+++ /dev/null
@@ -1,198 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index acf5dd9..fd2096a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,3 +86,8 @@ dkms.conf
*.out
*.app
+.settings
+.vscode
+build
+/*.bak
+/SW Debug.launch
diff --git a/.mxproject b/.mxproject
new file mode 100644
index 0000000..f05cee6
--- /dev/null
+++ b/.mxproject
@@ -0,0 +1,54 @@
+[PreviousLibFiles]
+LibFiles=Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pcd.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pcd_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_usb.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_def.h;Drivers\STM32G4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_rcc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_rcc_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_bus.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_rcc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_system.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_utils.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_crs.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_flash.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_flash_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_flash_ramfunc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_gpio.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_gpio_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_gpio.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_exti.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_exti.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_dma.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_dma_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_dma.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_dmamux.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pwr.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pwr_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_pwr.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_cortex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_cortex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_adc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_adc_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_adc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_i2c.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_i2c.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_i2c_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_tim.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_tim_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_tim.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_uart.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_usart.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_lpuart.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_uart_ex.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_core.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_ctlreq.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_def.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_ioreq.h;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Inc\usbd_cdc.h;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_usb.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ramfunc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_gpio.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_core.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ioreq.c;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pcd.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pcd_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_usb.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_def.h;Drivers\STM32G4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_rcc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_rcc_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_bus.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_rcc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_system.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_utils.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_crs.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_flash.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_flash_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_flash_ramfunc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_gpio.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_gpio_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_gpio.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_exti.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_exti.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_dma.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_dma_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_dma.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_dmamux.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pwr.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_pwr_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_pwr.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_cortex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_cortex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_adc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_adc_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_adc.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_i2c.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_i2c.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_i2c_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_tim.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_tim_ex.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_tim.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_uart.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_usart.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_ll_lpuart.h;Drivers\STM32G4xx_HAL_Driver\Inc\stm32g4xx_hal_uart_ex.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_core.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_ctlreq.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_def.h;Middlewares\ST\STM32_USB_Device_Library\Core\Inc\usbd_ioreq.h;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Inc\usbd_cdc.h;Drivers\CMSIS\Device\ST\STM32G4xx\Include\stm32g473xx.h;Drivers\CMSIS\Device\ST\STM32G4xx\Include\stm32g4xx.h;Drivers\CMSIS\Device\ST\STM32G4xx\Include\system_stm32g4xx.h;Drivers\CMSIS\Device\ST\STM32G4xx\Source\Templates\system_stm32g4xx.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;
+
+[PreviousUsedCubeIDEFiles]
+SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\adc.c;Core\Src\dma.c;Core\Src\i2c.c;Core\Src\tim.c;Core\Src\usart.c;USB_Device\App\usb_device.c;USB_Device\Target\usbd_conf.c;USB_Device\App\usbd_desc.c;USB_Device\App\usbd_cdc_if.c;Core\Src\stm32g4xx_it.c;Core\Src\stm32g4xx_hal_msp.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_usb.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ramfunc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_gpio.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_core.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ioreq.c;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c;Drivers\CMSIS\Device\ST\STM32G4xx\Source\Templates\system_stm32g4xx.c;Core\Src\system_stm32g4xx.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_usb.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ramfunc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_gpio.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_core.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ioreq.c;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c;Drivers\CMSIS\Device\ST\STM32G4xx\Source\Templates\system_stm32g4xx.c;Core\Src\system_stm32g4xx.c;;;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_core.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ioreq.c;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c;
+HeaderPath=Drivers\STM32G4xx_HAL_Driver\Inc;Drivers\STM32G4xx_HAL_Driver\Inc\Legacy;Middlewares\ST\STM32_USB_Device_Library\Core\Inc;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Inc;Drivers\CMSIS\Device\ST\STM32G4xx\Include;Drivers\CMSIS\Include;Core\Inc;USB_Device\App;USB_Device\Target;
+CDefines=USE_HAL_DRIVER;STM32G473xx;USE_HAL_DRIVER;USE_HAL_DRIVER;
+
+[PreviousUsedCMakes]
+SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\adc.c;Core\Src\dma.c;Core\Src\i2c.c;Core\Src\tim.c;Core\Src\usart.c;USB_Device\App\usb_device.c;USB_Device\Target\usbd_conf.c;USB_Device\App\usbd_desc.c;USB_Device\App\usbd_cdc_if.c;Core\Src\stm32g4xx_it.c;Core\Src\stm32g4xx_hal_msp.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_usb.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ramfunc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_gpio.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_core.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ioreq.c;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c;Drivers\CMSIS\Device\ST\STM32G4xx\Source\Templates\system_stm32g4xx.c;Core\Src\system_stm32g4xx.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pcd_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_usb.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash_ramfunc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_gpio.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_i2c_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart.c;Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_core.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ioreq.c;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c;Drivers\CMSIS\Device\ST\STM32G4xx\Source\Templates\system_stm32g4xx.c;Core\Src\system_stm32g4xx.c;;;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_core.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ctlreq.c;Middlewares\ST\STM32_USB_Device_Library\Core\Src\usbd_ioreq.c;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c;
+HeaderPath=Drivers\STM32G4xx_HAL_Driver\Inc;Drivers\STM32G4xx_HAL_Driver\Inc\Legacy;Middlewares\ST\STM32_USB_Device_Library\Core\Inc;Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Inc;Drivers\CMSIS\Device\ST\STM32G4xx\Include;Drivers\CMSIS\Include;Core\Inc;USB_Device\App;USB_Device\Target;
+CDefines=USE_HAL_DRIVER;STM32G473xx;USE_HAL_DRIVER;USE_HAL_DRIVER;
+
+[PreviousGenFiles]
+AdvancedFolderStructure=true
+HeaderFileListSize=13
+HeaderFiles#0=..\Core\Inc\gpio.h
+HeaderFiles#1=..\Core\Inc\adc.h
+HeaderFiles#2=..\Core\Inc\dma.h
+HeaderFiles#3=..\Core\Inc\i2c.h
+HeaderFiles#4=..\Core\Inc\tim.h
+HeaderFiles#5=..\Core\Inc\usart.h
+HeaderFiles#6=..\USB_Device\App\usb_device.h
+HeaderFiles#7=..\USB_Device\Target\usbd_conf.h
+HeaderFiles#8=..\USB_Device\App\usbd_desc.h
+HeaderFiles#9=..\USB_Device\App\usbd_cdc_if.h
+HeaderFiles#10=..\Core\Inc\stm32g4xx_it.h
+HeaderFiles#11=..\Core\Inc\stm32g4xx_hal_conf.h
+HeaderFiles#12=..\Core\Inc\main.h
+HeaderFolderListSize=3
+HeaderPath#0=..\Core\Inc
+HeaderPath#1=..\USB_Device\App
+HeaderPath#2=..\USB_Device\Target
+HeaderFiles=;
+SourceFileListSize=13
+SourceFiles#0=..\Core\Src\gpio.c
+SourceFiles#1=..\Core\Src\adc.c
+SourceFiles#2=..\Core\Src\dma.c
+SourceFiles#3=..\Core\Src\i2c.c
+SourceFiles#4=..\Core\Src\tim.c
+SourceFiles#5=..\Core\Src\usart.c
+SourceFiles#6=..\USB_Device\App\usb_device.c
+SourceFiles#7=..\USB_Device\Target\usbd_conf.c
+SourceFiles#8=..\USB_Device\App\usbd_desc.c
+SourceFiles#9=..\USB_Device\App\usbd_cdc_if.c
+SourceFiles#10=..\Core\Src\stm32g4xx_it.c
+SourceFiles#11=..\Core\Src\stm32g4xx_hal_msp.c
+SourceFiles#12=..\Core\Src\main.c
+SourceFolderListSize=3
+SourcePath#0=..\Core\Src
+SourcePath#1=..\USB_Device\App
+SourcePath#2=..\USB_Device\Target
+SourceFiles=;
+
diff --git a/.project b/.project
deleted file mode 100644
index 76d282e..0000000
--- a/.project
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
- SW
-
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.genmakebuilder
- clean,full,incremental,
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
- full,incremental,
-
-
-
-
-
- com.st.stm32cube.ide.mcu.MCUProjectNature
- com.st.stm32cube.ide.mcu.MCUCubeProjectNature
- org.eclipse.cdt.core.cnature
- com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature
- com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature
- com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature
- com.st.stm32cube.ide.mcu.MCURootProjectNature
- org.eclipse.cdt.managedbuilder.core.managedBuildNature
- org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
-
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..8308a3d
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,68 @@
+cmake_minimum_required(VERSION 3.22)
+
+#
+# This file is generated only once,
+# and is not re-generated if converter is called multiple times.
+#
+# User is free to modify the file as much as necessary
+#
+
+# Setup compiler settings
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+set(CMAKE_C_EXTENSIONS ON)
+
+
+# Define the build type
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Debug")
+endif()
+
+# Set the project name
+set(CMAKE_PROJECT_NAME SW)
+
+# Include toolchain file
+include("cmake/gcc-arm-none-eabi.cmake")
+
+# Enable compile command to ease indexing with e.g. clangd
+set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
+
+# Enable CMake support for ASM and C languages
+enable_language(C ASM)
+
+# Core project settings
+project(${CMAKE_PROJECT_NAME})
+message("Build type: " ${CMAKE_BUILD_TYPE})
+
+# Create an executable object type
+add_executable(${CMAKE_PROJECT_NAME})
+
+# Add STM32CubeMX generated sources
+add_subdirectory(cmake/stm32cubemx)
+
+# Link directories setup
+target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE
+ # Add user defined library search paths
+)
+
+# Add sources to executable
+target_sources(${CMAKE_PROJECT_NAME} PRIVATE
+ # Add user sources here
+)
+
+# Add include paths
+target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
+ # Add user defined include paths
+)
+
+# Add project symbols (macros)
+target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
+ # Add user defined symbols
+)
+
+# Add linked libraries
+target_link_libraries(${CMAKE_PROJECT_NAME}
+ stm32cubemx
+
+ # Add user defined libraries
+)
diff --git a/CMakePresets.json b/CMakePresets.json
new file mode 100644
index 0000000..a86b366
--- /dev/null
+++ b/CMakePresets.json
@@ -0,0 +1,61 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "default",
+ "hidden": true,
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/build/${presetName}",
+ "toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake",
+ "cacheVariables": {
+ "CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
+ }
+ },
+ {
+ "name": "Debug",
+ "inherits": "default",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug"
+ }
+ },
+ {
+ "name": "RelWithDebInfo",
+ "inherits": "default",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "RelWithDebInfo"
+ }
+ },
+ {
+ "name": "Release",
+ "inherits": "default",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Release"
+ }
+ },
+ {
+ "name": "MinSizeRel",
+ "inherits": "default",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "MinSizeRel"
+ }
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "Debug",
+ "configurePreset": "Debug"
+ },
+ {
+ "name": "RelWithDebInfo",
+ "configurePreset": "RelWithDebInfo"
+ },
+ {
+ "name": "Release",
+ "configurePreset": "Release"
+ },
+ {
+ "name": "MinSizeRel",
+ "configurePreset": "MinSizeRel"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Core/Inc/version.h b/Core/Inc/version.h
new file mode 100644
index 0000000..a507557
--- /dev/null
+++ b/Core/Inc/version.h
@@ -0,0 +1,9 @@
+#ifndef _VERSION_H
+
+#define _VERSION_H
+#define VERSION_MAJOR (1)
+#define VERSION_MINOR (0)
+#define VERSION_PATCH (1)
+#define VERSION_STR "V1.0.1"
+
+#endif
\ No newline at end of file
diff --git a/Core/Src/main.c b/Core/Src/main.c
index dac4a78..f59502b 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -1,20 +1,20 @@
/* USER CODE BEGIN Header */
/**
- ******************************************************************************
- * @file : main.c
- * @brief : Main program body
- ******************************************************************************
- * @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.
- *
- ******************************************************************************
- */
+ ******************************************************************************
+ * @file : main.c
+ * @brief : Main program body
+ ******************************************************************************
+ * @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 "main.h"
@@ -30,26 +30,28 @@
/* USER CODE BEGIN Includes */
#include
#include "usbd_cdc_if.h"
+#include "version.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
-typedef struct EMA_Filter {
- float filtered_sample;
- uint32_t last_sample;
- float coeff;
+typedef struct EMA_Filter
+{
+ float filtered_sample;
+ uint32_t last_sample;
+ float coeff;
} EMA_Filter_t;
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
-#define NUM_SLIDERS (6u)
-#define SLIDER_COEFF 0.30f
+#define NUM_SLIDERS (6u)
+#define SLIDER_COEFF 0.30f
-#define MAX_PWM_VALUE (1000u)
+#define MAX_PWM_VALUE (10000u)
-#define BTN_POLL_TIME (100u)
-#define UART_LOOP_TIME (1000u)
+#define BTN_POLL_TIME (100u)
+#define UART_LOOP_TIME (1000u)
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
@@ -97,252 +99,255 @@ float map_clamp(float x, float in_min, float in_max, float out_min, float out_ma
/* USER CODE END 0 */
/**
- * @brief The application entry point.
- * @retval int
- */
+ * @brief The application entry point.
+ * @retval int
+ */
int main(void)
{
- /* USER CODE BEGIN 1 */
- uint32_t prev_uart_tick = UART_LOOP_TIME;
- uint32_t prev_btn_time = BTN_POLL_TIME;
- /* USER CODE END 1 */
+ /* USER CODE BEGIN 1 */
+ uint32_t prev_uart_tick = UART_LOOP_TIME;
+ uint32_t prev_btn_time = BTN_POLL_TIME;
+ /* USER CODE END 1 */
- /* MCU Configuration--------------------------------------------------------*/
+ /* MCU Configuration--------------------------------------------------------*/
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
- HAL_Init();
+ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
+ HAL_Init();
- /* USER CODE BEGIN Init */
+ /* USER CODE BEGIN Init */
- /* USER CODE END Init */
+ /* USER CODE END Init */
- /* Configure the system clock */
- SystemClock_Config();
+ /* Configure the system clock */
+ SystemClock_Config();
- /* USER CODE BEGIN SysInit */
+ /* USER CODE BEGIN SysInit */
- /* USER CODE END SysInit */
+ /* USER CODE END SysInit */
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- MX_DMA_Init();
- MX_I2C1_Init();
- MX_TIM1_Init();
- MX_TIM2_Init();
- MX_TIM3_Init();
- MX_ADC1_Init();
- MX_ADC2_Init();
- MX_USART1_UART_Init();
- MX_USB_Device_Init();
- /* USER CODE BEGIN 2 */
- // Initialize EMA filters
- for (uint32_t i = 0; i < NUM_SLIDERS; i++)
- {
- m_slider_filters[i].last_sample = 0;
- m_slider_filters[i].coeff = SLIDER_COEFF;
- }
+ /* Initialize all configured peripherals */
+ MX_GPIO_Init();
+ MX_DMA_Init();
+ MX_I2C1_Init();
+ MX_TIM1_Init();
+ MX_TIM2_Init();
+ MX_TIM3_Init();
+ MX_ADC1_Init();
+ MX_ADC2_Init();
+ MX_USART1_UART_Init();
+ MX_USB_Device_Init();
+ /* USER CODE BEGIN 2 */
+ // Initialize EMA filters
+ for (uint32_t i = 0; i < NUM_SLIDERS; i++)
+ {
+ m_slider_filters[i].last_sample = 0;
+ m_slider_filters[i].coeff = SLIDER_COEFF;
+ }
- // ADC setup
- // Calibrate
- HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
- HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);
+ // ADC setup
+ // Calibrate
+ HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
+ HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);
- HAL_ADC_Start_DMA(&hadc1, (uint32_t *)m_adc1, 4);
- HAL_ADC_Start_DMA(&hadc2, (uint32_t *)m_adc2, 2);
+ HAL_ADC_Start_DMA(&hadc1, (uint32_t *)m_adc1, 4);
+ HAL_ADC_Start_DMA(&hadc2, (uint32_t *)m_adc2, 2);
- // PWM Setup
- htim1.Instance->CCR1 = 0;
- htim1.Instance->CCR2 = 0;
- htim1.Instance->CCR3 = 0;
+ // PWM Setup
+ htim1.Instance->CCR1 = 0;
+ htim1.Instance->CCR2 = 0;
+ htim1.Instance->CCR3 = 0;
- htim2.Instance->CCR1 = 0;
- htim2.Instance->CCR2 = 0;
- htim2.Instance->CCR3 = 0;
+ htim2.Instance->CCR1 = 0;
+ htim2.Instance->CCR2 = 0;
+ htim2.Instance->CCR3 = 0;
- HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
- HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
- HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
+ HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
+ HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
+ HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
- HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
- HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2);
- HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_3);
+ HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
+ HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2);
+ HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_3);
- HAL_TIM_Base_Start(&htim3);
+ HAL_TIM_Base_Start(&htim3);
- /* USER CODE END 2 */
+ /* USER CODE END 2 */
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- while (1)
- {
- if ((m_adc1_filtered_ready) == true && (m_adc2_filtered_ready == true))
- {
- // Map ADC value to PWM value
- for(uint32_t i = 0; i < NUM_SLIDERS; i++)
- {
- m_sliders[i] = map_clamp(m_slider_filters[i].filtered_sample, 100.0f, 3900.0f, 0.0f, 100.0f);
- }
+ /* Infinite loop */
+ /* USER CODE BEGIN WHILE */
+ while (1)
+ {
+ if ((m_adc1_filtered_ready) == true && (m_adc2_filtered_ready == true))
+ {
+ // Map ADC value to PWM value
+ for (uint32_t i = 0; i < NUM_SLIDERS; i++)
+ {
+ m_sliders[i] = map_clamp(m_slider_filters[i].filtered_sample, 100.0f, 3900.0f, 0.0f, 100.0f);
+ }
- // Channel 1 is master, Channels 2-6 are slaves
- for(uint32_t j = 1; j < NUM_SLIDERS; j++)
- {
- m_sliders[j] = map_clamp(m_sliders[j], 0.0f, 100.0f, 0.0f, m_sliders[0]);
- }
+ // Channel 1 is master, Channels 2-6 are slaves
+ for (uint32_t j = 1; j < NUM_SLIDERS; j++)
+ {
+ m_sliders[j] = map_clamp(m_sliders[j], 0.0f, 100.0f, 0.0f, m_sliders[0]);
+ }
- set_pwm_outputs();
+ set_pwm_outputs();
- m_adc1_filtered_ready = false;
- m_adc2_filtered_ready = false;
- }
+ m_adc1_filtered_ready = false;
+ m_adc2_filtered_ready = false;
+ }
- if ((HAL_GetTick() - prev_uart_tick) >= UART_LOOP_TIME)
- {
- prev_uart_tick = HAL_GetTick();
+ if ((HAL_GetTick() - prev_uart_tick) >= UART_LOOP_TIME)
+ {
+ prev_uart_tick = HAL_GetTick();
- int len = snprintf(buf, 128, "Master\tCh1\tCh2\tCh3\tCh4\t\r\n");
- CDC_Transmit_FS((uint8_t *)buf, len);
+ int len = snprintf(buf, 128, "Version: %s\r\n", VERSION_STR);
+ CDC_Transmit_FS((uint8_t *)buf, len);
- len = snprintf(buf, 128, "%03.1f\t%03.1f\t%03.1f\t%03.1f\t%03.1f\t\r\n",
- m_sliders[0], m_sliders[1], m_sliders[2], m_sliders[3], m_sliders[4]);
- CDC_Transmit_FS((uint8_t *)buf, len);
- }
+ len = snprintf(buf, 128, "Master\tCh1\tCh2\tCh3\tCh4\t\r\n");
+ CDC_Transmit_FS((uint8_t *)buf, len);
- if ((HAL_GetTick() - prev_btn_time) >= BTN_POLL_TIME)
- {
- prev_btn_time = HAL_GetTick();
+ len = snprintf(buf, 128, "%03.1f\t%03.1f\t%03.1f\t%03.1f\t%03.1f\t\r\n",
+ m_sliders[0], m_sliders[1], m_sliders[2], m_sliders[3], m_sliders[4]);
+ CDC_Transmit_FS((uint8_t *)buf, len);
+ }
- m_buttons |= (m_buttons & ~0x01) | HAL_GPIO_ReadPin(Btn_0_GPIO_Port, Btn_0_Pin);
- m_buttons |= (m_buttons & ~0x02) | HAL_GPIO_ReadPin(Btn_1_GPIO_Port, Btn_1_Pin) << 1;
- m_buttons |= (m_buttons & ~0x04) | HAL_GPIO_ReadPin(Btn_2_GPIO_Port, Btn_2_Pin) << 2;
- m_buttons |= (m_buttons & ~0x08) | HAL_GPIO_ReadPin(Btn_3_GPIO_Port, Btn_3_Pin) << 3;
- m_buttons |= (m_buttons & ~0x10) | HAL_GPIO_ReadPin(Btn_4_GPIO_Port, Btn_4_Pin) << 4;
- m_buttons |= (m_buttons & ~0x20) | HAL_GPIO_ReadPin(Btn_5_GPIO_Port, Btn_5_Pin) << 5;
- m_buttons |= (m_buttons & ~0x40) | HAL_GPIO_ReadPin(Btn_6_GPIO_Port, Btn_6_Pin) << 6;
- m_buttons |= (m_buttons & ~0x80) | HAL_GPIO_ReadPin(Btn_7_GPIO_Port, Btn_7_Pin) << 7;
- }
- /* USER CODE END WHILE */
+ if ((HAL_GetTick() - prev_btn_time) >= BTN_POLL_TIME)
+ {
+ prev_btn_time = HAL_GetTick();
- /* USER CODE BEGIN 3 */
- }
- /* USER CODE END 3 */
+ m_buttons |= (m_buttons & ~0x01) | HAL_GPIO_ReadPin(Btn_0_GPIO_Port, Btn_0_Pin);
+ m_buttons |= (m_buttons & ~0x02) | HAL_GPIO_ReadPin(Btn_1_GPIO_Port, Btn_1_Pin) << 1;
+ m_buttons |= (m_buttons & ~0x04) | HAL_GPIO_ReadPin(Btn_2_GPIO_Port, Btn_2_Pin) << 2;
+ m_buttons |= (m_buttons & ~0x08) | HAL_GPIO_ReadPin(Btn_3_GPIO_Port, Btn_3_Pin) << 3;
+ m_buttons |= (m_buttons & ~0x10) | HAL_GPIO_ReadPin(Btn_4_GPIO_Port, Btn_4_Pin) << 4;
+ m_buttons |= (m_buttons & ~0x20) | HAL_GPIO_ReadPin(Btn_5_GPIO_Port, Btn_5_Pin) << 5;
+ m_buttons |= (m_buttons & ~0x40) | HAL_GPIO_ReadPin(Btn_6_GPIO_Port, Btn_6_Pin) << 6;
+ m_buttons |= (m_buttons & ~0x80) | HAL_GPIO_ReadPin(Btn_7_GPIO_Port, Btn_7_Pin) << 7;
+ }
+ /* USER CODE END WHILE */
+
+ /* USER CODE BEGIN 3 */
+ }
+ /* USER CODE END 3 */
}
/**
- * @brief System Clock Configuration
- * @retval None
- */
+ * @brief System Clock Configuration
+ * @retval None
+ */
void SystemClock_Config(void)
{
- RCC_OscInitTypeDef RCC_OscInitStruct = {0};
- RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
+ RCC_OscInitTypeDef RCC_OscInitStruct = {0};
+ RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
- /** Configure the main internal regulator output voltage
- */
- HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
+ /** Configure the main internal regulator output voltage
+ */
+ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
- /** Initializes the RCC Oscillators according to the specified parameters
- * in the RCC_OscInitTypeDef structure.
- */
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE;
- RCC_OscInitStruct.HSEState = RCC_HSE_ON;
- RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
- RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
- RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV4;
- RCC_OscInitStruct.PLL.PLLN = 85;
- RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
- RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV4;
- RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
- if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
- {
- Error_Handler();
- }
+ /** Initializes the RCC Oscillators according to the specified parameters
+ * in the RCC_OscInitTypeDef structure.
+ */
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE;
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+ RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+ RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV4;
+ RCC_OscInitStruct.PLL.PLLN = 85;
+ RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
+ RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV4;
+ RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
+ if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
+ {
+ Error_Handler();
+ }
- /** Initializes the CPU, AHB and APB buses clocks
- */
- RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
- |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
- RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
- RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
- RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
- RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
+ /** Initializes the CPU, AHB and APB buses clocks
+ */
+ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
+ RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
- if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
- {
- Error_Handler();
- }
+ if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
+ {
+ Error_Handler();
+ }
}
/* USER CODE BEGIN 4 */
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
{
- if (hadc->Instance == ADC1)
- {
- filter_adc1();
- }
- else if (hadc->Instance == ADC2)
- {
- filter_adc2();
- }
+ if (hadc->Instance == ADC1)
+ {
+ filter_adc1();
+ }
+ else if (hadc->Instance == ADC2)
+ {
+ filter_adc2();
+ }
}
-
/*
*
*/
void filter_adc1(void)
{
- for (uint32_t i = 0; i < 4; i++)
- {
- // EMA
- m_slider_filters[i].filtered_sample = (m_adc1[i] * m_slider_filters[i].coeff) + ((1 - m_slider_filters[i].coeff) * m_slider_filters[i].last_sample);
- // Store current sample for next time
- m_slider_filters[i].last_sample = m_adc1[i];
+ for (uint32_t i = 0; i < 4; i++)
+ {
+ // EMA
+ m_slider_filters[i].filtered_sample = (m_adc1[i] * m_slider_filters[i].coeff) + ((1 - m_slider_filters[i].coeff) * m_slider_filters[i].last_sample);
+ // Store current sample for next time
+ m_slider_filters[i].last_sample = m_adc1[i];
- m_adc1_filtered_ready = true;
- }
+ m_adc1_filtered_ready = true;
+ }
}
-
/*
*
*/
void filter_adc2(void)
{
- for (uint32_t i = 4; i < NUM_SLIDERS; i++)
- {
- // EMA
- m_slider_filters[i].filtered_sample = (m_adc2[i - 4] * m_slider_filters[i].coeff) + ((1 - m_slider_filters[i].coeff) * m_slider_filters[i].last_sample);
- // Store current sample for next time
- m_slider_filters[i].last_sample = m_adc2[i - 4];
+ for (uint32_t i = 4; i < NUM_SLIDERS; i++)
+ {
+ // EMA
+ m_slider_filters[i].filtered_sample = (m_adc2[i - 4] * m_slider_filters[i].coeff) + ((1 - m_slider_filters[i].coeff) * m_slider_filters[i].last_sample);
+ // Store current sample for next time
+ m_slider_filters[i].last_sample = m_adc2[i - 4];
- m_adc2_filtered_ready = true;
- }
+ m_adc2_filtered_ready = true;
+ }
}
-
/*
*
*/
void set_pwm_outputs(void)
{
- htim1.Instance->CCR1 = (uint32_t)(MAX_PWM_VALUE * m_sliders[1]);
- htim1.Instance->CCR2 = (uint32_t)(MAX_PWM_VALUE * m_sliders[2]);
- htim1.Instance->CCR3 = (uint32_t)(MAX_PWM_VALUE * m_sliders[3]);
+ float ch1 = map_clamp(m_sliders[1], 0.0f, 100.0f, 0, MAX_PWM_VALUE * 0.02f);
+ float ch2 = map_clamp(m_sliders[2], 0.0f, 100.0f, 0, MAX_PWM_VALUE * 0.02f);
+ float ch3 = map_clamp(m_sliders[3], 0.0f, 100.0f, 0, MAX_PWM_VALUE * 0.02f);
+ float ch4 = map_clamp(m_sliders[4], 0.0f, 100.0f, 0, MAX_PWM_VALUE * 0.02f);
- htim2.Instance->CCR1 = (uint32_t)(MAX_PWM_VALUE * m_sliders[4]);
- // htim2.Instance->CCR2 = (uint32_t)(MAX_PWM_VALUE * m_sliders[5]);
- //htim2.Instance->CCR3 = (uint32_t)(MAX_PWM_VALUE * m_sliders[5]);
+ htim1.Instance->CCR1 = (uint32_t)(ch1);
+ htim1.Instance->CCR2 = (uint32_t)(ch2);
+ htim1.Instance->CCR3 = (uint32_t)(ch3);
+
+ htim2.Instance->CCR1 = (uint32_t)(ch4);
+ // htim2.Instance->CCR2 = (uint32_t)(MAX_PWM_VALUE * m_sliders[5]);
+ // htim2.Instance->CCR3 = (uint32_t)(MAX_PWM_VALUE * m_sliders[5]);
}
-
/*
*
*/
float map(float x, float in_min, float in_max, float out_min, float out_max)
{
- return ((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min);
+ return ((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min);
}
/*
@@ -350,61 +355,60 @@ float map(float x, float in_min, float in_max, float out_min, float out_max)
*/
float map_clamp(float x, float in_min, float in_max, float out_min, float out_max)
{
- float y = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
+ float y = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
- if (out_min > y)
- y = out_min;
- else if (out_max < y)
- y = out_max;
+ if (out_min > y)
+ y = out_min;
+ else if (out_max < y)
+ y = out_max;
- return (y);
+ return (y);
}
-
/**
- * @brief Retargets the C library printf function to the USART.
- * @param None
- * @retval None
- */
+ * @brief Retargets the C library printf function to the USART.
+ * @param None
+ * @retval None
+ */
PUTCHAR_PROTOTYPE
{
- /* Place your implementation of fputc here */
- /* e.g. write a character to the USART1 and Loop until the end of transmission */
- HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
+ /* Place your implementation of fputc here */
+ /* e.g. write a character to the USART1 and Loop until the end of transmission */
+ HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
- return ch;
+ return ch;
}
/* USER CODE END 4 */
/**
- * @brief This function is executed in case of error occurrence.
- * @retval None
- */
+ * @brief This function is executed in case of error occurrence.
+ * @retval None
+ */
void Error_Handler(void)
{
- /* USER CODE BEGIN Error_Handler_Debug */
- /* User can add his own implementation to report the HAL error return state */
- __disable_irq();
- while (1)
- {
- }
- /* USER CODE END Error_Handler_Debug */
+ /* USER CODE BEGIN Error_Handler_Debug */
+ /* User can add his own implementation to report the HAL error return state */
+ __disable_irq();
+ while (1)
+ {
+ }
+ /* USER CODE END Error_Handler_Debug */
}
-#ifdef USE_FULL_ASSERT
+#ifdef USE_FULL_ASSERT
/**
- * @brief Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * @param file: pointer to the source file name
- * @param line: assert_param error line source number
- * @retval None
- */
+ * @brief Reports the name of the source file and the source line number
+ * where the assert_param error has occurred.
+ * @param file: pointer to the source file name
+ * @param line: assert_param error line source number
+ * @retval None
+ */
void assert_failed(uint8_t *file, uint32_t line)
{
- /* USER CODE BEGIN 6 */
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
- /* USER CODE END 6 */
+ /* USER CODE BEGIN 6 */
+ /* User can add his own implementation to report the file name and line number,
+ ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
+ /* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
diff --git a/Core/Src/syscalls.c b/Core/Src/syscalls.c
index f3462a0..e33a849 100644
--- a/Core/Src/syscalls.c
+++ b/Core/Src/syscalls.c
@@ -1,8 +1,8 @@
/**
******************************************************************************
* @file syscalls.c
- * @author Auto-generated by STM32CubeIDE
- * @brief STM32CubeIDE Minimal System calls file
+ * @author Auto-generated by STM32CubeMX
+ * @brief Minimal System calls file
*
* For more information about which c-functions
* need which of these lowlevel functions
diff --git a/Core/Src/sysmem.c b/Core/Src/sysmem.c
index 6122419..246470e 100644
--- a/Core/Src/sysmem.c
+++ b/Core/Src/sysmem.c
@@ -1,8 +1,8 @@
/**
******************************************************************************
* @file sysmem.c
- * @author Generated by STM32CubeIDE
- * @brief STM32CubeIDE System Memory calls file
+ * @author Generated by STM32CubeMX
+ * @brief System Memory calls file
*
* For more information about which C functions
* need which of these lowlevel functions
diff --git a/Core/Src/tim.c b/Core/Src/tim.c
index 97fcfff..bc7efd5 100644
--- a/Core/Src/tim.c
+++ b/Core/Src/tim.c
@@ -45,9 +45,9 @@ void MX_TIM1_Init(void)
/* USER CODE END TIM1_Init 1 */
htim1.Instance = TIM1;
- htim1.Init.Prescaler = 169;
+ htim1.Init.Prescaler = 16;
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
- htim1.Init.Period = 999;
+ htim1.Init.Period = 9999;
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim1.Init.RepetitionCounter = 0;
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
@@ -129,9 +129,9 @@ void MX_TIM2_Init(void)
/* USER CODE END TIM2_Init 1 */
htim2.Instance = TIM2;
- htim2.Init.Prescaler = 169;
+ htim2.Init.Prescaler = 16;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
- htim2.Init.Period = 999;
+ htim2.Init.Period = 9999;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
if (HAL_TIM_Base_Init(&htim2) != HAL_OK)
diff --git a/STM32G473CEUX_FLASH.ld b/STM32G473CEUX_FLASH.ld
index 3802077..a40b324 100644
--- a/STM32G473CEUX_FLASH.ld
+++ b/STM32G473CEUX_FLASH.ld
@@ -1,57 +1,74 @@
/*
******************************************************************************
**
-** @file : LinkerScript.ld
+
+** File : LinkerScript.ld
**
-** @author : Auto-generated by STM32CubeIDE
+** Author : STM32CubeMX
**
-** @brief : Linker script for STM32G473CEUx Device from STM32G4 series
-** 512KBytes FLASH
-** 128KBytes RAM
+** Abstract : Linker script for STM32G473CEUx series
+** 512Kbytes FLASH and 128Kbytes RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
-** Set memory bank area and size if external memory is used
+** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics STM32
**
-** Distribution: The file is distributed as is, without any warranty
+** Distribution: The file is distributed “as is,” without any warranty
** of any kind.
**
-******************************************************************************
+*****************************************************************************
** @attention
**
-** Copyright (c) 2024 STMicroelectronics.
-** All rights reserved.
+** © COPYRIGHT(c) 2019 STMicroelectronics
**
-** 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.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+** 1. Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with the distribution.
+** 3. Neither the name of STMicroelectronics nor the names of its contributors
+** may be used to endorse or promote products derived from this software
+** without specific prior written permission.
**
-******************************************************************************
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+*****************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
-_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
-
-_Min_Heap_Size = 0x200; /* required amount of heap */
+_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
-/* Memories definition */
+/* Specify the memory areas */
MEMORY
{
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
- FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 256K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 256K
}
-/* Sections */
+/* Define output sections */
SECTIONS
{
- /* The startup code into "FLASH" Rom type memory */
+ /* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
@@ -59,7 +76,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH
- /* The program code and other data into "FLASH" Rom type memory */
+ /* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
@@ -76,7 +93,7 @@ SECTIONS
_etext = .; /* define a global symbols at end of code */
} >FLASH
- /* Constant data into "FLASH" Rom type memory */
+ /* Constant data goes into FLASH */
.rodata :
{
. = ALIGN(4);
@@ -85,74 +102,55 @@ SECTIONS
. = ALIGN(4);
} >FLASH
- .ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
- {
- . = ALIGN(4);
- *(.ARM.extab* .gnu.linkonce.armextab.*)
- . = ALIGN(4);
- } >FLASH
-
- .ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
- {
- . = ALIGN(4);
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
- . = ALIGN(4);
} >FLASH
- .preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ .preinit_array :
{
- . = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
- . = ALIGN(4);
} >FLASH
-
- .init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ .init_array :
{
- . = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
- . = ALIGN(4);
} >FLASH
-
- .fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ .fini_array :
{
- . = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
- . = ALIGN(4);
} >FLASH
- /* Used by the startup to initialize data */
+ /* used by the startup to initialize data */
_sidata = LOADADDR(.data);
- /* Initialized data sections into "RAM" Ram type memory */
+ /* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
- *(.RamFunc) /* .RamFunc sections */
- *(.RamFunc*) /* .RamFunc* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
-
} >RAM AT> FLASH
- /* Uninitialized data section into "RAM" Ram type memory */
+
+ /* Uninitialized data section */
. = ALIGN(4);
.bss :
{
- /* This is used by the startup in order to initialize the .bss section */
+ /* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
@@ -164,7 +162,7 @@ SECTIONS
__bss_end__ = _ebss;
} >RAM
- /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
+ /* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(8);
@@ -175,7 +173,9 @@ SECTIONS
. = ALIGN(8);
} >RAM
- /* Remove information from the compiler libraries */
+
+
+ /* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
@@ -185,3 +185,5 @@ SECTIONS
.ARM.attributes 0 : { *(.ARM.attributes) }
}
+
+
diff --git a/SW.ioc b/SW.ioc
index 9140b2a..1b613bb 100644
--- a/SW.ioc
+++ b/SW.ioc
@@ -267,11 +267,11 @@ ProjectManager.ProjectName=SW
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x400
-ProjectManager.TargetToolchain=STM32CubeIDE
+ProjectManager.TargetToolchain=CMake
ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath=
-ProjectManager.UnderRoot=true
+ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_TIM1_Init-TIM1-false-HAL-true,6-MX_TIM2_Init-TIM2-false-HAL-true,7-MX_TIM3_Init-TIM3-false-HAL-true,8-MX_ADC1_Init-ADC1-false-HAL-true,9-MX_ADC2_Init-ADC2-false-HAL-true,10-MX_USART1_UART_Init-USART1-false-HAL-true,11-MX_USB_Device_Init-USB_DEVICE-false-HAL-false
RCC.ADC12Freq_Value=170000000
RCC.ADC345Freq_Value=170000000
@@ -342,15 +342,15 @@ TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM1.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
TIM1.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
TIM1.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Prescaler,PeriodNoDither,AutoReloadPreload
-TIM1.PeriodNoDither=999
-TIM1.Prescaler=169
+TIM1.PeriodNoDither=9999
+TIM1.Prescaler=16
TIM2.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
TIM2.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM2.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
TIM2.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
TIM2.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Prescaler,PeriodNoDither,AutoReloadPreload
-TIM2.PeriodNoDither=999
-TIM2.Prescaler=169
+TIM2.PeriodNoDither=9999
+TIM2.Prescaler=16
TIM3.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
TIM3.IPParameters=TIM_MasterOutputTrigger,Prescaler,PeriodNoDither,AutoReloadPreload
TIM3.PeriodNoDither=999
@@ -375,4 +375,3 @@ VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS
VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS
board=custom
-isbadioc=false
diff --git a/cmake/gcc-arm-none-eabi.cmake b/cmake/gcc-arm-none-eabi.cmake
new file mode 100644
index 0000000..94c9329
--- /dev/null
+++ b/cmake/gcc-arm-none-eabi.cmake
@@ -0,0 +1,48 @@
+set(CMAKE_SYSTEM_NAME Generic)
+set(CMAKE_SYSTEM_PROCESSOR arm)
+
+set(CMAKE_C_COMPILER_FORCED TRUE)
+set(CMAKE_CXX_COMPILER_FORCED TRUE)
+set(CMAKE_C_COMPILER_ID GNU)
+set(CMAKE_CXX_COMPILER_ID GNU)
+
+# Some default GCC settings
+# arm-none-eabi- must be part of path environment
+set(TOOLCHAIN_PREFIX arm-none-eabi-)
+
+set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
+set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
+set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
+set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}g++)
+set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
+set(CMAKE_SIZE ${TOOLCHAIN_PREFIX}size)
+
+set(CMAKE_EXECUTABLE_SUFFIX_ASM ".elf")
+set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
+set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf")
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
+# MCU specific flags
+set(TARGET_FLAGS "-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard ")
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections")
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g3")
+endif()
+if(CMAKE_BUILD_TYPE MATCHES Release)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -g0")
+endif()
+
+set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -MMD -MP")
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -fno-threadsafe-statics")
+
+set(CMAKE_C_LINK_FLAGS "${TARGET_FLAGS}")
+set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -T \"${CMAKE_SOURCE_DIR}/STM32G473CEUx_FLASH.ld\"")
+set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} --specs=nano.specs")
+set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-Map=${CMAKE_PROJECT_NAME}.map -Wl,--gc-sections")
+set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--start-group -lc -lm -Wl,--end-group")
+set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--print-memory-usage")
+
+set(CMAKE_CXX_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--start-group -lstdc++ -lsupc++ -Wl,--end-group")
\ No newline at end of file
diff --git a/cmake/stm32cubemx/CMakeLists.txt b/cmake/stm32cubemx/CMakeLists.txt
new file mode 100644
index 0000000..d3162d5
--- /dev/null
+++ b/cmake/stm32cubemx/CMakeLists.txt
@@ -0,0 +1,87 @@
+cmake_minimum_required(VERSION 3.22)
+
+project(stm32cubemx)
+add_library(stm32cubemx INTERFACE)
+
+# Enable CMake support for ASM and C languages
+enable_language(C ASM)
+
+target_compile_definitions(stm32cubemx INTERFACE
+ USE_HAL_DRIVER
+ STM32G473xx
+ $<$:DEBUG>
+)
+
+target_include_directories(stm32cubemx INTERFACE
+ ../../Core/Inc
+ ../../USB_Device/App
+ ../../USB_Device/Target
+ ../../Drivers/STM32G4xx_HAL_Driver/Inc
+ ../../Drivers/STM32G4xx_HAL_Driver/Inc/Legacy
+ ../../Middlewares/ST/STM32_USB_Device_Library/Core/Inc
+ ../../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
+ ../../Drivers/CMSIS/Device/ST/STM32G4xx/Include
+ ../../Drivers/CMSIS/Include
+)
+
+target_sources(stm32cubemx INTERFACE
+ ../../Core/Src/main.c
+ ../../Core/Src/gpio.c
+ ../../Core/Src/adc.c
+ ../../Core/Src/dma.c
+ ../../Core/Src/i2c.c
+ ../../Core/Src/tim.c
+ ../../Core/Src/usart.c
+ ../../Core/Src/stm32g4xx_it.c
+ ../../Core/Src/stm32g4xx_hal_msp.c
+ ../../USB_Device/Target/usbd_conf.c
+ ../../USB_Device/App/usb_device.c
+ ../../USB_Device/App/usbd_desc.c
+ ../../USB_Device/App/usbd_cdc_if.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pcd.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pcd_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_usb.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_rcc.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_rcc_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash_ramfunc.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_gpio.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_exti.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_dma.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_dma_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pwr.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pwr_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_cortex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_adc.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_adc_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_adc.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_i2c.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_i2c_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_tim.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_tim_ex.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_uart.c
+ ../../Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_uart_ex.c
+ ../../Core/Src/system_stm32g4xx.c
+ ../../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c
+ ../../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
+ ../../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c
+ ../../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
+ ../../Core/Src/sysmem.c
+ ../../Core/Src/syscalls.c
+ ../../startup_stm32g473xx.s
+)
+
+target_link_directories(stm32cubemx INTERFACE
+)
+
+target_link_libraries(stm32cubemx INTERFACE
+)
+
+# Validate that STM32CubeMX code is compatible with C standard
+if(CMAKE_C_STANDARD LESS 11)
+ message(ERROR "Generated code requires C11 or higher")
+endif()
+
+
diff --git a/startup_stm32g473xx.s b/startup_stm32g473xx.s
new file mode 100644
index 0000000..88b797f
--- /dev/null
+++ b/startup_stm32g473xx.s
@@ -0,0 +1,568 @@
+/**
+ ******************************************************************************
+ * @file startup_stm32g473xx.s
+ * @author MCD Application Team
+ * @brief STM32G473xx devices vector table GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address,
+ * - Configure the clock system
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2019 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.
+ *
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+
+.equ BootRAM, 0xF1E0F85F
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval : None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+ ldr r0, =_estack
+ mov sp, r0 /* set stack pointer */
+
+/* Call the clock system initialization function.*/
+ bl SystemInit
+
+/* Copy the data segment initializers from flash to SRAM */
+ ldr r0, =_sdata
+ ldr r1, =_edata
+ ldr r2, =_sidata
+ movs r3, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r4, [r2, r3]
+ str r4, [r0, r3]
+ adds r3, r3, #4
+
+LoopCopyDataInit:
+ adds r4, r0, r3
+ cmp r4, r1
+ bcc CopyDataInit
+
+/* Zero fill the bss segment. */
+ ldr r2, =_sbss
+ ldr r4, =_ebss
+ movs r3, #0
+ b LoopFillZerobss
+
+FillZerobss:
+ str r3, [r2]
+ adds r2, r2, #4
+
+LoopFillZerobss:
+ cmp r2, r4
+ bcc FillZerobss
+
+/* Call static constructors */
+ bl __libc_init_array
+/* Call the application's entry point.*/
+ bl main
+
+LoopForever:
+ b LoopForever
+
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ *
+ * @param None
+ * @retval : None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex-M4. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+ .word WWDG_IRQHandler
+ .word PVD_PVM_IRQHandler
+ .word RTC_TAMP_LSECSS_IRQHandler
+ .word RTC_WKUP_IRQHandler
+ .word FLASH_IRQHandler
+ .word RCC_IRQHandler
+ .word EXTI0_IRQHandler
+ .word EXTI1_IRQHandler
+ .word EXTI2_IRQHandler
+ .word EXTI3_IRQHandler
+ .word EXTI4_IRQHandler
+ .word DMA1_Channel1_IRQHandler
+ .word DMA1_Channel2_IRQHandler
+ .word DMA1_Channel3_IRQHandler
+ .word DMA1_Channel4_IRQHandler
+ .word DMA1_Channel5_IRQHandler
+ .word DMA1_Channel6_IRQHandler
+ .word DMA1_Channel7_IRQHandler
+ .word ADC1_2_IRQHandler
+ .word USB_HP_IRQHandler
+ .word USB_LP_IRQHandler
+ .word FDCAN1_IT0_IRQHandler
+ .word FDCAN1_IT1_IRQHandler
+ .word EXTI9_5_IRQHandler
+ .word TIM1_BRK_TIM15_IRQHandler
+ .word TIM1_UP_TIM16_IRQHandler
+ .word TIM1_TRG_COM_TIM17_IRQHandler
+ .word TIM1_CC_IRQHandler
+ .word TIM2_IRQHandler
+ .word TIM3_IRQHandler
+ .word TIM4_IRQHandler
+ .word I2C1_EV_IRQHandler
+ .word I2C1_ER_IRQHandler
+ .word I2C2_EV_IRQHandler
+ .word I2C2_ER_IRQHandler
+ .word SPI1_IRQHandler
+ .word SPI2_IRQHandler
+ .word USART1_IRQHandler
+ .word USART2_IRQHandler
+ .word USART3_IRQHandler
+ .word EXTI15_10_IRQHandler
+ .word RTC_Alarm_IRQHandler
+ .word USBWakeUp_IRQHandler
+ .word TIM8_BRK_IRQHandler
+ .word TIM8_UP_IRQHandler
+ .word TIM8_TRG_COM_IRQHandler
+ .word TIM8_CC_IRQHandler
+ .word ADC3_IRQHandler
+ .word FMC_IRQHandler
+ .word LPTIM1_IRQHandler
+ .word TIM5_IRQHandler
+ .word SPI3_IRQHandler
+ .word UART4_IRQHandler
+ .word UART5_IRQHandler
+ .word TIM6_DAC_IRQHandler
+ .word TIM7_DAC_IRQHandler
+ .word DMA2_Channel1_IRQHandler
+ .word DMA2_Channel2_IRQHandler
+ .word DMA2_Channel3_IRQHandler
+ .word DMA2_Channel4_IRQHandler
+ .word DMA2_Channel5_IRQHandler
+ .word ADC4_IRQHandler
+ .word ADC5_IRQHandler
+ .word UCPD1_IRQHandler
+ .word COMP1_2_3_IRQHandler
+ .word COMP4_5_6_IRQHandler
+ .word COMP7_IRQHandler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word CRS_IRQHandler
+ .word SAI1_IRQHandler
+ .word TIM20_BRK_IRQHandler
+ .word TIM20_UP_IRQHandler
+ .word TIM20_TRG_COM_IRQHandler
+ .word TIM20_CC_IRQHandler
+ .word FPU_IRQHandler
+ .word I2C4_EV_IRQHandler
+ .word I2C4_ER_IRQHandler
+ .word SPI4_IRQHandler
+ .word 0
+ .word FDCAN2_IT0_IRQHandler
+ .word FDCAN2_IT1_IRQHandler
+ .word FDCAN3_IT0_IRQHandler
+ .word FDCAN3_IT1_IRQHandler
+ .word RNG_IRQHandler
+ .word LPUART1_IRQHandler
+ .word I2C3_EV_IRQHandler
+ .word I2C3_ER_IRQHandler
+ .word DMAMUX_OVR_IRQHandler
+ .word QUADSPI_IRQHandler
+ .word DMA1_Channel8_IRQHandler
+ .word DMA2_Channel6_IRQHandler
+ .word DMA2_Channel7_IRQHandler
+ .word DMA2_Channel8_IRQHandler
+ .word CORDIC_IRQHandler
+ .word FMAC_IRQHandler
+
+ .size g_pfnVectors, .-g_pfnVectors
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_PVM_IRQHandler
+ .thumb_set PVD_PVM_IRQHandler,Default_Handler
+
+ .weak RTC_TAMP_LSECSS_IRQHandler
+ .thumb_set RTC_TAMP_LSECSS_IRQHandler,Default_Handler
+
+ .weak RTC_WKUP_IRQHandler
+ .thumb_set RTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak FDCAN1_IT0_IRQHandler
+ .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler
+
+ .weak FDCAN1_IT1_IRQHandler
+ .thumb_set FDCAN1_IT1_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TIM1_BRK_TIM15_IRQHandler
+ .thumb_set TIM1_BRK_TIM15_IRQHandler,Default_Handler
+
+ .weak TIM1_UP_TIM16_IRQHandler
+ .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler
+
+ .weak TIM1_TRG_COM_TIM17_IRQHandler
+ .thumb_set TIM1_TRG_COM_TIM17_IRQHandler,Default_Handler
+
+ .weak TIM1_CC_IRQHandler
+ .thumb_set TIM1_CC_IRQHandler,Default_Handler
+
+ .weak TIM2_IRQHandler
+ .thumb_set TIM2_IRQHandler,Default_Handler
+
+ .weak TIM3_IRQHandler
+ .thumb_set TIM3_IRQHandler,Default_Handler
+
+ .weak TIM4_IRQHandler
+ .thumb_set TIM4_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTC_Alarm_IRQHandler
+ .thumb_set RTC_Alarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TIM8_BRK_IRQHandler
+ .thumb_set TIM8_BRK_IRQHandler,Default_Handler
+
+ .weak TIM8_UP_IRQHandler
+ .thumb_set TIM8_UP_IRQHandler,Default_Handler
+
+ .weak TIM8_TRG_COM_IRQHandler
+ .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler
+
+ .weak TIM8_CC_IRQHandler
+ .thumb_set TIM8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak FMC_IRQHandler
+ .thumb_set FMC_IRQHandler,Default_Handler
+
+ .weak LPTIM1_IRQHandler
+ .thumb_set LPTIM1_IRQHandler,Default_Handler
+
+ .weak TIM5_IRQHandler
+ .thumb_set TIM5_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TIM6_DAC_IRQHandler
+ .thumb_set TIM6_DAC_IRQHandler,Default_Handler
+
+ .weak TIM7_DAC_IRQHandler
+ .thumb_set TIM7_DAC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_IRQHandler
+ .thumb_set DMA2_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel5_IRQHandler
+ .thumb_set DMA2_Channel5_IRQHandler,Default_Handler
+
+ .weak ADC4_IRQHandler
+ .thumb_set ADC4_IRQHandler,Default_Handler
+
+ .weak ADC5_IRQHandler
+ .thumb_set ADC5_IRQHandler,Default_Handler
+
+ .weak UCPD1_IRQHandler
+ .thumb_set UCPD1_IRQHandler,Default_Handler
+
+ .weak COMP1_2_3_IRQHandler
+ .thumb_set COMP1_2_3_IRQHandler,Default_Handler
+
+ .weak COMP4_5_6_IRQHandler
+ .thumb_set COMP4_5_6_IRQHandler,Default_Handler
+
+ .weak COMP7_IRQHandler
+ .thumb_set COMP7_IRQHandler,Default_Handler
+
+ .weak CRS_IRQHandler
+ .thumb_set CRS_IRQHandler,Default_Handler
+
+ .weak SAI1_IRQHandler
+ .thumb_set SAI1_IRQHandler,Default_Handler
+
+ .weak TIM20_BRK_IRQHandler
+ .thumb_set TIM20_BRK_IRQHandler,Default_Handler
+
+ .weak TIM20_UP_IRQHandler
+ .thumb_set TIM20_UP_IRQHandler,Default_Handler
+
+ .weak TIM20_TRG_COM_IRQHandler
+ .thumb_set TIM20_TRG_COM_IRQHandler,Default_Handler
+
+ .weak TIM20_CC_IRQHandler
+ .thumb_set TIM20_CC_IRQHandler,Default_Handler
+
+ .weak FPU_IRQHandler
+ .thumb_set FPU_IRQHandler,Default_Handler
+
+ .weak I2C4_EV_IRQHandler
+ .thumb_set I2C4_EV_IRQHandler,Default_Handler
+
+ .weak I2C4_ER_IRQHandler
+ .thumb_set I2C4_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak FDCAN2_IT0_IRQHandler
+ .thumb_set FDCAN2_IT0_IRQHandler,Default_Handler
+
+ .weak FDCAN2_IT1_IRQHandler
+ .thumb_set FDCAN2_IT1_IRQHandler,Default_Handler
+
+ .weak FDCAN3_IT0_IRQHandler
+ .thumb_set FDCAN3_IT0_IRQHandler,Default_Handler
+
+ .weak FDCAN3_IT1_IRQHandler
+ .thumb_set FDCAN3_IT1_IRQHandler,Default_Handler
+
+ .weak RNG_IRQHandler
+ .thumb_set RNG_IRQHandler,Default_Handler
+
+ .weak LPUART1_IRQHandler
+ .thumb_set LPUART1_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak DMAMUX_OVR_IRQHandler
+ .thumb_set DMAMUX_OVR_IRQHandler,Default_Handler
+
+ .weak QUADSPI_IRQHandler
+ .thumb_set QUADSPI_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel8_IRQHandler
+ .thumb_set DMA1_Channel8_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_IRQHandler
+ .thumb_set DMA2_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel7_IRQHandler
+ .thumb_set DMA2_Channel7_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel8_IRQHandler
+ .thumb_set DMA2_Channel8_IRQHandler,Default_Handler
+
+ .weak CORDIC_IRQHandler
+ .thumb_set CORDIC_IRQHandler,Default_Handler
+
+ .weak FMAC_IRQHandler
+ .thumb_set FMAC_IRQHandler,Default_Handler
+