Browse Source

Работа с настройками

TelenkovDmitry 1 week ago
parent
commit
6c87e320da

+ 2 - 0
README.md

@@ -0,0 +1,2 @@
+### STM32G431CBU6 (48 pin, 128 KB ROM, 32 KB RAM)
+

+ 5 - 4
desk/libs/thirdparty/oled_ssd1327/OLED_SSD1327.c

@@ -140,13 +140,13 @@ void SSD1327_Init(void)
 	SSD1327_Command(SSD1327_DISPLAYOFF);  // Display Off
 
 	SSD1327_Command(SSD1327_SETMULTIPLEX);
-	SSD1327_Command(0x5F);
+	SSD1327_Command(0x7F);
 
 	SSD1327_Command(SSD1327_SETDISPLAYSTARTLINE);
 	SSD1327_Command(0x00);
 
 	SSD1327_Command(SSD1327_SETDISPLAYOFFSET);
-	SSD1327_Command(0x20);
+    SSD1327_Command(0x0);
 
 	SSD1327_Command(SSD1327_SEGREMAP);
 	SSD1327_Command(0x51);
@@ -179,7 +179,7 @@ void SSD1327_Init(void)
 
 	SSD1327_Command(SSD1327_SETROWADDRESS);
 	SSD1327_Command(0x00);
-	SSD1327_Command(0x5F);
+	SSD1327_Command(0x7F);
 
 	SSD1327_Command(SSD1327_NORMALDISPLAY);  // Set Normal Display
 
@@ -258,7 +258,8 @@ void SSD1327_Display(void)
 
 	SSD1327_Command(SSD1327_SETROWADDRESS);
 	SSD1327_Command(0x00);
-	SSD1327_Command(0x5F);
+	//SSD1327_Command(0x5F);
+    SSD1327_Command(0x7F);
 
 #ifdef SSD1327_I2C_CONTROL
 #ifdef SSD1327_I2C_DMA_ENABLE

+ 15 - 1
desk/libs/thirdparty/oled_ssd1327/OLED_SSD1327.h

@@ -35,7 +35,7 @@
 // Resolution
 //
 #define SSD1327_LCDWIDTH                  128
-#define SSD1327_LCDHEIGHT                 96
+#define SSD1327_LCDHEIGHT                 128 //96
 
 /*
  * 		Please set what functionality you want to use.
@@ -51,7 +51,21 @@
 //
 // Commands
 //
+/*
+ Эта трёхбайтовая команда определяет начальный и конечный адреса столбцов 
+в ОЗУ данных отображения. Эта
+команда также устанавливает указатель адреса столбца на начальный адрес столбца.
+ Этот указатель используется для определения
+текущего адреса столбца для чтения/записи в ОЗУ данных графического отображения. 
+ Если режим горизонтального увеличения адреса включён командой A0h, после 
+завершения чтения/записи данных одного столбца он автоматически увеличивается до
+адреса следующего столбца. Всякий раз, когда указатель адреса столбца завершает 
+доступ к адресу конечного столбца, он сбрасывается обратно на адрес начального 
+столбца, а адрес строки увеличивается до следующей строки.
+*/
 #define SSD1327_SETCOLUMNADDRESS	0x15
+
+
 #define SSD1327_SETROWADDRESS		0x75
 #define SSD1327_SETCONTRASTCURRENT 	0x81
 #define SSD1327_NOP					0x84

+ 115 - 0
desk/libs/thirdparty/oled_ssd1327/fonts/font_8x5.h

@@ -0,0 +1,115 @@
+/*
+ * font_8x5.h
+ *
+ *  The MIT License.
+ *  Created on: 25.05.2017
+ *      Author: Mateusz Salamon
+ *      www.msalamon.pl
+ *      mateusz@msalamon.pl
+ */
+
+#ifndef FONT_8X5_H_
+#define FONT_8X5_H_
+
+// Font definition
+const uint8_t font_8x5[] =
+{
+			8, 5, //height, width
+			0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x5F, 0x00, 0x00,
+			0x00, 0x07, 0x00, 0x07, 0x00,
+			0x14, 0x7F, 0x14, 0x7F, 0x14,
+			0x24, 0x2A, 0x7F, 0x2A, 0x12,
+			0x23, 0x13, 0x08, 0x64, 0x62,
+			0x36, 0x49, 0x56, 0x20, 0x50,
+			0x00, 0x08, 0x07, 0x03, 0x00,
+			0x00, 0x1C, 0x22, 0x41, 0x00,
+			0x00, 0x41, 0x22, 0x1C, 0x00,
+			0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
+			0x08, 0x08, 0x3E, 0x08, 0x08,
+			0x00, 0x80, 0x70, 0x30, 0x00,
+			0x08, 0x08, 0x08, 0x08, 0x08,
+			0x00, 0x00, 0x60, 0x60, 0x00,
+			0x20, 0x10, 0x08, 0x04, 0x02,
+			0x3E, 0x51, 0x49, 0x45, 0x3E,
+			0x00, 0x42, 0x7F, 0x40, 0x00,
+			0x72, 0x49, 0x49, 0x49, 0x46,
+			0x21, 0x41, 0x49, 0x4D, 0x33,
+			0x18, 0x14, 0x12, 0x7F, 0x10,
+			0x27, 0x45, 0x45, 0x45, 0x39,
+			0x3C, 0x4A, 0x49, 0x49, 0x31,
+			0x41, 0x21, 0x11, 0x09, 0x07,
+			0x36, 0x49, 0x49, 0x49, 0x36,
+			0x46, 0x49, 0x49, 0x29, 0x1E,
+			0x00, 0x00, 0x14, 0x00, 0x00,
+			0x00, 0x40, 0x34, 0x00, 0x00,
+			0x00, 0x08, 0x14, 0x22, 0x41,
+			0x14, 0x14, 0x14, 0x14, 0x14,
+			0x00, 0x41, 0x22, 0x14, 0x08,
+			0x02, 0x01, 0x59, 0x09, 0x06,
+			0x3E, 0x41, 0x5D, 0x59, 0x4E,
+			0x7C, 0x12, 0x11, 0x12, 0x7C,
+			0x7F, 0x49, 0x49, 0x49, 0x36,
+			0x3E, 0x41, 0x41, 0x41, 0x22,
+			0x7F, 0x41, 0x41, 0x41, 0x3E,
+			0x7F, 0x49, 0x49, 0x49, 0x41,
+			0x7F, 0x09, 0x09, 0x09, 0x01,
+			0x3E, 0x41, 0x41, 0x51, 0x73,
+			0x7F, 0x08, 0x08, 0x08, 0x7F,
+			0x00, 0x41, 0x7F, 0x41, 0x00,
+			0x20, 0x40, 0x41, 0x3F, 0x01,
+			0x7F, 0x08, 0x14, 0x22, 0x41,
+			0x7F, 0x40, 0x40, 0x40, 0x40,
+			0x7F, 0x02, 0x1C, 0x02, 0x7F,
+			0x7F, 0x04, 0x08, 0x10, 0x7F,
+			0x3E, 0x41, 0x41, 0x41, 0x3E,
+			0x7F, 0x09, 0x09, 0x09, 0x06,
+			0x3E, 0x41, 0x51, 0x21, 0x5E,
+			0x7F, 0x09, 0x19, 0x29, 0x46,
+			0x26, 0x49, 0x49, 0x49, 0x32,
+			0x03, 0x01, 0x7F, 0x01, 0x03,
+			0x3F, 0x40, 0x40, 0x40, 0x3F,
+			0x1F, 0x20, 0x40, 0x20, 0x1F,
+			0x3F, 0x40, 0x38, 0x40, 0x3F,
+			0x63, 0x14, 0x08, 0x14, 0x63,
+			0x03, 0x04, 0x78, 0x04, 0x03,
+			0x61, 0x59, 0x49, 0x4D, 0x43,
+			0x00, 0x7F, 0x41, 0x41, 0x41,
+			0x02, 0x04, 0x08, 0x10, 0x20,
+			0x00, 0x41, 0x41, 0x41, 0x7F,
+			0x04, 0x02, 0x01, 0x02, 0x04,
+			0x40, 0x40, 0x40, 0x40, 0x40,
+			0x00, 0x03, 0x07, 0x08, 0x00,
+			0x20, 0x54, 0x54, 0x78, 0x40,
+			0x7F, 0x28, 0x44, 0x44, 0x38,
+			0x38, 0x44, 0x44, 0x44, 0x28,
+			0x38, 0x44, 0x44, 0x28, 0x7F,
+			0x38, 0x54, 0x54, 0x54, 0x18,
+			0x00, 0x08, 0x7E, 0x09, 0x02,
+			0x18, 0xA4, 0xA4, 0x9C, 0x78,
+			0x7F, 0x08, 0x04, 0x04, 0x78,
+			0x00, 0x44, 0x7D, 0x40, 0x00,
+			0x20, 0x40, 0x40, 0x3D, 0x00,
+			0x7F, 0x10, 0x28, 0x44, 0x00,
+			0x00, 0x41, 0x7F, 0x40, 0x00,
+			0x7C, 0x04, 0x78, 0x04, 0x78,
+			0x7C, 0x08, 0x04, 0x04, 0x78,
+			0x38, 0x44, 0x44, 0x44, 0x38,
+			0xFC, 0x18, 0x24, 0x24, 0x18,
+			0x18, 0x24, 0x24, 0x18, 0xFC,
+			0x7C, 0x08, 0x04, 0x04, 0x08,
+			0x48, 0x54, 0x54, 0x54, 0x24,
+			0x04, 0x04, 0x3F, 0x44, 0x24,
+			0x3C, 0x40, 0x40, 0x20, 0x7C,
+			0x1C, 0x20, 0x40, 0x20, 0x1C,
+			0x3C, 0x40, 0x30, 0x40, 0x3C,
+			0x44, 0x28, 0x10, 0x28, 0x44,
+			0x4C, 0x90, 0x90, 0x90, 0x7C,
+			0x44, 0x64, 0x54, 0x4C, 0x44,
+			0x00, 0x08, 0x36, 0x41, 0x00,
+			0x00, 0x00, 0x77, 0x00, 0x00,
+			0x00, 0x41, 0x36, 0x08, 0x00,
+			0x02, 0x01, 0x02, 0x04, 0x02,
+};
+
+#endif /* FONT_8X5_H_ */

+ 26 - 0
desk/libs/thirdparty/oled_ssd1327/fonts/fonts.h

@@ -0,0 +1,26 @@
+/*
+ * fonts.h
+ *
+ *  The MIT License.
+ *  Created on: 25.05.2017
+ *      Author: Mateusz Salamon
+ *      www.msalamon.pl
+ *      mateusz@msalamon.pl
+ */
+
+#ifndef FONTS_FONTS_H_
+#define FONTS_FONTS_H_
+
+//
+//	Set fonts you want to use
+//
+#define FONT_8x5 1
+
+//
+//	Automatic includes
+//
+#if(FONT_8x5 ==1)
+#include "font_8x5.h"
+#endif
+
+#endif /* FONTS_FONTS_H_ */

+ 20 - 0
desk/modules/configs/config.h

@@ -0,0 +1,20 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include "stm32g4xx_hal.h"
+
+
+#define FW_VERSION          "1.0"
+
+#define SETTINGS_ADDR       0x08000000 + (63 * 2048)  //0x01F7FF
+
+#define CRC_ADDRESS         0x01FFFC  
+
+#define FLASH_ROW_SIZE          32
+
+/* @note All the executable code is mapped in SRAM1 area */
+#define FLASH_USER_START_ADDR   ADDR_FLASH_PAGE_0   /* Start @ of user Flash area */
+#define FLASH_USER_END_ADDR     (ADDR_FLASH_PAGE_63 + FLASH_PAGE_SIZE - 1)   /* End @ of user Flash area */
+
+
+#endif /* #ifndef __CONFIG_H */

+ 151 - 0
desk/modules/settings/settings.cpp

@@ -0,0 +1,151 @@
+#include "settings.h"
+#include "cmsis_os.h"
+#include "config.h"
+#include <string.h>
+
+
+CRC_HandleTypeDef hcrc;
+
+
+//volatile FLASH_Status FLASHStatus = FLASH_COMPLETE;
+
+settings_t settings;
+
+static FLASH_EraseInitTypeDef EraseInitStruct;
+
+
+//
+void settings_crc_init(void)
+{
+    hcrc.Instance = CRC;
+    hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE;
+    hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE;
+    hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;
+    hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;
+    hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_WORDS;
+    HAL_CRC_Init(&hcrc);
+}
+
+
+//
+void HAL_CRC_MspInit(CRC_HandleTypeDef* hcrc)
+{
+    if(hcrc->Instance==CRC)
+    {
+        __HAL_RCC_CRC_CLK_ENABLE();
+    }
+}
+
+
+//
+void HAL_CRC_MspDeInit(CRC_HandleTypeDef* hcrc)
+{
+    if(hcrc->Instance==CRC)
+    {
+        __HAL_RCC_CRC_CLK_DISABLE();
+    }
+}
+
+
+//
+void settings_load(void)
+{
+    uint32_t load_crc;  // CRC из flash
+    uint32_t new_crc;   // CRC загруженной структуры настроек
+    
+    settings_read_from_flash((uint8_t*)&settings, sizeof(settings));
+
+    // Считываем CRC из флеш памяти
+    load_crc = (*(uint32_t*)CRC_ADDRESS);
+
+    // Рассчитываем CRC для структуры настроек
+    new_crc = settings_get_crc();
+    
+    // Если CRC не совпадают нужно прошивать дефолтные настройки
+    if (load_crc != new_crc) {
+        settings_set_def();
+        settings_save();
+    }
+}
+
+
+//
+void settings_save(void)
+{
+    uint32_t baseAddress = SETTINGS_ADDR;
+    uint32_t crc;
+    uint32_t size = sizeof(settings) / 4;
+    uint32_t *data = (uint32_t*)&settings;
+    
+    HAL_FLASH_Unlock();
+    
+    __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
+    
+    EraseInitStruct.TypeErase = FLASH_TYPEERASE_MASSERASE;
+    EraseInitStruct.Banks     = FLASH_BANK_1;
+    //HAL_FLASHEx_Erase(&EraseInitStruct, &PAGEError)
+    
+    FLASH_PageErase(SETTINGS_ADDR, FLASH_BANK_1);
+    
+    HAL_FLASH_Lock();
+    
+#if 0    
+    vPortEnterCritical();
+    
+    FLASH_Unlock();
+    
+    FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
+    
+    FLASHStatus = FLASH_ErasePage(SETTINGS_ADDR);
+        
+    //crc = settings_get_crc();
+    
+    FLASH_ProgramWord(CRC_ADDRESS, crc);
+    
+    for (uint32_t i = 0; i < size; i++) {
+        FLASH_ProgramWord(baseAddress, *data++);
+        baseAddress += 4;
+    }
+          
+    FLASH_Lock();
+    
+    vPortExitCritical();
+#endif    
+}
+
+
+//
+void settings_set_def(void)
+{
+    memset(settings.fw_version, 0, 20);
+    strcpy(settings.fw_version, FW_VERSION);
+    
+    settings.motor_speed = 50;
+    settings.support_speed = 60;
+    settings.temperature_threshold = 70;
+}
+
+
+//
+uint32_t settings_get_crc(void)
+{
+    //CRC_ResetDR();
+    return HAL_CRC_Calculate(&hcrc, (uint32_t*)&settings, sizeof(settings));
+    //return CRC_CalcBlockCRC((uint32_t*)&settings, sizeof(settings));
+}
+
+
+//
+void settings_read_from_flash(uint8_t *data, uint32_t size)
+{
+    uint32_t baseAddress = SETTINGS_ADDR;
+        
+    for (uint32_t i = 0; i < size; i++)
+        *data++ = (*(uint32_t*)baseAddress++);    
+}
+
+
+//
+void settings_test(void)
+{   
+}

+ 47 - 0
desk/modules/settings/settings.h

@@ -0,0 +1,47 @@
+#ifndef __SETTINGS_H
+#define __SETTINGS_H
+   
+#include "stm32g4xx_hal.h"
+
+
+
+// общая структура настроек
+//#pragma pack(push, 4)
+typedef struct
+{
+    char fw_version[20];
+    uint32_t motor_speed;
+    uint32_t support_speed;
+    uint32_t temperature_threshold;
+      
+} settings_t;
+//#pragma pack(pop)    
+
+
+//
+void settings_crc_init(void);
+
+//
+void settings_load(void);
+
+//
+void settings_save(void);
+
+//
+void settings_set_def(void);
+
+//
+uint32_t settings_get_crc(void);
+
+//
+void settings_read_from_flash(uint8_t *data, uint32_t size);
+
+//
+void settings_test(void);
+
+
+extern settings_t settings;
+
+
+#endif /* #ifndef __SETTINGS_H */
+

+ 29 - 0
desk/modules/ssd_1327/oled_common.cpp

@@ -2,6 +2,7 @@
 #include "oled_common.h"
 #include "i2c_bridge.h"
 #include "logo_grayscale.h"
+#include "fonts.h"
 
 extern "C" {
 #include "OLED_SSD1327.h"
@@ -49,6 +50,34 @@ void test_oled(void)
     
     SSD1327_DrawPixel(40, 20, 5);
     
+    //void GFX_DrawLine(int x_start, int y_start, int x_end, int y_end, uint8_t color);
+    // Верхняя 
+    GFX_DrawLine(0, 0, 127, 0, 15);
+    
+    // Левая
+    GFX_DrawLine(0, 0, 0, 127, 15);
+    
+    // Правая
+    GFX_DrawLine(127, 0, 127, 127, 15);
+    
+    // Нижняя 
+    GFX_DrawLine(0, 127, 127, 127, 15);
+    
+    GFX_SetFont(font_8x5);
+    GFX_SetFontSize(2);
+    
+    GFX_DrawChar(50, 50, 'F', 15, 0);
+    GFX_DrawString(10, 100, "Hellow world", 15, 0);
+    
+    
+#if 0    
+    uint8_t GFX_GetFontHeight(void);
+    uint8_t GFX_GetFontWidth(void);
+    uint8_t  GFX_GetFontSize(void);
+    void GFX_DrawChar(int x, int y, char chr, uint8_t color, uint8_t background);
+    void GFX_DrawString(int x, int y, char* str, uint8_t color, uint8_t background);
+#endif    
+
     SSD1327_Display();
     
 }

+ 5 - 1
desk/user/main.cpp

@@ -5,7 +5,7 @@
 #include "terminal_usartbridge.h"
 #include "control.h"
 #include "oled_common.h"
-
+#include "settings.h"
 #include <stdio.h>
 
 void SystemClock_Config(void);
@@ -51,6 +51,10 @@ void StartupTask(void const *argument)
     // USART терминал
     terminalUsartBridge.configure();
     
+    // Настройки
+    settings_crc_init();
+    settings_load();
+    
     //
     init_encoder();
     

+ 380 - 380
desk/user/stm32g4xx_hal_conf.h

@@ -1,380 +1,380 @@
-/* USER CODE BEGIN Header */
-/**
-  ******************************************************************************
-  * @file    stm32g4xx_hal_conf.h
-  * @author  MCD Application Team
-  * @brief   HAL configuration file
-  ******************************************************************************
- * @attention
-  *
-  * Copyright (c) 2019 STMicroelectronics.
-  * All rights reserved.
-  *
-  * This software is licensed under terms that can be found in the LICENSE file
-  * in the root directory of this software component.
-  * If no LICENSE file comes with this software, it is provided AS-IS.
-  *
-  ******************************************************************************
-  */
-/* USER CODE END Header */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef STM32G4xx_HAL_CONF_H
-#define STM32G4xx_HAL_CONF_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* ########################## Module Selection ############################## */
-/**
-  * @brief This is the list of modules to be used in the HAL driver
-  */
-
-#define HAL_MODULE_ENABLED
-
-  /*#define HAL_ADC_MODULE_ENABLED   */
-/*#define HAL_COMP_MODULE_ENABLED   */
-/*#define HAL_CORDIC_MODULE_ENABLED   */
-/*#define HAL_CRC_MODULE_ENABLED   */
-/*#define HAL_CRYP_MODULE_ENABLED   */
-/*#define HAL_DAC_MODULE_ENABLED   */
-/*#define HAL_FDCAN_MODULE_ENABLED   */
-/*#define HAL_FMAC_MODULE_ENABLED   */
-/*#define HAL_HRTIM_MODULE_ENABLED   */
-/*#define HAL_IRDA_MODULE_ENABLED   */
-/*#define HAL_IWDG_MODULE_ENABLED   */
-#define HAL_I2C_MODULE_ENABLED
-/*#define HAL_I2S_MODULE_ENABLED   */
-/*#define HAL_LPTIM_MODULE_ENABLED   */
-/*#define HAL_NAND_MODULE_ENABLED   */
-/*#define HAL_NOR_MODULE_ENABLED   */
-/*#define HAL_OPAMP_MODULE_ENABLED   */
-//#define HAL_PCD_MODULE_ENABLED
-/*#define HAL_QSPI_MODULE_ENABLED   */
-/*#define HAL_RNG_MODULE_ENABLED   */
-#define HAL_RTC_MODULE_ENABLED
-/*#define HAL_SAI_MODULE_ENABLED   */
-/*#define HAL_SMARTCARD_MODULE_ENABLED   */
-/*#define HAL_SMBUS_MODULE_ENABLED   */
-/*#define HAL_SPI_MODULE_ENABLED   */
-/*#define HAL_SRAM_MODULE_ENABLED   */
-#define HAL_TIM_MODULE_ENABLED   
-#define HAL_UART_MODULE_ENABLED
-#define HAL_USART_MODULE_ENABLED 
-/*#define HAL_WWDG_MODULE_ENABLED   */
-#define HAL_GPIO_MODULE_ENABLED
-#define HAL_EXTI_MODULE_ENABLED
-#define HAL_DMA_MODULE_ENABLED
-#define HAL_RCC_MODULE_ENABLED
-#define HAL_FLASH_MODULE_ENABLED
-#define HAL_PWR_MODULE_ENABLED
-#define HAL_CORTEX_MODULE_ENABLED
-
-/* ########################## Register Callbacks selection ############################## */
-/**
-  * @brief This is the list of modules where register callback can be used
-  */
-#define USE_HAL_ADC_REGISTER_CALLBACKS        0U
-#define USE_HAL_COMP_REGISTER_CALLBACKS       0U
-#define USE_HAL_CORDIC_REGISTER_CALLBACKS     0U
-#define USE_HAL_CRYP_REGISTER_CALLBACKS       0U
-#define USE_HAL_DAC_REGISTER_CALLBACKS        0U
-#define USE_HAL_EXTI_REGISTER_CALLBACKS       0U
-#define USE_HAL_FDCAN_REGISTER_CALLBACKS      0U
-#define USE_HAL_FMAC_REGISTER_CALLBACKS       0U
-#define USE_HAL_HRTIM_REGISTER_CALLBACKS      0U
-#define USE_HAL_I2C_REGISTER_CALLBACKS        0U
-#define USE_HAL_I2S_REGISTER_CALLBACKS        0U
-#define USE_HAL_IRDA_REGISTER_CALLBACKS       0U
-#define USE_HAL_LPTIM_REGISTER_CALLBACKS      0U
-#define USE_HAL_NAND_REGISTER_CALLBACKS       0U
-#define USE_HAL_NOR_REGISTER_CALLBACKS        0U
-#define USE_HAL_OPAMP_REGISTER_CALLBACKS      0U
-#define USE_HAL_PCD_REGISTER_CALLBACKS        0U
-#define USE_HAL_QSPI_REGISTER_CALLBACKS       0U
-#define USE_HAL_RNG_REGISTER_CALLBACKS        0U
-#define USE_HAL_RTC_REGISTER_CALLBACKS        0U
-#define USE_HAL_SAI_REGISTER_CALLBACKS        0U
-#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS  0U
-#define USE_HAL_SMBUS_REGISTER_CALLBACKS      0U
-#define USE_HAL_SPI_REGISTER_CALLBACKS        0U
-#define USE_HAL_SRAM_REGISTER_CALLBACKS       0U
-#define USE_HAL_TIM_REGISTER_CALLBACKS        0U
-#define USE_HAL_UART_REGISTER_CALLBACKS       0U
-#define USE_HAL_USART_REGISTER_CALLBACKS      0U
-#define USE_HAL_WWDG_REGISTER_CALLBACKS       0U
-
-/* ########################## Oscillator Values adaptation ####################*/
-/**
-  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
-  *        This value is used by the RCC HAL module to compute the system frequency
-  *        (when HSE is used as system clock source, directly or through the PLL).
-  */
-#if !defined  (HSE_VALUE)
-  #define HSE_VALUE    (8000000UL) /*!< Value of the External oscillator in Hz */
-#endif /* HSE_VALUE */
-
-#if !defined  (HSE_STARTUP_TIMEOUT)
-  #define HSE_STARTUP_TIMEOUT    (100UL)   /*!< Time out for HSE start up, in ms */
-#endif /* HSE_STARTUP_TIMEOUT */
-
-/**
-  * @brief Internal High Speed oscillator (HSI) value.
-  *        This value is used by the RCC HAL module to compute the system frequency
-  *        (when HSI is used as system clock source, directly or through the PLL).
-  */
-#if !defined  (HSI_VALUE)
-  #define HSI_VALUE    (16000000UL) /*!< Value of the Internal oscillator in Hz*/
-#endif /* HSI_VALUE */
-
-/**
-  * @brief Internal High Speed oscillator (HSI48) value for USB FS and RNG.
-  *        This internal oscillator is mainly dedicated to provide a high precision clock to
-  *        the USB peripheral by means of a special Clock Recovery System (CRS) circuitry.
-  *        When the CRS is not used, the HSI48 RC oscillator runs on it default frequency
-  *        which is subject to manufacturing process variations.
-  */
-#if !defined  (HSI48_VALUE)
-  #define HSI48_VALUE   (48000000UL) /*!< Value of the Internal High Speed oscillator for USB FS/RNG in Hz.
-                                               The real value my vary depending on manufacturing process variations.*/
-#endif /* HSI48_VALUE */
-
-/**
-  * @brief Internal Low Speed oscillator (LSI) value.
-  */
-#if !defined  (LSI_VALUE)
-/*!< Value of the Internal Low Speed oscillator in Hz
-The real value may vary depending on the variations in voltage and temperature.*/
-#define LSI_VALUE  (32000UL)     /*!< LSI Typical Value in Hz*/
-#endif /* LSI_VALUE */
-/**
-  * @brief External Low Speed oscillator (LSE) value.
-  *        This value is used by the UART, RTC HAL module to compute the system frequency
-  */
-#if !defined  (LSE_VALUE)
-#define LSE_VALUE  (32768UL)    /*!< Value of the External Low Speed oscillator in Hz */
-#endif /* LSE_VALUE */
-
-#if !defined  (LSE_STARTUP_TIMEOUT)
-#define LSE_STARTUP_TIMEOUT    (5000UL)   /*!< Time out for LSE start up, in ms */
-#endif /* LSE_STARTUP_TIMEOUT */
-
-/**
-  * @brief External clock source for I2S and SAI peripherals
-  *        This value is used by the I2S and SAI HAL modules to compute the I2S and SAI clock source
-  *        frequency, this source is inserted directly through I2S_CKIN pad.
-  */
-#if !defined  (EXTERNAL_CLOCK_VALUE)
-#define EXTERNAL_CLOCK_VALUE    (12288000UL) /*!< Value of the External oscillator in Hz*/
-#endif /* EXTERNAL_CLOCK_VALUE */
-
-/* Tip: To avoid modifying this file each time you need to use different HSE,
-   ===  you can define the HSE value in your toolchain compiler preprocessor. */
-
-/* ########################### System Configuration ######################### */
-/**
-  * @brief This is the HAL system configuration section
-  */
-
-#define  VDD_VALUE                   (3300UL) /*!< Value of VDD in mv */
-#define  TICK_INT_PRIORITY           (15UL)    /*!< tick interrupt priority (lowest by default)  */
-#define  USE_RTOS                     0U
-#define  PREFETCH_ENABLE              0U
-#define  INSTRUCTION_CACHE_ENABLE     1U
-#define  DATA_CACHE_ENABLE            1U
-
-/* ########################## Assert Selection ############################## */
-/**
-  * @brief Uncomment the line below to expanse the "assert_param" macro in the
-  *        HAL drivers code
-  */
-/* #define USE_FULL_ASSERT    1U */
-
-/* ################## SPI peripheral configuration ########################## */
-
-/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
- * Activated: CRC code is present inside driver
- * Deactivated: CRC code cleaned from driver
- */
-
-#define USE_SPI_CRC                   0U
-
-/* Includes ------------------------------------------------------------------*/
-/**
-  * @brief Include module's header file
-  */
-
-#ifdef HAL_RCC_MODULE_ENABLED
-#include "stm32g4xx_hal_rcc.h"
-#endif /* HAL_RCC_MODULE_ENABLED */
-
-#ifdef HAL_GPIO_MODULE_ENABLED
-#include "stm32g4xx_hal_gpio.h"
-#endif /* HAL_GPIO_MODULE_ENABLED */
-
-#ifdef HAL_DMA_MODULE_ENABLED
-#include "stm32g4xx_hal_dma.h"
-#endif /* HAL_DMA_MODULE_ENABLED */
-
-#ifdef HAL_CORTEX_MODULE_ENABLED
-#include "stm32g4xx_hal_cortex.h"
-#endif /* HAL_CORTEX_MODULE_ENABLED */
-
-#ifdef HAL_ADC_MODULE_ENABLED
-#include "stm32g4xx_hal_adc.h"
-#endif /* HAL_ADC_MODULE_ENABLED */
-
-#ifdef HAL_COMP_MODULE_ENABLED
-#include "stm32g4xx_hal_comp.h"
-#endif /* HAL_COMP_MODULE_ENABLED */
-
-#ifdef HAL_CORDIC_MODULE_ENABLED
-#include "stm32g4xx_hal_cordic.h"
-#endif /* HAL_CORDIC_MODULE_ENABLED */
-
-#ifdef HAL_CRC_MODULE_ENABLED
-#include "stm32g4xx_hal_crc.h"
-#endif /* HAL_CRC_MODULE_ENABLED */
-
-#ifdef HAL_CRYP_MODULE_ENABLED
-#include "stm32g4xx_hal_cryp.h"
-#endif /* HAL_CRYP_MODULE_ENABLED */
-
-#ifdef HAL_DAC_MODULE_ENABLED
-#include "stm32g4xx_hal_dac.h"
-#endif /* HAL_DAC_MODULE_ENABLED */
-
-#ifdef HAL_EXTI_MODULE_ENABLED
-#include "stm32g4xx_hal_exti.h"
-#endif /* HAL_EXTI_MODULE_ENABLED */
-
-#ifdef HAL_FDCAN_MODULE_ENABLED
-#include "stm32g4xx_hal_fdcan.h"
-#endif /* HAL_FDCAN_MODULE_ENABLED */
-
-#ifdef HAL_FLASH_MODULE_ENABLED
-#include "stm32g4xx_hal_flash.h"
-#endif /* HAL_FLASH_MODULE_ENABLED */
-
-#ifdef HAL_FMAC_MODULE_ENABLED
-#include "stm32g4xx_hal_fmac.h"
-#endif /* HAL_FMAC_MODULE_ENABLED */
-
-#ifdef HAL_HRTIM_MODULE_ENABLED
-#include "stm32g4xx_hal_hrtim.h"
-#endif /* HAL_HRTIM_MODULE_ENABLED */
-
-#ifdef HAL_IRDA_MODULE_ENABLED
-#include "stm32g4xx_hal_irda.h"
-#endif /* HAL_IRDA_MODULE_ENABLED */
-
-#ifdef HAL_IWDG_MODULE_ENABLED
-#include "stm32g4xx_hal_iwdg.h"
-#endif /* HAL_IWDG_MODULE_ENABLED */
-
-#ifdef HAL_I2C_MODULE_ENABLED
-#include "stm32g4xx_hal_i2c.h"
-#endif /* HAL_I2C_MODULE_ENABLED */
-
-#ifdef HAL_I2S_MODULE_ENABLED
-#include "stm32g4xx_hal_i2s.h"
-#endif /* HAL_I2S_MODULE_ENABLED */
-
-#ifdef HAL_LPTIM_MODULE_ENABLED
-#include "stm32g4xx_hal_lptim.h"
-#endif /* HAL_LPTIM_MODULE_ENABLED */
-
-#ifdef HAL_NAND_MODULE_ENABLED
-#include "stm32g4xx_hal_nand.h"
-#endif /* HAL_NAND_MODULE_ENABLED */
-
-#ifdef HAL_NOR_MODULE_ENABLED
-#include "stm32g4xx_hal_nor.h"
-#endif /* HAL_NOR_MODULE_ENABLED */
-
-#ifdef HAL_OPAMP_MODULE_ENABLED
-#include "stm32g4xx_hal_opamp.h"
-#endif /* HAL_OPAMP_MODULE_ENABLED */
-
-#ifdef HAL_PCD_MODULE_ENABLED
-#include "stm32g4xx_hal_pcd.h"
-#endif /* HAL_PCD_MODULE_ENABLED */
-
-#ifdef HAL_PWR_MODULE_ENABLED
-#include "stm32g4xx_hal_pwr.h"
-#endif /* HAL_PWR_MODULE_ENABLED */
-
-#ifdef HAL_QSPI_MODULE_ENABLED
-#include "stm32g4xx_hal_qspi.h"
-#endif /* HAL_QSPI_MODULE_ENABLED */
-
-#ifdef HAL_RNG_MODULE_ENABLED
-#include "stm32g4xx_hal_rng.h"
-#endif /* HAL_RNG_MODULE_ENABLED */
-
-#ifdef HAL_RTC_MODULE_ENABLED
-#include "stm32g4xx_hal_rtc.h"
-#endif /* HAL_RTC_MODULE_ENABLED */
-
-#ifdef HAL_SAI_MODULE_ENABLED
-#include "stm32g4xx_hal_sai.h"
-#endif /* HAL_SAI_MODULE_ENABLED */
-
-#ifdef HAL_SMARTCARD_MODULE_ENABLED
-#include "stm32g4xx_hal_smartcard.h"
-#endif /* HAL_SMARTCARD_MODULE_ENABLED */
-
-#ifdef HAL_SMBUS_MODULE_ENABLED
-#include "stm32g4xx_hal_smbus.h"
-#endif /* HAL_SMBUS_MODULE_ENABLED */
-
-#ifdef HAL_SPI_MODULE_ENABLED
-#include "stm32g4xx_hal_spi.h"
-#endif /* HAL_SPI_MODULE_ENABLED */
-
-#ifdef HAL_SRAM_MODULE_ENABLED
-#include "stm32g4xx_hal_sram.h"
-#endif /* HAL_SRAM_MODULE_ENABLED */
-
-#ifdef HAL_TIM_MODULE_ENABLED
-#include "stm32g4xx_hal_tim.h"
-#endif /* HAL_TIM_MODULE_ENABLED */
-
-#ifdef HAL_UART_MODULE_ENABLED
-#include "stm32g4xx_hal_uart.h"
-#endif /* HAL_UART_MODULE_ENABLED */
-
-#ifdef HAL_USART_MODULE_ENABLED
-#include "stm32g4xx_hal_usart.h"
-#endif /* HAL_USART_MODULE_ENABLED */
-
-#ifdef HAL_WWDG_MODULE_ENABLED
-#include "stm32g4xx_hal_wwdg.h"
-#endif /* HAL_WWDG_MODULE_ENABLED */
-
-/* Exported macro ------------------------------------------------------------*/
-#ifdef  USE_FULL_ASSERT
-/**
-  * @brief  The assert_param macro is used for function's parameters check.
-  * @param  expr: If expr is false, it calls assert_failed function
-  *         which reports the name of the source file and the source
-  *         line number of the call that failed.
-  *         If expr is true, it returns no value.
-  * @retval None
-  */
-#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
-/* Exported functions ------------------------------------------------------- */
-void assert_failed(uint8_t *file, uint32_t line);
-#else
-#define assert_param(expr) ((void)0U)
-#endif /* USE_FULL_ASSERT */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* STM32G4xx_HAL_CONF_H */
+/* USER CODE BEGIN Header */
+/**
+  ******************************************************************************
+  * @file    stm32g4xx_hal_conf.h
+  * @author  MCD Application Team
+  * @brief   HAL configuration file
+  ******************************************************************************
+ * @attention
+  *
+  * Copyright (c) 2019 STMicroelectronics.
+  * All rights reserved.
+  *
+  * This software is licensed under terms that can be found in the LICENSE file
+  * in the root directory of this software component.
+  * If no LICENSE file comes with this software, it is provided AS-IS.
+  *
+  ******************************************************************************
+  */
+/* USER CODE END Header */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef STM32G4xx_HAL_CONF_H
+#define STM32G4xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+  * @brief This is the list of modules to be used in the HAL driver
+  */
+
+#define HAL_MODULE_ENABLED
+
+  /*#define HAL_ADC_MODULE_ENABLED   */
+/*#define HAL_COMP_MODULE_ENABLED   */
+/*#define HAL_CORDIC_MODULE_ENABLED   */
+#define HAL_CRC_MODULE_ENABLED
+/*#define HAL_CRYP_MODULE_ENABLED   */
+/*#define HAL_DAC_MODULE_ENABLED   */
+/*#define HAL_FDCAN_MODULE_ENABLED   */
+/*#define HAL_FMAC_MODULE_ENABLED   */
+/*#define HAL_HRTIM_MODULE_ENABLED   */
+/*#define HAL_IRDA_MODULE_ENABLED   */
+/*#define HAL_IWDG_MODULE_ENABLED   */
+#define HAL_I2C_MODULE_ENABLED
+/*#define HAL_I2S_MODULE_ENABLED   */
+/*#define HAL_LPTIM_MODULE_ENABLED   */
+/*#define HAL_NAND_MODULE_ENABLED   */
+/*#define HAL_NOR_MODULE_ENABLED   */
+/*#define HAL_OPAMP_MODULE_ENABLED   */
+//#define HAL_PCD_MODULE_ENABLED
+/*#define HAL_QSPI_MODULE_ENABLED   */
+/*#define HAL_RNG_MODULE_ENABLED   */
+#define HAL_RTC_MODULE_ENABLED
+/*#define HAL_SAI_MODULE_ENABLED   */
+/*#define HAL_SMARTCARD_MODULE_ENABLED   */
+/*#define HAL_SMBUS_MODULE_ENABLED   */
+/*#define HAL_SPI_MODULE_ENABLED   */
+/*#define HAL_SRAM_MODULE_ENABLED   */
+#define HAL_TIM_MODULE_ENABLED   
+#define HAL_UART_MODULE_ENABLED
+#define HAL_USART_MODULE_ENABLED 
+/*#define HAL_WWDG_MODULE_ENABLED   */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+
+/* ########################## Register Callbacks selection ############################## */
+/**
+  * @brief This is the list of modules where register callback can be used
+  */
+#define USE_HAL_ADC_REGISTER_CALLBACKS        0U
+#define USE_HAL_COMP_REGISTER_CALLBACKS       0U
+#define USE_HAL_CORDIC_REGISTER_CALLBACKS     0U
+#define USE_HAL_CRYP_REGISTER_CALLBACKS       0U
+#define USE_HAL_DAC_REGISTER_CALLBACKS        0U
+#define USE_HAL_EXTI_REGISTER_CALLBACKS       0U
+#define USE_HAL_FDCAN_REGISTER_CALLBACKS      0U
+#define USE_HAL_FMAC_REGISTER_CALLBACKS       0U
+#define USE_HAL_HRTIM_REGISTER_CALLBACKS      0U
+#define USE_HAL_I2C_REGISTER_CALLBACKS        0U
+#define USE_HAL_I2S_REGISTER_CALLBACKS        0U
+#define USE_HAL_IRDA_REGISTER_CALLBACKS       0U
+#define USE_HAL_LPTIM_REGISTER_CALLBACKS      0U
+#define USE_HAL_NAND_REGISTER_CALLBACKS       0U
+#define USE_HAL_NOR_REGISTER_CALLBACKS        0U
+#define USE_HAL_OPAMP_REGISTER_CALLBACKS      0U
+#define USE_HAL_PCD_REGISTER_CALLBACKS        0U
+#define USE_HAL_QSPI_REGISTER_CALLBACKS       0U
+#define USE_HAL_RNG_REGISTER_CALLBACKS        0U
+#define USE_HAL_RTC_REGISTER_CALLBACKS        0U
+#define USE_HAL_SAI_REGISTER_CALLBACKS        0U
+#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS  0U
+#define USE_HAL_SMBUS_REGISTER_CALLBACKS      0U
+#define USE_HAL_SPI_REGISTER_CALLBACKS        0U
+#define USE_HAL_SRAM_REGISTER_CALLBACKS       0U
+#define USE_HAL_TIM_REGISTER_CALLBACKS        0U
+#define USE_HAL_UART_REGISTER_CALLBACKS       0U
+#define USE_HAL_USART_REGISTER_CALLBACKS      0U
+#define USE_HAL_WWDG_REGISTER_CALLBACKS       0U
+
+/* ########################## Oscillator Values adaptation ####################*/
+/**
+  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+  *        This value is used by the RCC HAL module to compute the system frequency
+  *        (when HSE is used as system clock source, directly or through the PLL).
+  */
+#if !defined  (HSE_VALUE)
+  #define HSE_VALUE    (8000000UL) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined  (HSE_STARTUP_TIMEOUT)
+  #define HSE_STARTUP_TIMEOUT    (100UL)   /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+  * @brief Internal High Speed oscillator (HSI) value.
+  *        This value is used by the RCC HAL module to compute the system frequency
+  *        (when HSI is used as system clock source, directly or through the PLL).
+  */
+#if !defined  (HSI_VALUE)
+  #define HSI_VALUE    (16000000UL) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+  * @brief Internal High Speed oscillator (HSI48) value for USB FS and RNG.
+  *        This internal oscillator is mainly dedicated to provide a high precision clock to
+  *        the USB peripheral by means of a special Clock Recovery System (CRS) circuitry.
+  *        When the CRS is not used, the HSI48 RC oscillator runs on it default frequency
+  *        which is subject to manufacturing process variations.
+  */
+#if !defined  (HSI48_VALUE)
+  #define HSI48_VALUE   (48000000UL) /*!< Value of the Internal High Speed oscillator for USB FS/RNG in Hz.
+                                               The real value my vary depending on manufacturing process variations.*/
+#endif /* HSI48_VALUE */
+
+/**
+  * @brief Internal Low Speed oscillator (LSI) value.
+  */
+#if !defined  (LSI_VALUE)
+/*!< Value of the Internal Low Speed oscillator in Hz
+The real value may vary depending on the variations in voltage and temperature.*/
+#define LSI_VALUE  (32000UL)     /*!< LSI Typical Value in Hz*/
+#endif /* LSI_VALUE */
+/**
+  * @brief External Low Speed oscillator (LSE) value.
+  *        This value is used by the UART, RTC HAL module to compute the system frequency
+  */
+#if !defined  (LSE_VALUE)
+#define LSE_VALUE  (32768UL)    /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined  (LSE_STARTUP_TIMEOUT)
+#define LSE_STARTUP_TIMEOUT    (5000UL)   /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+/**
+  * @brief External clock source for I2S and SAI peripherals
+  *        This value is used by the I2S and SAI HAL modules to compute the I2S and SAI clock source
+  *        frequency, this source is inserted directly through I2S_CKIN pad.
+  */
+#if !defined  (EXTERNAL_CLOCK_VALUE)
+#define EXTERNAL_CLOCK_VALUE    (12288000UL) /*!< Value of the External oscillator in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+   ===  you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+  * @brief This is the HAL system configuration section
+  */
+
+#define  VDD_VALUE                   (3300UL) /*!< Value of VDD in mv */
+#define  TICK_INT_PRIORITY           (15UL)    /*!< tick interrupt priority (lowest by default)  */
+#define  USE_RTOS                     0U
+#define  PREFETCH_ENABLE              0U
+#define  INSTRUCTION_CACHE_ENABLE     1U
+#define  DATA_CACHE_ENABLE            1U
+
+/* ########################## Assert Selection ############################## */
+/**
+  * @brief Uncomment the line below to expanse the "assert_param" macro in the
+  *        HAL drivers code
+  */
+/* #define USE_FULL_ASSERT    1U */
+
+/* ################## SPI peripheral configuration ########################## */
+
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
+ * Activated: CRC code is present inside driver
+ * Deactivated: CRC code cleaned from driver
+ */
+
+#define USE_SPI_CRC                   0U
+
+/* Includes ------------------------------------------------------------------*/
+/**
+  * @brief Include module's header file
+  */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+#include "stm32g4xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+#include "stm32g4xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+#include "stm32g4xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+#include "stm32g4xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+#include "stm32g4xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_COMP_MODULE_ENABLED
+#include "stm32g4xx_hal_comp.h"
+#endif /* HAL_COMP_MODULE_ENABLED */
+
+#ifdef HAL_CORDIC_MODULE_ENABLED
+#include "stm32g4xx_hal_cordic.h"
+#endif /* HAL_CORDIC_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+#include "stm32g4xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+#include "stm32g4xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+#include "stm32g4xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+#include "stm32g4xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_FDCAN_MODULE_ENABLED
+#include "stm32g4xx_hal_fdcan.h"
+#endif /* HAL_FDCAN_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+#include "stm32g4xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_FMAC_MODULE_ENABLED
+#include "stm32g4xx_hal_fmac.h"
+#endif /* HAL_FMAC_MODULE_ENABLED */
+
+#ifdef HAL_HRTIM_MODULE_ENABLED
+#include "stm32g4xx_hal_hrtim.h"
+#endif /* HAL_HRTIM_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+#include "stm32g4xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+#include "stm32g4xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+#include "stm32g4xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+#include "stm32g4xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+#include "stm32g4xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+#include "stm32g4xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+#include "stm32g4xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_OPAMP_MODULE_ENABLED
+#include "stm32g4xx_hal_opamp.h"
+#endif /* HAL_OPAMP_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+#include "stm32g4xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+#include "stm32g4xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+#include "stm32g4xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+#include "stm32g4xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+#include "stm32g4xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+#include "stm32g4xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+#include "stm32g4xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_SMBUS_MODULE_ENABLED
+#include "stm32g4xx_hal_smbus.h"
+#endif /* HAL_SMBUS_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+#include "stm32g4xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+#include "stm32g4xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+#include "stm32g4xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+#include "stm32g4xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+#include "stm32g4xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+#include "stm32g4xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef  USE_FULL_ASSERT
+/**
+  * @brief  The assert_param macro is used for function's parameters check.
+  * @param  expr: If expr is false, it calls assert_failed function
+  *         which reports the name of the source file and the source
+  *         line number of the call that failed.
+  *         If expr is true, it returns no value.
+  * @retval None
+  */
+#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+void assert_failed(uint8_t *file, uint32_t line);
+#else
+#define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STM32G4xx_HAL_CONF_H */

BIN
project/ewarm/desk/Debug/Exe/desk.out


BIN
project/ewarm/desk/Debug/Exe/desk.sim


File diff suppressed because it is too large
+ 418 - 377
project/ewarm/desk/Debug/List/desk.map


File diff suppressed because it is too large
+ 374 - 359
project/ewarm/desk/desk.dep


+ 27 - 3
project/ewarm/desk/desk.ewp

@@ -356,6 +356,8 @@
                     <state>$PROJ_DIR$/../../../desk/modules/terminal</state>
                     <state>$PROJ_DIR$/../../../desk/modules/menu</state>
                     <state>$PROJ_DIR$/../../../desk/modules/ssd_1327</state>
+                    <state>$PROJ_DIR$/../../../desk/modules/settings</state>
+                    <state>$PROJ_DIR$/../../../desk/modules/configs</state>
                     <state>$PROJ_DIR$/../../../desk/libs/stm32/hal/Inc</state>
                     <state>$PROJ_DIR$/../../../desk/libs/stm32/cmsis</state>
                     <state>$PROJ_DIR$/../../../desk/libs/thirdparty/freertos/CMSIS_RTOS</state>
@@ -363,6 +365,7 @@
                     <state>$PROJ_DIR$/../../../desk/libs/thirdparty/freertos/include</state>
                     <state>$PROJ_DIR$/../../../desk/libs/thirdparty/freertos</state>
                     <state>$PROJ_DIR$/../../../desk/libs/thirdparty/oled_ssd1327</state>
+                    <state>$PROJ_DIR$/../../../desk/libs/thirdparty/oled_ssd1327/fonts</state>
                     <state>$PROJ_DIR$/../../../thirdparty_libs/microrl</state>
                 </option>
                 <option>
@@ -2367,12 +2370,18 @@
             </group>
             <group>
                 <name>oled_ssd1327</name>
+                <group>
+                    <name>fonts</name>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\font_8x5.h</name>
+                    </file>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\fonts.h</name>
+                    </file>
+                </group>
                 <file>
                     <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\GFX_SSD1327.c</name>
                 </file>
-                <file>
-                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\i2c.c</name>
-                </file>
                 <file>
                     <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\logo_grayscale.h</name>
                 </file>
@@ -2384,12 +2393,24 @@
     </group>
     <group>
         <name>modules</name>
+        <group>
+            <name>configs</name>
+            <file>
+                <name>$PROJ_DIR$\..\..\..\desk\modules\configs\config.h</name>
+            </file>
+        </group>
         <group>
             <name>menu</name>
             <file>
                 <name>$PROJ_DIR$\..\..\..\desk\modules\menu\control.cpp</name>
             </file>
         </group>
+        <group>
+            <name>settings</name>
+            <file>
+                <name>$PROJ_DIR$\..\..\..\desk\modules\settings\settings.cpp</name>
+            </file>
+        </group>
         <group>
             <name>ssd_1327</name>
             <file>
@@ -2436,4 +2457,7 @@
             <name>$PROJ_DIR$\..\..\..\desk\user\stm32g4xx_it.c</name>
         </file>
     </group>
+    <file>
+        <name>$PROJ_DIR$\..\..\..\README.md</name>
+    </file>
 </project>

+ 24 - 3
project/ewarm/desk/desk.ewt

@@ -2609,12 +2609,18 @@
             </group>
             <group>
                 <name>oled_ssd1327</name>
+                <group>
+                    <name>fonts</name>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\font_8x5.h</name>
+                    </file>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\fonts.h</name>
+                    </file>
+                </group>
                 <file>
                     <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\GFX_SSD1327.c</name>
                 </file>
-                <file>
-                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\i2c.c</name>
-                </file>
                 <file>
                     <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\logo_grayscale.h</name>
                 </file>
@@ -2626,12 +2632,24 @@
     </group>
     <group>
         <name>modules</name>
+        <group>
+            <name>configs</name>
+            <file>
+                <name>$PROJ_DIR$\..\..\..\desk\modules\configs\config.h</name>
+            </file>
+        </group>
         <group>
             <name>menu</name>
             <file>
                 <name>$PROJ_DIR$\..\..\..\desk\modules\menu\control.cpp</name>
             </file>
         </group>
+        <group>
+            <name>settings</name>
+            <file>
+                <name>$PROJ_DIR$\..\..\..\desk\modules\settings\settings.cpp</name>
+            </file>
+        </group>
         <group>
             <name>ssd_1327</name>
             <file>
@@ -2678,4 +2696,7 @@
             <name>$PROJ_DIR$\..\..\..\desk\user\stm32g4xx_it.c</name>
         </file>
     </group>
+    <file>
+        <name>$PROJ_DIR$\..\..\..\README.md</name>
+    </file>
 </project>

+ 13 - 13
project/ewarm/desk/settings/desk.dnx

@@ -16,7 +16,7 @@
         <ShowSource>1</ShowSource>
     </Trace1>
     <DebugChecksum>
-        <Checksum>742084521</Checksum>
+        <Checksum>1081711284</Checksum>
     </DebugChecksum>
     <Disassembly>
         <MixedMode>1</MixedMode>
@@ -52,10 +52,10 @@
     <StLinkDriver>
         <stlinkserialNo>67161124</stlinkserialNo>
         <stlinkfoundProbes />
-        <stlinkResetStyle>0</stlinkResetStyle>
-        <stlinkResetStrategy>0</stlinkResetStrategy>
         <CStepIntDis>_ 0</CStepIntDis>
         <LeaveTargetRunning>_ 0</LeaveTargetRunning>
+        <stlinkResetStyle>0</stlinkResetStyle>
+        <stlinkResetStrategy>0</stlinkResetStrategy>
     </StLinkDriver>
     <SWOTraceHWSettings>
         <OverrideDefaultClocks>0</OverrideDefaultClocks>
@@ -120,6 +120,12 @@
         <ShowTimeSum>1</ShowTimeSum>
         <SumSortOrder>0</SumSortOrder>
     </EventLog>
+    <DisassembleMode>
+        <mode>0</mode>
+    </DisassembleMode>
+    <Breakpoints2>
+        <Count>0</Count>
+    </Breakpoints2>
     <TermIOLog>
         <LoggingEnabled>_ 0</LoggingEnabled>
         <LogFile>_ ""</LogFile>
@@ -129,6 +135,10 @@
         <LogFile>_ ""</LogFile>
         <Category>_ 0</Category>
     </LogFile>
+    <Aliases>
+        <Count>0</Count>
+        <SuppressDialog>0</SuppressDialog>
+    </Aliases>
     <DriverProfiling>
         <Enabled>0</Enabled>
         <Mode>3</Mode>
@@ -142,14 +152,4 @@
     <CallStackStripe>
         <ShowTiming>1</ShowTiming>
     </CallStackStripe>
-    <DisassembleMode>
-        <mode>0</mode>
-    </DisassembleMode>
-    <Breakpoints2>
-        <Count>0</Count>
-    </Breakpoints2>
-    <Aliases>
-        <Count>0</Count>
-        <SuppressDialog>0</SuppressDialog>
-    </Aliases>
 </settings>

+ 10 - 10
project/ewarm/robot/robot.dep

@@ -6,30 +6,30 @@
         <name>Debug</name>
         <outputs>
             <file>$PROJ_DIR$\main.cpp</file>
-            <file>$PROJ_DIR$\Debug\Exe\robot.out</file>
-            <file>$PROJ_DIR$\Debug\Obj\main.xcl</file>
             <file>$PROJ_DIR$\Debug\Obj\main.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\main.xcl</file>
+            <file>$PROJ_DIR$\Debug\Exe\robot.out</file>
         </outputs>
         <file>
-            <name>[ROOT_NODE]</name>
+            <name>$PROJ_DIR$\main.cpp</name>
             <outputs>
                 <tool>
-                    <name>ILINK</name>
+                    <name>ICCARM</name>
                     <file> 1</file>
                 </tool>
+                <tool>
+                    <name>BICOMP</name>
+                    <file> 2</file>
+                </tool>
             </outputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\main.cpp</name>
+            <name>[ROOT_NODE]</name>
             <outputs>
                 <tool>
-                    <name>ICCARM</name>
+                    <name>ILINK</name>
                     <file> 3</file>
                 </tool>
-                <tool>
-                    <name>BICOMP</name>
-                    <file> 2</file>
-                </tool>
             </outputs>
         </file>
         <forcedrebuild>

Some files were not shown because too many files changed in this diff