diff --git a/.mxproject b/.mxproject
index 695268f..11da701 100644
--- a/.mxproject
+++ b/.mxproject
@@ -1,8 +1,8 @@
[PreviousLibFiles]
-LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_spi.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_uart.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.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_uart.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_spi.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_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/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_armv8mbl.h;
+LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.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/Src/stm32f1xx_hal_uart.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/Inc/stm32f1xx_hal_uart.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.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/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/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_armv8mbl.h;
[PreviousUsedCubeIDEFiles]
-SourceFiles=Core/Src/main.c;Core/Src/stm32f1xx_it.c;Core/Src/stm32f1xx_hal_msp.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Core/Src/system_stm32f1xx.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Core/Src/system_stm32f1xx.c;;;
+SourceFiles=Core/Src/main.c;Core/Src/stm32f1xx_it.c;Core/Src/stm32f1xx_hal_msp.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Core/Src/system_stm32f1xx.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Core/Src/system_stm32f1xx.c;;;
HeaderPath=/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Inc;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/CMSIS/Device/ST/STM32F1xx/Include;/Users/clement/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/CMSIS/Include;Core/Inc;
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;
diff --git a/.project b/.project
index 3ee57ee..cdf7d8d 100644
--- a/.project
+++ b/.project
@@ -85,11 +85,6 @@
1
PARENT-4-PROJECT_LOC/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c
-
- Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_spi.c
- 1
- PARENT-4-PROJECT_LOC/STM32Cube/Repository/STM32Cube_FW_F1_V1.8.6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c
-
Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_uart.c
1
diff --git a/Core/Inc/LCD_driver.h b/Core/Inc/LCD_driver.h
index e5079a1..a6ab793 100644
--- a/Core/Inc/LCD_driver.h
+++ b/Core/Inc/LCD_driver.h
@@ -26,6 +26,16 @@
#include "stm32f1xx.h"
#include "main.h"
+// Control pins (replace with your actual definitions if needed)
+#define MCU_CS_LOW() MCU_CS_GPIO_Port->BRR = MCU_CS_Pin
+#define MCU_CS_HIGH() MCU_CS_GPIO_Port->BSRR = MCU_CS_Pin
+#define MCU_WR_LOW() MCU_WR_GPIO_Port->BRR = MCU_WR_Pin
+#define MCU_WR_HIGH() MCU_WR_GPIO_Port->BSRR = MCU_WR_Pin
+#define MCU_RS_LOW() DCX_GPIO_Port->BRR = DCX_Pin // Command mode
+#define MCU_RS_HIGH() DCX_GPIO_Port->BSRR = DCX_Pin // Data mode
+#define MCU_RD_LOW() DRDX_GPIO_Port->BRR = DRDX_Pin
+#define MCU_RD_HIGH() DRDX_GPIO_Port->BSRR = DRDX_Pin
+
#define SPI1_BASEDR_ADR SPI1_BASE //adresse du reg SPI3 DR pour acces 8 bits (defs std permet accès 16bits seulement)
#define LCD_SCREEN_HEIGHT 282 // ST7365 is 320 (centered, offset = 19)
diff --git a/Core/Inc/main.h b/Core/Inc/main.h
index 687f2cf..5143c14 100644
--- a/Core/Inc/main.h
+++ b/Core/Inc/main.h
@@ -1,4 +1,4 @@
-/* USER CODE BEGIN Header */
+/* USER CODE BEGIN */
/**
******************************************************************************
* @file : main.h
@@ -16,7 +16,7 @@
*
******************************************************************************
*/
-/* USER CODE END Header */
+/* USER CODE END */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
@@ -30,31 +30,31 @@ extern "C" {
#include "stm32f1xx_hal.h"
/* Private includes ----------------------------------------------------------*/
-/* USER CODE BEGIN Includes */
+/* USER CODE BEGIN */
-/* USER CODE END Includes */
+/* USER CODE END */
/* Exported types ------------------------------------------------------------*/
-/* USER CODE BEGIN ET */
+/* USER CODE BEGIN */
-/* USER CODE END ET */
+/* USER CODE END */
/* Exported constants --------------------------------------------------------*/
-/* USER CODE BEGIN EC */
+/* USER CODE BEGIN */
-/* USER CODE END EC */
+/* USER CODE END */
/* Exported macro ------------------------------------------------------------*/
-/* USER CODE BEGIN EM */
+/* USER CODE BEGIN */
-/* USER CODE END EM */
+/* USER CODE END */
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
-/* USER CODE BEGIN EFP */
+/* USER CODE BEGIN */
-/* USER CODE END EFP */
+/* USER CODE END */
/* Private defines -----------------------------------------------------------*/
#define DB10_Pin GPIO_PIN_13
@@ -75,6 +75,10 @@ void Error_Handler(void);
#define DTE_GPIO_Port GPIOA
#define DCX_Pin GPIO_PIN_3
#define DCX_GPIO_Port GPIOA
+#define MCU_CS_Pin GPIO_PIN_4
+#define MCU_CS_GPIO_Port GPIOA
+#define MCU_WR_Pin GPIO_PIN_5
+#define MCU_WR_GPIO_Port GPIOA
#define DB1_Pin GPIO_PIN_0
#define DB1_GPIO_Port GPIOB
#define DB3_Pin GPIO_PIN_1
@@ -97,8 +101,8 @@ void Error_Handler(void);
#define IM2_GPIO_Port GPIOA
#define IM1_Pin GPIO_PIN_9
#define IM1_GPIO_Port GPIOA
-#define PB14_Pin GPIO_PIN_10
-#define PB14_GPIO_Port GPIOA
+#define DB14_Pin GPIO_PIN_10
+#define DB14_GPIO_Port GPIOA
#define A11_Pin GPIO_PIN_11
#define A11_GPIO_Port GPIOA
#define A12_Pin GPIO_PIN_12
@@ -108,9 +112,9 @@ void Error_Handler(void);
#define DB12_Pin GPIO_PIN_9
#define DB12_GPIO_Port GPIOB
-/* USER CODE BEGIN Private defines */
+/* USER CODE BEGIN */
-/* USER CODE END Private defines */
+/* USER CODE END */
#ifdef __cplusplus
}
diff --git a/Core/Inc/stm32f1xx_hal_conf.h b/Core/Inc/stm32f1xx_hal_conf.h
index d25098d..63a1183 100644
--- a/Core/Inc/stm32f1xx_hal_conf.h
+++ b/Core/Inc/stm32f1xx_hal_conf.h
@@ -1,4 +1,4 @@
-/* USER CODE BEGIN Header */
+/* USER CODE BEGIN */
/**
******************************************************************************
* @file stm32f1xx_hal_conf.h
@@ -15,7 +15,7 @@
*
******************************************************************************
*/
-/* USER CODE END Header */
+/* USER CODE END */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_CONF_H
@@ -62,7 +62,7 @@
/*#define HAL_MMC_MODULE_ENABLED */
/*#define HAL_SDRAM_MODULE_ENABLED */
/*#define HAL_SMARTCARD_MODULE_ENABLED */
-#define HAL_SPI_MODULE_ENABLED
+/*#define HAL_SPI_MODULE_ENABLED */
/*#define HAL_SRAM_MODULE_ENABLED */
/*#define HAL_TIM_MODULE_ENABLED */
#define HAL_UART_MODULE_ENABLED
diff --git a/Core/Src/LCD_driver.c b/Core/Src/LCD_driver.c
index e228641..19cd0ee 100644
--- a/Core/Src/LCD_driver.c
+++ b/Core/Src/LCD_driver.c
@@ -32,39 +32,129 @@
volatile uint16_t LCD_HEIGHT = LCD_SCREEN_HEIGHT;
volatile uint16_t LCD_WIDTH = LCD_SCREEN_WIDTH;
-/* SPI3 & GPIOs init function */
-//void LCD_SPI_Init(void) {
-////__HAL_RCC_SPI3_CLK_ENABLE();
-// RCC->APB1ENR1 |= RCC_APB1ENR1_SPI3EN;// SPI3 clock enable
-// RCC->AHB2ENR |= RCC_AHB2ENR_GPIOCEN;// GPIOC clock enable
-//
-// /** CS & DC GPIO signals configuration
-// PC8 ------> LCD_CS_PIN
-// PC11 ------> LCD_DC_PIN
-// */
-// GPIOC->BSRR = LCD_CS_PIN | (LCD_DC_PIN << 16);//CS à 1 et DC à 0
-// GPIOC->MODER |= (1 << 16) | (1 << 22);//GPIO out
-// GPIOC->MODER &= ~((1 << 17) | (1 << 23));//mise à 0
-// GPIOC->OTYPER &= (GPIO_OTYPER_OT8 | GPIO_OTYPER_OT11);//PC8 & 11 en PP
-// GPIOC->OSPEEDR |= (3 << 16) | (3 << 22);//High speed
-//
-// /**SPI3 GPIO Configuration
-// PC10 ------> SPI3_SCK
-// PC12 ------> SPI3_MOSI */
-// GPIOC->AFR[1] |= (6 << 8) | (6 << 16);//PC10 en AF6 : SPI3_SCK, PC12 en AF6 : SPI3_MOSI
-// GPIOC->AFR[1] &= 0xFFF6F6FF;//Mise à 0
-// GPIOC->MODER |= (2 << 20) | (2 << 24);//MODE AF
-// GPIOC->MODER &= 0xFEEFFFFF;//Mise à 0
-// GPIOC->OTYPER &= (GPIO_OTYPER_OT10 | GPIO_OTYPER_OT12);//PC10 & 12 en PP
-// GPIOC->OSPEEDR |= (3 << 24) | (3 << 20);//High speed
-//
-// /*Configure module SPI3*/
-// SPI3->CR1 = SPI_CR1_SSM | SPI_CR1_SSI;//CS soft, SSI à 1 sinon decl. mode fault
-// SPI3->CR1 |= SPI_CR1_MSTR;// 0 sauf SPE et mode Master, BR = 0 => /2=> Fsck=40M
-// SPI3->CR2 = 0x0700 | SPI_CR2_FRXTH;// | SPI_CR2_NSSP; //mode 8 bits, ITs disabled, no DMA, FRXTH doit être à 1 en 8 bits
-// SPI3->CR1 |= SPI_CR1_SPE;
+
+// Set all 16 data pins (DB0-DB15) based on a 16-bit value
+void SetDataPins(uint16_t value) {
+ GPIOA->BSRR = (value & (1 << 0) ? DB0_Pin : (DB0_Pin << 16)) | // DB0 (GPIOA)
+ (value & (1 << 14) ? DB14_Pin : (DB14_Pin << 16)); // DB14 (GPIOA)
+ GPIOB->BSRR = (value & (1 << 1) ? DB1_Pin : (DB1_Pin << 16)) | // DB1 (GPIOB)
+ (value & (1 << 3) ? DB3_Pin : (DB3_Pin << 16)) | // DB3 (GPIOB)
+ (value & (1 << 5) ? DB5_Pin : (DB5_Pin << 16)) | // DB5 (GPIOB)
+ (value & (1 << 7) ? DB7_Pin : (DB7_Pin << 16)) | // DB7 (GPIOB)
+ (value & (1 << 9) ? DB9_Pin : (DB9_Pin << 16)) | // DB9 (GPIOB)
+ (value & (1 << 11) ? DB11_Pin : (DB11_Pin << 16)) | // DB11 (GPIOB)
+ (value & (1 << 12) ? DB12_Pin : (DB12_Pin << 16)) | // DB12 (GPIOB)
+ (value & (1 << 13) ? DB13_Pin : (DB13_Pin << 16)) | // DB13 (GPIOB)
+ (value & (1 << 15) ? DB15_Pin : (DB15_Pin << 16)); // DB15 (GPIOB)
+
+ GPIOD->BSRR = (value & (1 << 2) ? DB2_Pin : (DB2_Pin << 16)) | // DB2 (GPIOD)
+ (value & (1 << 4) ? DB4_Pin : (DB4_Pin << 16)); // DB4 (GPIOD)
+
+ GPIOC->BSRR = (value & (1 << 6) ? DB6_Pin : (DB6_Pin << 16)) | // DB6 (GPIOC)
+ (value & (1 << 8) ? DB8_Pin : (DB8_Pin << 16)) | // DB8 (GPIOC)
+ (value & (1 << 10) ? DB10_Pin : (DB10_Pin << 16)); // DB10 (GPIOC)
+}
+//void SetDataPins(uint16_t value) {
+// // Reset all data pins to 0 first (using BRR)
+// GPIOA->BRR = DB0_Pin | DB14_Pin; // Reset DB0, DB14 (GPIOA)
+// GPIOB->BRR = DB1_Pin | DB3_Pin | DB5_Pin | DB7_Pin | DB9_Pin |
+// DB11_Pin | DB12_Pin | DB13_Pin | DB15_Pin; // Reset DB1, DB3, DB5, DB7, DB9, DB11, DB12, DB13, DB15 (GPIOB)
+// GPIOD->BRR = DB2_Pin | DB4_Pin; // Reset DB2, DB4 (GPIOD)
+// GPIOC->BRR = DB6_Pin | DB8_Pin | DB10_Pin; // Reset DB6, DB8, DB10 (GPIOC)
//
+// // Set pins to 1 if their corresponding bit in 'value' is 1 (using BSRR)
+// if (value & (1 << 0)) GPIOA->BSRR = DB0_Pin; // DB0 (GPIOA)
+// if (value & (1 << 1)) GPIOB->BSRR = DB1_Pin; // DB1 (GPIOB)
+// if (value & (1 << 2)) GPIOD->BSRR = DB2_Pin; // DB2 (GPIOD)
+// if (value & (1 << 3)) GPIOB->BSRR = DB3_Pin; // DB3 (GPIOB)
+// if (value & (1 << 4)) GPIOD->BSRR = DB4_Pin; // DB4 (GPIOD)
+// if (value & (1 << 5)) GPIOB->BSRR = DB5_Pin; // DB5 (GPIOB)
+// if (value & (1 << 6)) GPIOC->BSRR = DB6_Pin; // DB6 (GPIOC)
+// if (value & (1 << 7)) GPIOB->BSRR = DB7_Pin; // DB7 (GPIOB)
+// if (value & (1 << 8)) GPIOC->BSRR = DB8_Pin; // DB8 (GPIOC)
+// if (value & (1 << 9)) GPIOB->BSRR = DB9_Pin; // DB9 (GPIOB)
+// if (value & (1 << 10)) GPIOC->BSRR = DB10_Pin; // DB10 (GPIOC)
+// if (value & (1 << 11)) GPIOB->BSRR = DB11_Pin; // DB11 (GPIOB)
+// if (value & (1 << 12)) GPIOB->BSRR = DB12_Pin; // DB12 (GPIOB)
+// if (value & (1 << 13)) GPIOB->BSRR = DB13_Pin; // DB13 (GPIOB)
+// if (value & (1 << 14)) GPIOA->BSRR = DB14_Pin; // DB14 (GPIOA)
+// if (value & (1 << 15)) GPIOB->BSRR = DB15_Pin; // DB15 (GPIOB)
//}
+//typedef struct {
+// GPIO_TypeDef* port;
+// uint16_t pin;
+//} DataPin;
+//
+//// Map each data bit (DB0-DB15) to its GPIO port and pin
+//const DataPin dataPins[16] = {
+// {DB0_GPIO_Port, DB0_Pin}, // DB0
+// {DB1_GPIO_Port, DB1_Pin}, // DB1
+// {DB2_GPIO_Port, DB2_Pin}, // DB2
+// {DB3_GPIO_Port, DB3_Pin}, // DB3
+// {DB4_GPIO_Port, DB4_Pin}, // DB4
+// {DB5_GPIO_Port, DB5_Pin}, // DB5
+// {DB6_GPIO_Port, DB6_Pin}, // DB6
+// {DB7_GPIO_Port, DB7_Pin}, // DB7
+// {DB8_GPIO_Port, DB8_Pin}, // DB8
+// {DB9_GPIO_Port, DB9_Pin}, // DB9
+// {DB10_GPIO_Port, DB10_Pin}, // DB10
+// {DB11_GPIO_Port, DB11_Pin}, // DB11
+// {DB12_GPIO_Port, DB12_Pin}, // DB12
+// {DB13_GPIO_Port, DB13_Pin}, // DB13
+// {DB14_GPIO_Port, DB14_Pin}, // DB14
+// {DB15_GPIO_Port, DB15_Pin} // DB15
+//};
+//
+//void SetDataPins(uint16_t value) {
+// for (int i = 0; i < 16; i++) {
+// // Check if the i-th bit in 'value' is set
+// GPIO_PinState state = (value & (1 << i)) ? GPIO_PIN_SET : GPIO_PIN_RESET;
+//
+// // Write the state to the corresponding GPIO pin
+// HAL_GPIO_WritePin(dataPins[i].port, dataPins[i].pin, state);
+// }
+//}
+
+void ScreenWriteCmd(uint16_t command) {
+ __NOP(); __NOP(); // ~32 ns
+
+ MCU_RS_LOW();
+ //__NOP(); // ~16 ns
+ MCU_CS_LOW();
+ __NOP(); // ~16 ns
+ MCU_WR_LOW();
+ __NOP(); // ~16 ns
+
+ SetDataPins(command);
+ __NOP();
+
+ MCU_WR_HIGH();
+ __NOP();
+
+ MCU_CS_HIGH();
+ __NOP();
+}
+void ScreenWriteData(uint16_t data) {
+ __NOP(); __NOP(); // ~32 ns
+
+ MCU_RS_HIGH();
+ //__NOP(); // ~16 ns
+ MCU_CS_LOW();
+ __NOP(); // ~16 ns
+ MCU_WR_LOW();
+ __NOP(); // ~16 ns
+
+ SetDataPins(data);
+ __NOP();
+
+ MCU_WR_HIGH();
+ __NOP();
+
+ MCU_CS_HIGH();
+ __NOP();
+}
+
+
/* Send command (char) to LCD via SPI bus */
void LCD_Write_Command(uint8_t Command) {
while ((SPI1->SR & SPI_SR_BSY) != 0);
@@ -93,48 +183,17 @@ void LCD_Write_Data16(uint16_t data) {
/* Set the frame to draw into and sends a write into frame command */
void LCD_Set_Address(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2) {
- LCD_Write_Command(0x2A);
- LCD_Write_Data16(X1 + 10);
- LCD_Write_Data16(X2 + 10);
+ ScreenWriteCmd(0x2A);
+ ScreenWriteData(X1 + 10);
+ ScreenWriteData(X2 + 10);
- LCD_Write_Command(0x2B);
- LCD_Write_Data16(Y1 + 19);
- LCD_Write_Data16(Y2 + 19);
+ ScreenWriteCmd(0x2B);
+ ScreenWriteData(Y1 + 19);
+ ScreenWriteData(Y2 + 19);
- LCD_Write_Command(0x2C);
+ ScreenWriteCmd(0x2C);
}
-//void LCD_Set_Rotation(uint8_t Rotation) {
-//
-// uint8_t screen_rotation = Rotation;
-//
-// LCD_Write_Command(0x36);
-//
-// switch (screen_rotation)
-// case SCREEN_VERTICAL_1:
-// LCD_Write_Data(0x40 | 0x08);
-// LCD_WIDTH = 240;
-// LCD_HEIGHT = 320;
-// break;
-// case SCREEN_HORIZONTAL_1:
-// LCD_Write_Data(0x20 | 0x08);
-// LCD_WIDTH = 320;
-// LCD_HEIGHT = 240;
-// break;
-// case SCREEN_VERTICAL_2:
-// LCD_Write_Data(0x80 | 0x08);
-// LCD_WIDTH = 240;
-// LCD_HEIGHT = 320;
-// break;
-// case SCREEN_HORIZONTAL_2:
-// LCD_Write_Data(0x40 | 0x80 | 0x20 | 0x08);
-// LCD_WIDTH = 320;
-// LCD_HEIGHT = 240;
-// break;
-// default:
-// break;
-//}
-
void LCD_HardwareReset() {
HAL_GPIO_WritePin(DRESET_GPIO_Port, DRESET_Pin, GPIO_PIN_SET);
HAL_Delay(1);
@@ -149,53 +208,55 @@ void LCD_Init(void) {
LCD_HardwareReset();
// enable spi1
- SPI1->CR1 |= SPI_CR1_SPE;// NSS (CS) pin is automatically pulled low
+ //SPI1->CR1 |= SPI_CR1_SPE;// NSS (CS) pin is automatically pulled low
HAL_Delay(300);
// Software reset
- LCD_Write_Command(0x01);
+ ScreenWriteCmd(0x01); // 1
HAL_Delay(150);
// Color mode: 16bit/pixels
- LCD_Write_Command(0x3A);
- LCD_Write_Data(0x55);
+ ScreenWriteCmd(0x3A); // 0111010
+ ScreenWriteData(0x55);// 1010101
+ // 1010001
HAL_Delay(150);
// Enable color inversion (INVON)
- LCD_Write_Command(0x21);
+ ScreenWriteCmd(0x21); // 0100001
+ // 1010001
// Configure orientation stuff
- LCD_Write_Command(0x36);
- LCD_Write_Data(0b10110100);
+ ScreenWriteCmd(0x36);
+ ScreenWriteData(0b10110100);
// Exit sleep
- LCD_Write_Command(0x11);
+ ScreenWriteCmd(0x11);
HAL_Delay(150);
// Turn on display
- LCD_Write_Command(0x29);
+ ScreenWriteCmd(0x29);
HAL_Delay(400);
// Fill white
LCD_Fill_Screen(WHITE);
// Draw colors columns
- LCD_Set_Address(30, 30, LCD_SCREEN_WIDTH - 30, LCD_SCREEN_HEIGHT - 30);
- uint32_t size = (LCD_SCREEN_WIDTH - 59) * 20;
- LCD_Draw_Colour_Burst(BLACK, size);
- LCD_Draw_Colour_Burst(WHITE, size);
- LCD_Draw_Colour_Burst(BLUE, size);
- LCD_Draw_Colour_Burst(GREEN, size);
- LCD_Draw_Colour_Burst(RED, size);
- LCD_Draw_Colour_Burst(BLACK, 4 * size);
+// LCD_Set_Address(30, 30, LCD_SCREEN_WIDTH - 30, LCD_SCREEN_HEIGHT - 30);
+// uint32_t size = (LCD_SCREEN_WIDTH - 59) * 20;
+// LCD_Draw_Colour_Burst(BLACK, size);
+// LCD_Draw_Colour_Burst(WHITE, size);
+// LCD_Draw_Colour_Burst(BLUE, size);
+// LCD_Draw_Colour_Burst(GREEN, size);
+// LCD_Draw_Colour_Burst(RED, size);
+// LCD_Draw_Colour_Burst(BLACK, 4 * size);
// Draw rectangles in the angles
- LCD_Draw_Rectangle(1, 1, 20, 20, RED);
- LCD_Draw_Rectangle(LCD_SCREEN_WIDTH - 21, 1, 20, 20, GREEN);
- LCD_Draw_Rectangle(LCD_SCREEN_WIDTH - 21, LCD_SCREEN_HEIGHT - 21, 20, 20,
- MAGENTA);
- LCD_Draw_Rectangle(1, LCD_SCREEN_HEIGHT - 21, 20, 20, BLUE);
+// LCD_Draw_Rectangle(1, 1, 20, 20, RED);
+// LCD_Draw_Rectangle(LCD_SCREEN_WIDTH - 21, 1, 20, 20, GREEN);
+// LCD_Draw_Rectangle(LCD_SCREEN_WIDTH - 21, LCD_SCREEN_HEIGHT - 21, 20, 20,
+// MAGENTA);
+// LCD_Draw_Rectangle(1, LCD_SCREEN_HEIGHT - 21, 20, 20, BLUE);
// STARTING ROTATION
//LCD_Set_Rotation(SCREEN_HORIZONTAL_1);
@@ -204,14 +265,14 @@ void LCD_Init(void) {
//INTERNAL FUNCTION OF LIBRARY
/*Sends block colour information to LCD*/
void LCD_Draw_Colour_Burst(uint16_t color, uint32_t size) {
- while ((SPI1->SR & SPI_SR_BSY) != 0);// Wait until SPI is not busy
- DATA
- ;
+ //while ((SPI1->SR & SPI_SR_BSY) != 0);// Wait until SPI is not busy
+// DATA;
for (uint32_t j = 0; j < size; j++) {
- while ((SPI1->SR & SPI_SR_TXE) == 0);// Waiting for TX register to be available.
- SPI1->DR = (color >> 8) & 0xFF;
- while ((SPI1->SR & SPI_SR_TXE) == 0);// Waiting for TX register to be available.
- SPI1->DR = color & 0xFF;
+ ScreenWriteData(color);
+// while ((SPI1->SR & SPI_SR_TXE) == 0);// Waiting for TX register to be available.
+// SPI1->DR = (color >> 8) & 0xFF;
+// while ((SPI1->SR & SPI_SR_TXE) == 0);// Waiting for TX register to be available.
+// SPI1->DR = color & 0xFF;
}
}
diff --git a/Core/Src/main.c b/Core/Src/main.c
index 1b15857..31ab6e5 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -1,4 +1,4 @@
-/* USER CODE BEGIN Header */
+/* USER CODE BEGIN */
/**
******************************************************************************
* @file : main.c
@@ -15,52 +15,49 @@
*
******************************************************************************
*/
-/* USER CODE END Header */
+/* USER CODE END */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private includes ----------------------------------------------------------*/
-/* USER CODE BEGIN Includes */
+/* USER CODE BEGIN */
-/* USER CODE END Includes */
+/* USER CODE END */
/* Private typedef -----------------------------------------------------------*/
-/* USER CODE BEGIN PTD */
+/* USER CODE BEGIN */
-/* USER CODE END PTD */
+/* USER CODE END */
/* Private define ------------------------------------------------------------*/
-/* USER CODE BEGIN PD */
+/* USER CODE BEGIN */
-/* USER CODE END PD */
+/* USER CODE END */
/* Private macro -------------------------------------------------------------*/
-/* USER CODE BEGIN PM */
+/* USER CODE BEGIN */
-/* USER CODE END PM */
+/* USER CODE END */
/* Private variables ---------------------------------------------------------*/
-SPI_HandleTypeDef hspi1;
-
UART_HandleTypeDef huart1;
-/* USER CODE BEGIN PV */
+/* USER CODE BEGIN */
-/* USER CODE END PV */
+/* USER CODE END */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
-static void MX_SPI1_Init(void);
static void MX_USART1_UART_Init(void);
-/* USER CODE BEGIN PFP */
+/* USER CODE BEGIN */
-/* USER CODE END PFP */
+/* USER CODE END */
/* Private user code ---------------------------------------------------------*/
-/* USER CODE BEGIN 0 */
+/* USER CODE BEGIN */
-/* USER CODE END 0 */
+/* USER CODE END */
/**
* @brief The application entry point.
@@ -69,47 +66,45 @@ static void MX_USART1_UART_Init(void);
int main(void)
{
- /* USER CODE BEGIN 1 */
+/* USER CODE BEGIN */
- /* USER CODE END 1 */
+/* USER CODE END */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
- /* USER CODE BEGIN Init */
+/* USER CODE BEGIN */
- /* USER CODE END Init */
+/* USER CODE END */
/* Configure the system clock */
SystemClock_Config();
- /* USER CODE BEGIN SysInit */
+/* USER CODE BEGIN */
- /* USER CODE END SysInit */
+/* USER CODE END */
/* Initialize all configured peripherals */
MX_GPIO_Init();
- MX_SPI1_Init();
MX_USART1_UART_Init();
- /* USER CODE BEGIN 2 */
+/* USER CODE BEGIN */
- /* USER CODE END 2 */
+/* USER CODE END */
/* Infinite loop */
- /* USER CODE BEGIN WHILE */
+/* USER CODE BEGIN */
while (1)
{
+/* USER CODE END */
+
+/* USER CODE BEGIN */
LCD_Init();
- HAL_Delay(10000);
- HAL_Delay(10);
-
- /* USER CODE END WHILE */
-
- /* USER CODE BEGIN 3 */
+ HAL_Delay(3000);
+ __NOP();
}
- /* USER CODE END 3 */
+/* USER CODE END */
}
/**
@@ -150,44 +145,6 @@ void SystemClock_Config(void)
}
}
-/**
- * @brief SPI1 Initialization Function
- * @param None
- * @retval None
- */
-static void MX_SPI1_Init(void)
-{
-
- /* USER CODE BEGIN SPI1_Init 0 */
-
- /* USER CODE END SPI1_Init 0 */
-
- /* USER CODE BEGIN SPI1_Init 1 */
-
- /* USER CODE END SPI1_Init 1 */
- /* SPI1 parameter configuration*/
- hspi1.Instance = SPI1;
- hspi1.Init.Mode = SPI_MODE_MASTER;
- hspi1.Init.Direction = SPI_DIRECTION_2LINES;
- hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
- hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
- hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
- hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT;
- hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
- hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
- hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
- hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
- hspi1.Init.CRCPolynomial = 10;
- if (HAL_SPI_Init(&hspi1) != HAL_OK)
- {
- Error_Handler();
- }
- /* USER CODE BEGIN SPI1_Init 2 */
-
- /* USER CODE END SPI1_Init 2 */
-
-}
-
/**
* @brief USART1 Initialization Function
* @param None
@@ -196,13 +153,13 @@ static void MX_SPI1_Init(void)
static void MX_USART1_UART_Init(void)
{
- /* USER CODE BEGIN USART1_Init 0 */
+/* USER CODE BEGIN */
- /* USER CODE END USART1_Init 0 */
+/* USER CODE END */
- /* USER CODE BEGIN USART1_Init 1 */
+/* USER CODE BEGIN */
- /* USER CODE END USART1_Init 1 */
+/* USER CODE END */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
@@ -215,9 +172,9 @@ static void MX_USART1_UART_Init(void)
{
Error_Handler();
}
- /* USER CODE BEGIN USART1_Init 2 */
+/* USER CODE BEGIN */
- /* USER CODE END USART1_Init 2 */
+/* USER CODE END */
}
@@ -229,9 +186,9 @@ static void MX_USART1_UART_Init(void)
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
- /* USER CODE BEGIN MX_GPIO_Init_1 */
+/* USER CODE BEGIN */
- /* USER CODE END MX_GPIO_Init_1 */
+/* USER CODE END */
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
@@ -246,18 +203,16 @@ static void MX_GPIO_Init(void)
HAL_GPIO_WritePin(GPIOD, DB4_Pin|DB2_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
- HAL_GPIO_WritePin(GPIOA, DB0_Pin|DRESET_Pin|DCX_Pin|PB14_Pin, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, DB0_Pin|DRESET_Pin|DCX_Pin|MCU_CS_Pin
+ |MCU_WR_Pin|IM2_Pin|DB14_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, DB1_Pin|DB3_Pin|DB5_Pin|DB7_Pin
|DB9_Pin|DB11_Pin|DB13_Pin|DB15_Pin
- |DRDX_Pin|DB12_Pin, GPIO_PIN_RESET);
+ |IM0_Pin|DRDX_Pin|DB12_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
- HAL_GPIO_WritePin(IM0_GPIO_Port, IM0_Pin, GPIO_PIN_SET);
-
- /*Configure GPIO pin Output Level */
- HAL_GPIO_WritePin(GPIOA, IM2_Pin|IM1_Pin, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(IM1_GPIO_Port, IM1_Pin, GPIO_PIN_SET);
/*Configure GPIO pins : DB10_Pin DB8_Pin DB6_Pin */
GPIO_InitStruct.Pin = DB10_Pin|DB8_Pin|DB6_Pin;
@@ -273,10 +228,10 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
- /*Configure GPIO pins : DB0_Pin DRESET_Pin DCX_Pin IM2_Pin
- IM1_Pin PB14_Pin */
- GPIO_InitStruct.Pin = DB0_Pin|DRESET_Pin|DCX_Pin|IM2_Pin
- |IM1_Pin|PB14_Pin;
+ /*Configure GPIO pins : DB0_Pin DRESET_Pin DCX_Pin MCU_CS_Pin
+ MCU_WR_Pin IM2_Pin IM1_Pin DB14_Pin */
+ GPIO_InitStruct.Pin = DB0_Pin|DRESET_Pin|DCX_Pin|MCU_CS_Pin
+ |MCU_WR_Pin|IM2_Pin|IM1_Pin|DB14_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
@@ -288,6 +243,12 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ /*Configure GPIO pins : PA6 PA7 */
+ GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
/*Configure GPIO pins : DB1_Pin DB3_Pin DB5_Pin DB7_Pin
DB9_Pin DB11_Pin DB13_Pin DB15_Pin
IM0_Pin DRDX_Pin DB12_Pin */
@@ -302,14 +263,14 @@ static void MX_GPIO_Init(void)
/*Configure peripheral I/O remapping */
__HAL_AFIO_REMAP_PD01_ENABLE();
- /* USER CODE BEGIN MX_GPIO_Init_2 */
+/* USER CODE BEGIN */
- /* USER CODE END MX_GPIO_Init_2 */
+/* USER CODE END */
}
-/* USER CODE BEGIN 4 */
+/* USER CODE BEGIN */
-/* USER CODE END 4 */
+/* USER CODE END */
/**
* @brief This function is executed in case of error occurrence.
@@ -317,13 +278,13 @@ static void MX_GPIO_Init(void)
*/
void Error_Handler(void)
{
- /* USER CODE BEGIN Error_Handler_Debug */
+/* USER CODE BEGIN */
/* 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 END */
}
#ifdef USE_FULL_ASSERT
/**
@@ -335,9 +296,9 @@ void Error_Handler(void)
*/
void assert_failed(uint8_t *file, uint32_t line)
{
- /* USER CODE BEGIN 6 */
+/* USER CODE BEGIN */
/* 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 END */
}
#endif /* USE_FULL_ASSERT */
diff --git a/Core/Src/stm32f1xx_hal_msp.c b/Core/Src/stm32f1xx_hal_msp.c
index f0df8d7..f23e9e0 100644
--- a/Core/Src/stm32f1xx_hal_msp.c
+++ b/Core/Src/stm32f1xx_hal_msp.c
@@ -81,79 +81,6 @@ void HAL_MspInit(void)
/* USER CODE END */
}
-/**
- * @brief SPI MSP Initialization
- * This function configures the hardware resources used in this example
- * @param hspi: SPI handle pointer
- * @retval None
- */
-void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
-{
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if(hspi->Instance==SPI1)
- {
-/* USER CODE BEGIN */
-
-/* USER CODE END */
- /* Peripheral clock enable */
- __HAL_RCC_SPI1_CLK_ENABLE();
-
- __HAL_RCC_GPIOA_CLK_ENABLE();
- /**SPI1 GPIO Configuration
- PA4 ------> SPI1_NSS
- PA5 ------> SPI1_SCK
- PA6 ------> SPI1_MISO
- PA7 ------> SPI1_MOSI
- */
- GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
- GPIO_InitStruct.Pin = GPIO_PIN_6;
- GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
-/* USER CODE BEGIN */
-
-/* USER CODE END */
-
- }
-
-}
-
-/**
- * @brief SPI MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param hspi: SPI handle pointer
- * @retval None
- */
-void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
-{
- if(hspi->Instance==SPI1)
- {
-/* USER CODE BEGIN */
-
-/* USER CODE END */
- /* Peripheral clock disable */
- __HAL_RCC_SPI1_CLK_DISABLE();
-
- /**SPI1 GPIO Configuration
- PA4 ------> SPI1_NSS
- PA5 ------> SPI1_SCK
- PA6 ------> SPI1_MISO
- PA7 ------> SPI1_MOSI
- */
- HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
-
-/* USER CODE BEGIN */
-
-/* USER CODE END */
- }
-
-}
-
/**
* @brief UART MSP Initialization
* This function configures the hardware resources used in this example
diff --git a/ow-dash-cube.ioc b/ow-dash-cube.ioc
index 992ef5f..4303c90 100644
--- a/ow-dash-cube.ioc
+++ b/ow-dash-cube.ioc
@@ -9,10 +9,9 @@ Mcu.CPN=STM32F103CBT6
Mcu.Family=STM32F1
Mcu.IP0=NVIC
Mcu.IP1=RCC
-Mcu.IP2=SPI1
-Mcu.IP3=SYS
-Mcu.IP4=USART1
-Mcu.IPNb=5
+Mcu.IP2=SYS
+Mcu.IP3=USART1
+Mcu.IPNb=4
Mcu.Name=STM32F103C(8-B)Tx
Mcu.Package=LQFP48
Mcu.Pin0=PC13-TAMPER-RTC
@@ -76,7 +75,7 @@ PA1.GPIO_Label=DRESET
PA1.Locked=true
PA1.Signal=GPIO_Output
PA10.GPIOParameters=GPIO_Label
-PA10.GPIO_Label=PB14
+PA10.GPIO_Label=DB14
PA10.Locked=true
PA10.Signal=GPIO_Output
PA11.GPIOParameters=GPIO_Label
@@ -101,23 +100,23 @@ PA3.GPIOParameters=GPIO_Label
PA3.GPIO_Label=DCX
PA3.Locked=true
PA3.Signal=GPIO_Output
+PA4.GPIOParameters=GPIO_Label
+PA4.GPIO_Label=MCU_CS
PA4.Locked=true
-PA4.Mode=NSS_Signal_Hard_Output
-PA4.Signal=SPI1_NSS
+PA4.Signal=GPIO_Output
+PA5.GPIOParameters=GPIO_Label
+PA5.GPIO_Label=MCU_WR
PA5.Locked=true
-PA5.Mode=Full_Duplex_Master
-PA5.Signal=SPI1_SCK
+PA5.Signal=GPIO_Output
PA6.Locked=true
-PA6.Mode=Full_Duplex_Master
PA6.Signal=SPI1_MISO
PA7.Locked=true
-PA7.Mode=Full_Duplex_Master
PA7.Signal=SPI1_MOSI
PA8.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
PA8.GPIO_Label=IM2
PA8.GPIO_Speed=GPIO_SPEED_FREQ_LOW
PA8.Locked=true
-PA8.PinState=GPIO_PIN_SET
+PA8.PinState=GPIO_PIN_RESET
PA8.Signal=GPIO_Output
PA9.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
PA9.GPIO_Label=IM1
@@ -156,7 +155,7 @@ PB14.Signal=GPIO_Output
PB15.GPIOParameters=PinState,GPIO_Label
PB15.GPIO_Label=IM0
PB15.Locked=true
-PB15.PinState=GPIO_PIN_SET
+PB15.PinState=GPIO_PIN_RESET
PB15.Signal=GPIO_Output
PB2.GPIOParameters=GPIO_Label
PB2.GPIO_Label=DB5
@@ -230,7 +229,7 @@ ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath=
ProjectManager.UnderRoot=true
-ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_SPI1_Init-SPI1-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true
+ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART1_UART_Init-USART1-false-HAL-true
RCC.ADCFreqValue=32000000
RCC.AHBFreq_Value=64000000
RCC.APB1CLKDivider=RCC_HCLK_DIV2
@@ -250,14 +249,6 @@ RCC.SYSCLKFreq_VALUE=64000000
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
RCC.TimSysFreq_Value=64000000
RCC.USBFreq_Value=64000000
-SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_4
-SPI1.CalculateBaudRate=16.0 MBits/s
-SPI1.DataSize=SPI_DATASIZE_8BIT
-SPI1.Direction=SPI_DIRECTION_2LINES
-SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,VirtualNSS,BaudRatePrescaler,DataSize
-SPI1.Mode=SPI_MODE_MASTER
-SPI1.VirtualNSS=VM_NSSHARD
-SPI1.VirtualType=VM_MASTER
USART1.IPParameters=VirtualMode
USART1.VirtualMode=VM_ASYNC
VP_SYS_VS_Systick.Mode=SysTick