From 73f2ea0ce1b7bad65989244dc35e93cd00b43cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Grennerat?= Date: Sun, 14 Sep 2025 17:17:59 +0200 Subject: [PATCH] Revert switch to parallel interface --- .mxproject | 4 +- .project | 5 + Core/Inc/LCD_driver.h | 10 -- Core/Inc/main.h | 36 ++-- Core/Inc/stm32f1xx_hal_conf.h | 6 +- Core/Src/LCD_driver.c | 315 ++++++++++++---------------------- Core/Src/main.c | 183 +++++++++++--------- Core/Src/stm32f1xx_hal_msp.c | 73 ++++++++ ow-dash-cube.ioc | 91 +++++----- 9 files changed, 350 insertions(+), 373 deletions(-) diff --git a/.mxproject b/.mxproject index 11da701..695268f 100644 --- a/.mxproject +++ b/.mxproject @@ -1,8 +1,8 @@ [PreviousLibFiles] -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; +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; [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_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;;; +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;;; 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 cdf7d8d..3ee57ee 100644 --- a/.project +++ b/.project @@ -85,6 +85,11 @@ 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 a6ab793..e5079a1 100644 --- a/Core/Inc/LCD_driver.h +++ b/Core/Inc/LCD_driver.h @@ -26,16 +26,6 @@ #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 5143c14..687f2cf 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -1,4 +1,4 @@ -/* USER CODE BEGIN */ +/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.h @@ -16,7 +16,7 @@ * ****************************************************************************** */ -/* USER CODE END */ +/* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H @@ -30,31 +30,31 @@ extern "C" { #include "stm32f1xx_hal.h" /* Private includes ----------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN Includes */ -/* USER CODE END */ +/* USER CODE END Includes */ /* Exported types ------------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN ET */ -/* USER CODE END */ +/* USER CODE END ET */ /* Exported constants --------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN EC */ -/* USER CODE END */ +/* USER CODE END EC */ /* Exported macro ------------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN EM */ -/* USER CODE END */ +/* USER CODE END EM */ /* Exported functions prototypes ---------------------------------------------*/ void Error_Handler(void); -/* USER CODE BEGIN */ +/* USER CODE BEGIN EFP */ -/* USER CODE END */ +/* USER CODE END EFP */ /* Private defines -----------------------------------------------------------*/ #define DB10_Pin GPIO_PIN_13 @@ -75,10 +75,6 @@ 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 @@ -101,8 +97,8 @@ void Error_Handler(void); #define IM2_GPIO_Port GPIOA #define IM1_Pin GPIO_PIN_9 #define IM1_GPIO_Port GPIOA -#define DB14_Pin GPIO_PIN_10 -#define DB14_GPIO_Port GPIOA +#define PB14_Pin GPIO_PIN_10 +#define PB14_GPIO_Port GPIOA #define A11_Pin GPIO_PIN_11 #define A11_GPIO_Port GPIOA #define A12_Pin GPIO_PIN_12 @@ -112,9 +108,9 @@ void Error_Handler(void); #define DB12_Pin GPIO_PIN_9 #define DB12_GPIO_Port GPIOB -/* USER CODE BEGIN */ +/* USER CODE BEGIN Private defines */ -/* USER CODE END */ +/* USER CODE END Private defines */ #ifdef __cplusplus } diff --git a/Core/Inc/stm32f1xx_hal_conf.h b/Core/Inc/stm32f1xx_hal_conf.h index 63a1183..d25098d 100644 --- a/Core/Inc/stm32f1xx_hal_conf.h +++ b/Core/Inc/stm32f1xx_hal_conf.h @@ -1,4 +1,4 @@ -/* USER CODE BEGIN */ +/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file stm32f1xx_hal_conf.h @@ -15,7 +15,7 @@ * ****************************************************************************** */ -/* USER CODE END */ +/* USER CODE END Header */ /* 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 7dbe322..e228641 100644 --- a/Core/Src/LCD_driver.c +++ b/Core/Src/LCD_driver.c @@ -32,173 +32,39 @@ volatile uint16_t LCD_HEIGHT = LCD_SCREEN_HEIGHT; volatile uint16_t LCD_WIDTH = LCD_SCREEN_WIDTH; - -// 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) +/* 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 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) { -// MCU_RS_LOW(); -// MCU_CS_LOW(); -// SetDataPins(command); -// __NOP(); -// -// MCU_WR_LOW(); -// __NOP(); __NOP(); __NOP(); __NOP(); -// MCU_WR_HIGH(); -// __NOP(); __NOP(); __NOP(); __NOP(); -// -// MCU_CS_HIGH(); -//} -//void ScreenWriteData(uint16_t data) { -// MCU_RS_HIGH(); -// MCU_CS_LOW(); -// SetDataPins(data); -// __NOP(); -// -// MCU_WR_LOW(); -// __NOP(); __NOP(); __NOP(); __NOP(); -// MCU_WR_HIGH(); -// __NOP(); __NOP(); __NOP(); __NOP(); -// -// MCU_CS_HIGH(); -//} -// Write Command (optimized for timing) -void ScreenWriteCmd(uint16_t command) { - // 1. Set RS to command mode (t_AS = 10 ns) - MCU_RS_LOW(); - __NOP(); // 1 NOP = ~15.625 ns > 10 ns - - // 2. Assert CS (t_AS = 10 ns) - MCU_CS_LOW(); - __NOP(); // 1 NOP = ~15.625 ns > 10 ns - - // 3. Set data pins (t_DSW = 10 ns) - SetDataPins(command); - __NOP(); // 1 NOP = ~15.625 ns > 10 ns - - // 4. Pulse WR low (PWLW = 50 ns) - MCU_WR_LOW(); - __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); // 4 NOPs = ~62.5 ns > 50 ns - __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); - MCU_WR_HIGH(); - - __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); - // 5. Hold time (t_H = 15 ns) - __NOP(); __NOP(); __NOP(); __NOP(); // 4 NOPs - - // 6. Deassert CS (t_AH = 5 ns) - MCU_CS_HIGH(); -} - -// Write Data (same timing as command) -void ScreenWriteData(uint16_t data) { - // 1. Set RS to data mode (t_AS = 10 ns) - MCU_RS_HIGH(); - __NOP(); // 1 NOP - - // 2. Assert CS (t_AS = 10 ns) - MCU_CS_LOW(); - __NOP(); // 1 NOP - - // 3. Set data pins (t_DSW = 10 ns) - SetDataPins(data); - __NOP(); // 1 NOP - - // 4. Pulse WR low (PWLW = 50 ns) - MCU_WR_LOW(); - __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); // 4 NOPs - __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); - MCU_WR_HIGH(); - - __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); - // 5. Hold time (t_H = 15 ns) - __NOP(); __NOP(); __NOP(); __NOP(); // 4 NOPs - - // 6. Deassert CS (t_AH = 5 ns) - MCU_CS_HIGH(); -} - - - /* Send command (char) to LCD via SPI bus */ void LCD_Write_Command(uint8_t Command) { while ((SPI1->SR & SPI_SR_BSY) != 0); @@ -227,76 +93,109 @@ 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) { - ScreenWriteCmd(0x2A); - ScreenWriteData(X1 + 10); - ScreenWriteData(X2 + 10); + LCD_Write_Command(0x2A); + LCD_Write_Data16(X1 + 10); + LCD_Write_Data16(X2 + 10); - ScreenWriteCmd(0x2B); - ScreenWriteData(Y1 + 19); - ScreenWriteData(Y2 + 19); + LCD_Write_Command(0x2B); + LCD_Write_Data16(Y1 + 19); + LCD_Write_Data16(Y2 + 19); - ScreenWriteCmd(0x2C); + LCD_Write_Command(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); HAL_GPIO_WritePin(DRESET_GPIO_Port, DRESET_Pin, GPIO_PIN_RESET); HAL_Delay(20); HAL_GPIO_WritePin(DRESET_GPIO_Port, DRESET_Pin, GPIO_PIN_SET); - HAL_Delay(200); + HAL_Delay(150); } void LCD_Init(void) { - MCU_RD_HIGH(); LCD_HardwareReset(); +// enable spi1 + SPI1->CR1 |= SPI_CR1_SPE;// NSS (CS) pin is automatically pulled low + HAL_Delay(300); + // Software reset - //ScreenWriteCmd(0x01); // 1 - //HAL_Delay(150); + LCD_Write_Command(0x01); + HAL_Delay(150); // Color mode: 16bit/pixels - ScreenWriteCmd(0x3A); - ScreenWriteData(0x55); - HAL_Delay(10); + LCD_Write_Command(0x3A); + LCD_Write_Data(0x55); + HAL_Delay(150); // Enable color inversion (INVON) - //ScreenWriteCmd(0x21); // 0100001 - // 1010001 + LCD_Write_Command(0x21); // Configure orientation stuff - //ScreenWriteCmd(0x36); - //ScreenWriteData(0b10110100); + LCD_Write_Command(0x36); + LCD_Write_Data(0b10110100); // Exit sleep - ScreenWriteCmd(0x11); - HAL_Delay(120); + LCD_Write_Command(0x11); + HAL_Delay(150); // Turn on display - ScreenWriteCmd(0x29); - HAL_Delay(100); + LCD_Write_Command(0x29); + HAL_Delay(400); // Fill white - LCD_Fill_Screen(RED); + 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); @@ -305,14 +204,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++) { - 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; + 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 a2d3506..1b15857 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -1,4 +1,4 @@ -/* USER CODE BEGIN */ +/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c @@ -15,49 +15,52 @@ * ****************************************************************************** */ -/* USER CODE END */ +/* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Private includes ----------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN Includes */ -/* USER CODE END */ +/* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN PTD */ -/* USER CODE END */ +/* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN PD */ -/* USER CODE END */ +/* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN PM */ -/* USER CODE END */ +/* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ +SPI_HandleTypeDef hspi1; + UART_HandleTypeDef huart1; -/* USER CODE BEGIN */ +/* USER CODE BEGIN PV */ -/* USER CODE END */ +/* USER CODE END PV */ /* 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 */ +/* USER CODE BEGIN PFP */ -/* USER CODE END */ +/* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ -/* USER CODE BEGIN */ +/* USER CODE BEGIN 0 */ -/* USER CODE END */ +/* USER CODE END 0 */ /** * @brief The application entry point. @@ -66,45 +69,47 @@ static void MX_USART1_UART_Init(void); int main(void) { -/* USER CODE BEGIN */ + /* USER CODE BEGIN 1 */ -/* USER CODE END */ + /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); -/* USER CODE BEGIN */ + /* USER CODE BEGIN Init */ -/* USER CODE END */ + /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); -/* USER CODE BEGIN */ + /* USER CODE BEGIN SysInit */ -/* USER CODE END */ + /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); + MX_SPI1_Init(); MX_USART1_UART_Init(); -/* USER CODE BEGIN */ + /* USER CODE BEGIN 2 */ -/* USER CODE END */ + /* USER CODE END 2 */ /* Infinite loop */ -/* USER CODE BEGIN */ + /* USER CODE BEGIN WHILE */ while (1) { LCD_Init(); - HAL_Delay(1000); - __NOP(); -/* USER CODE END */ + HAL_Delay(10000); + HAL_Delay(10); -/* USER CODE BEGIN */ + /* USER CODE END WHILE */ + + /* USER CODE BEGIN 3 */ } -/* USER CODE END */ + /* USER CODE END 3 */ } /** @@ -145,6 +150,44 @@ 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 @@ -153,13 +196,13 @@ void SystemClock_Config(void) static void MX_USART1_UART_Init(void) { -/* USER CODE BEGIN */ + /* USER CODE BEGIN USART1_Init 0 */ -/* USER CODE END */ + /* USER CODE END USART1_Init 0 */ -/* USER CODE BEGIN */ + /* USER CODE BEGIN USART1_Init 1 */ -/* USER CODE END */ + /* USER CODE END USART1_Init 1 */ huart1.Instance = USART1; huart1.Init.BaudRate = 115200; huart1.Init.WordLength = UART_WORDLENGTH_8B; @@ -172,9 +215,9 @@ static void MX_USART1_UART_Init(void) { Error_Handler(); } -/* USER CODE BEGIN */ + /* USER CODE BEGIN USART1_Init 2 */ -/* USER CODE END */ + /* USER CODE END USART1_Init 2 */ } @@ -186,9 +229,9 @@ static void MX_USART1_UART_Init(void) static void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; -/* USER CODE BEGIN */ + /* USER CODE BEGIN MX_GPIO_Init_1 */ -/* USER CODE END */ + /* USER CODE END MX_GPIO_Init_1 */ /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOC_CLK_ENABLE(); @@ -203,42 +246,37 @@ 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|MCU_CS_Pin - |MCU_WR_Pin|IM2_Pin|DB14_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOA, DB0_Pin|DRESET_Pin|DCX_Pin|PB14_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 - |IM0_Pin|DRDX_Pin|DB12_Pin, GPIO_PIN_RESET); + |DRDX_Pin|DB12_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(IM1_GPIO_Port, IM1_Pin, GPIO_PIN_SET); + 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); /*Configure GPIO pins : DB10_Pin DB8_Pin DB6_Pin */ GPIO_InitStruct.Pin = DB10_Pin|DB8_Pin|DB6_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /*Configure GPIO pins : DB4_Pin DB2_Pin */ GPIO_InitStruct.Pin = DB4_Pin|DB2_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); - /*Configure GPIO pins : DB0_Pin DCX_Pin MCU_CS_Pin MCU_WR_Pin - DB14_Pin */ - GPIO_InitStruct.Pin = DB0_Pin|DCX_Pin|MCU_CS_Pin|MCU_WR_Pin - |DB14_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - - /*Configure GPIO pins : DRESET_Pin IM2_Pin IM1_Pin */ - GPIO_InitStruct.Pin = DRESET_Pin|IM2_Pin|IM1_Pin; + /*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; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; @@ -250,41 +288,28 @@ 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 - DRDX_Pin DB12_Pin */ + IM0_Pin DRDX_Pin DB12_Pin */ GPIO_InitStruct.Pin = DB1_Pin|DB3_Pin|DB5_Pin|DB7_Pin |DB9_Pin|DB11_Pin|DB13_Pin|DB15_Pin - |DRDX_Pin|DB12_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - - /*Configure GPIO pin : IM0_Pin */ - GPIO_InitStruct.Pin = IM0_Pin; + |IM0_Pin|DRDX_Pin|DB12_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - HAL_GPIO_Init(IM0_GPIO_Port, &GPIO_InitStruct); + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /*Configure peripheral I/O remapping */ __HAL_AFIO_REMAP_PD01_ENABLE(); -/* USER CODE BEGIN */ + /* USER CODE BEGIN MX_GPIO_Init_2 */ -/* USER CODE END */ + /* USER CODE END MX_GPIO_Init_2 */ } -/* USER CODE BEGIN */ +/* USER CODE BEGIN 4 */ -/* USER CODE END */ +/* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. @@ -292,13 +317,13 @@ static void MX_GPIO_Init(void) */ void Error_Handler(void) { -/* USER CODE BEGIN */ + /* 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 */ + /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** @@ -310,9 +335,9 @@ void Error_Handler(void) */ void assert_failed(uint8_t *file, uint32_t line) { -/* USER CODE BEGIN */ + /* 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 */ + /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ diff --git a/Core/Src/stm32f1xx_hal_msp.c b/Core/Src/stm32f1xx_hal_msp.c index f23e9e0..f0df8d7 100644 --- a/Core/Src/stm32f1xx_hal_msp.c +++ b/Core/Src/stm32f1xx_hal_msp.c @@ -81,6 +81,79 @@ 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 d73f5ec..992ef5f 100644 --- a/ow-dash-cube.ioc +++ b/ow-dash-cube.ioc @@ -9,9 +9,10 @@ Mcu.CPN=STM32F103CBT6 Mcu.Family=STM32F1 Mcu.IP0=NVIC Mcu.IP1=RCC -Mcu.IP2=SYS -Mcu.IP3=USART1 -Mcu.IPNb=4 +Mcu.IP2=SPI1 +Mcu.IP3=SYS +Mcu.IP4=USART1 +Mcu.IPNb=5 Mcu.Name=STM32F103C(8-B)Tx Mcu.Package=LQFP48 Mcu.Pin0=PC13-TAMPER-RTC @@ -66,18 +67,16 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false -PA0-WKUP.GPIOParameters=GPIO_Speed,GPIO_Label +PA0-WKUP.GPIOParameters=GPIO_Label PA0-WKUP.GPIO_Label=DB0 -PA0-WKUP.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PA0-WKUP.Locked=true PA0-WKUP.Signal=GPIO_Output PA1.GPIOParameters=GPIO_Label PA1.GPIO_Label=DRESET PA1.Locked=true PA1.Signal=GPIO_Output -PA10.GPIOParameters=GPIO_Speed,GPIO_Label -PA10.GPIO_Label=DB14 -PA10.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA10.GPIOParameters=GPIO_Label +PA10.GPIO_Label=PB14 PA10.Locked=true PA10.Signal=GPIO_Output PA11.GPIOParameters=GPIO_Label @@ -98,30 +97,27 @@ PA2.GPIOParameters=GPIO_Label PA2.GPIO_Label=DTE PA2.Locked=true PA2.Signal=GPIO_Input -PA3.GPIOParameters=GPIO_Speed,GPIO_Label +PA3.GPIOParameters=GPIO_Label PA3.GPIO_Label=DCX -PA3.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PA3.Locked=true PA3.Signal=GPIO_Output -PA4.GPIOParameters=GPIO_Speed,GPIO_Label -PA4.GPIO_Label=MCU_CS -PA4.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PA4.Locked=true -PA4.Signal=GPIO_Output -PA5.GPIOParameters=GPIO_Speed,GPIO_Label -PA5.GPIO_Label=MCU_WR -PA5.GPIO_Speed=GPIO_SPEED_FREQ_HIGH +PA4.Mode=NSS_Signal_Hard_Output +PA4.Signal=SPI1_NSS PA5.Locked=true -PA5.Signal=GPIO_Output +PA5.Mode=Full_Duplex_Master +PA5.Signal=SPI1_SCK 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_RESET +PA8.PinState=GPIO_PIN_SET PA8.Signal=GPIO_Output PA9.GPIOParameters=GPIO_Speed,PinState,GPIO_Label PA9.GPIO_Label=IM1 @@ -129,56 +125,47 @@ PA9.GPIO_Speed=GPIO_SPEED_FREQ_LOW PA9.Locked=true PA9.PinState=GPIO_PIN_SET PA9.Signal=GPIO_Output -PB0.GPIOParameters=GPIO_Speed,GPIO_Label +PB0.GPIOParameters=GPIO_Label PB0.GPIO_Label=DB1 -PB0.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB0.Locked=true PB0.Signal=GPIO_Output -PB1.GPIOParameters=GPIO_Speed,GPIO_Label +PB1.GPIOParameters=GPIO_Label PB1.GPIO_Label=DB3 -PB1.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB1.Locked=true PB1.Signal=GPIO_Output -PB10.GPIOParameters=GPIO_Speed,GPIO_Label +PB10.GPIOParameters=GPIO_Label PB10.GPIO_Label=DB7 -PB10.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB10.Locked=true PB10.Signal=GPIO_Output -PB11.GPIOParameters=GPIO_Speed,GPIO_Label +PB11.GPIOParameters=GPIO_Label PB11.GPIO_Label=DB9 -PB11.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB11.Locked=true PB11.Signal=GPIO_Output -PB12.GPIOParameters=GPIO_Speed,GPIO_Label +PB12.GPIOParameters=GPIO_Label PB12.GPIO_Label=DB11 -PB12.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB12.Locked=true PB12.Signal=GPIO_Output -PB13.GPIOParameters=GPIO_Speed,GPIO_Label +PB13.GPIOParameters=GPIO_Label PB13.GPIO_Label=DB13 -PB13.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB13.Locked=true PB13.Signal=GPIO_Output -PB14.GPIOParameters=GPIO_Speed,GPIO_Label +PB14.GPIOParameters=GPIO_Label PB14.GPIO_Label=DB15 -PB14.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB14.Locked=true PB14.Signal=GPIO_Output PB15.GPIOParameters=PinState,GPIO_Label PB15.GPIO_Label=IM0 PB15.Locked=true -PB15.PinState=GPIO_PIN_RESET +PB15.PinState=GPIO_PIN_SET PB15.Signal=GPIO_Output -PB2.GPIOParameters=GPIO_Speed,GPIO_Label +PB2.GPIOParameters=GPIO_Label PB2.GPIO_Label=DB5 -PB2.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB2.Locked=true PB2.Signal=GPIO_Output PB3.Locked=true PB3.Signal=SYS_JTDO-TRACESWO -PB5.GPIOParameters=GPIO_Speed,GPIO_Label +PB5.GPIOParameters=GPIO_Label PB5.GPIO_Label=DRDX -PB5.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB5.Locked=true PB5.Signal=GPIO_Output PB6.Locked=true @@ -187,34 +174,28 @@ PB6.Signal=USART1_TX PB7.Locked=true PB7.Mode=Asynchronous PB7.Signal=USART1_RX -PB9.GPIOParameters=GPIO_Speed,GPIO_Label +PB9.GPIOParameters=GPIO_Label PB9.GPIO_Label=DB12 -PB9.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PB9.Locked=true PB9.Signal=GPIO_Output -PC13-TAMPER-RTC.GPIOParameters=GPIO_Speed,GPIO_Label +PC13-TAMPER-RTC.GPIOParameters=GPIO_Label PC13-TAMPER-RTC.GPIO_Label=DB10 -PC13-TAMPER-RTC.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PC13-TAMPER-RTC.Locked=true PC13-TAMPER-RTC.Signal=GPIO_Output -PC14-OSC32_IN.GPIOParameters=GPIO_Speed,GPIO_Label +PC14-OSC32_IN.GPIOParameters=GPIO_Label PC14-OSC32_IN.GPIO_Label=DB8 -PC14-OSC32_IN.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PC14-OSC32_IN.Locked=true PC14-OSC32_IN.Signal=GPIO_Output -PC15-OSC32_OUT.GPIOParameters=GPIO_Speed,GPIO_Label +PC15-OSC32_OUT.GPIOParameters=GPIO_Label PC15-OSC32_OUT.GPIO_Label=DB6 -PC15-OSC32_OUT.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PC15-OSC32_OUT.Locked=true PC15-OSC32_OUT.Signal=GPIO_Output -PD0-OSC_IN.GPIOParameters=GPIO_Speed,GPIO_Label +PD0-OSC_IN.GPIOParameters=GPIO_Label PD0-OSC_IN.GPIO_Label=DB4 -PD0-OSC_IN.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PD0-OSC_IN.Locked=true PD0-OSC_IN.Signal=GPIO_Output -PD1-OSC_OUT.GPIOParameters=GPIO_Speed,GPIO_Label +PD1-OSC_OUT.GPIOParameters=GPIO_Label PD1-OSC_OUT.GPIO_Label=DB2 -PD1-OSC_OUT.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PD1-OSC_OUT.Locked=true PD1-OSC_OUT.Signal=GPIO_Output PinOutPanel.RotationAngle=-90 @@ -249,7 +230,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_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_SPI1_Init-SPI1-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true RCC.ADCFreqValue=32000000 RCC.AHBFreq_Value=64000000 RCC.APB1CLKDivider=RCC_HCLK_DIV2 @@ -269,6 +250,14 @@ 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