├── .gitignore ├── .mxproject ├── Inc ├── main.h ├── stm32f1xx_hal_conf.h └── stm32f1xx_it.h ├── LICENSE ├── Makefile ├── README.md ├── STM32F103C8Tx_FLASH.ld ├── Src ├── main.c ├── stm32f1xx_hal_msp.c ├── stm32f1xx_it.c └── system_stm32f1xx.c ├── cubefix.sh ├── main.ioc ├── st7735 ├── fonts.c ├── fonts.h ├── st7735.c └── st7735.h └── startup_stm32f103xb.s /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | Makefile.backup 3 | -------------------------------------------------------------------------------- /.mxproject: -------------------------------------------------------------------------------- 1 | [PreviousGenFiles] 2 | HeaderPath=/Users/eax/projects/sandbox/stm32/stm32-rotary-encoder/Inc 3 | HeaderFiles=stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h; 4 | SourcePath=/Users/eax/projects/sandbox/stm32/stm32-rotary-encoder/Src 5 | SourceFiles=stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c; 6 | 7 | [PreviousLibFiles] 8 | LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/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_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_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_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/Src/stm32f1xx_hal_spi.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.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/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/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_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_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cmSimd.h; 9 | 10 | [PreviousUsedMakefileFiles] 11 | SourceFiles=Src/main.c;Src/stm32f1xx_it.c;Src/stm32f1xx_hal_msp.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Src/system_stm32f1xx.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Src/system_stm32f1xx.c;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;/Users/eax/projects/sandbox/stm32/stm32-rotary-encoder//startup_stm32f103xb.s; 12 | HeaderPath=/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Inc;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/CMSIS/Device/ST/STM32F1xx/Include;/Users/eax/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0/Drivers/CMSIS/Include;Inc; 13 | 14 | -------------------------------------------------------------------------------- /Inc/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.h 5 | * @brief : Header for main.c file. 6 | * This file contains the common defines of the application. 7 | ****************************************************************************** 8 | ** This notice applies to any and all portions of this file 9 | * that are not between comment pairs USER CODE BEGIN and 10 | * USER CODE END. Other portions of this file, whether 11 | * inserted by the user or by software development tools 12 | * are owned by their respective copyright owners. 13 | * 14 | * COPYRIGHT(c) 2020 STMicroelectronics 15 | * 16 | * Redistribution and use in source and binary forms, with or without modification, 17 | * are permitted provided that the following conditions are met: 18 | * 1. Redistributions of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 24 | * may be used to endorse or promote products derived from this software 25 | * without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | ****************************************************************************** 39 | */ 40 | /* USER CODE END Header */ 41 | 42 | /* Define to prevent recursive inclusion -------------------------------------*/ 43 | #ifndef __MAIN_H 44 | #define __MAIN_H 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | /* Includes ------------------------------------------------------------------*/ 51 | #include "stm32f1xx_hal.h" 52 | 53 | /* Private includes ----------------------------------------------------------*/ 54 | /* USER CODE BEGIN Includes */ 55 | 56 | /* USER CODE END Includes */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* USER CODE BEGIN ET */ 60 | 61 | /* USER CODE END ET */ 62 | 63 | /* Exported constants --------------------------------------------------------*/ 64 | /* USER CODE BEGIN EC */ 65 | 66 | /* USER CODE END EC */ 67 | 68 | /* Exported macro ------------------------------------------------------------*/ 69 | /* USER CODE BEGIN EM */ 70 | 71 | /* USER CODE END EM */ 72 | 73 | /* Exported functions prototypes ---------------------------------------------*/ 74 | void Error_Handler(void); 75 | 76 | /* USER CODE BEGIN EFP */ 77 | 78 | /* USER CODE END EFP */ 79 | 80 | /* Private defines -----------------------------------------------------------*/ 81 | /* USER CODE BEGIN Private defines */ 82 | 83 | /* USER CODE END Private defines */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* __MAIN_H */ 90 | 91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 92 | -------------------------------------------------------------------------------- /Inc/stm32f1xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_conf.h 4 | * @brief HAL configuration file. 5 | ****************************************************************************** 6 | * @attention 7 | * 8 | *

© COPYRIGHT(c) 2020 STMicroelectronics

9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | ****************************************************************************** 33 | */ 34 | 35 | /* Define to prevent recursive inclusion -------------------------------------*/ 36 | #ifndef __STM32F1xx_HAL_CONF_H 37 | #define __STM32F1xx_HAL_CONF_H 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /* Exported types ------------------------------------------------------------*/ 44 | /* Exported constants --------------------------------------------------------*/ 45 | 46 | /* ########################## Module Selection ############################## */ 47 | /** 48 | * @brief This is the list of modules to be used in the HAL driver 49 | */ 50 | 51 | #define HAL_MODULE_ENABLED 52 | /*#define HAL_ADC_MODULE_ENABLED */ 53 | /*#define HAL_CRYP_MODULE_ENABLED */ 54 | /*#define HAL_CAN_MODULE_ENABLED */ 55 | /*#define HAL_CEC_MODULE_ENABLED */ 56 | /*#define HAL_CORTEX_MODULE_ENABLED */ 57 | /*#define HAL_CRC_MODULE_ENABLED */ 58 | /*#define HAL_DAC_MODULE_ENABLED */ 59 | /*#define HAL_DMA_MODULE_ENABLED */ 60 | /*#define HAL_ETH_MODULE_ENABLED */ 61 | /*#define HAL_FLASH_MODULE_ENABLED */ 62 | #define HAL_GPIO_MODULE_ENABLED 63 | /*#define HAL_I2C_MODULE_ENABLED */ 64 | /*#define HAL_I2S_MODULE_ENABLED */ 65 | /*#define HAL_IRDA_MODULE_ENABLED */ 66 | /*#define HAL_IWDG_MODULE_ENABLED */ 67 | /*#define HAL_NOR_MODULE_ENABLED */ 68 | /*#define HAL_NAND_MODULE_ENABLED */ 69 | /*#define HAL_PCCARD_MODULE_ENABLED */ 70 | /*#define HAL_PCD_MODULE_ENABLED */ 71 | /*#define HAL_HCD_MODULE_ENABLED */ 72 | /*#define HAL_PWR_MODULE_ENABLED */ 73 | /*#define HAL_RCC_MODULE_ENABLED */ 74 | /*#define HAL_RTC_MODULE_ENABLED */ 75 | /*#define HAL_SD_MODULE_ENABLED */ 76 | /*#define HAL_MMC_MODULE_ENABLED */ 77 | /*#define HAL_SDRAM_MODULE_ENABLED */ 78 | /*#define HAL_SMARTCARD_MODULE_ENABLED */ 79 | #define HAL_SPI_MODULE_ENABLED 80 | /*#define HAL_SRAM_MODULE_ENABLED */ 81 | #define HAL_TIM_MODULE_ENABLED 82 | /*#define HAL_UART_MODULE_ENABLED */ 83 | /*#define HAL_USART_MODULE_ENABLED */ 84 | /*#define HAL_WWDG_MODULE_ENABLED */ 85 | /*#define HAL_EXTI_MODULE_ENABLED */ 86 | 87 | #define HAL_CORTEX_MODULE_ENABLED 88 | #define HAL_DMA_MODULE_ENABLED 89 | #define HAL_FLASH_MODULE_ENABLED 90 | #define HAL_GPIO_MODULE_ENABLED 91 | #define HAL_PWR_MODULE_ENABLED 92 | #define HAL_RCC_MODULE_ENABLED 93 | 94 | /* ########################## Oscillator Values adaptation ####################*/ 95 | /** 96 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 97 | * This value is used by the RCC HAL module to compute the system frequency 98 | * (when HSE is used as system clock source, directly or through the PLL). 99 | */ 100 | #if !defined (HSE_VALUE) 101 | #define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */ 102 | #endif /* HSE_VALUE */ 103 | 104 | #if !defined (HSE_STARTUP_TIMEOUT) 105 | #define HSE_STARTUP_TIMEOUT ((uint32_t)100) /*!< Time out for HSE start up, in ms */ 106 | #endif /* HSE_STARTUP_TIMEOUT */ 107 | 108 | /** 109 | * @brief Internal High Speed oscillator (HSI) value. 110 | * This value is used by the RCC HAL module to compute the system frequency 111 | * (when HSI is used as system clock source, directly or through the PLL). 112 | */ 113 | #if !defined (HSI_VALUE) 114 | #define HSI_VALUE ((uint32_t)8000000) /*!< Value of the Internal oscillator in Hz*/ 115 | #endif /* HSI_VALUE */ 116 | 117 | /** 118 | * @brief Internal Low Speed oscillator (LSI) value. 119 | */ 120 | #if !defined (LSI_VALUE) 121 | #define LSI_VALUE 40000U /*!< LSI Typical Value in Hz */ 122 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 123 | The real value may vary depending on the variations 124 | in voltage and temperature. */ 125 | 126 | /** 127 | * @brief External Low Speed oscillator (LSE) value. 128 | * This value is used by the UART, RTC HAL module to compute the system frequency 129 | */ 130 | #if !defined (LSE_VALUE) 131 | #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External oscillator in Hz*/ 132 | #endif /* LSE_VALUE */ 133 | 134 | #if !defined (LSE_STARTUP_TIMEOUT) 135 | #define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */ 136 | #endif /* LSE_STARTUP_TIMEOUT */ 137 | 138 | /* Tip: To avoid modifying this file each time you need to use different HSE, 139 | === you can define the HSE value in your toolchain compiler preprocessor. */ 140 | 141 | /* ########################### System Configuration ######################### */ 142 | /** 143 | * @brief This is the HAL system configuration section 144 | */ 145 | #define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */ 146 | #define TICK_INT_PRIORITY ((uint32_t)0) /*!< tick interrupt priority (lowest by default) */ 147 | #define USE_RTOS 0 148 | #define PREFETCH_ENABLE 1 149 | 150 | /* ########################## Assert Selection ############################## */ 151 | /** 152 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 153 | * HAL drivers code 154 | */ 155 | /* #define USE_FULL_ASSERT 1U */ 156 | 157 | /* ################## Ethernet peripheral configuration ##################### */ 158 | 159 | /* Section 1 : Ethernet peripheral configuration */ 160 | 161 | /* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ 162 | #define MAC_ADDR0 2 163 | #define MAC_ADDR1 0 164 | #define MAC_ADDR2 0 165 | #define MAC_ADDR3 0 166 | #define MAC_ADDR4 0 167 | #define MAC_ADDR5 0 168 | 169 | /* Definition of the Ethernet driver buffers size and count */ 170 | #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ 171 | #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ 172 | #define ETH_RXBUFNB ((uint32_t)8) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ 173 | #define ETH_TXBUFNB ((uint32_t)4) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ 174 | 175 | /* Section 2: PHY configuration section */ 176 | 177 | /* DP83848_PHY_ADDRESS Address*/ 178 | #define DP83848_PHY_ADDRESS 0x01U 179 | /* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ 180 | #define PHY_RESET_DELAY ((uint32_t)0x000000FF) 181 | /* PHY Configuration delay */ 182 | #define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF) 183 | 184 | #define PHY_READ_TO ((uint32_t)0x0000FFFF) 185 | #define PHY_WRITE_TO ((uint32_t)0x0000FFFF) 186 | 187 | /* Section 3: Common PHY Registers */ 188 | 189 | #define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */ 190 | #define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */ 191 | 192 | #define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ 193 | #define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ 194 | #define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ 195 | #define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ 196 | #define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ 197 | #define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ 198 | #define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ 199 | #define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ 200 | #define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ 201 | #define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ 202 | 203 | #define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ 204 | #define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ 205 | #define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ 206 | 207 | /* Section 4: Extended PHY Registers */ 208 | #define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ 209 | 210 | #define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ 211 | #define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ 212 | 213 | /* Includes ------------------------------------------------------------------*/ 214 | /** 215 | * @brief Include module's header file 216 | */ 217 | 218 | #ifdef HAL_RCC_MODULE_ENABLED 219 | #include "stm32f1xx_hal_rcc.h" 220 | #endif /* HAL_RCC_MODULE_ENABLED */ 221 | 222 | #ifdef HAL_EXTI_MODULE_ENABLED 223 | #include "stm32f1xx_hal_exti.h" 224 | #endif /* HAL_EXTI_MODULE_ENABLED */ 225 | 226 | #ifdef HAL_GPIO_MODULE_ENABLED 227 | #include "stm32f1xx_hal_gpio.h" 228 | #endif /* HAL_GPIO_MODULE_ENABLED */ 229 | 230 | #ifdef HAL_DMA_MODULE_ENABLED 231 | #include "stm32f1xx_hal_dma.h" 232 | #endif /* HAL_DMA_MODULE_ENABLED */ 233 | 234 | #ifdef HAL_ETH_MODULE_ENABLED 235 | #include "stm32f1xx_hal_eth.h" 236 | #endif /* HAL_ETH_MODULE_ENABLED */ 237 | 238 | #ifdef HAL_CAN_MODULE_ENABLED 239 | #include "stm32f1xx_hal_can.h" 240 | #endif /* HAL_CAN_MODULE_ENABLED */ 241 | 242 | #ifdef HAL_CEC_MODULE_ENABLED 243 | #include "stm32f1xx_hal_cec.h" 244 | #endif /* HAL_CEC_MODULE_ENABLED */ 245 | 246 | #ifdef HAL_CORTEX_MODULE_ENABLED 247 | #include "stm32f1xx_hal_cortex.h" 248 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 249 | 250 | #ifdef HAL_ADC_MODULE_ENABLED 251 | #include "stm32f1xx_hal_adc.h" 252 | #endif /* HAL_ADC_MODULE_ENABLED */ 253 | 254 | #ifdef HAL_CRC_MODULE_ENABLED 255 | #include "stm32f1xx_hal_crc.h" 256 | #endif /* HAL_CRC_MODULE_ENABLED */ 257 | 258 | #ifdef HAL_DAC_MODULE_ENABLED 259 | #include "stm32f1xx_hal_dac.h" 260 | #endif /* HAL_DAC_MODULE_ENABLED */ 261 | 262 | #ifdef HAL_FLASH_MODULE_ENABLED 263 | #include "stm32f1xx_hal_flash.h" 264 | #endif /* HAL_FLASH_MODULE_ENABLED */ 265 | 266 | #ifdef HAL_SRAM_MODULE_ENABLED 267 | #include "stm32f1xx_hal_sram.h" 268 | #endif /* HAL_SRAM_MODULE_ENABLED */ 269 | 270 | #ifdef HAL_NOR_MODULE_ENABLED 271 | #include "stm32f1xx_hal_nor.h" 272 | #endif /* HAL_NOR_MODULE_ENABLED */ 273 | 274 | #ifdef HAL_I2C_MODULE_ENABLED 275 | #include "stm32f1xx_hal_i2c.h" 276 | #endif /* HAL_I2C_MODULE_ENABLED */ 277 | 278 | #ifdef HAL_I2S_MODULE_ENABLED 279 | #include "stm32f1xx_hal_i2s.h" 280 | #endif /* HAL_I2S_MODULE_ENABLED */ 281 | 282 | #ifdef HAL_IWDG_MODULE_ENABLED 283 | #include "stm32f1xx_hal_iwdg.h" 284 | #endif /* HAL_IWDG_MODULE_ENABLED */ 285 | 286 | #ifdef HAL_PWR_MODULE_ENABLED 287 | #include "stm32f1xx_hal_pwr.h" 288 | #endif /* HAL_PWR_MODULE_ENABLED */ 289 | 290 | #ifdef HAL_RTC_MODULE_ENABLED 291 | #include "stm32f1xx_hal_rtc.h" 292 | #endif /* HAL_RTC_MODULE_ENABLED */ 293 | 294 | #ifdef HAL_PCCARD_MODULE_ENABLED 295 | #include "stm32f1xx_hal_pccard.h" 296 | #endif /* HAL_PCCARD_MODULE_ENABLED */ 297 | 298 | #ifdef HAL_SD_MODULE_ENABLED 299 | #include "stm32f1xx_hal_sd.h" 300 | #endif /* HAL_SD_MODULE_ENABLED */ 301 | 302 | #ifdef HAL_MMC_MODULE_ENABLED 303 | #include "stm32f1xx_hal_mmc.h" 304 | #endif /* HAL_MMC_MODULE_ENABLED */ 305 | 306 | #ifdef HAL_NAND_MODULE_ENABLED 307 | #include "stm32f1xx_hal_nand.h" 308 | #endif /* HAL_NAND_MODULE_ENABLED */ 309 | 310 | #ifdef HAL_SPI_MODULE_ENABLED 311 | #include "stm32f1xx_hal_spi.h" 312 | #endif /* HAL_SPI_MODULE_ENABLED */ 313 | 314 | #ifdef HAL_TIM_MODULE_ENABLED 315 | #include "stm32f1xx_hal_tim.h" 316 | #endif /* HAL_TIM_MODULE_ENABLED */ 317 | 318 | #ifdef HAL_UART_MODULE_ENABLED 319 | #include "stm32f1xx_hal_uart.h" 320 | #endif /* HAL_UART_MODULE_ENABLED */ 321 | 322 | #ifdef HAL_USART_MODULE_ENABLED 323 | #include "stm32f1xx_hal_usart.h" 324 | #endif /* HAL_USART_MODULE_ENABLED */ 325 | 326 | #ifdef HAL_IRDA_MODULE_ENABLED 327 | #include "stm32f1xx_hal_irda.h" 328 | #endif /* HAL_IRDA_MODULE_ENABLED */ 329 | 330 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 331 | #include "stm32f1xx_hal_smartcard.h" 332 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 333 | 334 | #ifdef HAL_WWDG_MODULE_ENABLED 335 | #include "stm32f1xx_hal_wwdg.h" 336 | #endif /* HAL_WWDG_MODULE_ENABLED */ 337 | 338 | #ifdef HAL_PCD_MODULE_ENABLED 339 | #include "stm32f1xx_hal_pcd.h" 340 | #endif /* HAL_PCD_MODULE_ENABLED */ 341 | 342 | #ifdef HAL_HCD_MODULE_ENABLED 343 | #include "stm32f1xx_hal_hcd.h" 344 | #endif /* HAL_HCD_MODULE_ENABLED */ 345 | 346 | 347 | /* Exported macro ------------------------------------------------------------*/ 348 | #ifdef USE_FULL_ASSERT 349 | /** 350 | * @brief The assert_param macro is used for function's parameters check. 351 | * @param expr: If expr is false, it calls assert_failed function 352 | * which reports the name of the source file and the source 353 | * line number of the call that failed. 354 | * If expr is true, it returns no value. 355 | * @retval None 356 | */ 357 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 358 | /* Exported functions ------------------------------------------------------- */ 359 | void assert_failed(uint8_t* file, uint32_t line); 360 | #else 361 | #define assert_param(expr) ((void)0U) 362 | #endif /* USE_FULL_ASSERT */ 363 | 364 | #ifdef __cplusplus 365 | } 366 | #endif 367 | 368 | #endif /* __STM32F1xx_HAL_CONF_H */ 369 | 370 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 371 | -------------------------------------------------------------------------------- /Inc/stm32f1xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * 8 | * COPYRIGHT(c) 2020 STMicroelectronics 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | ****************************************************************************** 33 | */ 34 | /* USER CODE END Header */ 35 | 36 | /* Define to prevent recursive inclusion -------------------------------------*/ 37 | #ifndef __STM32F1xx_IT_H 38 | #define __STM32F1xx_IT_H 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /* Private includes ----------------------------------------------------------*/ 45 | /* USER CODE BEGIN Includes */ 46 | 47 | /* USER CODE END Includes */ 48 | 49 | /* Exported types ------------------------------------------------------------*/ 50 | /* USER CODE BEGIN ET */ 51 | 52 | /* USER CODE END ET */ 53 | 54 | /* Exported constants --------------------------------------------------------*/ 55 | /* USER CODE BEGIN EC */ 56 | 57 | /* USER CODE END EC */ 58 | 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* USER CODE BEGIN EM */ 61 | 62 | /* USER CODE END EM */ 63 | 64 | /* Exported functions prototypes ---------------------------------------------*/ 65 | void NMI_Handler(void); 66 | void HardFault_Handler(void); 67 | void MemManage_Handler(void); 68 | void BusFault_Handler(void); 69 | void UsageFault_Handler(void); 70 | void SVC_Handler(void); 71 | void DebugMon_Handler(void); 72 | void PendSV_Handler(void); 73 | void SysTick_Handler(void); 74 | void EXTI15_10_IRQHandler(void); 75 | /* USER CODE BEGIN EFP */ 76 | 77 | /* USER CODE END EFP */ 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif /* __STM32F1xx_IT_H */ 84 | 85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 86 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Aleksander Alekseev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ########################################################################################################################## 2 | # File automatically-generated by tool: [projectgenerator] version: [3.0.0] date: [Thu Nov 19 23:05:16 MSK 2020] 3 | ########################################################################################################################## 4 | 5 | # ------------------------------------------------ 6 | # Generic Makefile (based on gcc) 7 | # 8 | # ChangeLog : 9 | # 2017-02-10 - Several enhancements + project update mode 10 | # 2015-07-22 - first version 11 | # ------------------------------------------------ 12 | 13 | ###################################### 14 | # target 15 | ###################################### 16 | TARGET = main 17 | 18 | ###################################### 19 | # building variables 20 | ###################################### 21 | # debug build? 22 | DEBUG = 1 23 | # optimization 24 | OPT = -Og -Wall 25 | 26 | 27 | ####################################### 28 | # paths 29 | ####################################### 30 | # source path 31 | SOURCES_DIR = \ 32 | Application/User/Src/main.c \ 33 | Application \ 34 | Application/User/Src/stm32f1xx_it.c \ 35 | Application/MAKEFILE \ 36 | Application/User/Src/stm32f1xx_hal_msp.c \ 37 | Application/User \ 38 | Drivers/STM32F1xx_HAL_Driver \ 39 | Drivers \ 40 | Drivers/CMSIS \ 41 | Application/User/Src 42 | 43 | # firmware library path 44 | PERIFLIB_PATH = 45 | 46 | # Build path 47 | BUILD_DIR = build 48 | 49 | ###################################### 50 | # source 51 | ###################################### 52 | 53 | FIRMWARE = $(HOME)/STM32Cube/Repository/STM32Cube_FW_F1_V1.7.0 54 | 55 | # C sources 56 | C_SOURCES = \ 57 | Src/main.c \ 58 | Src/system_stm32f1xx.c \ 59 | Src/stm32f1xx_hal_msp.c \ 60 | Src/stm32f1xx_it.c \ 61 | st7735/fonts.c \ 62 | st7735/st7735.c \ 63 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ 64 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ 65 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c \ 66 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ 67 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ 68 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ 69 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ 70 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ 71 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ 72 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ 73 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ 74 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ 75 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ 76 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ 77 | $(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c 78 | 79 | # ASM sources 80 | ASM_SOURCES = \ 81 | startup_stm32f103xb.s 82 | 83 | 84 | ###################################### 85 | # firmware library 86 | ###################################### 87 | PERIFLIB_SOURCES = 88 | 89 | 90 | ####################################### 91 | # binaries 92 | ####################################### 93 | BINPATH=/usr/local/bin 94 | PREFIX=arm-none-eabi- 95 | CC = $(BINPATH)/$(PREFIX)gcc 96 | AS = $(BINPATH)/$(PREFIX)gcc -x assembler-with-cpp 97 | CP = $(BINPATH)/$(PREFIX)objcopy 98 | AR = $(BINPATH)/$(PREFIX)ar 99 | SZ = $(BINPATH)/$(PREFIX)size 100 | HEX = $(CP) -O ihex 101 | BIN = $(CP) -O binary -S 102 | 103 | ####################################### 104 | # CFLAGS 105 | ####################################### 106 | # cpu 107 | CPU = -mcpu=cortex-m3 108 | 109 | # fpu 110 | # NONE for Cortex-M0/M0+/M3 111 | 112 | # float-abi 113 | 114 | 115 | # mcu 116 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 117 | 118 | # macros for gcc 119 | # AS defines 120 | AS_DEFS = 121 | 122 | # C defines 123 | C_DEFS = \ 124 | -DUSE_HAL_DRIVER \ 125 | -DSTM32F103xB 126 | 127 | 128 | # AS includes 129 | AS_INCLUDES = 130 | 131 | # C includes 132 | C_INCLUDES = \ 133 | -IInc \ 134 | -Ist7735 \ 135 | -I$(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Inc \ 136 | -I$(FIRMWARE)/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy \ 137 | -I$(FIRMWARE)/Drivers/CMSIS/Device/ST/STM32F1xx/Include \ 138 | -I$(FIRMWARE)/Drivers/CMSIS/Include 139 | 140 | # compile gcc flags 141 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 142 | 143 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 144 | 145 | ifeq ($(DEBUG), 1) 146 | CFLAGS += -g -gdwarf-2 147 | endif 148 | 149 | 150 | # Generate dependency information 151 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" 152 | 153 | 154 | ####################################### 155 | # LDFLAGS 156 | ####################################### 157 | # link script 158 | LDSCRIPT = STM32F103C8Tx_FLASH.ld 159 | 160 | # libraries 161 | LIBS = -lc -lm -lnosys 162 | LIBDIR = 163 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 164 | 165 | # default action: build all 166 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin 167 | 168 | 169 | ####################################### 170 | # build the application 171 | ####################################### 172 | # list of objects 173 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 174 | vpath %.c $(sort $(dir $(C_SOURCES))) 175 | # list of ASM program objects 176 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 177 | vpath %.s $(sort $(dir $(ASM_SOURCES))) 178 | 179 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 180 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 181 | 182 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 183 | $(AS) -c $(CFLAGS) $< -o $@ 184 | 185 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile 186 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ 187 | $(SZ) $@ 188 | 189 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 190 | $(HEX) $< $@ 191 | 192 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 193 | $(BIN) $< $@ 194 | 195 | $(BUILD_DIR): 196 | mkdir $@ 197 | 198 | ####################################### 199 | # clean up 200 | ####################################### 201 | clean: 202 | -rm -fR .dep $(BUILD_DIR) 203 | 204 | # проверьте, что для отступа используется табуляция, а не пробелы! 205 | flash: all 206 | st-flash --reset write build/$(TARGET).bin 0x8000000 207 | erase: 208 | st-flash --reset erase 209 | uart: 210 | screen /dev/ttyACM0 211 | 212 | ####################################### 213 | # dependencies 214 | ####################################### 215 | -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) 216 | 217 | # *** EOF *** 218 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # stm32-rotary-encoder-example 2 | STM32: an example of reading a rotary encoder 3 | -------------------------------------------------------------------------------- /STM32F103C8Tx_FLASH.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************** 3 | ** 4 | 5 | ** File : LinkerScript.ld 6 | ** 7 | ** Abstract : Linker script for STM32F103C8Tx Device with 8 | ** 64KByte FLASH, 20KByte RAM 9 | ** 10 | ** Set heap size, stack size and stack location according 11 | ** to application requirements. 12 | ** 13 | ** Set memory bank area and size if external memory is used. 14 | ** 15 | ** Target : STMicroelectronics STM32 16 | ** 17 | ** 18 | ** Distribution: The file is distributed as is, without any warranty 19 | ** of any kind. 20 | ** 21 | ** (c)Copyright Ac6. 22 | ** You may use this file as-is or modify it according to the needs of your 23 | ** project. Distribution of this file (unmodified or modified) is not 24 | ** permitted. Ac6 permit registered System Workbench for MCU users the 25 | ** rights to distribute the assembled, compiled & linked contents of this 26 | ** file as part of an application binary file, provided that it is built 27 | ** using the System Workbench for MCU toolchain. 28 | ** 29 | ***************************************************************************** 30 | */ 31 | 32 | /* Entry Point */ 33 | ENTRY(Reset_Handler) 34 | 35 | /* Highest address of the user mode stack */ 36 | _estack = 0x20005000; /* end of RAM */ 37 | /* Generate a link error if heap and stack don't fit into RAM */ 38 | _Min_Heap_Size = 0x200; /* required amount of heap */ 39 | _Min_Stack_Size = 0x400; /* required amount of stack */ 40 | 41 | /* Specify the memory areas */ 42 | MEMORY 43 | { 44 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K 45 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K 46 | } 47 | 48 | /* Define output sections */ 49 | SECTIONS 50 | { 51 | /* The startup code goes first into FLASH */ 52 | .isr_vector : 53 | { 54 | . = ALIGN(4); 55 | KEEP(*(.isr_vector)) /* Startup code */ 56 | . = ALIGN(4); 57 | } >FLASH 58 | 59 | /* The program code and other data goes into FLASH */ 60 | .text : 61 | { 62 | . = ALIGN(4); 63 | *(.text) /* .text sections (code) */ 64 | *(.text*) /* .text* sections (code) */ 65 | *(.glue_7) /* glue arm to thumb code */ 66 | *(.glue_7t) /* glue thumb to arm code */ 67 | *(.eh_frame) 68 | 69 | KEEP (*(.init)) 70 | KEEP (*(.fini)) 71 | 72 | . = ALIGN(4); 73 | _etext = .; /* define a global symbols at end of code */ 74 | } >FLASH 75 | 76 | /* Constant data goes into FLASH */ 77 | .rodata : 78 | { 79 | . = ALIGN(4); 80 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 81 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 82 | . = ALIGN(4); 83 | } >FLASH 84 | 85 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 86 | .ARM : { 87 | __exidx_start = .; 88 | *(.ARM.exidx*) 89 | __exidx_end = .; 90 | } >FLASH 91 | 92 | .preinit_array : 93 | { 94 | PROVIDE_HIDDEN (__preinit_array_start = .); 95 | KEEP (*(.preinit_array*)) 96 | PROVIDE_HIDDEN (__preinit_array_end = .); 97 | } >FLASH 98 | .init_array : 99 | { 100 | PROVIDE_HIDDEN (__init_array_start = .); 101 | KEEP (*(SORT(.init_array.*))) 102 | KEEP (*(.init_array*)) 103 | PROVIDE_HIDDEN (__init_array_end = .); 104 | } >FLASH 105 | .fini_array : 106 | { 107 | PROVIDE_HIDDEN (__fini_array_start = .); 108 | KEEP (*(SORT(.fini_array.*))) 109 | KEEP (*(.fini_array*)) 110 | PROVIDE_HIDDEN (__fini_array_end = .); 111 | } >FLASH 112 | 113 | /* used by the startup to initialize data */ 114 | _sidata = LOADADDR(.data); 115 | 116 | /* Initialized data sections goes into RAM, load LMA copy after code */ 117 | .data : 118 | { 119 | . = ALIGN(4); 120 | _sdata = .; /* create a global symbol at data start */ 121 | *(.data) /* .data sections */ 122 | *(.data*) /* .data* sections */ 123 | 124 | . = ALIGN(4); 125 | _edata = .; /* define a global symbol at data end */ 126 | } >RAM AT> FLASH 127 | 128 | 129 | /* Uninitialized data section */ 130 | . = ALIGN(4); 131 | .bss : 132 | { 133 | /* This is used by the startup in order to initialize the .bss secion */ 134 | _sbss = .; /* define a global symbol at bss start */ 135 | __bss_start__ = _sbss; 136 | *(.bss) 137 | *(.bss*) 138 | *(COMMON) 139 | 140 | . = ALIGN(4); 141 | _ebss = .; /* define a global symbol at bss end */ 142 | __bss_end__ = _ebss; 143 | } >RAM 144 | 145 | /* User_heap_stack section, used to check that there is enough RAM left */ 146 | ._user_heap_stack : 147 | { 148 | . = ALIGN(8); 149 | PROVIDE ( end = . ); 150 | PROVIDE ( _end = . ); 151 | . = . + _Min_Heap_Size; 152 | . = . + _Min_Stack_Size; 153 | . = ALIGN(8); 154 | } >RAM 155 | 156 | 157 | 158 | /* Remove information from the standard libraries */ 159 | /DISCARD/ : 160 | { 161 | libc.a ( * ) 162 | libm.a ( * ) 163 | libgcc.a ( * ) 164 | } 165 | 166 | .ARM.attributes 0 : { *(.ARM.attributes) } 167 | } 168 | 169 | 170 | -------------------------------------------------------------------------------- /Src/main.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.c 5 | * @brief : Main program body 6 | ****************************************************************************** 7 | ** This notice applies to any and all portions of this file 8 | * that are not between comment pairs USER CODE BEGIN and 9 | * USER CODE END. Other portions of this file, whether 10 | * inserted by the user or by software development tools 11 | * are owned by their respective copyright owners. 12 | * 13 | * COPYRIGHT(c) 2020 STMicroelectronics 14 | * 15 | * Redistribution and use in source and binary forms, with or without modification, 16 | * are permitted provided that the following conditions are met: 17 | * 1. Redistributions of source code must retain the above copyright notice, 18 | * this list of conditions and the following disclaimer. 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 34 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************** 38 | */ 39 | /* USER CODE END Header */ 40 | 41 | /* Includes ------------------------------------------------------------------*/ 42 | #include "main.h" 43 | 44 | /* Private includes ----------------------------------------------------------*/ 45 | /* USER CODE BEGIN Includes */ 46 | #include "st7735.h" 47 | /* USER CODE END Includes */ 48 | 49 | /* Private typedef -----------------------------------------------------------*/ 50 | /* USER CODE BEGIN PTD */ 51 | 52 | /* USER CODE END PTD */ 53 | 54 | /* Private define ------------------------------------------------------------*/ 55 | /* USER CODE BEGIN PD */ 56 | 57 | /* USER CODE END PD */ 58 | 59 | /* Private macro -------------------------------------------------------------*/ 60 | /* USER CODE BEGIN PM */ 61 | 62 | /* USER CODE END PM */ 63 | 64 | /* Private variables ---------------------------------------------------------*/ 65 | SPI_HandleTypeDef hspi1; 66 | 67 | TIM_HandleTypeDef htim1; 68 | 69 | /* USER CODE BEGIN PV */ 70 | /* Private variables ---------------------------------------------------------*/ 71 | 72 | /* USER CODE END PV */ 73 | 74 | /* Private function prototypes -----------------------------------------------*/ 75 | void SystemClock_Config(void); 76 | static void MX_GPIO_Init(void); 77 | static void MX_SPI1_Init(void); 78 | static void MX_TIM1_Init(void); 79 | /* USER CODE BEGIN PFP */ 80 | /* Private function prototypes -----------------------------------------------*/ 81 | 82 | /* USER CODE END PFP */ 83 | 84 | /* Private user code ---------------------------------------------------------*/ 85 | /* USER CODE BEGIN 0 */ 86 | 87 | extern volatile uint8_t buttonPressed[5]; 88 | int32_t prevCounter = 0; 89 | 90 | void init() { 91 | ST7735_Init(); 92 | ST7735_FillScreen(ST7735_BLACK); 93 | ST7735_WriteString(0, 26*0, "--------", Font_16x26, ST7735_RED, ST7735_BLACK); 94 | ST7735_WriteString(0, 26*1, "??????", Font_16x26, ST7735_GREEN, ST7735_BLACK); 95 | HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); 96 | } 97 | 98 | void loop() { 99 | // Thats annoying 100 | // HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13); 101 | 102 | int currCounter = __HAL_TIM_GET_COUNTER(&htim1); 103 | currCounter = 32767 - ((currCounter-1) & 0xFFFF) / 2; 104 | if(currCounter != prevCounter) { 105 | char buff[16]; 106 | snprintf(buff, sizeof(buff), "%06d", currCounter); 107 | ST7735_WriteString(0, 26*1, buff, Font_16x26, ST7735_GREEN, ST7735_BLACK); 108 | prevCounter = currCounter; 109 | } 110 | 111 | uint8_t buttonNumber = 0; 112 | while(buttonNumber < sizeof(buttonPressed)/sizeof(buttonPressed[0])) { 113 | if(buttonPressed[buttonNumber]) { 114 | buttonPressed[buttonNumber] = 0; 115 | char buff[16]; 116 | snprintf(buff, sizeof(buff), "BUTTON %d", buttonNumber); 117 | ST7735_WriteString(0, 26*0, buff, Font_16x26, ST7735_RED, ST7735_BLACK); 118 | } 119 | buttonNumber++; 120 | } 121 | 122 | HAL_Delay(100); 123 | } 124 | 125 | /* USER CODE END 0 */ 126 | 127 | /** 128 | * @brief The application entry point. 129 | * @retval int 130 | */ 131 | int main(void) 132 | { 133 | /* USER CODE BEGIN 1 */ 134 | 135 | /* USER CODE END 1 */ 136 | 137 | /* MCU Configuration--------------------------------------------------------*/ 138 | 139 | /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ 140 | HAL_Init(); 141 | 142 | /* USER CODE BEGIN Init */ 143 | 144 | /* USER CODE END Init */ 145 | 146 | /* Configure the system clock */ 147 | SystemClock_Config(); 148 | 149 | /* USER CODE BEGIN SysInit */ 150 | 151 | /* USER CODE END SysInit */ 152 | 153 | /* Initialize all configured peripherals */ 154 | MX_GPIO_Init(); 155 | MX_SPI1_Init(); 156 | MX_TIM1_Init(); 157 | /* USER CODE BEGIN 2 */ 158 | init(); 159 | /* USER CODE END 2 */ 160 | 161 | /* Infinite loop */ 162 | /* USER CODE BEGIN WHILE */ 163 | while (1) 164 | { 165 | loop(); 166 | /* USER CODE END WHILE */ 167 | 168 | /* USER CODE BEGIN 3 */ 169 | 170 | } 171 | /* USER CODE END 3 */ 172 | } 173 | 174 | /** 175 | * @brief System Clock Configuration 176 | * @retval None 177 | */ 178 | void SystemClock_Config(void) 179 | { 180 | RCC_OscInitTypeDef RCC_OscInitStruct = {0}; 181 | RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; 182 | 183 | /**Initializes the CPU, AHB and APB busses clocks 184 | */ 185 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; 186 | RCC_OscInitStruct.HSIState = RCC_HSI_ON; 187 | RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; 188 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; 189 | if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) 190 | { 191 | Error_Handler(); 192 | } 193 | /**Initializes the CPU, AHB and APB busses clocks 194 | */ 195 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK 196 | |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; 197 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI; 198 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 199 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; 200 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; 201 | 202 | if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) 203 | { 204 | Error_Handler(); 205 | } 206 | } 207 | 208 | /** 209 | * @brief SPI1 Initialization Function 210 | * @param None 211 | * @retval None 212 | */ 213 | static void MX_SPI1_Init(void) 214 | { 215 | 216 | /* USER CODE BEGIN SPI1_Init 0 */ 217 | 218 | /* USER CODE END SPI1_Init 0 */ 219 | 220 | /* USER CODE BEGIN SPI1_Init 1 */ 221 | 222 | /* USER CODE END SPI1_Init 1 */ 223 | /* SPI1 parameter configuration*/ 224 | hspi1.Instance = SPI1; 225 | hspi1.Init.Mode = SPI_MODE_MASTER; 226 | hspi1.Init.Direction = SPI_DIRECTION_1LINE; 227 | hspi1.Init.DataSize = SPI_DATASIZE_8BIT; 228 | hspi1.Init.CLKPolarity = SPI_POLARITY_LOW; 229 | hspi1.Init.CLKPhase = SPI_PHASE_1EDGE; 230 | hspi1.Init.NSS = SPI_NSS_SOFT; 231 | hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2; 232 | hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB; 233 | hspi1.Init.TIMode = SPI_TIMODE_DISABLE; 234 | hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; 235 | hspi1.Init.CRCPolynomial = 10; 236 | if (HAL_SPI_Init(&hspi1) != HAL_OK) 237 | { 238 | Error_Handler(); 239 | } 240 | /* USER CODE BEGIN SPI1_Init 2 */ 241 | 242 | /* USER CODE END SPI1_Init 2 */ 243 | 244 | } 245 | 246 | /** 247 | * @brief TIM1 Initialization Function 248 | * @param None 249 | * @retval None 250 | */ 251 | static void MX_TIM1_Init(void) 252 | { 253 | 254 | /* USER CODE BEGIN TIM1_Init 0 */ 255 | 256 | /* USER CODE END TIM1_Init 0 */ 257 | 258 | TIM_Encoder_InitTypeDef sConfig = {0}; 259 | TIM_MasterConfigTypeDef sMasterConfig = {0}; 260 | 261 | /* USER CODE BEGIN TIM1_Init 1 */ 262 | 263 | /* USER CODE END TIM1_Init 1 */ 264 | htim1.Instance = TIM1; 265 | htim1.Init.Prescaler = 0; 266 | htim1.Init.CounterMode = TIM_COUNTERMODE_UP; 267 | htim1.Init.Period = 65535; 268 | htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; 269 | htim1.Init.RepetitionCounter = 0; 270 | htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; 271 | sConfig.EncoderMode = TIM_ENCODERMODE_TI1; 272 | sConfig.IC1Polarity = TIM_ICPOLARITY_RISING; 273 | sConfig.IC1Selection = TIM_ICSELECTION_DIRECTTI; 274 | sConfig.IC1Prescaler = TIM_ICPSC_DIV1; 275 | sConfig.IC1Filter = 0; 276 | sConfig.IC2Polarity = TIM_ICPOLARITY_RISING; 277 | sConfig.IC2Selection = TIM_ICSELECTION_DIRECTTI; 278 | sConfig.IC2Prescaler = TIM_ICPSC_DIV1; 279 | sConfig.IC2Filter = 0; 280 | if (HAL_TIM_Encoder_Init(&htim1, &sConfig) != HAL_OK) 281 | { 282 | Error_Handler(); 283 | } 284 | sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; 285 | sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; 286 | if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK) 287 | { 288 | Error_Handler(); 289 | } 290 | /* USER CODE BEGIN TIM1_Init 2 */ 291 | 292 | /* USER CODE END TIM1_Init 2 */ 293 | 294 | } 295 | 296 | /** 297 | * @brief GPIO Initialization Function 298 | * @param None 299 | * @retval None 300 | */ 301 | static void MX_GPIO_Init(void) 302 | { 303 | GPIO_InitTypeDef GPIO_InitStruct = {0}; 304 | 305 | /* GPIO Ports Clock Enable */ 306 | __HAL_RCC_GPIOC_CLK_ENABLE(); 307 | __HAL_RCC_GPIOA_CLK_ENABLE(); 308 | __HAL_RCC_GPIOB_CLK_ENABLE(); 309 | 310 | /*Configure GPIO pin Output Level */ 311 | HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); 312 | 313 | /*Configure GPIO pin Output Level */ 314 | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2, GPIO_PIN_RESET); 315 | 316 | /*Configure GPIO pin : PC13 */ 317 | GPIO_InitStruct.Pin = GPIO_PIN_13; 318 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 319 | GPIO_InitStruct.Pull = GPIO_NOPULL; 320 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 321 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); 322 | 323 | /*Configure GPIO pins : PA0 PA2 */ 324 | GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_2; 325 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 326 | GPIO_InitStruct.Pull = GPIO_NOPULL; 327 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 328 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 329 | 330 | /*Configure GPIO pin : PA1 */ 331 | GPIO_InitStruct.Pin = GPIO_PIN_1; 332 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 333 | GPIO_InitStruct.Pull = GPIO_PULLUP; 334 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 335 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 336 | 337 | /*Configure GPIO pins : PB10 PB11 PB12 PB13 338 | PB14 */ 339 | GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13 340 | |GPIO_PIN_14; 341 | GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; 342 | GPIO_InitStruct.Pull = GPIO_PULLDOWN; 343 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); 344 | 345 | /* EXTI interrupt init*/ 346 | HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0); 347 | HAL_NVIC_EnableIRQ(EXTI15_10_IRQn); 348 | 349 | } 350 | 351 | /* USER CODE BEGIN 4 */ 352 | 353 | /* USER CODE END 4 */ 354 | 355 | /** 356 | * @brief This function is executed in case of error occurrence. 357 | * @retval None 358 | */ 359 | void Error_Handler(void) 360 | { 361 | /* USER CODE BEGIN Error_Handler_Debug */ 362 | /* User can add his own implementation to report the HAL error return state */ 363 | while(1) 364 | { 365 | } 366 | /* USER CODE END Error_Handler_Debug */ 367 | } 368 | 369 | #ifdef USE_FULL_ASSERT 370 | /** 371 | * @brief Reports the name of the source file and the source line number 372 | * where the assert_param error has occurred. 373 | * @param file: pointer to the source file name 374 | * @param line: assert_param error line source number 375 | * @retval None 376 | */ 377 | void assert_failed(uint8_t *file, uint32_t line) 378 | { 379 | /* USER CODE BEGIN 6 */ 380 | /* USER CODE END 6 */ 381 | } 382 | #endif /* USE_FULL_ASSERT */ 383 | 384 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 385 | -------------------------------------------------------------------------------- /Src/stm32f1xx_hal_msp.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * File Name : stm32f1xx_hal_msp.c 5 | * Description : This file provides code for the MSP Initialization 6 | * and de-Initialization codes. 7 | ****************************************************************************** 8 | ** This notice applies to any and all portions of this file 9 | * that are not between comment pairs USER CODE BEGIN and 10 | * USER CODE END. Other portions of this file, whether 11 | * inserted by the user or by software development tools 12 | * are owned by their respective copyright owners. 13 | * 14 | * COPYRIGHT(c) 2020 STMicroelectronics 15 | * 16 | * Redistribution and use in source and binary forms, with or without modification, 17 | * are permitted provided that the following conditions are met: 18 | * 1. Redistributions of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 24 | * may be used to endorse or promote products derived from this software 25 | * without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | ****************************************************************************** 39 | */ 40 | /* USER CODE END Header */ 41 | 42 | /* Includes ------------------------------------------------------------------*/ 43 | #include "main.h" 44 | /* USER CODE BEGIN Includes */ 45 | 46 | /* USER CODE END Includes */ 47 | 48 | /* Private typedef -----------------------------------------------------------*/ 49 | /* USER CODE BEGIN TD */ 50 | 51 | /* USER CODE END TD */ 52 | 53 | /* Private define ------------------------------------------------------------*/ 54 | /* USER CODE BEGIN Define */ 55 | 56 | /* USER CODE END Define */ 57 | 58 | /* Private macro -------------------------------------------------------------*/ 59 | /* USER CODE BEGIN Macro */ 60 | 61 | /* USER CODE END Macro */ 62 | 63 | /* Private variables ---------------------------------------------------------*/ 64 | /* USER CODE BEGIN PV */ 65 | 66 | /* USER CODE END PV */ 67 | 68 | /* Private function prototypes -----------------------------------------------*/ 69 | /* USER CODE BEGIN PFP */ 70 | 71 | /* USER CODE END PFP */ 72 | 73 | /* External functions --------------------------------------------------------*/ 74 | /* USER CODE BEGIN ExternalFunctions */ 75 | 76 | /* USER CODE END ExternalFunctions */ 77 | 78 | /* USER CODE BEGIN 0 */ 79 | 80 | /* USER CODE END 0 */ 81 | /** 82 | * Initializes the Global MSP. 83 | */ 84 | void HAL_MspInit(void) 85 | { 86 | /* USER CODE BEGIN MspInit 0 */ 87 | 88 | /* USER CODE END MspInit 0 */ 89 | 90 | __HAL_RCC_AFIO_CLK_ENABLE(); 91 | __HAL_RCC_PWR_CLK_ENABLE(); 92 | 93 | /* System interrupt init*/ 94 | 95 | /**NOJTAG: JTAG-DP Disabled and SW-DP Enabled 96 | */ 97 | __HAL_AFIO_REMAP_SWJ_NOJTAG(); 98 | 99 | /* USER CODE BEGIN MspInit 1 */ 100 | 101 | /* USER CODE END MspInit 1 */ 102 | } 103 | 104 | /** 105 | * @brief SPI MSP Initialization 106 | * This function configures the hardware resources used in this example 107 | * @param hspi: SPI handle pointer 108 | * @retval None 109 | */ 110 | void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) 111 | { 112 | 113 | GPIO_InitTypeDef GPIO_InitStruct = {0}; 114 | if(hspi->Instance==SPI1) 115 | { 116 | /* USER CODE BEGIN SPI1_MspInit 0 */ 117 | 118 | /* USER CODE END SPI1_MspInit 0 */ 119 | /* Peripheral clock enable */ 120 | __HAL_RCC_SPI1_CLK_ENABLE(); 121 | 122 | __HAL_RCC_GPIOA_CLK_ENABLE(); 123 | /**SPI1 GPIO Configuration 124 | PA5 ------> SPI1_SCK 125 | PA7 ------> SPI1_MOSI 126 | */ 127 | GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_7; 128 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; 129 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; 130 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 131 | 132 | /* USER CODE BEGIN SPI1_MspInit 1 */ 133 | 134 | /* USER CODE END SPI1_MspInit 1 */ 135 | } 136 | 137 | } 138 | 139 | /** 140 | * @brief SPI MSP De-Initialization 141 | * This function freeze the hardware resources used in this example 142 | * @param hspi: SPI handle pointer 143 | * @retval None 144 | */ 145 | 146 | void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi) 147 | { 148 | 149 | if(hspi->Instance==SPI1) 150 | { 151 | /* USER CODE BEGIN SPI1_MspDeInit 0 */ 152 | 153 | /* USER CODE END SPI1_MspDeInit 0 */ 154 | /* Peripheral clock disable */ 155 | __HAL_RCC_SPI1_CLK_DISABLE(); 156 | 157 | /**SPI1 GPIO Configuration 158 | PA5 ------> SPI1_SCK 159 | PA7 ------> SPI1_MOSI 160 | */ 161 | HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_7); 162 | 163 | /* USER CODE BEGIN SPI1_MspDeInit 1 */ 164 | 165 | /* USER CODE END SPI1_MspDeInit 1 */ 166 | } 167 | 168 | } 169 | 170 | /** 171 | * @brief TIM_Encoder MSP Initialization 172 | * This function configures the hardware resources used in this example 173 | * @param htim_encoder: TIM_Encoder handle pointer 174 | * @retval None 175 | */ 176 | void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* htim_encoder) 177 | { 178 | 179 | GPIO_InitTypeDef GPIO_InitStruct = {0}; 180 | if(htim_encoder->Instance==TIM1) 181 | { 182 | /* USER CODE BEGIN TIM1_MspInit 0 */ 183 | 184 | /* USER CODE END TIM1_MspInit 0 */ 185 | /* Peripheral clock enable */ 186 | __HAL_RCC_TIM1_CLK_ENABLE(); 187 | 188 | __HAL_RCC_GPIOA_CLK_ENABLE(); 189 | /**TIM1 GPIO Configuration 190 | PA8 ------> TIM1_CH1 191 | PA9 ------> TIM1_CH2 192 | */ 193 | GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; 194 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; 195 | GPIO_InitStruct.Pull = GPIO_PULLUP; 196 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 197 | 198 | /* USER CODE BEGIN TIM1_MspInit 1 */ 199 | 200 | /* USER CODE END TIM1_MspInit 1 */ 201 | } 202 | 203 | } 204 | 205 | /** 206 | * @brief TIM_Encoder MSP De-Initialization 207 | * This function freeze the hardware resources used in this example 208 | * @param htim_encoder: TIM_Encoder handle pointer 209 | * @retval None 210 | */ 211 | 212 | void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* htim_encoder) 213 | { 214 | 215 | if(htim_encoder->Instance==TIM1) 216 | { 217 | /* USER CODE BEGIN TIM1_MspDeInit 0 */ 218 | 219 | /* USER CODE END TIM1_MspDeInit 0 */ 220 | /* Peripheral clock disable */ 221 | __HAL_RCC_TIM1_CLK_DISABLE(); 222 | 223 | /**TIM1 GPIO Configuration 224 | PA8 ------> TIM1_CH1 225 | PA9 ------> TIM1_CH2 226 | */ 227 | HAL_GPIO_DeInit(GPIOA, GPIO_PIN_8|GPIO_PIN_9); 228 | 229 | /* USER CODE BEGIN TIM1_MspDeInit 1 */ 230 | 231 | /* USER CODE END TIM1_MspDeInit 1 */ 232 | } 233 | 234 | } 235 | 236 | /* USER CODE BEGIN 1 */ 237 | 238 | /* USER CODE END 1 */ 239 | 240 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 241 | -------------------------------------------------------------------------------- /Src/stm32f1xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * 8 | * COPYRIGHT(c) 2020 STMicroelectronics 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | ****************************************************************************** 33 | */ 34 | /* USER CODE END Header */ 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "main.h" 38 | #include "stm32f1xx_it.h" 39 | /* Private includes ----------------------------------------------------------*/ 40 | /* USER CODE BEGIN Includes */ 41 | /* USER CODE END Includes */ 42 | 43 | /* Private typedef -----------------------------------------------------------*/ 44 | /* USER CODE BEGIN TD */ 45 | 46 | /* USER CODE END TD */ 47 | 48 | /* Private define ------------------------------------------------------------*/ 49 | /* USER CODE BEGIN PD */ 50 | 51 | /* USER CODE END PD */ 52 | 53 | /* Private macro -------------------------------------------------------------*/ 54 | /* USER CODE BEGIN PM */ 55 | 56 | /* USER CODE END PM */ 57 | 58 | /* Private variables ---------------------------------------------------------*/ 59 | /* USER CODE BEGIN PV */ 60 | 61 | /* USER CODE END PV */ 62 | 63 | /* Private function prototypes -----------------------------------------------*/ 64 | /* USER CODE BEGIN PFP */ 65 | 66 | /* USER CODE END PFP */ 67 | 68 | /* Private user code ---------------------------------------------------------*/ 69 | /* USER CODE BEGIN 0 */ 70 | volatile uint8_t buttonPressed[5] = { 0 }; 71 | uint32_t lastPressed = 0; 72 | /* USER CODE END 0 */ 73 | 74 | /* External variables --------------------------------------------------------*/ 75 | /* USER CODE BEGIN EV */ 76 | /* USER CODE END EV */ 77 | 78 | /******************************************************************************/ 79 | /* Cortex-M3 Processor Interruption and Exception Handlers */ 80 | /******************************************************************************/ 81 | /** 82 | * @brief This function handles Non maskable interrupt. 83 | */ 84 | void NMI_Handler(void) 85 | { 86 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 87 | 88 | /* USER CODE END NonMaskableInt_IRQn 0 */ 89 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 90 | 91 | /* USER CODE END NonMaskableInt_IRQn 1 */ 92 | } 93 | 94 | /** 95 | * @brief This function handles Hard fault interrupt. 96 | */ 97 | void HardFault_Handler(void) 98 | { 99 | /* USER CODE BEGIN HardFault_IRQn 0 */ 100 | 101 | /* USER CODE END HardFault_IRQn 0 */ 102 | while (1) 103 | { 104 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 105 | /* USER CODE END W1_HardFault_IRQn 0 */ 106 | } 107 | } 108 | 109 | /** 110 | * @brief This function handles Memory management fault. 111 | */ 112 | void MemManage_Handler(void) 113 | { 114 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 115 | 116 | /* USER CODE END MemoryManagement_IRQn 0 */ 117 | while (1) 118 | { 119 | /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ 120 | /* USER CODE END W1_MemoryManagement_IRQn 0 */ 121 | } 122 | } 123 | 124 | /** 125 | * @brief This function handles Prefetch fault, memory access fault. 126 | */ 127 | void BusFault_Handler(void) 128 | { 129 | /* USER CODE BEGIN BusFault_IRQn 0 */ 130 | 131 | /* USER CODE END BusFault_IRQn 0 */ 132 | while (1) 133 | { 134 | /* USER CODE BEGIN W1_BusFault_IRQn 0 */ 135 | /* USER CODE END W1_BusFault_IRQn 0 */ 136 | } 137 | } 138 | 139 | /** 140 | * @brief This function handles Undefined instruction or illegal state. 141 | */ 142 | void UsageFault_Handler(void) 143 | { 144 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 145 | 146 | /* USER CODE END UsageFault_IRQn 0 */ 147 | while (1) 148 | { 149 | /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ 150 | /* USER CODE END W1_UsageFault_IRQn 0 */ 151 | } 152 | } 153 | 154 | /** 155 | * @brief This function handles System service call via SWI instruction. 156 | */ 157 | void SVC_Handler(void) 158 | { 159 | /* USER CODE BEGIN SVCall_IRQn 0 */ 160 | 161 | /* USER CODE END SVCall_IRQn 0 */ 162 | /* USER CODE BEGIN SVCall_IRQn 1 */ 163 | 164 | /* USER CODE END SVCall_IRQn 1 */ 165 | } 166 | 167 | /** 168 | * @brief This function handles Debug monitor. 169 | */ 170 | void DebugMon_Handler(void) 171 | { 172 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 173 | 174 | /* USER CODE END DebugMonitor_IRQn 0 */ 175 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 176 | 177 | /* USER CODE END DebugMonitor_IRQn 1 */ 178 | } 179 | 180 | /** 181 | * @brief This function handles Pendable request for system service. 182 | */ 183 | void PendSV_Handler(void) 184 | { 185 | /* USER CODE BEGIN PendSV_IRQn 0 */ 186 | 187 | /* USER CODE END PendSV_IRQn 0 */ 188 | /* USER CODE BEGIN PendSV_IRQn 1 */ 189 | 190 | /* USER CODE END PendSV_IRQn 1 */ 191 | } 192 | 193 | /** 194 | * @brief This function handles System tick timer. 195 | */ 196 | void SysTick_Handler(void) 197 | { 198 | /* USER CODE BEGIN SysTick_IRQn 0 */ 199 | 200 | /* USER CODE END SysTick_IRQn 0 */ 201 | HAL_IncTick(); 202 | /* USER CODE BEGIN SysTick_IRQn 1 */ 203 | 204 | /* USER CODE END SysTick_IRQn 1 */ 205 | } 206 | 207 | /******************************************************************************/ 208 | /* STM32F1xx Peripheral Interrupt Handlers */ 209 | /* Add here the Interrupt Handlers for the used peripherals. */ 210 | /* For the available peripheral interrupt handler names, */ 211 | /* please refer to the startup file (startup_stm32f1xx.s). */ 212 | /******************************************************************************/ 213 | 214 | /** 215 | * @brief This function handles EXTI line[15:10] interrupts. 216 | */ 217 | void EXTI15_10_IRQHandler(void) 218 | { 219 | /* USER CODE BEGIN EXTI15_10_IRQn 0 */ 220 | 221 | /* USER CODE END EXTI15_10_IRQn 0 */ 222 | HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_10); 223 | HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_11); 224 | HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_12); 225 | HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13); 226 | HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_14); 227 | /* USER CODE BEGIN EXTI15_10_IRQn 1 */ 228 | 229 | /* USER CODE END EXTI15_10_IRQn 1 */ 230 | } 231 | 232 | /* USER CODE BEGIN 1 */ 233 | void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { 234 | int8_t buttonNumber = -1; 235 | 236 | if(GPIO_Pin == GPIO_PIN_10) { 237 | buttonNumber = 0; 238 | } else if(GPIO_Pin == GPIO_PIN_11) { 239 | buttonNumber = 1; 240 | } else if(GPIO_Pin == GPIO_PIN_12) { 241 | buttonNumber = 2; 242 | } else if(GPIO_Pin == GPIO_PIN_13) { 243 | buttonNumber = 3; 244 | } else if(GPIO_Pin == GPIO_PIN_14) { 245 | buttonNumber = 4; 246 | } 247 | 248 | if(buttonNumber < 0) { 249 | return; 250 | } 251 | 252 | // debounce 253 | uint32_t tstamp = HAL_GetTick(); 254 | if(tstamp - lastPressed < 100) 255 | return; 256 | lastPressed = tstamp; 257 | 258 | buttonPressed[buttonNumber] = 1; 259 | } 260 | /* USER CODE END 1 */ 261 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 262 | -------------------------------------------------------------------------------- /Src/system_stm32f1xx.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f1xx.c 4 | * @author MCD Application Team 5 | * @version V4.2.0 6 | * @date 31-March-2017 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Source File. 8 | * 9 | * 1. This file provides two functions and one global variable to be called from 10 | * user application: 11 | * - SystemInit(): Setups the system clock (System clock source, PLL Multiplier 12 | * factors, AHB/APBx prescalers and Flash settings). 13 | * This function is called at startup just after reset and 14 | * before branch to main program. This call is made inside 15 | * the "startup_stm32f1xx_xx.s" file. 16 | * 17 | * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used 18 | * by the user application to setup the SysTick 19 | * timer or configure other parameters. 20 | * 21 | * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must 22 | * be called whenever the core clock is changed 23 | * during program execution. 24 | * 25 | * 2. After each device reset the HSI (8 MHz) is used as system clock source. 26 | * Then SystemInit() function is called, in "startup_stm32f1xx_xx.s" file, to 27 | * configure the system clock before to branch to main program. 28 | * 29 | * 4. The default value of HSE crystal is set to 8 MHz (or 25 MHz, depending on 30 | * the product used), refer to "HSE_VALUE". 31 | * When HSE is used as system clock source, directly or through PLL, and you 32 | * are using different crystal you have to adapt the HSE value to your own 33 | * configuration. 34 | * 35 | ****************************************************************************** 36 | * @attention 37 | * 38 | *

© COPYRIGHT(c) 2017 STMicroelectronics

39 | * 40 | * Redistribution and use in source and binary forms, with or without modification, 41 | * are permitted provided that the following conditions are met: 42 | * 1. Redistributions of source code must retain the above copyright notice, 43 | * this list of conditions and the following disclaimer. 44 | * 2. Redistributions in binary form must reproduce the above copyright notice, 45 | * this list of conditions and the following disclaimer in the documentation 46 | * and/or other materials provided with the distribution. 47 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 48 | * may be used to endorse or promote products derived from this software 49 | * without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 52 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 54 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 57 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 58 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 59 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 61 | * 62 | ****************************************************************************** 63 | */ 64 | 65 | /** @addtogroup CMSIS 66 | * @{ 67 | */ 68 | 69 | /** @addtogroup stm32f1xx_system 70 | * @{ 71 | */ 72 | 73 | /** @addtogroup STM32F1xx_System_Private_Includes 74 | * @{ 75 | */ 76 | 77 | #include "stm32f1xx.h" 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @addtogroup STM32F1xx_System_Private_TypesDefinitions 84 | * @{ 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @addtogroup STM32F1xx_System_Private_Defines 92 | * @{ 93 | */ 94 | 95 | #if !defined (HSE_VALUE) 96 | #define HSE_VALUE 8000000U /*!< Default value of the External oscillator in Hz. 97 | This value can be provided and adapted by the user application. */ 98 | #endif /* HSE_VALUE */ 99 | 100 | #if !defined (HSI_VALUE) 101 | #define HSI_VALUE 8000000U /*!< Default value of the Internal oscillator in Hz. 102 | This value can be provided and adapted by the user application. */ 103 | #endif /* HSI_VALUE */ 104 | 105 | /*!< Uncomment the following line if you need to use external SRAM */ 106 | #if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) 107 | /* #define DATA_IN_ExtSRAM */ 108 | #endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */ 109 | 110 | /*!< Uncomment the following line if you need to relocate your vector Table in 111 | Internal SRAM. */ 112 | /* #define VECT_TAB_SRAM */ 113 | #define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field. 114 | This value must be a multiple of 0x200. */ 115 | 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** @addtogroup STM32F1xx_System_Private_Macros 122 | * @{ 123 | */ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /** @addtogroup STM32F1xx_System_Private_Variables 130 | * @{ 131 | */ 132 | 133 | /******************************************************************************* 134 | * Clock Definitions 135 | *******************************************************************************/ 136 | #if defined(STM32F100xB) ||defined(STM32F100xE) 137 | uint32_t SystemCoreClock = 24000000U; /*!< System Clock Frequency (Core Clock) */ 138 | #else /*!< HSI Selected as System Clock source */ 139 | uint32_t SystemCoreClock = 72000000U; /*!< System Clock Frequency (Core Clock) */ 140 | #endif 141 | 142 | const uint8_t AHBPrescTable[16U] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; 143 | const uint8_t APBPrescTable[8U] = {0, 0, 0, 0, 1, 2, 3, 4}; 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /** @addtogroup STM32F1xx_System_Private_FunctionPrototypes 150 | * @{ 151 | */ 152 | 153 | #if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) 154 | #ifdef DATA_IN_ExtSRAM 155 | static void SystemInit_ExtMemCtl(void); 156 | #endif /* DATA_IN_ExtSRAM */ 157 | #endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */ 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | /** @addtogroup STM32F1xx_System_Private_Functions 164 | * @{ 165 | */ 166 | 167 | /** 168 | * @brief Setup the microcontroller system 169 | * Initialize the Embedded Flash Interface, the PLL and update the 170 | * SystemCoreClock variable. 171 | * @note This function should be used only after reset. 172 | * @param None 173 | * @retval None 174 | */ 175 | void SystemInit (void) 176 | { 177 | /* Reset the RCC clock configuration to the default reset state(for debug purpose) */ 178 | /* Set HSION bit */ 179 | RCC->CR |= 0x00000001U; 180 | 181 | /* Reset SW, HPRE, PPRE1, PPRE2, ADCPRE and MCO bits */ 182 | #if !defined(STM32F105xC) && !defined(STM32F107xC) 183 | RCC->CFGR &= 0xF8FF0000U; 184 | #else 185 | RCC->CFGR &= 0xF0FF0000U; 186 | #endif /* STM32F105xC */ 187 | 188 | /* Reset HSEON, CSSON and PLLON bits */ 189 | RCC->CR &= 0xFEF6FFFFU; 190 | 191 | /* Reset HSEBYP bit */ 192 | RCC->CR &= 0xFFFBFFFFU; 193 | 194 | /* Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE/OTGFSPRE bits */ 195 | RCC->CFGR &= 0xFF80FFFFU; 196 | 197 | #if defined(STM32F105xC) || defined(STM32F107xC) 198 | /* Reset PLL2ON and PLL3ON bits */ 199 | RCC->CR &= 0xEBFFFFFFU; 200 | 201 | /* Disable all interrupts and clear pending bits */ 202 | RCC->CIR = 0x00FF0000U; 203 | 204 | /* Reset CFGR2 register */ 205 | RCC->CFGR2 = 0x00000000U; 206 | #elif defined(STM32F100xB) || defined(STM32F100xE) 207 | /* Disable all interrupts and clear pending bits */ 208 | RCC->CIR = 0x009F0000U; 209 | 210 | /* Reset CFGR2 register */ 211 | RCC->CFGR2 = 0x00000000U; 212 | #else 213 | /* Disable all interrupts and clear pending bits */ 214 | RCC->CIR = 0x009F0000U; 215 | #endif /* STM32F105xC */ 216 | 217 | #if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) 218 | #ifdef DATA_IN_ExtSRAM 219 | SystemInit_ExtMemCtl(); 220 | #endif /* DATA_IN_ExtSRAM */ 221 | #endif 222 | 223 | #ifdef VECT_TAB_SRAM 224 | SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */ 225 | #else 226 | SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */ 227 | #endif 228 | } 229 | 230 | /** 231 | * @brief Update SystemCoreClock variable according to Clock Register Values. 232 | * The SystemCoreClock variable contains the core clock (HCLK), it can 233 | * be used by the user application to setup the SysTick timer or configure 234 | * other parameters. 235 | * 236 | * @note Each time the core clock (HCLK) changes, this function must be called 237 | * to update SystemCoreClock variable value. Otherwise, any configuration 238 | * based on this variable will be incorrect. 239 | * 240 | * @note - The system frequency computed by this function is not the real 241 | * frequency in the chip. It is calculated based on the predefined 242 | * constant and the selected clock source: 243 | * 244 | * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*) 245 | * 246 | * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**) 247 | * 248 | * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**) 249 | * or HSI_VALUE(*) multiplied by the PLL factors. 250 | * 251 | * (*) HSI_VALUE is a constant defined in stm32f1xx.h file (default value 252 | * 8 MHz) but the real value may vary depending on the variations 253 | * in voltage and temperature. 254 | * 255 | * (**) HSE_VALUE is a constant defined in stm32f1xx.h file (default value 256 | * 8 MHz or 25 MHz, depending on the product used), user has to ensure 257 | * that HSE_VALUE is same as the real frequency of the crystal used. 258 | * Otherwise, this function may have wrong result. 259 | * 260 | * - The result of this function could be not correct when using fractional 261 | * value for HSE crystal. 262 | * @param None 263 | * @retval None 264 | */ 265 | void SystemCoreClockUpdate (void) 266 | { 267 | uint32_t tmp = 0U, pllmull = 0U, pllsource = 0U; 268 | 269 | #if defined(STM32F105xC) || defined(STM32F107xC) 270 | uint32_t prediv1source = 0U, prediv1factor = 0U, prediv2factor = 0U, pll2mull = 0U; 271 | #endif /* STM32F105xC */ 272 | 273 | #if defined(STM32F100xB) || defined(STM32F100xE) 274 | uint32_t prediv1factor = 0U; 275 | #endif /* STM32F100xB or STM32F100xE */ 276 | 277 | /* Get SYSCLK source -------------------------------------------------------*/ 278 | tmp = RCC->CFGR & RCC_CFGR_SWS; 279 | 280 | switch (tmp) 281 | { 282 | case 0x00U: /* HSI used as system clock */ 283 | SystemCoreClock = HSI_VALUE; 284 | break; 285 | case 0x04U: /* HSE used as system clock */ 286 | SystemCoreClock = HSE_VALUE; 287 | break; 288 | case 0x08U: /* PLL used as system clock */ 289 | 290 | /* Get PLL clock source and multiplication factor ----------------------*/ 291 | pllmull = RCC->CFGR & RCC_CFGR_PLLMULL; 292 | pllsource = RCC->CFGR & RCC_CFGR_PLLSRC; 293 | 294 | #if !defined(STM32F105xC) && !defined(STM32F107xC) 295 | pllmull = ( pllmull >> 18U) + 2U; 296 | 297 | if (pllsource == 0x00U) 298 | { 299 | /* HSI oscillator clock divided by 2 selected as PLL clock entry */ 300 | SystemCoreClock = (HSI_VALUE >> 1U) * pllmull; 301 | } 302 | else 303 | { 304 | #if defined(STM32F100xB) || defined(STM32F100xE) 305 | prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U; 306 | /* HSE oscillator clock selected as PREDIV1 clock entry */ 307 | SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull; 308 | #else 309 | /* HSE selected as PLL clock entry */ 310 | if ((RCC->CFGR & RCC_CFGR_PLLXTPRE) != (uint32_t)RESET) 311 | {/* HSE oscillator clock divided by 2 */ 312 | SystemCoreClock = (HSE_VALUE >> 1U) * pllmull; 313 | } 314 | else 315 | { 316 | SystemCoreClock = HSE_VALUE * pllmull; 317 | } 318 | #endif 319 | } 320 | #else 321 | pllmull = pllmull >> 18U; 322 | 323 | if (pllmull != 0x0DU) 324 | { 325 | pllmull += 2U; 326 | } 327 | else 328 | { /* PLL multiplication factor = PLL input clock * 6.5 */ 329 | pllmull = 13U / 2U; 330 | } 331 | 332 | if (pllsource == 0x00U) 333 | { 334 | /* HSI oscillator clock divided by 2 selected as PLL clock entry */ 335 | SystemCoreClock = (HSI_VALUE >> 1U) * pllmull; 336 | } 337 | else 338 | {/* PREDIV1 selected as PLL clock entry */ 339 | 340 | /* Get PREDIV1 clock source and division factor */ 341 | prediv1source = RCC->CFGR2 & RCC_CFGR2_PREDIV1SRC; 342 | prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U; 343 | 344 | if (prediv1source == 0U) 345 | { 346 | /* HSE oscillator clock selected as PREDIV1 clock entry */ 347 | SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull; 348 | } 349 | else 350 | {/* PLL2 clock selected as PREDIV1 clock entry */ 351 | 352 | /* Get PREDIV2 division factor and PLL2 multiplication factor */ 353 | prediv2factor = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> 4U) + 1U; 354 | pll2mull = ((RCC->CFGR2 & RCC_CFGR2_PLL2MUL) >> 8U) + 2U; 355 | SystemCoreClock = (((HSE_VALUE / prediv2factor) * pll2mull) / prediv1factor) * pllmull; 356 | } 357 | } 358 | #endif /* STM32F105xC */ 359 | break; 360 | 361 | default: 362 | SystemCoreClock = HSI_VALUE; 363 | break; 364 | } 365 | 366 | /* Compute HCLK clock frequency ----------------*/ 367 | /* Get HCLK prescaler */ 368 | tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4U)]; 369 | /* HCLK clock frequency */ 370 | SystemCoreClock >>= tmp; 371 | } 372 | 373 | #if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG) 374 | /** 375 | * @brief Setup the external memory controller. Called in startup_stm32f1xx.s 376 | * before jump to __main 377 | * @param None 378 | * @retval None 379 | */ 380 | #ifdef DATA_IN_ExtSRAM 381 | /** 382 | * @brief Setup the external memory controller. 383 | * Called in startup_stm32f1xx_xx.s/.c before jump to main. 384 | * This function configures the external SRAM mounted on STM3210E-EVAL 385 | * board (STM32 High density devices). This SRAM will be used as program 386 | * data memory (including heap and stack). 387 | * @param None 388 | * @retval None 389 | */ 390 | void SystemInit_ExtMemCtl(void) 391 | { 392 | __IO uint32_t tmpreg; 393 | /*!< FSMC Bank1 NOR/SRAM3 is used for the STM3210E-EVAL, if another Bank is 394 | required, then adjust the Register Addresses */ 395 | 396 | /* Enable FSMC clock */ 397 | RCC->AHBENR = 0x00000114U; 398 | 399 | /* Delay after an RCC peripheral clock enabling */ 400 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN); 401 | 402 | /* Enable GPIOD, GPIOE, GPIOF and GPIOG clocks */ 403 | RCC->APB2ENR = 0x000001E0U; 404 | 405 | /* Delay after an RCC peripheral clock enabling */ 406 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN); 407 | 408 | (void)(tmpreg); 409 | 410 | /* --------------- SRAM Data lines, NOE and NWE configuration ---------------*/ 411 | /*---------------- SRAM Address lines configuration -------------------------*/ 412 | /*---------------- NOE and NWE configuration --------------------------------*/ 413 | /*---------------- NE3 configuration ----------------------------------------*/ 414 | /*---------------- NBL0, NBL1 configuration ---------------------------------*/ 415 | 416 | GPIOD->CRL = 0x44BB44BBU; 417 | GPIOD->CRH = 0xBBBBBBBBU; 418 | 419 | GPIOE->CRL = 0xB44444BBU; 420 | GPIOE->CRH = 0xBBBBBBBBU; 421 | 422 | GPIOF->CRL = 0x44BBBBBBU; 423 | GPIOF->CRH = 0xBBBB4444U; 424 | 425 | GPIOG->CRL = 0x44BBBBBBU; 426 | GPIOG->CRH = 0x444B4B44U; 427 | 428 | /*---------------- FSMC Configuration ---------------------------------------*/ 429 | /*---------------- Enable FSMC Bank1_SRAM Bank ------------------------------*/ 430 | 431 | FSMC_Bank1->BTCR[4U] = 0x00001091U; 432 | FSMC_Bank1->BTCR[5U] = 0x00110212U; 433 | } 434 | #endif /* DATA_IN_ExtSRAM */ 435 | #endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */ 436 | 437 | /** 438 | * @} 439 | */ 440 | 441 | /** 442 | * @} 443 | */ 444 | 445 | /** 446 | * @} 447 | */ 448 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 449 | -------------------------------------------------------------------------------- /cubefix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | dos2unix Makefile 6 | dos2unix Src/main.c 7 | dos2unix Src/stm32f1xx_it.c 8 | -------------------------------------------------------------------------------- /main.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | File.Version=6 3 | KeepUserPlacement=false 4 | Mcu.Family=STM32F1 5 | Mcu.IP0=NVIC 6 | Mcu.IP1=RCC 7 | Mcu.IP2=SPI1 8 | Mcu.IP3=SYS 9 | Mcu.IP4=TIM1 10 | Mcu.IPNb=5 11 | Mcu.Name=STM32F103C(8-B)Tx 12 | Mcu.Package=LQFP48 13 | Mcu.Pin0=PC13-TAMPER-RTC 14 | Mcu.Pin1=PA0-WKUP 15 | Mcu.Pin10=PB14 16 | Mcu.Pin11=PA8 17 | Mcu.Pin12=PA9 18 | Mcu.Pin13=PA13 19 | Mcu.Pin14=PA14 20 | Mcu.Pin15=VP_SYS_VS_Systick 21 | Mcu.Pin2=PA1 22 | Mcu.Pin3=PA2 23 | Mcu.Pin4=PA5 24 | Mcu.Pin5=PA7 25 | Mcu.Pin6=PB10 26 | Mcu.Pin7=PB11 27 | Mcu.Pin8=PB12 28 | Mcu.Pin9=PB13 29 | Mcu.PinsNb=16 30 | Mcu.ThirdPartyNb=0 31 | Mcu.UserConstants= 32 | Mcu.UserName=STM32F103C8Tx 33 | MxCube.Version=5.0.0 34 | MxDb.Version=DB.5.0.0 35 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false 36 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false 37 | NVIC.EXTI15_10_IRQn=true\:0\:0\:false\:false\:true\:true 38 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false 39 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false 40 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false 41 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false 42 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 43 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false 44 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false 45 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false 46 | PA0-WKUP.Locked=true 47 | PA0-WKUP.Signal=GPIO_Output 48 | PA1.GPIOParameters=GPIO_PuPd 49 | PA1.GPIO_PuPd=GPIO_PULLUP 50 | PA1.Locked=true 51 | PA1.Signal=GPIO_Output 52 | PA13.Mode=Serial_Wire 53 | PA13.Signal=SYS_JTMS-SWDIO 54 | PA14.Mode=Serial_Wire 55 | PA14.Signal=SYS_JTCK-SWCLK 56 | PA2.Locked=true 57 | PA2.Signal=GPIO_Output 58 | PA5.Mode=Simplex_Bidirectional_Master 59 | PA5.Signal=SPI1_SCK 60 | PA7.Mode=Simplex_Bidirectional_Master 61 | PA7.Signal=SPI1_MOSI 62 | PA8.GPIOParameters=GPIO_PuPd 63 | PA8.GPIO_PuPd=GPIO_PULLUP 64 | PA8.Signal=S_TIM1_CH1 65 | PA9.GPIOParameters=GPIO_PuPd 66 | PA9.GPIO_PuPd=GPIO_PULLUP 67 | PA9.Signal=S_TIM1_CH2 68 | PB10.GPIOParameters=GPIO_PuPd 69 | PB10.GPIO_PuPd=GPIO_PULLDOWN 70 | PB10.Locked=true 71 | PB10.Signal=GPXTI10 72 | PB11.GPIOParameters=GPIO_PuPd 73 | PB11.GPIO_PuPd=GPIO_PULLDOWN 74 | PB11.Locked=true 75 | PB11.Signal=GPXTI11 76 | PB12.GPIOParameters=GPIO_PuPd 77 | PB12.GPIO_PuPd=GPIO_PULLDOWN 78 | PB12.Locked=true 79 | PB12.Signal=GPXTI12 80 | PB13.GPIOParameters=GPIO_PuPd 81 | PB13.GPIO_PuPd=GPIO_PULLDOWN 82 | PB13.Locked=true 83 | PB13.Signal=GPXTI13 84 | PB14.GPIOParameters=GPIO_PuPd 85 | PB14.GPIO_PuPd=GPIO_PULLDOWN 86 | PB14.Locked=true 87 | PB14.Signal=GPXTI14 88 | PC13-TAMPER-RTC.Locked=true 89 | PC13-TAMPER-RTC.Signal=GPIO_Output 90 | PCC.Checker=false 91 | PCC.Line=STM32F103 92 | PCC.MCU=STM32F103C(8-B)Tx 93 | PCC.PartNumber=STM32F103C8Tx 94 | PCC.Seq0=0 95 | PCC.Series=STM32F1 96 | PCC.Temperature=25 97 | PCC.Vdd=3.3 98 | PinOutPanel.RotationAngle=0 99 | ProjectManager.AskForMigrate=true 100 | ProjectManager.BackupPrevious=false 101 | ProjectManager.CompilerOptimize=6 102 | ProjectManager.ComputerToolchain=false 103 | ProjectManager.CoupleFile=false 104 | ProjectManager.CustomerFirmwarePackage= 105 | ProjectManager.DefaultFWLocation=true 106 | ProjectManager.DeletePrevious=true 107 | ProjectManager.DeviceId=STM32F103C8Tx 108 | ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.7.0 109 | ProjectManager.FreePins=false 110 | ProjectManager.HalAssertFull=false 111 | ProjectManager.HeapSize=0x200 112 | ProjectManager.KeepUserCode=true 113 | ProjectManager.LastFirmware=true 114 | ProjectManager.LibraryCopy=2 115 | ProjectManager.MainLocation=Src 116 | ProjectManager.NoMain=false 117 | ProjectManager.PreviousToolchain= 118 | ProjectManager.ProjectBuild=false 119 | ProjectManager.ProjectFileName=main.ioc 120 | ProjectManager.ProjectName=main 121 | ProjectManager.StackSize=0x400 122 | ProjectManager.TargetToolchain=Makefile 123 | ProjectManager.ToolChainLocation= 124 | ProjectManager.UnderRoot=false 125 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-true,3-MX_SPI1_Init-SPI1-false-HAL-true,4-MX_TIM1_Init-TIM1-false-HAL-true 126 | RCC.ADCFreqValue=4000000 127 | RCC.AHBFreq_Value=8000000 128 | RCC.APB1Freq_Value=8000000 129 | RCC.APB1TimFreq_Value=8000000 130 | RCC.APB2Freq_Value=8000000 131 | RCC.APB2TimFreq_Value=8000000 132 | RCC.FCLKCortexFreq_Value=8000000 133 | RCC.FamilyName=M 134 | RCC.HCLKFreq_Value=8000000 135 | RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,SYSCLKFreq_VALUE,TimSysFreq_Value,USBFreq_Value 136 | RCC.MCOFreq_Value=8000000 137 | RCC.PLLCLKFreq_Value=8000000 138 | RCC.PLLMCOFreq_Value=4000000 139 | RCC.SYSCLKFreq_VALUE=8000000 140 | RCC.TimSysFreq_Value=8000000 141 | RCC.USBFreq_Value=8000000 142 | SH.GPXTI10.0=GPIO_EXTI10 143 | SH.GPXTI10.ConfNb=1 144 | SH.GPXTI11.0=GPIO_EXTI11 145 | SH.GPXTI11.ConfNb=1 146 | SH.GPXTI12.0=GPIO_EXTI12 147 | SH.GPXTI12.ConfNb=1 148 | SH.GPXTI13.0=GPIO_EXTI13 149 | SH.GPXTI13.ConfNb=1 150 | SH.GPXTI14.0=GPIO_EXTI14 151 | SH.GPXTI14.ConfNb=1 152 | SH.S_TIM1_CH1.0=TIM1_CH1,Encoder_Interface 153 | SH.S_TIM1_CH1.ConfNb=1 154 | SH.S_TIM1_CH2.0=TIM1_CH2,Encoder_Interface 155 | SH.S_TIM1_CH2.ConfNb=1 156 | SPI1.CalculateBaudRate=4.0 MBits/s 157 | SPI1.Direction=SPI_DIRECTION_1LINE 158 | SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate 159 | SPI1.Mode=SPI_MODE_MASTER 160 | SPI1.VirtualType=VM_MASTER 161 | TIM1.ClockDivision=TIM_CLOCKDIVISION_DIV1 162 | TIM1.CounterMode=TIM_COUNTERMODE_UP 163 | TIM1.EncoderMode=TIM_ENCODERMODE_TI1 164 | TIM1.IC1Filter=0 165 | TIM1.IC2Filter=0 166 | TIM1.IPParameters=Period,EncoderMode,IC1Filter,IC2Filter,Prescaler,CounterMode,ClockDivision 167 | TIM1.Period=65535 168 | TIM1.Prescaler=0 169 | VP_SYS_VS_Systick.Mode=SysTick 170 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick 171 | board=stm32-rotary-encoder 172 | -------------------------------------------------------------------------------- /st7735/fonts.c: -------------------------------------------------------------------------------- 1 | /* vim: set ai et ts=4 sw=4: */ 2 | #include "fonts.h" 3 | 4 | static const uint16_t Font7x10 [] = { 5 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // sp 6 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x1000, 0x0000, 0x0000, // ! 7 | 0x2800, 0x2800, 0x2800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // " 8 | 0x2400, 0x2400, 0x7C00, 0x2400, 0x4800, 0x7C00, 0x4800, 0x4800, 0x0000, 0x0000, // # 9 | 0x3800, 0x5400, 0x5000, 0x3800, 0x1400, 0x5400, 0x5400, 0x3800, 0x1000, 0x0000, // $ 10 | 0x2000, 0x5400, 0x5800, 0x3000, 0x2800, 0x5400, 0x1400, 0x0800, 0x0000, 0x0000, // % 11 | 0x1000, 0x2800, 0x2800, 0x1000, 0x3400, 0x4800, 0x4800, 0x3400, 0x0000, 0x0000, // & 12 | 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ' 13 | 0x0800, 0x1000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x1000, 0x0800, // ( 14 | 0x2000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x1000, 0x2000, // ) 15 | 0x1000, 0x3800, 0x1000, 0x2800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // * 16 | 0x0000, 0x0000, 0x1000, 0x1000, 0x7C00, 0x1000, 0x1000, 0x0000, 0x0000, 0x0000, // + 17 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x1000, 0x1000, // , 18 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3800, 0x0000, 0x0000, 0x0000, 0x0000, // - 19 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, // . 20 | 0x0800, 0x0800, 0x1000, 0x1000, 0x1000, 0x1000, 0x2000, 0x2000, 0x0000, 0x0000, // / 21 | 0x3800, 0x4400, 0x4400, 0x5400, 0x4400, 0x4400, 0x4400, 0x3800, 0x0000, 0x0000, // 0 22 | 0x1000, 0x3000, 0x5000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, // 1 23 | 0x3800, 0x4400, 0x4400, 0x0400, 0x0800, 0x1000, 0x2000, 0x7C00, 0x0000, 0x0000, // 2 24 | 0x3800, 0x4400, 0x0400, 0x1800, 0x0400, 0x0400, 0x4400, 0x3800, 0x0000, 0x0000, // 3 25 | 0x0800, 0x1800, 0x2800, 0x2800, 0x4800, 0x7C00, 0x0800, 0x0800, 0x0000, 0x0000, // 4 26 | 0x7C00, 0x4000, 0x4000, 0x7800, 0x0400, 0x0400, 0x4400, 0x3800, 0x0000, 0x0000, // 5 27 | 0x3800, 0x4400, 0x4000, 0x7800, 0x4400, 0x4400, 0x4400, 0x3800, 0x0000, 0x0000, // 6 28 | 0x7C00, 0x0400, 0x0800, 0x1000, 0x1000, 0x2000, 0x2000, 0x2000, 0x0000, 0x0000, // 7 29 | 0x3800, 0x4400, 0x4400, 0x3800, 0x4400, 0x4400, 0x4400, 0x3800, 0x0000, 0x0000, // 8 30 | 0x3800, 0x4400, 0x4400, 0x4400, 0x3C00, 0x0400, 0x4400, 0x3800, 0x0000, 0x0000, // 9 31 | 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, // : 32 | 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x1000, 0x1000, 0x1000, // ; 33 | 0x0000, 0x0000, 0x0C00, 0x3000, 0x4000, 0x3000, 0x0C00, 0x0000, 0x0000, 0x0000, // < 34 | 0x0000, 0x0000, 0x0000, 0x7C00, 0x0000, 0x7C00, 0x0000, 0x0000, 0x0000, 0x0000, // = 35 | 0x0000, 0x0000, 0x6000, 0x1800, 0x0400, 0x1800, 0x6000, 0x0000, 0x0000, 0x0000, // > 36 | 0x3800, 0x4400, 0x0400, 0x0800, 0x1000, 0x1000, 0x0000, 0x1000, 0x0000, 0x0000, // ? 37 | 0x3800, 0x4400, 0x4C00, 0x5400, 0x5C00, 0x4000, 0x4000, 0x3800, 0x0000, 0x0000, // @ 38 | 0x1000, 0x2800, 0x2800, 0x2800, 0x2800, 0x7C00, 0x4400, 0x4400, 0x0000, 0x0000, // A 39 | 0x7800, 0x4400, 0x4400, 0x7800, 0x4400, 0x4400, 0x4400, 0x7800, 0x0000, 0x0000, // B 40 | 0x3800, 0x4400, 0x4000, 0x4000, 0x4000, 0x4000, 0x4400, 0x3800, 0x0000, 0x0000, // C 41 | 0x7000, 0x4800, 0x4400, 0x4400, 0x4400, 0x4400, 0x4800, 0x7000, 0x0000, 0x0000, // D 42 | 0x7C00, 0x4000, 0x4000, 0x7C00, 0x4000, 0x4000, 0x4000, 0x7C00, 0x0000, 0x0000, // E 43 | 0x7C00, 0x4000, 0x4000, 0x7800, 0x4000, 0x4000, 0x4000, 0x4000, 0x0000, 0x0000, // F 44 | 0x3800, 0x4400, 0x4000, 0x4000, 0x5C00, 0x4400, 0x4400, 0x3800, 0x0000, 0x0000, // G 45 | 0x4400, 0x4400, 0x4400, 0x7C00, 0x4400, 0x4400, 0x4400, 0x4400, 0x0000, 0x0000, // H 46 | 0x3800, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x3800, 0x0000, 0x0000, // I 47 | 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x4400, 0x3800, 0x0000, 0x0000, // J 48 | 0x4400, 0x4800, 0x5000, 0x6000, 0x5000, 0x4800, 0x4800, 0x4400, 0x0000, 0x0000, // K 49 | 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x7C00, 0x0000, 0x0000, // L 50 | 0x4400, 0x6C00, 0x6C00, 0x5400, 0x4400, 0x4400, 0x4400, 0x4400, 0x0000, 0x0000, // M 51 | 0x4400, 0x6400, 0x6400, 0x5400, 0x5400, 0x4C00, 0x4C00, 0x4400, 0x0000, 0x0000, // N 52 | 0x3800, 0x4400, 0x4400, 0x4400, 0x4400, 0x4400, 0x4400, 0x3800, 0x0000, 0x0000, // O 53 | 0x7800, 0x4400, 0x4400, 0x4400, 0x7800, 0x4000, 0x4000, 0x4000, 0x0000, 0x0000, // P 54 | 0x3800, 0x4400, 0x4400, 0x4400, 0x4400, 0x4400, 0x5400, 0x3800, 0x0400, 0x0000, // Q 55 | 0x7800, 0x4400, 0x4400, 0x4400, 0x7800, 0x4800, 0x4800, 0x4400, 0x0000, 0x0000, // R 56 | 0x3800, 0x4400, 0x4000, 0x3000, 0x0800, 0x0400, 0x4400, 0x3800, 0x0000, 0x0000, // S 57 | 0x7C00, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, // T 58 | 0x4400, 0x4400, 0x4400, 0x4400, 0x4400, 0x4400, 0x4400, 0x3800, 0x0000, 0x0000, // U 59 | 0x4400, 0x4400, 0x4400, 0x2800, 0x2800, 0x2800, 0x1000, 0x1000, 0x0000, 0x0000, // V 60 | 0x4400, 0x4400, 0x5400, 0x5400, 0x5400, 0x6C00, 0x2800, 0x2800, 0x0000, 0x0000, // W 61 | 0x4400, 0x2800, 0x2800, 0x1000, 0x1000, 0x2800, 0x2800, 0x4400, 0x0000, 0x0000, // X 62 | 0x4400, 0x4400, 0x2800, 0x2800, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, // Y 63 | 0x7C00, 0x0400, 0x0800, 0x1000, 0x1000, 0x2000, 0x4000, 0x7C00, 0x0000, 0x0000, // Z 64 | 0x1800, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1800, // [ 65 | 0x2000, 0x2000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0000, 0x0000, /* \ */ 66 | 0x3000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x3000, // ] 67 | 0x1000, 0x2800, 0x2800, 0x4400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ^ 68 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFE00, // _ 69 | 0x2000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ` 70 | 0x0000, 0x0000, 0x3800, 0x4400, 0x3C00, 0x4400, 0x4C00, 0x3400, 0x0000, 0x0000, // a 71 | 0x4000, 0x4000, 0x5800, 0x6400, 0x4400, 0x4400, 0x6400, 0x5800, 0x0000, 0x0000, // b 72 | 0x0000, 0x0000, 0x3800, 0x4400, 0x4000, 0x4000, 0x4400, 0x3800, 0x0000, 0x0000, // c 73 | 0x0400, 0x0400, 0x3400, 0x4C00, 0x4400, 0x4400, 0x4C00, 0x3400, 0x0000, 0x0000, // d 74 | 0x0000, 0x0000, 0x3800, 0x4400, 0x7C00, 0x4000, 0x4400, 0x3800, 0x0000, 0x0000, // e 75 | 0x0C00, 0x1000, 0x7C00, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, // f 76 | 0x0000, 0x0000, 0x3400, 0x4C00, 0x4400, 0x4400, 0x4C00, 0x3400, 0x0400, 0x7800, // g 77 | 0x4000, 0x4000, 0x5800, 0x6400, 0x4400, 0x4400, 0x4400, 0x4400, 0x0000, 0x0000, // h 78 | 0x1000, 0x0000, 0x7000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, // i 79 | 0x1000, 0x0000, 0x7000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0xE000, // j 80 | 0x4000, 0x4000, 0x4800, 0x5000, 0x6000, 0x5000, 0x4800, 0x4400, 0x0000, 0x0000, // k 81 | 0x7000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, // l 82 | 0x0000, 0x0000, 0x7800, 0x5400, 0x5400, 0x5400, 0x5400, 0x5400, 0x0000, 0x0000, // m 83 | 0x0000, 0x0000, 0x5800, 0x6400, 0x4400, 0x4400, 0x4400, 0x4400, 0x0000, 0x0000, // n 84 | 0x0000, 0x0000, 0x3800, 0x4400, 0x4400, 0x4400, 0x4400, 0x3800, 0x0000, 0x0000, // o 85 | 0x0000, 0x0000, 0x5800, 0x6400, 0x4400, 0x4400, 0x6400, 0x5800, 0x4000, 0x4000, // p 86 | 0x0000, 0x0000, 0x3400, 0x4C00, 0x4400, 0x4400, 0x4C00, 0x3400, 0x0400, 0x0400, // q 87 | 0x0000, 0x0000, 0x5800, 0x6400, 0x4000, 0x4000, 0x4000, 0x4000, 0x0000, 0x0000, // r 88 | 0x0000, 0x0000, 0x3800, 0x4400, 0x3000, 0x0800, 0x4400, 0x3800, 0x0000, 0x0000, // s 89 | 0x2000, 0x2000, 0x7800, 0x2000, 0x2000, 0x2000, 0x2000, 0x1800, 0x0000, 0x0000, // t 90 | 0x0000, 0x0000, 0x4400, 0x4400, 0x4400, 0x4400, 0x4C00, 0x3400, 0x0000, 0x0000, // u 91 | 0x0000, 0x0000, 0x4400, 0x4400, 0x2800, 0x2800, 0x2800, 0x1000, 0x0000, 0x0000, // v 92 | 0x0000, 0x0000, 0x5400, 0x5400, 0x5400, 0x6C00, 0x2800, 0x2800, 0x0000, 0x0000, // w 93 | 0x0000, 0x0000, 0x4400, 0x2800, 0x1000, 0x1000, 0x2800, 0x4400, 0x0000, 0x0000, // x 94 | 0x0000, 0x0000, 0x4400, 0x4400, 0x2800, 0x2800, 0x1000, 0x1000, 0x1000, 0x6000, // y 95 | 0x0000, 0x0000, 0x7C00, 0x0800, 0x1000, 0x2000, 0x4000, 0x7C00, 0x0000, 0x0000, // z 96 | 0x1800, 0x1000, 0x1000, 0x1000, 0x2000, 0x2000, 0x1000, 0x1000, 0x1000, 0x1800, // { 97 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, // | 98 | 0x3000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x1000, 0x1000, 0x1000, 0x3000, // } 99 | 0x0000, 0x0000, 0x0000, 0x7400, 0x4C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ~ 100 | }; 101 | 102 | static const uint16_t Font11x18 [] = { 103 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // sp 104 | 0x0000, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, // ! 105 | 0x0000, 0x1B00, 0x1B00, 0x1B00, 0x1B00, 0x1B00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // " 106 | 0x0000, 0x1980, 0x1980, 0x1980, 0x1980, 0x7FC0, 0x7FC0, 0x1980, 0x3300, 0x7FC0, 0x7FC0, 0x3300, 0x3300, 0x3300, 0x3300, 0x0000, 0x0000, 0x0000, // # 107 | 0x0000, 0x1E00, 0x3F00, 0x7580, 0x6580, 0x7400, 0x3C00, 0x1E00, 0x0700, 0x0580, 0x6580, 0x6580, 0x7580, 0x3F00, 0x1E00, 0x0400, 0x0400, 0x0000, // $ 108 | 0x0000, 0x7000, 0xD800, 0xD840, 0xD8C0, 0xD980, 0x7300, 0x0600, 0x0C00, 0x1B80, 0x36C0, 0x66C0, 0x46C0, 0x06C0, 0x0380, 0x0000, 0x0000, 0x0000, // % 109 | 0x0000, 0x1E00, 0x3F00, 0x3300, 0x3300, 0x3300, 0x1E00, 0x0C00, 0x3CC0, 0x66C0, 0x6380, 0x6180, 0x6380, 0x3EC0, 0x1C80, 0x0000, 0x0000, 0x0000, // & 110 | 0x0000, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ' 111 | 0x0080, 0x0100, 0x0300, 0x0600, 0x0600, 0x0400, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0400, 0x0600, 0x0600, 0x0300, 0x0100, 0x0080, // ( 112 | 0x2000, 0x1000, 0x1800, 0x0C00, 0x0C00, 0x0400, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0400, 0x0C00, 0x0C00, 0x1800, 0x1000, 0x2000, // ) 113 | 0x0000, 0x0C00, 0x2D00, 0x3F00, 0x1E00, 0x3300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // * 114 | 0x0000, 0x0000, 0x0000, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0xFFC0, 0xFFC0, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // + 115 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C00, 0x0C00, 0x0400, 0x0400, 0x0800, // , 116 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1E00, 0x1E00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // - 117 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, // . 118 | 0x0000, 0x0300, 0x0300, 0x0300, 0x0600, 0x0600, 0x0600, 0x0600, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x1800, 0x1800, 0x1800, 0x0000, 0x0000, 0x0000, // / 119 | 0x0000, 0x1E00, 0x3F00, 0x3300, 0x6180, 0x6180, 0x6180, 0x6D80, 0x6D80, 0x6180, 0x6180, 0x6180, 0x3300, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // 0 120 | 0x0000, 0x0600, 0x0E00, 0x1E00, 0x3600, 0x2600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, // 1 121 | 0x0000, 0x1E00, 0x3F00, 0x7380, 0x6180, 0x6180, 0x0180, 0x0300, 0x0600, 0x0C00, 0x1800, 0x3000, 0x6000, 0x7F80, 0x7F80, 0x0000, 0x0000, 0x0000, // 2 122 | 0x0000, 0x1C00, 0x3E00, 0x6300, 0x6300, 0x0300, 0x0E00, 0x0E00, 0x0300, 0x0180, 0x0180, 0x6180, 0x7380, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // 3 123 | 0x0000, 0x0600, 0x0E00, 0x0E00, 0x1E00, 0x1E00, 0x1600, 0x3600, 0x3600, 0x6600, 0x7F80, 0x7F80, 0x0600, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, // 4 124 | 0x0000, 0x7F00, 0x7F00, 0x6000, 0x6000, 0x6000, 0x6E00, 0x7F00, 0x6380, 0x0180, 0x0180, 0x6180, 0x7380, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // 5 125 | 0x0000, 0x1E00, 0x3F00, 0x3380, 0x6180, 0x6000, 0x6E00, 0x7F00, 0x7380, 0x6180, 0x6180, 0x6180, 0x3380, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // 6 126 | 0x0000, 0x7F80, 0x7F80, 0x0180, 0x0300, 0x0300, 0x0600, 0x0600, 0x0C00, 0x0C00, 0x0C00, 0x0800, 0x1800, 0x1800, 0x1800, 0x0000, 0x0000, 0x0000, // 7 127 | 0x0000, 0x1E00, 0x3F00, 0x6380, 0x6180, 0x6180, 0x2100, 0x1E00, 0x3F00, 0x6180, 0x6180, 0x6180, 0x6180, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // 8 128 | 0x0000, 0x1E00, 0x3F00, 0x7300, 0x6180, 0x6180, 0x6180, 0x7380, 0x3F80, 0x1D80, 0x0180, 0x6180, 0x7300, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // 9 129 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, // : 130 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C00, 0x0C00, 0x0400, 0x0400, 0x0800, // ; 131 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0380, 0x0E00, 0x3800, 0x6000, 0x3800, 0x0E00, 0x0380, 0x0080, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // < 132 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7F80, 0x7F80, 0x0000, 0x0000, 0x7F80, 0x7F80, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // = 133 | 0x0000, 0x0000, 0x0000, 0x0000, 0x4000, 0x7000, 0x1C00, 0x0700, 0x0180, 0x0700, 0x1C00, 0x7000, 0x4000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // > 134 | 0x0000, 0x1F00, 0x3F80, 0x71C0, 0x60C0, 0x00C0, 0x01C0, 0x0380, 0x0700, 0x0E00, 0x0C00, 0x0C00, 0x0000, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, // ? 135 | 0x0000, 0x1E00, 0x3F00, 0x3180, 0x7180, 0x6380, 0x6F80, 0x6D80, 0x6D80, 0x6F80, 0x6780, 0x6000, 0x3200, 0x3E00, 0x1C00, 0x0000, 0x0000, 0x0000, // @ 136 | 0x0000, 0x0E00, 0x0E00, 0x1B00, 0x1B00, 0x1B00, 0x1B00, 0x3180, 0x3180, 0x3F80, 0x3F80, 0x3180, 0x60C0, 0x60C0, 0x60C0, 0x0000, 0x0000, 0x0000, // A 137 | 0x0000, 0x7C00, 0x7E00, 0x6300, 0x6300, 0x6300, 0x6300, 0x7E00, 0x7E00, 0x6300, 0x6180, 0x6180, 0x6380, 0x7F00, 0x7E00, 0x0000, 0x0000, 0x0000, // B 138 | 0x0000, 0x1E00, 0x3F00, 0x3180, 0x6180, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6180, 0x3180, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // C 139 | 0x0000, 0x7C00, 0x7F00, 0x6300, 0x6380, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6300, 0x6300, 0x7E00, 0x7C00, 0x0000, 0x0000, 0x0000, // D 140 | 0x0000, 0x7F80, 0x7F80, 0x6000, 0x6000, 0x6000, 0x6000, 0x7F00, 0x7F00, 0x6000, 0x6000, 0x6000, 0x6000, 0x7F80, 0x7F80, 0x0000, 0x0000, 0x0000, // E 141 | 0x0000, 0x7F80, 0x7F80, 0x6000, 0x6000, 0x6000, 0x6000, 0x7F00, 0x7F00, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x0000, 0x0000, 0x0000, // F 142 | 0x0000, 0x1E00, 0x3F00, 0x3180, 0x6180, 0x6000, 0x6000, 0x6000, 0x6380, 0x6380, 0x6180, 0x6180, 0x3180, 0x3F80, 0x1E00, 0x0000, 0x0000, 0x0000, // G 143 | 0x0000, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x7F80, 0x7F80, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x0000, 0x0000, 0x0000, // H 144 | 0x0000, 0x3F00, 0x3F00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x3F00, 0x3F00, 0x0000, 0x0000, 0x0000, // I 145 | 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x6180, 0x6180, 0x7380, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // J 146 | 0x0000, 0x60C0, 0x6180, 0x6300, 0x6600, 0x6600, 0x6C00, 0x7800, 0x7C00, 0x6600, 0x6600, 0x6300, 0x6180, 0x6180, 0x60C0, 0x0000, 0x0000, 0x0000, // K 147 | 0x0000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x7F80, 0x7F80, 0x0000, 0x0000, 0x0000, // L 148 | 0x0000, 0x71C0, 0x71C0, 0x7BC0, 0x7AC0, 0x6AC0, 0x6AC0, 0x6EC0, 0x64C0, 0x60C0, 0x60C0, 0x60C0, 0x60C0, 0x60C0, 0x60C0, 0x0000, 0x0000, 0x0000, // M 149 | 0x0000, 0x7180, 0x7180, 0x7980, 0x7980, 0x7980, 0x6D80, 0x6D80, 0x6D80, 0x6580, 0x6780, 0x6780, 0x6780, 0x6380, 0x6380, 0x0000, 0x0000, 0x0000, // N 150 | 0x0000, 0x1E00, 0x3F00, 0x3300, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x3300, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // O 151 | 0x0000, 0x7E00, 0x7F00, 0x6380, 0x6180, 0x6180, 0x6180, 0x6380, 0x7F00, 0x7E00, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x0000, 0x0000, 0x0000, // P 152 | 0x0000, 0x1E00, 0x3F00, 0x3300, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6580, 0x6780, 0x3300, 0x3F80, 0x1E40, 0x0000, 0x0000, 0x0000, // Q 153 | 0x0000, 0x7E00, 0x7F00, 0x6380, 0x6180, 0x6180, 0x6380, 0x7F00, 0x7E00, 0x6600, 0x6300, 0x6300, 0x6180, 0x6180, 0x60C0, 0x0000, 0x0000, 0x0000, // R 154 | 0x0000, 0x0E00, 0x1F00, 0x3180, 0x3180, 0x3000, 0x3800, 0x1E00, 0x0700, 0x0380, 0x6180, 0x6180, 0x3180, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // S 155 | 0x0000, 0xFFC0, 0xFFC0, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, // T 156 | 0x0000, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x7380, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // U 157 | 0x0000, 0x60C0, 0x60C0, 0x60C0, 0x3180, 0x3180, 0x3180, 0x1B00, 0x1B00, 0x1B00, 0x1B00, 0x0E00, 0x0E00, 0x0E00, 0x0400, 0x0000, 0x0000, 0x0000, // V 158 | 0x0000, 0xC0C0, 0xC0C0, 0xC0C0, 0xC0C0, 0xC0C0, 0xCCC0, 0x4C80, 0x4C80, 0x5E80, 0x5280, 0x5280, 0x7380, 0x6180, 0x6180, 0x0000, 0x0000, 0x0000, // W 159 | 0x0000, 0xC0C0, 0x6080, 0x6180, 0x3300, 0x3B00, 0x1E00, 0x0C00, 0x0C00, 0x1E00, 0x1F00, 0x3B00, 0x7180, 0x6180, 0xC0C0, 0x0000, 0x0000, 0x0000, // X 160 | 0x0000, 0xC0C0, 0x6180, 0x6180, 0x3300, 0x3300, 0x1E00, 0x1E00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, // Y 161 | 0x0000, 0x3F80, 0x3F80, 0x0180, 0x0300, 0x0300, 0x0600, 0x0C00, 0x0C00, 0x1800, 0x1800, 0x3000, 0x6000, 0x7F80, 0x7F80, 0x0000, 0x0000, 0x0000, // Z 162 | 0x0F00, 0x0F00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0F00, 0x0F00, // [ 163 | 0x0000, 0x1800, 0x1800, 0x1800, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0600, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300, 0x0300, 0x0000, 0x0000, 0x0000, /* \ */ 164 | 0x1E00, 0x1E00, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x1E00, 0x1E00, // ] 165 | 0x0000, 0x0C00, 0x0C00, 0x1E00, 0x1200, 0x3300, 0x3300, 0x6180, 0x6180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ^ 166 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFE0, 0x0000, // _ 167 | 0x0000, 0x3800, 0x1800, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ` 168 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1F00, 0x3F80, 0x6180, 0x0180, 0x1F80, 0x3F80, 0x6180, 0x6380, 0x7F80, 0x38C0, 0x0000, 0x0000, 0x0000, // a 169 | 0x0000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6E00, 0x7F00, 0x7380, 0x6180, 0x6180, 0x6180, 0x6180, 0x7380, 0x7F00, 0x6E00, 0x0000, 0x0000, 0x0000, // b 170 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1E00, 0x3F00, 0x7380, 0x6180, 0x6000, 0x6000, 0x6180, 0x7380, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // c 171 | 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x1D80, 0x3F80, 0x7380, 0x6180, 0x6180, 0x6180, 0x6180, 0x7380, 0x3F80, 0x1D80, 0x0000, 0x0000, 0x0000, // d 172 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1E00, 0x3F00, 0x7300, 0x6180, 0x7F80, 0x7F80, 0x6000, 0x7180, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // e 173 | 0x0000, 0x07C0, 0x0FC0, 0x0C00, 0x0C00, 0x7F80, 0x7F80, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, // f 174 | 0x0000, 0x0000, 0x0000, 0x0000, 0x1D80, 0x3F80, 0x7380, 0x6180, 0x6180, 0x6180, 0x6180, 0x7380, 0x3F80, 0x1D80, 0x0180, 0x6380, 0x7F00, 0x3E00, // g 175 | 0x0000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6F00, 0x7F80, 0x7180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x0000, 0x0000, 0x0000, // h 176 | 0x0000, 0x0600, 0x0600, 0x0000, 0x0000, 0x3E00, 0x3E00, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, // i 177 | 0x0600, 0x0600, 0x0000, 0x0000, 0x3E00, 0x3E00, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x4600, 0x7E00, 0x3C00, // j 178 | 0x0000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6180, 0x6300, 0x6600, 0x6C00, 0x7C00, 0x7600, 0x6300, 0x6300, 0x6180, 0x60C0, 0x0000, 0x0000, 0x0000, // k 179 | 0x0000, 0x3E00, 0x3E00, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, // l 180 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xDD80, 0xFFC0, 0xCEC0, 0xCCC0, 0xCCC0, 0xCCC0, 0xCCC0, 0xCCC0, 0xCCC0, 0xCCC0, 0x0000, 0x0000, 0x0000, // m 181 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6F00, 0x7F80, 0x7180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x0000, 0x0000, 0x0000, // n 182 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1E00, 0x3F00, 0x7380, 0x6180, 0x6180, 0x6180, 0x6180, 0x7380, 0x3F00, 0x1E00, 0x0000, 0x0000, 0x0000, // o 183 | 0x0000, 0x0000, 0x0000, 0x0000, 0x6E00, 0x7F00, 0x7380, 0x6180, 0x6180, 0x6180, 0x6180, 0x7380, 0x7F00, 0x6E00, 0x6000, 0x6000, 0x6000, 0x6000, // p 184 | 0x0000, 0x0000, 0x0000, 0x0000, 0x1D80, 0x3F80, 0x7380, 0x6180, 0x6180, 0x6180, 0x6180, 0x7380, 0x3F80, 0x1D80, 0x0180, 0x0180, 0x0180, 0x0180, // q 185 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6700, 0x3F80, 0x3900, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x0000, 0x0000, 0x0000, // r 186 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1E00, 0x3F80, 0x6180, 0x6000, 0x7F00, 0x3F80, 0x0180, 0x6180, 0x7F00, 0x1E00, 0x0000, 0x0000, 0x0000, // s 187 | 0x0000, 0x0000, 0x0800, 0x1800, 0x1800, 0x7F00, 0x7F00, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1F80, 0x0F80, 0x0000, 0x0000, 0x0000, // t 188 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6180, 0x6380, 0x7F80, 0x3D80, 0x0000, 0x0000, 0x0000, // u 189 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x60C0, 0x3180, 0x3180, 0x3180, 0x1B00, 0x1B00, 0x1B00, 0x0E00, 0x0E00, 0x0600, 0x0000, 0x0000, 0x0000, // v 190 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xDD80, 0xDD80, 0xDD80, 0x5500, 0x5500, 0x5500, 0x7700, 0x7700, 0x2200, 0x2200, 0x0000, 0x0000, 0x0000, // w 191 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6180, 0x3300, 0x3300, 0x1E00, 0x0C00, 0x0C00, 0x1E00, 0x3300, 0x3300, 0x6180, 0x0000, 0x0000, 0x0000, // x 192 | 0x0000, 0x0000, 0x0000, 0x0000, 0x6180, 0x6180, 0x3180, 0x3300, 0x3300, 0x1B00, 0x1B00, 0x1B00, 0x0E00, 0x0E00, 0x0E00, 0x1C00, 0x7C00, 0x7000, // y 193 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7FC0, 0x7FC0, 0x0180, 0x0300, 0x0600, 0x0C00, 0x1800, 0x3000, 0x7FC0, 0x7FC0, 0x0000, 0x0000, 0x0000, // z 194 | 0x0380, 0x0780, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0E00, 0x1C00, 0x1C00, 0x0E00, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0780, 0x0380, // { 195 | 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, // | 196 | 0x3800, 0x3C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0E00, 0x0700, 0x0700, 0x0E00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x3C00, 0x3800, // } 197 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3880, 0x7F80, 0x4700, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // ~ 198 | }; 199 | 200 | static const uint16_t Font16x26 [] = { 201 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [ ] 202 | 0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03C0,0x03C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [!] 203 | 0x1E3C,0x1E3C,0x1E3C,0x1E3C,0x1E3C,0x1E3C,0x1E3C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = ["] 204 | 0x01CE,0x03CE,0x03DE,0x039E,0x039C,0x079C,0x3FFF,0x7FFF,0x0738,0x0F38,0x0F78,0x0F78,0x0E78,0xFFFF,0xFFFF,0x1EF0,0x1CF0,0x1CE0,0x3CE0,0x3DE0,0x39E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [#] 205 | 0x03FC,0x0FFE,0x1FEE,0x1EE0,0x1EE0,0x1EE0,0x1EE0,0x1FE0,0x0FE0,0x07E0,0x03F0,0x01FC,0x01FE,0x01FE,0x01FE,0x01FE,0x01FE,0x01FE,0x3DFE,0x3FFC,0x0FF0,0x01E0,0x01E0,0x0000,0x0000,0x0000, // Ascii = [$] 206 | 0x3E03,0xF707,0xE78F,0xE78E,0xE39E,0xE3BC,0xE7B8,0xE7F8,0xF7F0,0x3FE0,0x01C0,0x03FF,0x07FF,0x07F3,0x0FF3,0x1EF3,0x3CF3,0x38F3,0x78F3,0xF07F,0xE03F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [%] 207 | 0x07E0,0x0FF8,0x0F78,0x1F78,0x1F78,0x1F78,0x0F78,0x0FF0,0x0FE0,0x1F80,0x7FC3,0xFBC3,0xF3E7,0xF1F7,0xF0F7,0xF0FF,0xF07F,0xF83E,0x7C7F,0x3FFF,0x1FEF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [&] 208 | 0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03C0,0x01C0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = ['] 209 | 0x003F,0x007C,0x01F0,0x01E0,0x03C0,0x07C0,0x0780,0x0780,0x0F80,0x0F00,0x0F00,0x0F00,0x0F00,0x0F00,0x0F00,0x0F80,0x0780,0x0780,0x07C0,0x03C0,0x01E0,0x01F0,0x007C,0x003F,0x000F,0x0000, // Ascii = [(] 210 | 0x7E00,0x1F00,0x07C0,0x03C0,0x01E0,0x01F0,0x00F0,0x00F0,0x00F8,0x0078,0x0078,0x0078,0x0078,0x0078,0x0078,0x00F8,0x00F0,0x00F0,0x01F0,0x01E0,0x03C0,0x07C0,0x1F00,0x7E00,0x7800,0x0000, // Ascii = [)] 211 | 0x03E0,0x03C0,0x01C0,0x39CE,0x3FFF,0x3F7F,0x0320,0x0370,0x07F8,0x0F78,0x1F3C,0x0638,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [*] 212 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0xFFFF,0xFFFF,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [+] 213 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x03E0,0x01E0,0x01E0,0x01E0,0x01C0,0x0380, // Ascii = [,] 214 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3FFE,0x3FFE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [-] 215 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [.] 216 | 0x000F,0x000F,0x001E,0x001E,0x003C,0x003C,0x0078,0x0078,0x00F0,0x00F0,0x01E0,0x01E0,0x03C0,0x03C0,0x0780,0x0780,0x0F00,0x0F00,0x1E00,0x1E00,0x3C00,0x3C00,0x7800,0x7800,0xF000,0x0000, // Ascii = [/] 217 | 0x07F0,0x0FF8,0x1F7C,0x3E3E,0x3C1E,0x7C1F,0x7C1F,0x780F,0x780F,0x780F,0x780F,0x780F,0x780F,0x780F,0x7C1F,0x7C1F,0x3C1E,0x3E3E,0x1F7C,0x0FF8,0x07F0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [0] 218 | 0x00F0,0x07F0,0x3FF0,0x3FF0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x3FFF,0x3FFF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [1] 219 | 0x0FE0,0x3FF8,0x3C7C,0x003C,0x003E,0x003E,0x003E,0x003C,0x003C,0x007C,0x00F8,0x01F0,0x03E0,0x07C0,0x0780,0x0F00,0x1E00,0x3E00,0x3C00,0x3FFE,0x3FFE,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [2] 220 | 0x0FF0,0x1FF8,0x1C7C,0x003E,0x003E,0x003E,0x003C,0x003C,0x00F8,0x0FF0,0x0FF8,0x007C,0x003E,0x001E,0x001E,0x001E,0x001E,0x003E,0x1C7C,0x1FF8,0x1FE0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [3] 221 | 0x0078,0x00F8,0x00F8,0x01F8,0x03F8,0x07F8,0x07F8,0x0F78,0x1E78,0x1E78,0x3C78,0x7878,0x7878,0xFFFF,0xFFFF,0x0078,0x0078,0x0078,0x0078,0x0078,0x0078,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [4] 222 | 0x1FFC,0x1FFC,0x1FFC,0x1E00,0x1E00,0x1E00,0x1E00,0x1E00,0x1FE0,0x1FF8,0x00FC,0x007C,0x003E,0x003E,0x001E,0x003E,0x003E,0x003C,0x1C7C,0x1FF8,0x1FE0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [5] 223 | 0x01FC,0x07FE,0x0F8E,0x1F00,0x1E00,0x3E00,0x3C00,0x3C00,0x3DF8,0x3FFC,0x7F3E,0x7E1F,0x3C0F,0x3C0F,0x3C0F,0x3C0F,0x3E0F,0x1E1F,0x1F3E,0x0FFC,0x03F0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [6] 224 | 0x3FFF,0x3FFF,0x3FFF,0x000F,0x001E,0x001E,0x003C,0x0038,0x0078,0x00F0,0x00F0,0x01E0,0x01E0,0x03C0,0x03C0,0x0780,0x0F80,0x0F80,0x0F00,0x1F00,0x1F00,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [7] 225 | 0x07F8,0x0FFC,0x1F3E,0x1E1E,0x3E1E,0x3E1E,0x1E1E,0x1F3C,0x0FF8,0x07F0,0x0FF8,0x1EFC,0x3E3E,0x3C1F,0x7C1F,0x7C0F,0x7C0F,0x3C1F,0x3F3E,0x1FFC,0x07F0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [8] 226 | 0x07F0,0x0FF8,0x1E7C,0x3C3E,0x3C1E,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x3C1F,0x3E3F,0x1FFF,0x07EF,0x001F,0x001E,0x001E,0x003E,0x003C,0x38F8,0x3FF0,0x1FE0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [9] 227 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [:] 228 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x03E0,0x01E0,0x01E0,0x01E0,0x03C0,0x0380, // Ascii = [;] 229 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0003,0x000F,0x003F,0x00FC,0x03F0,0x0FC0,0x3F00,0xFE00,0x3F00,0x0FC0,0x03F0,0x00FC,0x003F,0x000F,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [<] 230 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [=] 231 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xE000,0xF800,0x7E00,0x1F80,0x07E0,0x01F8,0x007E,0x001F,0x007E,0x01F8,0x07E0,0x1F80,0x7E00,0xF800,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [>] 232 | 0x1FF0,0x3FFC,0x383E,0x381F,0x381F,0x001E,0x001E,0x003C,0x0078,0x00F0,0x01E0,0x03C0,0x03C0,0x07C0,0x07C0,0x0000,0x0000,0x0000,0x07C0,0x07C0,0x07C0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [?] 233 | 0x03F8,0x0FFE,0x1F1E,0x3E0F,0x3C7F,0x78FF,0x79EF,0x73C7,0xF3C7,0xF38F,0xF38F,0xF38F,0xF39F,0xF39F,0x73FF,0x7BFF,0x79F7,0x3C00,0x1F1C,0x0FFC,0x03F8,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [@] 234 | 0x0000,0x0000,0x0000,0x03E0,0x03E0,0x07F0,0x07F0,0x07F0,0x0F78,0x0F78,0x0E7C,0x1E3C,0x1E3C,0x3C3E,0x3FFE,0x3FFF,0x781F,0x780F,0xF00F,0xF007,0xF007,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [A] 235 | 0x0000,0x0000,0x0000,0x3FF8,0x3FFC,0x3C3E,0x3C1E,0x3C1E,0x3C1E,0x3C3E,0x3C7C,0x3FF0,0x3FF8,0x3C7E,0x3C1F,0x3C1F,0x3C0F,0x3C0F,0x3C1F,0x3FFE,0x3FF8,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [B] 236 | 0x0000,0x0000,0x0000,0x01FF,0x07FF,0x1F87,0x3E00,0x3C00,0x7C00,0x7800,0x7800,0x7800,0x7800,0x7800,0x7C00,0x7C00,0x3E00,0x3F00,0x1F83,0x07FF,0x01FF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [C] 237 | 0x0000,0x0000,0x0000,0x7FF0,0x7FFC,0x787E,0x781F,0x781F,0x780F,0x780F,0x780F,0x780F,0x780F,0x780F,0x780F,0x780F,0x781F,0x781E,0x787E,0x7FF8,0x7FE0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [D] 238 | 0x0000,0x0000,0x0000,0x3FFF,0x3FFF,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3FFE,0x3FFE,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3FFF,0x3FFF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [E] 239 | 0x0000,0x0000,0x0000,0x1FFF,0x1FFF,0x1E00,0x1E00,0x1E00,0x1E00,0x1E00,0x1E00,0x1FFF,0x1FFF,0x1E00,0x1E00,0x1E00,0x1E00,0x1E00,0x1E00,0x1E00,0x1E00,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [F] 240 | 0x0000,0x0000,0x0000,0x03FE,0x0FFF,0x1F87,0x3E00,0x7C00,0x7C00,0x7800,0xF800,0xF800,0xF87F,0xF87F,0x780F,0x7C0F,0x7C0F,0x3E0F,0x1F8F,0x0FFF,0x03FE,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [G] 241 | 0x0000,0x0000,0x0000,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7FFF,0x7FFF,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x7C1F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [H] 242 | 0x0000,0x0000,0x0000,0x3FFF,0x3FFF,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x3FFF,0x3FFF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [I] 243 | 0x0000,0x0000,0x0000,0x1FFC,0x1FFC,0x007C,0x007C,0x007C,0x007C,0x007C,0x007C,0x007C,0x007C,0x007C,0x007C,0x007C,0x0078,0x0078,0x38F8,0x3FF0,0x3FC0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [J] 244 | 0x0000,0x0000,0x0000,0x3C1F,0x3C1E,0x3C3C,0x3C78,0x3CF0,0x3DE0,0x3FE0,0x3FC0,0x3F80,0x3FC0,0x3FE0,0x3DF0,0x3CF0,0x3C78,0x3C7C,0x3C3E,0x3C1F,0x3C0F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [K] 245 | 0x0000,0x0000,0x0000,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3FFF,0x3FFF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [L] 246 | 0x0000,0x0000,0x0000,0xF81F,0xFC1F,0xFC1F,0xFE3F,0xFE3F,0xFE3F,0xFF7F,0xFF77,0xFF77,0xF7F7,0xF7E7,0xF3E7,0xF3E7,0xF3C7,0xF007,0xF007,0xF007,0xF007,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [M] 247 | 0x0000,0x0000,0x0000,0x7C0F,0x7C0F,0x7E0F,0x7F0F,0x7F0F,0x7F8F,0x7F8F,0x7FCF,0x7BEF,0x79EF,0x79FF,0x78FF,0x78FF,0x787F,0x783F,0x783F,0x781F,0x781F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [N] 248 | 0x0000,0x0000,0x0000,0x07F0,0x1FFC,0x3E3E,0x7C1F,0x780F,0x780F,0xF80F,0xF80F,0xF80F,0xF80F,0xF80F,0xF80F,0x780F,0x780F,0x7C1F,0x3E3E,0x1FFC,0x07F0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [O] 249 | 0x0000,0x0000,0x0000,0x3FFC,0x3FFF,0x3E1F,0x3E0F,0x3E0F,0x3E0F,0x3E0F,0x3E1F,0x3E3F,0x3FFC,0x3FF0,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x3E00,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [P] 250 | 0x0000,0x0000,0x0000,0x07F0,0x1FFC,0x3E3E,0x7C1F,0x780F,0x780F,0xF80F,0xF80F,0xF80F,0xF80F,0xF80F,0xF80F,0x780F,0x780F,0x7C1F,0x3E3E,0x1FFC,0x07F8,0x007C,0x003F,0x000F,0x0003,0x0000, // Ascii = [Q] 251 | 0x0000,0x0000,0x0000,0x3FF0,0x3FFC,0x3C7E,0x3C3E,0x3C1E,0x3C1E,0x3C3E,0x3C3C,0x3CFC,0x3FF0,0x3FE0,0x3DF0,0x3CF8,0x3C7C,0x3C3E,0x3C1E,0x3C1F,0x3C0F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [R] 252 | 0x0000,0x0000,0x0000,0x07FC,0x1FFE,0x3E0E,0x3C00,0x3C00,0x3C00,0x3E00,0x1FC0,0x0FF8,0x03FE,0x007F,0x001F,0x000F,0x000F,0x201F,0x3C3E,0x3FFC,0x1FF0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [S] 253 | 0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [T] 254 | 0x0000,0x0000,0x0000,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x7C0F,0x3C1E,0x3C1E,0x3E3E,0x1FFC,0x07F0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [U] 255 | 0x0000,0x0000,0x0000,0xF007,0xF007,0xF807,0x780F,0x7C0F,0x3C1E,0x3C1E,0x3E1E,0x1E3C,0x1F3C,0x1F78,0x0F78,0x0FF8,0x07F0,0x07F0,0x07F0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [V] 256 | 0x0000,0x0000,0x0000,0xE003,0xF003,0xF003,0xF007,0xF3E7,0xF3E7,0xF3E7,0x73E7,0x7BF7,0x7FF7,0x7FFF,0x7F7F,0x7F7F,0x7F7E,0x3F7E,0x3E3E,0x3E3E,0x3E3E,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [W] 257 | 0x0000,0x0000,0x0000,0xF807,0x7C0F,0x3E1E,0x3E3E,0x1F3C,0x0FF8,0x07F0,0x07E0,0x03E0,0x03E0,0x07F0,0x0FF8,0x0F7C,0x1E7C,0x3C3E,0x781F,0x780F,0xF00F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [X] 258 | 0x0000,0x0000,0x0000,0xF807,0x7807,0x7C0F,0x3C1E,0x3E1E,0x1F3C,0x0F78,0x0FF8,0x07F0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [Y] 259 | 0x0000,0x0000,0x0000,0x7FFF,0x7FFF,0x000F,0x001F,0x003E,0x007C,0x00F8,0x00F0,0x01E0,0x03E0,0x07C0,0x0F80,0x0F00,0x1E00,0x3E00,0x7C00,0x7FFF,0x7FFF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [Z] 260 | 0x07FF,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x07FF,0x07FF,0x0000, // Ascii = [[] 261 | 0x7800,0x7800,0x3C00,0x3C00,0x1E00,0x1E00,0x0F00,0x0F00,0x0780,0x0780,0x03C0,0x03C0,0x01E0,0x01E0,0x00F0,0x00F0,0x0078,0x0078,0x003C,0x003C,0x001E,0x001E,0x000F,0x000F,0x0007,0x0000, // Ascii = [\] 262 | 0x7FF0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x7FF0,0x7FF0,0x0000, // Ascii = []] 263 | 0x00C0,0x01C0,0x01C0,0x03E0,0x03E0,0x07F0,0x07F0,0x0778,0x0F78,0x0F38,0x1E3C,0x1E3C,0x3C1E,0x3C1E,0x380F,0x780F,0x7807,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [^] 264 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000, // Ascii = [_] 265 | 0x00F0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [`] 266 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0FF8,0x3FFC,0x3C7C,0x003E,0x003E,0x003E,0x07FE,0x1FFE,0x3E3E,0x7C3E,0x783E,0x7C3E,0x7C7E,0x3FFF,0x1FCF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [a] 267 | 0x3C00,0x3C00,0x3C00,0x3C00,0x3C00,0x3C00,0x3DF8,0x3FFE,0x3F3E,0x3E1F,0x3C0F,0x3C0F,0x3C0F,0x3C0F,0x3C0F,0x3C0F,0x3C1F,0x3C1E,0x3F3E,0x3FFC,0x3BF0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [b] 268 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03FE,0x0FFF,0x1F87,0x3E00,0x3E00,0x3C00,0x7C00,0x7C00,0x7C00,0x3C00,0x3E00,0x3E00,0x1F87,0x0FFF,0x03FE,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [c] 269 | 0x001F,0x001F,0x001F,0x001F,0x001F,0x001F,0x07FF,0x1FFF,0x3E3F,0x3C1F,0x7C1F,0x7C1F,0x7C1F,0x781F,0x781F,0x7C1F,0x7C1F,0x3C3F,0x3E7F,0x1FFF,0x0FDF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [d] 270 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03F8,0x0FFC,0x1F3E,0x3E1E,0x3C1F,0x7C1F,0x7FFF,0x7FFF,0x7C00,0x7C00,0x3C00,0x3E00,0x1F07,0x0FFF,0x03FE,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [e] 271 | 0x01FF,0x03E1,0x03C0,0x07C0,0x07C0,0x07C0,0x7FFF,0x7FFF,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x07C0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [f] 272 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x07EF,0x1FFF,0x3E7F,0x3C1F,0x7C1F,0x7C1F,0x781F,0x781F,0x781F,0x7C1F,0x7C1F,0x3C3F,0x3E7F,0x1FFF,0x0FDF,0x001E,0x001E,0x001E,0x387C,0x3FF8, // Ascii = [g] 273 | 0x3C00,0x3C00,0x3C00,0x3C00,0x3C00,0x3C00,0x3DFC,0x3FFE,0x3F9E,0x3F1F,0x3E1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [h] 274 | 0x01F0,0x01F0,0x0000,0x0000,0x0000,0x0000,0x7FE0,0x7FE0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [i] 275 | 0x00F8,0x00F8,0x0000,0x0000,0x0000,0x0000,0x3FF8,0x3FF8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F8,0x00F0,0x71F0,0x7FE0, // Ascii = [j] 276 | 0x3C00,0x3C00,0x3C00,0x3C00,0x3C00,0x3C00,0x3C1F,0x3C3E,0x3C7C,0x3CF8,0x3DF0,0x3DE0,0x3FC0,0x3FC0,0x3FE0,0x3DF0,0x3CF8,0x3C7C,0x3C3E,0x3C1F,0x3C1F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [k] 277 | 0x7FF0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x01F0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [l] 278 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xF79E,0xFFFF,0xFFFF,0xFFFF,0xFBE7,0xF9E7,0xF1C7,0xF1C7,0xF1C7,0xF1C7,0xF1C7,0xF1C7,0xF1C7,0xF1C7,0xF1C7,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [m] 279 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3DFC,0x3FFE,0x3F9E,0x3F1F,0x3E1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x3C1F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [n] 280 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x07F0,0x1FFC,0x3E3E,0x3C1F,0x7C1F,0x780F,0x780F,0x780F,0x780F,0x780F,0x7C1F,0x3C1F,0x3E3E,0x1FFC,0x07F0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [o] 281 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3DF8,0x3FFE,0x3F3E,0x3E1F,0x3C0F,0x3C0F,0x3C0F,0x3C0F,0x3C0F,0x3C0F,0x3C1F,0x3E1E,0x3F3E,0x3FFC,0x3FF8,0x3C00,0x3C00,0x3C00,0x3C00,0x3C00, // Ascii = [p] 282 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x07EE,0x1FFE,0x3E7E,0x3C1E,0x7C1E,0x781E,0x781E,0x781E,0x781E,0x781E,0x7C1E,0x7C3E,0x3E7E,0x1FFE,0x0FDE,0x001E,0x001E,0x001E,0x001E,0x001E, // Ascii = [q] 283 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1F7F,0x1FFF,0x1FE7,0x1FC7,0x1F87,0x1F00,0x1F00,0x1F00,0x1F00,0x1F00,0x1F00,0x1F00,0x1F00,0x1F00,0x1F00,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [r] 284 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x07FC,0x1FFE,0x1E0E,0x3E00,0x3E00,0x3F00,0x1FE0,0x07FC,0x00FE,0x003E,0x001E,0x001E,0x3C3E,0x3FFC,0x1FF0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [s] 285 | 0x0000,0x0000,0x0000,0x0780,0x0780,0x0780,0x7FFF,0x7FFF,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x0780,0x07C0,0x03FF,0x01FF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [t] 286 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3C1E,0x3C1E,0x3C1E,0x3C1E,0x3C1E,0x3C1E,0x3C1E,0x3C1E,0x3C1E,0x3C1E,0x3C3E,0x3C7E,0x3EFE,0x1FFE,0x0FDE,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [u] 287 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xF007,0x780F,0x780F,0x3C1E,0x3C1E,0x3E1E,0x1E3C,0x1E3C,0x0F78,0x0F78,0x0FF0,0x07F0,0x07F0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [v] 288 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xF003,0xF1E3,0xF3E3,0xF3E7,0xF3F7,0xF3F7,0x7FF7,0x7F77,0x7F7F,0x7F7F,0x7F7F,0x3E3E,0x3E3E,0x3E3E,0x3E3E,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [w] 289 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7C0F,0x3E1E,0x3E3C,0x1F3C,0x0FF8,0x07F0,0x07F0,0x03E0,0x07F0,0x07F8,0x0FF8,0x1E7C,0x3E3E,0x3C1F,0x781F,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [x] 290 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xF807,0x780F,0x7C0F,0x3C1E,0x3C1E,0x1E3C,0x1E3C,0x1F3C,0x0F78,0x0FF8,0x07F0,0x07F0,0x03E0,0x03E0,0x03C0,0x03C0,0x03C0,0x0780,0x0F80,0x7F00, // Ascii = [y] 291 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3FFF,0x3FFF,0x001F,0x003E,0x007C,0x00F8,0x01F0,0x03E0,0x07C0,0x0F80,0x1F00,0x1E00,0x3C00,0x7FFF,0x7FFF,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [z] 292 | 0x01FE,0x03E0,0x03C0,0x03C0,0x03C0,0x03C0,0x01E0,0x01E0,0x01E0,0x01C0,0x03C0,0x3F80,0x3F80,0x03C0,0x01C0,0x01E0,0x01E0,0x01E0,0x03C0,0x03C0,0x03C0,0x03C0,0x03E0,0x01FE,0x007E,0x0000, // Ascii = [{] 293 | 0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x0000, // Ascii = [|] 294 | 0x3FC0,0x03E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01C0,0x03C0,0x03C0,0x01C0,0x01E0,0x00FE,0x00FE,0x01E0,0x01C0,0x03C0,0x03C0,0x01C0,0x01E0,0x01E0,0x01E0,0x01E0,0x03E0,0x3FC0,0x3F00,0x0000, // Ascii = [}] 295 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3F07,0x7FC7,0x73E7,0xF1FF,0xF07E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [~] 296 | }; 297 | 298 | 299 | FontDef Font_7x10 = {7,10,Font7x10}; 300 | FontDef Font_11x18 = {11,18,Font11x18}; 301 | FontDef Font_16x26 = {16,26,Font16x26}; 302 | -------------------------------------------------------------------------------- /st7735/fonts.h: -------------------------------------------------------------------------------- 1 | /* vim: set ai et ts=4 sw=4: */ 2 | #ifndef __FONTS_H__ 3 | #define __FONTS_H__ 4 | 5 | #include 6 | 7 | typedef struct { 8 | const uint8_t width; 9 | uint8_t height; 10 | const uint16_t *data; 11 | } FontDef; 12 | 13 | 14 | extern FontDef Font_7x10; 15 | extern FontDef Font_11x18; 16 | extern FontDef Font_16x26; 17 | 18 | #endif // __FONTS_H__ 19 | -------------------------------------------------------------------------------- /st7735/st7735.c: -------------------------------------------------------------------------------- 1 | /* vim: set ai et ts=4 sw=4: */ 2 | #include "stm32f1xx_hal.h" 3 | #include "st7735.h" 4 | 5 | #define DELAY 0x80 6 | 7 | // based on Adafruit ST7735 library for Arduino 8 | static const uint8_t 9 | init_cmds1[] = { // Init for 7735R, part 1 (red or green tab) 10 | 15, // 15 commands in list: 11 | ST7735_SWRESET, DELAY, // 1: Software reset, 0 args, w/delay 12 | 150, // 150 ms delay 13 | ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, 0 args, w/delay 14 | 255, // 500 ms delay 15 | ST7735_FRMCTR1, 3 , // 3: Frame rate ctrl - normal mode, 3 args: 16 | 0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D) 17 | ST7735_FRMCTR2, 3 , // 4: Frame rate control - idle mode, 3 args: 18 | 0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D) 19 | ST7735_FRMCTR3, 6 , // 5: Frame rate ctrl - partial mode, 6 args: 20 | 0x01, 0x2C, 0x2D, // Dot inversion mode 21 | 0x01, 0x2C, 0x2D, // Line inversion mode 22 | ST7735_INVCTR , 1 , // 6: Display inversion ctrl, 1 arg, no delay: 23 | 0x07, // No inversion 24 | ST7735_PWCTR1 , 3 , // 7: Power control, 3 args, no delay: 25 | 0xA2, 26 | 0x02, // -4.6V 27 | 0x84, // AUTO mode 28 | ST7735_PWCTR2 , 1 , // 8: Power control, 1 arg, no delay: 29 | 0xC5, // VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD 30 | ST7735_PWCTR3 , 2 , // 9: Power control, 2 args, no delay: 31 | 0x0A, // Opamp current small 32 | 0x00, // Boost frequency 33 | ST7735_PWCTR4 , 2 , // 10: Power control, 2 args, no delay: 34 | 0x8A, // BCLK/2, Opamp current small & Medium low 35 | 0x2A, 36 | ST7735_PWCTR5 , 2 , // 11: Power control, 2 args, no delay: 37 | 0x8A, 0xEE, 38 | ST7735_VMCTR1 , 1 , // 12: Power control, 1 arg, no delay: 39 | 0x0E, 40 | ST7735_INVOFF , 0 , // 13: Don't invert display, no args, no delay 41 | ST7735_MADCTL , 1 , // 14: Memory access control (directions), 1 arg: 42 | ST7735_ROTATION, // row addr/col addr, bottom to top refresh 43 | ST7735_COLMOD , 1 , // 15: set color mode, 1 arg, no delay: 44 | 0x05 }, // 16-bit color 45 | 46 | #if (defined(ST7735_IS_128X128) || defined(ST7735_IS_160X128)) 47 | init_cmds2[] = { // Init for 7735R, part 2 (1.44" display) 48 | 2, // 2 commands in list: 49 | ST7735_CASET , 4 , // 1: Column addr set, 4 args, no delay: 50 | 0x00, 0x00, // XSTART = 0 51 | 0x00, 0x7F, // XEND = 127 52 | ST7735_RASET , 4 , // 2: Row addr set, 4 args, no delay: 53 | 0x00, 0x00, // XSTART = 0 54 | 0x00, 0x7F }, // XEND = 127 55 | #endif // ST7735_IS_128X128 56 | 57 | #ifdef ST7735_IS_160X80 58 | init_cmds2[] = { // Init for 7735S, part 2 (160x80 display) 59 | 3, // 3 commands in list: 60 | ST7735_CASET , 4 , // 1: Column addr set, 4 args, no delay: 61 | 0x00, 0x00, // XSTART = 0 62 | 0x00, 0x4F, // XEND = 79 63 | ST7735_RASET , 4 , // 2: Row addr set, 4 args, no delay: 64 | 0x00, 0x00, // XSTART = 0 65 | 0x00, 0x9F , // XEND = 159 66 | ST7735_INVON, 0 }, // 3: Invert colors 67 | #endif 68 | 69 | init_cmds3[] = { // Init for 7735R, part 3 (red or green tab) 70 | 4, // 4 commands in list: 71 | ST7735_GMCTRP1, 16 , // 1: Magical unicorn dust, 16 args, no delay: 72 | 0x02, 0x1c, 0x07, 0x12, 73 | 0x37, 0x32, 0x29, 0x2d, 74 | 0x29, 0x25, 0x2B, 0x39, 75 | 0x00, 0x01, 0x03, 0x10, 76 | ST7735_GMCTRN1, 16 , // 2: Sparkles and rainbows, 16 args, no delay: 77 | 0x03, 0x1d, 0x07, 0x06, 78 | 0x2E, 0x2C, 0x29, 0x2D, 79 | 0x2E, 0x2E, 0x37, 0x3F, 80 | 0x00, 0x00, 0x02, 0x10, 81 | ST7735_NORON , DELAY, // 3: Normal display on, no args, w/delay 82 | 10, // 10 ms delay 83 | ST7735_DISPON , DELAY, // 4: Main screen turn on, no args w/delay 84 | 100 }; // 100 ms delay 85 | 86 | static void ST7735_Select() { 87 | HAL_GPIO_WritePin(ST7735_CS_GPIO_Port, ST7735_CS_Pin, GPIO_PIN_RESET); 88 | } 89 | 90 | void ST7735_Unselect() { 91 | HAL_GPIO_WritePin(ST7735_CS_GPIO_Port, ST7735_CS_Pin, GPIO_PIN_SET); 92 | } 93 | 94 | static void ST7735_Reset() { 95 | HAL_GPIO_WritePin(ST7735_RES_GPIO_Port, ST7735_RES_Pin, GPIO_PIN_RESET); 96 | HAL_Delay(5); 97 | HAL_GPIO_WritePin(ST7735_RES_GPIO_Port, ST7735_RES_Pin, GPIO_PIN_SET); 98 | } 99 | 100 | static void ST7735_WriteCommand(uint8_t cmd) { 101 | HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_RESET); 102 | HAL_SPI_Transmit(&ST7735_SPI_PORT, &cmd, sizeof(cmd), HAL_MAX_DELAY); 103 | } 104 | 105 | static void ST7735_WriteData(uint8_t* buff, size_t buff_size) { 106 | HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_SET); 107 | HAL_SPI_Transmit(&ST7735_SPI_PORT, buff, buff_size, HAL_MAX_DELAY); 108 | } 109 | 110 | static void ST7735_ExecuteCommandList(const uint8_t *addr) { 111 | uint8_t numCommands, numArgs; 112 | uint16_t ms; 113 | 114 | numCommands = *addr++; 115 | while(numCommands--) { 116 | uint8_t cmd = *addr++; 117 | ST7735_WriteCommand(cmd); 118 | 119 | numArgs = *addr++; 120 | // If high bit set, delay follows args 121 | ms = numArgs & DELAY; 122 | numArgs &= ~DELAY; 123 | if(numArgs) { 124 | ST7735_WriteData((uint8_t*)addr, numArgs); 125 | addr += numArgs; 126 | } 127 | 128 | if(ms) { 129 | ms = *addr++; 130 | if(ms == 255) ms = 500; 131 | HAL_Delay(ms); 132 | } 133 | } 134 | } 135 | 136 | static void ST7735_SetAddressWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) { 137 | // column address set 138 | ST7735_WriteCommand(ST7735_CASET); 139 | uint8_t data[] = { 0x00, x0 + ST7735_XSTART, 0x00, x1 + ST7735_XSTART }; 140 | ST7735_WriteData(data, sizeof(data)); 141 | 142 | // row address set 143 | ST7735_WriteCommand(ST7735_RASET); 144 | data[1] = y0 + ST7735_YSTART; 145 | data[3] = y1 + ST7735_YSTART; 146 | ST7735_WriteData(data, sizeof(data)); 147 | 148 | // write to RAM 149 | ST7735_WriteCommand(ST7735_RAMWR); 150 | } 151 | 152 | void ST7735_Init() { 153 | ST7735_Select(); 154 | ST7735_Reset(); 155 | ST7735_ExecuteCommandList(init_cmds1); 156 | ST7735_ExecuteCommandList(init_cmds2); 157 | ST7735_ExecuteCommandList(init_cmds3); 158 | ST7735_Unselect(); 159 | } 160 | 161 | void ST7735_DrawPixel(uint16_t x, uint16_t y, uint16_t color) { 162 | if((x >= ST7735_WIDTH) || (y >= ST7735_HEIGHT)) 163 | return; 164 | 165 | ST7735_Select(); 166 | 167 | ST7735_SetAddressWindow(x, y, x+1, y+1); 168 | uint8_t data[] = { color >> 8, color & 0xFF }; 169 | ST7735_WriteData(data, sizeof(data)); 170 | 171 | ST7735_Unselect(); 172 | } 173 | 174 | static void ST7735_WriteChar(uint16_t x, uint16_t y, char ch, FontDef font, uint16_t color, uint16_t bgcolor) { 175 | uint32_t i, b, j; 176 | 177 | ST7735_SetAddressWindow(x, y, x+font.width-1, y+font.height-1); 178 | 179 | for(i = 0; i < font.height; i++) { 180 | b = font.data[(ch - 32) * font.height + i]; 181 | for(j = 0; j < font.width; j++) { 182 | if((b << j) & 0x8000) { 183 | uint8_t data[] = { color >> 8, color & 0xFF }; 184 | ST7735_WriteData(data, sizeof(data)); 185 | } else { 186 | uint8_t data[] = { bgcolor >> 8, bgcolor & 0xFF }; 187 | ST7735_WriteData(data, sizeof(data)); 188 | } 189 | } 190 | } 191 | } 192 | 193 | /* 194 | Simpler (and probably slower) implementation: 195 | 196 | static void ST7735_WriteChar(uint16_t x, uint16_t y, char ch, FontDef font, uint16_t color) { 197 | uint32_t i, b, j; 198 | 199 | for(i = 0; i < font.height; i++) { 200 | b = font.data[(ch - 32) * font.height + i]; 201 | for(j = 0; j < font.width; j++) { 202 | if((b << j) & 0x8000) { 203 | ST7735_DrawPixel(x + j, y + i, color); 204 | } 205 | } 206 | } 207 | } 208 | */ 209 | 210 | void ST7735_WriteString(uint16_t x, uint16_t y, const char* str, FontDef font, uint16_t color, uint16_t bgcolor) { 211 | ST7735_Select(); 212 | 213 | while(*str) { 214 | if(x + font.width >= ST7735_WIDTH) { 215 | x = 0; 216 | y += font.height; 217 | if(y + font.height >= ST7735_HEIGHT) { 218 | break; 219 | } 220 | 221 | if(*str == ' ') { 222 | // skip spaces in the beginning of the new line 223 | str++; 224 | continue; 225 | } 226 | } 227 | 228 | ST7735_WriteChar(x, y, *str, font, color, bgcolor); 229 | x += font.width; 230 | str++; 231 | } 232 | 233 | ST7735_Unselect(); 234 | } 235 | 236 | void ST7735_FillRectangle(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color) { 237 | // clipping 238 | if((x >= ST7735_WIDTH) || (y >= ST7735_HEIGHT)) return; 239 | if((x + w - 1) >= ST7735_WIDTH) w = ST7735_WIDTH - x; 240 | if((y + h - 1) >= ST7735_HEIGHT) h = ST7735_HEIGHT - y; 241 | 242 | ST7735_Select(); 243 | ST7735_SetAddressWindow(x, y, x+w-1, y+h-1); 244 | 245 | uint8_t data[] = { color >> 8, color & 0xFF }; 246 | HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_SET); 247 | for(y = h; y > 0; y--) { 248 | for(x = w; x > 0; x--) { 249 | HAL_SPI_Transmit(&ST7735_SPI_PORT, data, sizeof(data), HAL_MAX_DELAY); 250 | } 251 | } 252 | 253 | ST7735_Unselect(); 254 | } 255 | 256 | void ST7735_FillScreen(uint16_t color) { 257 | ST7735_FillRectangle(0, 0, ST7735_WIDTH, ST7735_HEIGHT, color); 258 | } 259 | 260 | void ST7735_DrawImage(uint16_t x, uint16_t y, uint16_t w, uint16_t h, const uint16_t* data) { 261 | if((x >= ST7735_WIDTH) || (y >= ST7735_HEIGHT)) return; 262 | if((x + w - 1) >= ST7735_WIDTH) return; 263 | if((y + h - 1) >= ST7735_HEIGHT) return; 264 | 265 | ST7735_Select(); 266 | ST7735_SetAddressWindow(x, y, x+w-1, y+h-1); 267 | ST7735_WriteData((uint8_t*)data, sizeof(uint16_t)*w*h); 268 | ST7735_Unselect(); 269 | } 270 | 271 | void ST7735_InvertColors(bool invert) { 272 | ST7735_Select(); 273 | ST7735_WriteCommand(invert ? ST7735_INVON : ST7735_INVOFF); 274 | ST7735_Unselect(); 275 | } 276 | 277 | 278 | -------------------------------------------------------------------------------- /st7735/st7735.h: -------------------------------------------------------------------------------- 1 | /* vim: set ai et ts=4 sw=4: */ 2 | #ifndef __ST7735_H__ 3 | #define __ST7735_H__ 4 | 5 | #include "fonts.h" 6 | #include 7 | 8 | #define ST7735_MADCTL_MY 0x80 9 | #define ST7735_MADCTL_MX 0x40 10 | #define ST7735_MADCTL_MV 0x20 11 | #define ST7735_MADCTL_ML 0x10 12 | #define ST7735_MADCTL_RGB 0x00 13 | #define ST7735_MADCTL_BGR 0x08 14 | #define ST7735_MADCTL_MH 0x04 15 | 16 | /*** Redefine if necessary ***/ 17 | #define ST7735_SPI_PORT hspi1 18 | extern SPI_HandleTypeDef ST7735_SPI_PORT; 19 | 20 | #define ST7735_RES_Pin GPIO_PIN_0 21 | #define ST7735_RES_GPIO_Port GPIOA 22 | #define ST7735_CS_Pin GPIO_PIN_1 23 | #define ST7735_CS_GPIO_Port GPIOA 24 | #define ST7735_DC_Pin GPIO_PIN_2 25 | #define ST7735_DC_GPIO_Port GPIOA 26 | 27 | // AliExpress/eBay 1.8" display, default orientation 28 | /* 29 | #define ST7735_IS_160X128 1 30 | #define ST7735_WIDTH 128 31 | #define ST7735_HEIGHT 160 32 | #define ST7735_XSTART 0 33 | #define ST7735_YSTART 0 34 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MY) 35 | */ 36 | 37 | // AliExpress/eBay 1.8" display, rotate right 38 | #define ST7735_IS_160X128 1 39 | #define ST7735_WIDTH 160 40 | #define ST7735_HEIGHT 128 41 | #define ST7735_XSTART 0 42 | #define ST7735_YSTART 0 43 | #define ST7735_ROTATION (ST7735_MADCTL_MY | ST7735_MADCTL_MV) 44 | 45 | // AliExpress/eBay 1.8" display, rotate left 46 | /* 47 | #define ST7735_IS_160X128 1 48 | #define ST7735_WIDTH 160 49 | #define ST7735_HEIGHT 128 50 | #define ST7735_XSTART 0 51 | #define ST7735_YSTART 0 52 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MV) 53 | */ 54 | 55 | // AliExpress/eBay 1.8" display, upside down 56 | /* 57 | #define ST7735_IS_160X128 1 58 | #define ST7735_WIDTH 128 59 | #define ST7735_HEIGHT 160 60 | #define ST7735_XSTART 0 61 | #define ST7735_YSTART 0 62 | #define ST7735_ROTATION (0) 63 | */ 64 | 65 | // WaveShare ST7735S-based 1.8" display, default orientation 66 | /* 67 | #define ST7735_IS_160X128 1 68 | #define ST7735_WIDTH 128 69 | #define ST7735_HEIGHT 160 70 | #define ST7735_XSTART 2 71 | #define ST7735_YSTART 1 72 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MY | ST7735_MADCTL_RGB) 73 | */ 74 | 75 | // WaveShare ST7735S-based 1.8" display, rotate right 76 | /* 77 | #define ST7735_IS_160X128 1 78 | #define ST7735_WIDTH 160 79 | #define ST7735_HEIGHT 128 80 | #define ST7735_XSTART 1 81 | #define ST7735_YSTART 2 82 | #define ST7735_ROTATION (ST7735_MADCTL_MY | ST7735_MADCTL_MV | ST7735_MADCTL_RGB) 83 | */ 84 | 85 | // WaveShare ST7735S-based 1.8" display, rotate left 86 | /* 87 | #define ST7735_IS_160X128 1 88 | #define ST7735_WIDTH 160 89 | #define ST7735_HEIGHT 128 90 | #define ST7735_XSTART 1 91 | #define ST7735_YSTART 2 92 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MV | ST7735_MADCTL_RGB) 93 | */ 94 | 95 | // WaveShare ST7735S-based 1.8" display, upside down 96 | /* 97 | #define ST7735_IS_160X128 1 98 | #define ST7735_WIDTH 128 99 | #define ST7735_HEIGHT 160 100 | #define ST7735_XSTART 2 101 | #define ST7735_YSTART 1 102 | #define ST7735_ROTATION (ST7735_MADCTL_RGB) 103 | */ 104 | 105 | // 1.44" display, default orientation 106 | /* 107 | #define ST7735_IS_128X128 1 108 | #define ST7735_WIDTH 128 109 | #define ST7735_HEIGHT 128 110 | #define ST7735_XSTART 2 111 | #define ST7735_YSTART 3 112 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MY | ST7735_MADCTL_BGR) 113 | */ 114 | 115 | // 1.44" display, rotate right 116 | /* 117 | #define ST7735_IS_128X128 1 118 | #define ST7735_WIDTH 128 119 | #define ST7735_HEIGHT 128 120 | #define ST7735_XSTART 3 121 | #define ST7735_YSTART 2 122 | #define ST7735_ROTATION (ST7735_MADCTL_MY | ST7735_MADCTL_MV | ST7735_MADCTL_BGR) 123 | */ 124 | 125 | // 1.44" display, rotate left 126 | /* 127 | #define ST7735_IS_128X128 1 128 | #define ST7735_WIDTH 128 129 | #define ST7735_HEIGHT 128 130 | #define ST7735_XSTART 1 131 | #define ST7735_YSTART 2 132 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MV | ST7735_MADCTL_BGR) 133 | */ 134 | 135 | // 1.44" display, upside down 136 | /* 137 | #define ST7735_IS_128X128 1 138 | #define ST7735_WIDTH 128 139 | #define ST7735_HEIGHT 128 140 | #define ST7735_XSTART 2 141 | #define ST7735_YSTART 1 142 | #define ST7735_ROTATION (ST7735_MADCTL_BGR) 143 | */ 144 | 145 | // mini 160x80 display (it's unlikely you want the default orientation) 146 | /* 147 | #define ST7735_IS_160X80 1 148 | #define ST7735_XSTART 26 149 | #define ST7735_YSTART 1 150 | #define ST7735_WIDTH 80 151 | #define ST7735_HEIGHT 160 152 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MY | ST7735_MADCTL_BGR) 153 | */ 154 | 155 | // mini 160x80, rotate left 156 | /* 157 | #define ST7735_IS_160X80 1 158 | #define ST7735_XSTART 1 159 | #define ST7735_YSTART 26 160 | #define ST7735_WIDTH 160 161 | #define ST7735_HEIGHT 80 162 | #define ST7735_ROTATION (ST7735_MADCTL_MX | ST7735_MADCTL_MV | ST7735_MADCTL_BGR) 163 | */ 164 | 165 | // mini 160x80, rotate right 166 | /* 167 | #define ST7735_IS_160X80 1 168 | #define ST7735_XSTART 1 169 | #define ST7735_YSTART 26 170 | #define ST7735_WIDTH 160 171 | #define ST7735_HEIGHT 80 172 | #define ST7735_ROTATION (ST7735_MADCTL_MY | ST7735_MADCTL_MV | ST7735_MADCTL_BGR) 173 | */ 174 | 175 | /****************************/ 176 | 177 | #define ST7735_NOP 0x00 178 | #define ST7735_SWRESET 0x01 179 | #define ST7735_RDDID 0x04 180 | #define ST7735_RDDST 0x09 181 | 182 | #define ST7735_SLPIN 0x10 183 | #define ST7735_SLPOUT 0x11 184 | #define ST7735_PTLON 0x12 185 | #define ST7735_NORON 0x13 186 | 187 | #define ST7735_INVOFF 0x20 188 | #define ST7735_INVON 0x21 189 | #define ST7735_DISPOFF 0x28 190 | #define ST7735_DISPON 0x29 191 | #define ST7735_CASET 0x2A 192 | #define ST7735_RASET 0x2B 193 | #define ST7735_RAMWR 0x2C 194 | #define ST7735_RAMRD 0x2E 195 | 196 | #define ST7735_PTLAR 0x30 197 | #define ST7735_COLMOD 0x3A 198 | #define ST7735_MADCTL 0x36 199 | 200 | #define ST7735_FRMCTR1 0xB1 201 | #define ST7735_FRMCTR2 0xB2 202 | #define ST7735_FRMCTR3 0xB3 203 | #define ST7735_INVCTR 0xB4 204 | #define ST7735_DISSET5 0xB6 205 | 206 | #define ST7735_PWCTR1 0xC0 207 | #define ST7735_PWCTR2 0xC1 208 | #define ST7735_PWCTR3 0xC2 209 | #define ST7735_PWCTR4 0xC3 210 | #define ST7735_PWCTR5 0xC4 211 | #define ST7735_VMCTR1 0xC5 212 | 213 | #define ST7735_RDID1 0xDA 214 | #define ST7735_RDID2 0xDB 215 | #define ST7735_RDID3 0xDC 216 | #define ST7735_RDID4 0xDD 217 | 218 | #define ST7735_PWCTR6 0xFC 219 | 220 | #define ST7735_GMCTRP1 0xE0 221 | #define ST7735_GMCTRN1 0xE1 222 | 223 | // Color definitions 224 | #define ST7735_BLACK 0x0000 225 | #define ST7735_BLUE 0x001F 226 | #define ST7735_RED 0xF800 227 | #define ST7735_GREEN 0x07E0 228 | #define ST7735_CYAN 0x07FF 229 | #define ST7735_MAGENTA 0xF81F 230 | #define ST7735_YELLOW 0xFFE0 231 | #define ST7735_WHITE 0xFFFF 232 | #define ST7735_COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)) 233 | 234 | // call before initializing any SPI devices 235 | void ST7735_Unselect(); 236 | 237 | void ST7735_Init(void); 238 | void ST7735_DrawPixel(uint16_t x, uint16_t y, uint16_t color); 239 | void ST7735_WriteString(uint16_t x, uint16_t y, const char* str, FontDef font, uint16_t color, uint16_t bgcolor); 240 | void ST7735_FillRectangle(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color); 241 | void ST7735_FillScreen(uint16_t color); 242 | void ST7735_DrawImage(uint16_t x, uint16_t y, uint16_t w, uint16_t h, const uint16_t* data); 243 | void ST7735_InvertColors(bool invert); 244 | 245 | #endif // __ST7735_H__ 246 | -------------------------------------------------------------------------------- /startup_stm32f103xb.s: -------------------------------------------------------------------------------- 1 | /** 2 | *************** (C) COPYRIGHT 2017 STMicroelectronics ************************ 3 | * @file startup_stm32f103xb.s 4 | * @author MCD Application Team 5 | * @version V4.2.0 6 | * @date 31-March-2017 7 | * @brief STM32F103xB Devices vector table for Atollic toolchain. 8 | * This module performs: 9 | * - Set the initial SP 10 | * - Set the initial PC == Reset_Handler, 11 | * - Set the vector table entries with the exceptions ISR address 12 | * - Configure the clock system 13 | * - Branches to main in the C library (which eventually 14 | * calls main()). 15 | * After Reset the Cortex-M3 processor is in Thread mode, 16 | * priority is Privileged, and the Stack is set to Main. 17 | ****************************************************************************** 18 | * 19 | *

© COPYRIGHT(c) 2017 STMicroelectronics

20 | * 21 | * Redistribution and use in source and binary forms, with or without modification, 22 | * are permitted provided that the following conditions are met: 23 | * 1. Redistributions of source code must retain the above copyright notice, 24 | * this list of conditions and the following disclaimer. 25 | * 2. Redistributions in binary form must reproduce the above copyright notice, 26 | * this list of conditions and the following disclaimer in the documentation 27 | * and/or other materials provided with the distribution. 28 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 29 | * may be used to endorse or promote products derived from this software 30 | * without specific prior written permission. 31 | * 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 33 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 35 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 36 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 38 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 40 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | * 43 | ****************************************************************************** 44 | */ 45 | 46 | .syntax unified 47 | .cpu cortex-m3 48 | .fpu softvfp 49 | .thumb 50 | 51 | .global g_pfnVectors 52 | .global Default_Handler 53 | 54 | /* start address for the initialization values of the .data section. 55 | defined in linker script */ 56 | .word _sidata 57 | /* start address for the .data section. defined in linker script */ 58 | .word _sdata 59 | /* end address for the .data section. defined in linker script */ 60 | .word _edata 61 | /* start address for the .bss section. defined in linker script */ 62 | .word _sbss 63 | /* end address for the .bss section. defined in linker script */ 64 | .word _ebss 65 | 66 | .equ BootRAM, 0xF108F85F 67 | /** 68 | * @brief This is the code that gets called when the processor first 69 | * starts execution following a reset event. Only the absolutely 70 | * necessary set is performed, after which the application 71 | * supplied main() routine is called. 72 | * @param None 73 | * @retval : None 74 | */ 75 | 76 | .section .text.Reset_Handler 77 | .weak Reset_Handler 78 | .type Reset_Handler, %function 79 | Reset_Handler: 80 | 81 | /* Copy the data segment initializers from flash to SRAM */ 82 | movs r1, #0 83 | b LoopCopyDataInit 84 | 85 | CopyDataInit: 86 | ldr r3, =_sidata 87 | ldr r3, [r3, r1] 88 | str r3, [r0, r1] 89 | adds r1, r1, #4 90 | 91 | LoopCopyDataInit: 92 | ldr r0, =_sdata 93 | ldr r3, =_edata 94 | adds r2, r0, r1 95 | cmp r2, r3 96 | bcc CopyDataInit 97 | ldr r2, =_sbss 98 | b LoopFillZerobss 99 | /* Zero fill the bss segment. */ 100 | FillZerobss: 101 | movs r3, #0 102 | str r3, [r2], #4 103 | 104 | LoopFillZerobss: 105 | ldr r3, = _ebss 106 | cmp r2, r3 107 | bcc FillZerobss 108 | 109 | /* Call the clock system intitialization function.*/ 110 | bl SystemInit 111 | /* Call static constructors */ 112 | bl __libc_init_array 113 | /* Call the application's entry point.*/ 114 | bl main 115 | bx lr 116 | .size Reset_Handler, .-Reset_Handler 117 | 118 | /** 119 | * @brief This is the code that gets called when the processor receives an 120 | * unexpected interrupt. This simply enters an infinite loop, preserving 121 | * the system state for examination by a debugger. 122 | * 123 | * @param None 124 | * @retval : None 125 | */ 126 | .section .text.Default_Handler,"ax",%progbits 127 | Default_Handler: 128 | Infinite_Loop: 129 | b Infinite_Loop 130 | .size Default_Handler, .-Default_Handler 131 | /****************************************************************************** 132 | * 133 | * The minimal vector table for a Cortex M3. Note that the proper constructs 134 | * must be placed on this to ensure that it ends up at physical address 135 | * 0x0000.0000. 136 | * 137 | ******************************************************************************/ 138 | .section .isr_vector,"a",%progbits 139 | .type g_pfnVectors, %object 140 | .size g_pfnVectors, .-g_pfnVectors 141 | 142 | 143 | g_pfnVectors: 144 | 145 | .word _estack 146 | .word Reset_Handler 147 | .word NMI_Handler 148 | .word HardFault_Handler 149 | .word MemManage_Handler 150 | .word BusFault_Handler 151 | .word UsageFault_Handler 152 | .word 0 153 | .word 0 154 | .word 0 155 | .word 0 156 | .word SVC_Handler 157 | .word DebugMon_Handler 158 | .word 0 159 | .word PendSV_Handler 160 | .word SysTick_Handler 161 | .word WWDG_IRQHandler 162 | .word PVD_IRQHandler 163 | .word TAMPER_IRQHandler 164 | .word RTC_IRQHandler 165 | .word FLASH_IRQHandler 166 | .word RCC_IRQHandler 167 | .word EXTI0_IRQHandler 168 | .word EXTI1_IRQHandler 169 | .word EXTI2_IRQHandler 170 | .word EXTI3_IRQHandler 171 | .word EXTI4_IRQHandler 172 | .word DMA1_Channel1_IRQHandler 173 | .word DMA1_Channel2_IRQHandler 174 | .word DMA1_Channel3_IRQHandler 175 | .word DMA1_Channel4_IRQHandler 176 | .word DMA1_Channel5_IRQHandler 177 | .word DMA1_Channel6_IRQHandler 178 | .word DMA1_Channel7_IRQHandler 179 | .word ADC1_2_IRQHandler 180 | .word USB_HP_CAN1_TX_IRQHandler 181 | .word USB_LP_CAN1_RX0_IRQHandler 182 | .word CAN1_RX1_IRQHandler 183 | .word CAN1_SCE_IRQHandler 184 | .word EXTI9_5_IRQHandler 185 | .word TIM1_BRK_IRQHandler 186 | .word TIM1_UP_IRQHandler 187 | .word TIM1_TRG_COM_IRQHandler 188 | .word TIM1_CC_IRQHandler 189 | .word TIM2_IRQHandler 190 | .word TIM3_IRQHandler 191 | .word TIM4_IRQHandler 192 | .word I2C1_EV_IRQHandler 193 | .word I2C1_ER_IRQHandler 194 | .word I2C2_EV_IRQHandler 195 | .word I2C2_ER_IRQHandler 196 | .word SPI1_IRQHandler 197 | .word SPI2_IRQHandler 198 | .word USART1_IRQHandler 199 | .word USART2_IRQHandler 200 | .word USART3_IRQHandler 201 | .word EXTI15_10_IRQHandler 202 | .word RTC_Alarm_IRQHandler 203 | .word USBWakeUp_IRQHandler 204 | .word 0 205 | .word 0 206 | .word 0 207 | .word 0 208 | .word 0 209 | .word 0 210 | .word 0 211 | .word BootRAM /* @0x108. This is for boot in RAM mode for 212 | STM32F10x Medium Density devices. */ 213 | 214 | /******************************************************************************* 215 | * 216 | * Provide weak aliases for each Exception handler to the Default_Handler. 217 | * As they are weak aliases, any function with the same name will override 218 | * this definition. 219 | * 220 | *******************************************************************************/ 221 | 222 | .weak NMI_Handler 223 | .thumb_set NMI_Handler,Default_Handler 224 | 225 | .weak HardFault_Handler 226 | .thumb_set HardFault_Handler,Default_Handler 227 | 228 | .weak MemManage_Handler 229 | .thumb_set MemManage_Handler,Default_Handler 230 | 231 | .weak BusFault_Handler 232 | .thumb_set BusFault_Handler,Default_Handler 233 | 234 | .weak UsageFault_Handler 235 | .thumb_set UsageFault_Handler,Default_Handler 236 | 237 | .weak SVC_Handler 238 | .thumb_set SVC_Handler,Default_Handler 239 | 240 | .weak DebugMon_Handler 241 | .thumb_set DebugMon_Handler,Default_Handler 242 | 243 | .weak PendSV_Handler 244 | .thumb_set PendSV_Handler,Default_Handler 245 | 246 | .weak SysTick_Handler 247 | .thumb_set SysTick_Handler,Default_Handler 248 | 249 | .weak WWDG_IRQHandler 250 | .thumb_set WWDG_IRQHandler,Default_Handler 251 | 252 | .weak PVD_IRQHandler 253 | .thumb_set PVD_IRQHandler,Default_Handler 254 | 255 | .weak TAMPER_IRQHandler 256 | .thumb_set TAMPER_IRQHandler,Default_Handler 257 | 258 | .weak RTC_IRQHandler 259 | .thumb_set RTC_IRQHandler,Default_Handler 260 | 261 | .weak FLASH_IRQHandler 262 | .thumb_set FLASH_IRQHandler,Default_Handler 263 | 264 | .weak RCC_IRQHandler 265 | .thumb_set RCC_IRQHandler,Default_Handler 266 | 267 | .weak EXTI0_IRQHandler 268 | .thumb_set EXTI0_IRQHandler,Default_Handler 269 | 270 | .weak EXTI1_IRQHandler 271 | .thumb_set EXTI1_IRQHandler,Default_Handler 272 | 273 | .weak EXTI2_IRQHandler 274 | .thumb_set EXTI2_IRQHandler,Default_Handler 275 | 276 | .weak EXTI3_IRQHandler 277 | .thumb_set EXTI3_IRQHandler,Default_Handler 278 | 279 | .weak EXTI4_IRQHandler 280 | .thumb_set EXTI4_IRQHandler,Default_Handler 281 | 282 | .weak DMA1_Channel1_IRQHandler 283 | .thumb_set DMA1_Channel1_IRQHandler,Default_Handler 284 | 285 | .weak DMA1_Channel2_IRQHandler 286 | .thumb_set DMA1_Channel2_IRQHandler,Default_Handler 287 | 288 | .weak DMA1_Channel3_IRQHandler 289 | .thumb_set DMA1_Channel3_IRQHandler,Default_Handler 290 | 291 | .weak DMA1_Channel4_IRQHandler 292 | .thumb_set DMA1_Channel4_IRQHandler,Default_Handler 293 | 294 | .weak DMA1_Channel5_IRQHandler 295 | .thumb_set DMA1_Channel5_IRQHandler,Default_Handler 296 | 297 | .weak DMA1_Channel6_IRQHandler 298 | .thumb_set DMA1_Channel6_IRQHandler,Default_Handler 299 | 300 | .weak DMA1_Channel7_IRQHandler 301 | .thumb_set DMA1_Channel7_IRQHandler,Default_Handler 302 | 303 | .weak ADC1_2_IRQHandler 304 | .thumb_set ADC1_2_IRQHandler,Default_Handler 305 | 306 | .weak USB_HP_CAN1_TX_IRQHandler 307 | .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler 308 | 309 | .weak USB_LP_CAN1_RX0_IRQHandler 310 | .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler 311 | 312 | .weak CAN1_RX1_IRQHandler 313 | .thumb_set CAN1_RX1_IRQHandler,Default_Handler 314 | 315 | .weak CAN1_SCE_IRQHandler 316 | .thumb_set CAN1_SCE_IRQHandler,Default_Handler 317 | 318 | .weak EXTI9_5_IRQHandler 319 | .thumb_set EXTI9_5_IRQHandler,Default_Handler 320 | 321 | .weak TIM1_BRK_IRQHandler 322 | .thumb_set TIM1_BRK_IRQHandler,Default_Handler 323 | 324 | .weak TIM1_UP_IRQHandler 325 | .thumb_set TIM1_UP_IRQHandler,Default_Handler 326 | 327 | .weak TIM1_TRG_COM_IRQHandler 328 | .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler 329 | 330 | .weak TIM1_CC_IRQHandler 331 | .thumb_set TIM1_CC_IRQHandler,Default_Handler 332 | 333 | .weak TIM2_IRQHandler 334 | .thumb_set TIM2_IRQHandler,Default_Handler 335 | 336 | .weak TIM3_IRQHandler 337 | .thumb_set TIM3_IRQHandler,Default_Handler 338 | 339 | .weak TIM4_IRQHandler 340 | .thumb_set TIM4_IRQHandler,Default_Handler 341 | 342 | .weak I2C1_EV_IRQHandler 343 | .thumb_set I2C1_EV_IRQHandler,Default_Handler 344 | 345 | .weak I2C1_ER_IRQHandler 346 | .thumb_set I2C1_ER_IRQHandler,Default_Handler 347 | 348 | .weak I2C2_EV_IRQHandler 349 | .thumb_set I2C2_EV_IRQHandler,Default_Handler 350 | 351 | .weak I2C2_ER_IRQHandler 352 | .thumb_set I2C2_ER_IRQHandler,Default_Handler 353 | 354 | .weak SPI1_IRQHandler 355 | .thumb_set SPI1_IRQHandler,Default_Handler 356 | 357 | .weak SPI2_IRQHandler 358 | .thumb_set SPI2_IRQHandler,Default_Handler 359 | 360 | .weak USART1_IRQHandler 361 | .thumb_set USART1_IRQHandler,Default_Handler 362 | 363 | .weak USART2_IRQHandler 364 | .thumb_set USART2_IRQHandler,Default_Handler 365 | 366 | .weak USART3_IRQHandler 367 | .thumb_set USART3_IRQHandler,Default_Handler 368 | 369 | .weak EXTI15_10_IRQHandler 370 | .thumb_set EXTI15_10_IRQHandler,Default_Handler 371 | 372 | .weak RTC_Alarm_IRQHandler 373 | .thumb_set RTC_Alarm_IRQHandler,Default_Handler 374 | 375 | .weak USBWakeUp_IRQHandler 376 | .thumb_set USBWakeUp_IRQHandler,Default_Handler 377 | 378 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 379 | 380 | --------------------------------------------------------------------------------