Initial commit
This commit is contained in:
59
.gitignore
vendored
Normal file
59
.gitignore
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Keil uVision project files
|
||||||
|
*.uvproj
|
||||||
|
*.uvprojx
|
||||||
|
*.uvopt
|
||||||
|
*.uvoptx
|
||||||
|
*.mdklaunch
|
||||||
|
|
||||||
|
# Build output
|
||||||
|
*.axf
|
||||||
|
*.crf
|
||||||
|
*.o
|
||||||
|
*.d
|
||||||
|
*.hex
|
||||||
|
*.bin
|
||||||
|
*.lst
|
||||||
|
*.map
|
||||||
|
*.htm
|
||||||
|
*.h51
|
||||||
|
*.lnp
|
||||||
|
*.sct
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dbg*
|
||||||
|
*.ini
|
||||||
|
|
||||||
|
# User files
|
||||||
|
*.plg
|
||||||
|
*.bak
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# IDE files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# System files
|
||||||
|
Thumbs.db
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Large files
|
||||||
|
sdram_map.xlsx
|
||||||
|
|
||||||
|
# Middleware libraries
|
||||||
|
Middlewares/
|
||||||
|
Utilities/
|
||||||
|
|
||||||
|
# USB files
|
||||||
|
USB_DEVICE/
|
||||||
|
USB_HOST/
|
||||||
|
|
||||||
|
# MDK-ARM directory
|
||||||
|
MDK-ARM/
|
||||||
|
|
||||||
|
# STM32CubeMX files
|
||||||
|
*.ioc
|
||||||
|
|
||||||
|
# Build directories
|
||||||
|
build/
|
||||||
|
debug/
|
||||||
|
release/
|
||||||
72
FW/.mxproject
Normal file
72
FW/.mxproject
Normal file
File diff suppressed because one or more lines are too long
52
FW/Core/Inc/dma.h
Normal file
52
FW/Core/Inc/dma.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file dma.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the dma.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __DMA_H__
|
||||||
|
#define __DMA_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* DMA memory to memory transfer handles -------------------------------------*/
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_DMA_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __DMA_H__ */
|
||||||
|
|
||||||
50
FW/Core/Inc/dma2d.h
Normal file
50
FW/Core/Inc/dma2d.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file dma2d.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the dma2d.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __DMA2D_H__
|
||||||
|
#define __DMA2D_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_DMA2D_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __DMA2D_H__ */
|
||||||
|
|
||||||
52
FW/Core/Inc/fdcan.h
Normal file
52
FW/Core/Inc/fdcan.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file fdcan.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the fdcan.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __FDCAN_H__
|
||||||
|
#define __FDCAN_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern FDCAN_HandleTypeDef hfdcan2;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_FDCAN2_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __FDCAN_H__ */
|
||||||
|
|
||||||
59
FW/Core/Inc/fmc.h
Normal file
59
FW/Core/Inc/fmc.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : FMC.h
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the FMC peripheral.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __FMC_H
|
||||||
|
#define __FMC_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern SDRAM_HandleTypeDef hsdram1;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_FMC_Init(void);
|
||||||
|
void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef* hsdram);
|
||||||
|
void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef* hsdram);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*__FMC_H */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
49
FW/Core/Inc/gpio.h
Normal file
49
FW/Core/Inc/gpio.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file gpio.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the gpio.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __GPIO_H__
|
||||||
|
#define __GPIO_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_GPIO_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*__ GPIO_H__ */
|
||||||
|
|
||||||
50
FW/Core/Inc/iwdg.h
Normal file
50
FW/Core/Inc/iwdg.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file iwdg.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the iwdg.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __IWDG_H__
|
||||||
|
#define __IWDG_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_IWDG1_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __IWDG_H__ */
|
||||||
|
|
||||||
52
FW/Core/Inc/jpeg.h
Normal file
52
FW/Core/Inc/jpeg.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file jpeg.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the jpeg.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __JPEG_H__
|
||||||
|
#define __JPEG_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern JPEG_HandleTypeDef hjpeg;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_JPEG_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __JPEG_H__ */
|
||||||
|
|
||||||
56
FW/Core/Inc/jpeg_utils_conf.h
Normal file
56
FW/Core/Inc/jpeg_utils_conf.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* jpeg_utils_conf.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
|
* Modified 1997-2011 by Guido Vollbeding.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file contains additional configuration options that customize the
|
||||||
|
* JPEG HW configuration. Most users will not need to touch this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __JPEG_UTILS_CONF_H__
|
||||||
|
#define __JPEG_UTILS_CONF_H__
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "stm32h7xx_hal.h"
|
||||||
|
#include "stm32h7xx_hal_jpeg.h"
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/** @addtogroup JPEG_Private_Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* RGB Color format definition for JPEG encoding/Decoding : Should not be modified*/
|
||||||
|
#define JPEG_ARGB8888 0 /* ARGB8888 Color Format */
|
||||||
|
#define JPEG_RGB888 1 /* RGB888 Color Format */
|
||||||
|
#define JPEG_RGB565 2 /* RGB565 Color Format */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define USE_JPEG_DECODER
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USE_JPEG_DECODER 1 /* 1 or 0 ********* Value different from default value : 1 ********** */
|
||||||
|
/*
|
||||||
|
* Define USE_JPEG_ENCODER
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USE_JPEG_ENCODER 1 /* 1 or 0 ********* Value different from default value : 1 ********** */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define JPEG_RGB_FORMAT
|
||||||
|
*/
|
||||||
|
#define JPEG_RGB_FORMAT JPEG_ARGB8888 /* JPEG_ARGB8888, JPEG_RGB888, JPEG_RGB565 ********* Value different from default value : 0 ********** */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define JPEG_SWAP_RG
|
||||||
|
*/
|
||||||
|
#define JPEG_SWAP_RG 0 /* 0 or 1 ********* Value different from default value : 0 ********** */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
|
||||||
|
#endif /* __JPEG_UTILS_CONF_H__ */
|
||||||
52
FW/Core/Inc/ltdc.h
Normal file
52
FW/Core/Inc/ltdc.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file ltdc.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the ltdc.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __LTDC_H__
|
||||||
|
#define __LTDC_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern LTDC_HandleTypeDef hltdc;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_LTDC_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __LTDC_H__ */
|
||||||
|
|
||||||
108
FW/Core/Inc/main.h
Normal file
108
FW/Core/Inc/main.h
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file : main.h
|
||||||
|
* @brief : Header for main.c file.
|
||||||
|
* This file contains the common defines of the application.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __MAIN_H
|
||||||
|
#define __MAIN_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32h7xx_hal.h"
|
||||||
|
|
||||||
|
#include "stm32h7xx_ll_crc.h"
|
||||||
|
#include "stm32h7xx_ll_dma.h"
|
||||||
|
#include "stm32h7xx_ll_dma2d.h"
|
||||||
|
#include "stm32h7xx_ll_iwdg.h"
|
||||||
|
#include "stm32h7xx_ll_lpuart.h"
|
||||||
|
#include "stm32h7xx_ll_rcc.h"
|
||||||
|
#include "stm32h7xx_ll_rtc.h"
|
||||||
|
#include "stm32h7xx_ll_spi.h"
|
||||||
|
#include "stm32h7xx_ll_tim.h"
|
||||||
|
#include "stm32h7xx_ll_usart.h"
|
||||||
|
#include "stm32h7xx_ll_system.h"
|
||||||
|
#include "stm32h7xx_ll_gpio.h"
|
||||||
|
#include "stm32h7xx_ll_exti.h"
|
||||||
|
#include "stm32h7xx_ll_bus.h"
|
||||||
|
#include "stm32h7xx_ll_cortex.h"
|
||||||
|
#include "stm32h7xx_ll_utils.h"
|
||||||
|
#include "stm32h7xx_ll_pwr.h"
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ET */
|
||||||
|
|
||||||
|
/* USER CODE END ET */
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EC */
|
||||||
|
#define FLASH_BASE_ADDR (uint32_t)(FLASH_BASE)
|
||||||
|
#define FLASH_END_ADDR (uint32_t)(0x081FFFFF)
|
||||||
|
|
||||||
|
/* Base address of the Flash sectors Bank 1 */
|
||||||
|
#define ADDR_FLASH_SECTOR_0_BANK1 ((uint32_t)0x08000000) /* Base @ of Sector 0, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_1_BANK1 ((uint32_t)0x08020000) /* Base @ of Sector 1, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_2_BANK1 ((uint32_t)0x08040000) /* Base @ of Sector 2, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_3_BANK1 ((uint32_t)0x08060000) /* Base @ of Sector 3, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_4_BANK1 ((uint32_t)0x08080000) /* Base @ of Sector 4, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_5_BANK1 ((uint32_t)0x080A0000) /* Base @ of Sector 5, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_6_BANK1 ((uint32_t)0x080C0000) /* Base @ of Sector 6, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_7_BANK1 ((uint32_t)0x080E0000) /* Base @ of Sector 7, 128 Kbytes */
|
||||||
|
|
||||||
|
/* Base address of the Flash sectors Bank 2 */
|
||||||
|
#define ADDR_FLASH_SECTOR_0_BANK2 ((uint32_t)0x08100000) /* Base @ of Sector 0, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_1_BANK2 ((uint32_t)0x08120000) /* Base @ of Sector 1, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_2_BANK2 ((uint32_t)0x08140000) /* Base @ of Sector 2, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_3_BANK2 ((uint32_t)0x08160000) /* Base @ of Sector 3, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_4_BANK2 ((uint32_t)0x08180000) /* Base @ of Sector 4, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_5_BANK2 ((uint32_t)0x081A0000) /* Base @ of Sector 5, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_6_BANK2 ((uint32_t)0x081C0000) /* Base @ of Sector 6, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_7_BANK2 ((uint32_t)0x081E0000) /* Base @ of Sector 7, 128 Kbytes */
|
||||||
|
/* USER CODE END EC */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EM */
|
||||||
|
|
||||||
|
/* USER CODE END EM */
|
||||||
|
|
||||||
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
|
void Error_Handler(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __MAIN_H */
|
||||||
54
FW/Core/Inc/quadspi.h
Normal file
54
FW/Core/Inc/quadspi.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file quadspi.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the quadspi.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __QUADSPI_H__
|
||||||
|
#define __QUADSPI_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern QSPI_HandleTypeDef hqspi;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_QUADSPI_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
void QSPI_Send_CMD(unsigned int instruction,unsigned int address,unsigned int dummyCycles,unsigned int instructionMode,unsigned int addressMode,unsigned int addressSize,unsigned int dataMode);
|
||||||
|
unsigned char QSPI_Receive(unsigned char* buf,unsigned int datalen);
|
||||||
|
unsigned char QSPI_Transmit(unsigned char* buf,unsigned int datalen);
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __QUADSPI_H__ */
|
||||||
|
|
||||||
50
FW/Core/Inc/rtc.h
Normal file
50
FW/Core/Inc/rtc.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file rtc.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the rtc.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __RTC_H__
|
||||||
|
#define __RTC_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_RTC_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
void RTC_DataTimeSet(unsigned char aY, unsigned char aM, unsigned char aD, unsigned char aH, unsigned char aMin, unsigned char aSec, unsigned char aWk);
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __RTC_H__ */
|
||||||
|
|
||||||
50
FW/Core/Inc/spi.h
Normal file
50
FW/Core/Inc/spi.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file spi.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the spi.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __SPI_H__
|
||||||
|
#define __SPI_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_SPI1_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SPI_H__ */
|
||||||
|
|
||||||
53
FW/Core/Inc/stm32_assert.h
Normal file
53
FW/Core/Inc/stm32_assert.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32_assert.h
|
||||||
|
* @brief STM32 assert file.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2017 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 __STM32_ASSERT_H
|
||||||
|
#define __STM32_ASSERT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
/* 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 /* __STM32_ASSERT_H */
|
||||||
|
|
||||||
515
FW/Core/Inc/stm32h7xx_hal_conf.h
Normal file
515
FW/Core/Inc/stm32h7xx_hal_conf.h
Normal file
@@ -0,0 +1,515 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7xx_hal_conf.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief HAL configuration file.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2017 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 STM32H7xx_HAL_CONF_H
|
||||||
|
#define STM32H7xx_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_FDCAN_MODULE_ENABLED
|
||||||
|
/* #define HAL_FMAC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_CEC_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_DCMI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_DMA2D_MODULE_ENABLED */
|
||||||
|
/* #define HAL_ETH_MODULE_ENABLED */
|
||||||
|
/* #define HAL_ETH_LEGACY_MODULE_ENABLED */
|
||||||
|
/* #define HAL_NAND_MODULE_ENABLED */
|
||||||
|
/* #define HAL_NOR_MODULE_ENABLED */
|
||||||
|
/* #define HAL_OTFDEC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SRAM_MODULE_ENABLED */
|
||||||
|
#define HAL_SDRAM_MODULE_ENABLED
|
||||||
|
/* #define HAL_HASH_MODULE_ENABLED */
|
||||||
|
/* #define HAL_HRTIM_MODULE_ENABLED */
|
||||||
|
/* #define HAL_HSEM_MODULE_ENABLED */
|
||||||
|
/* #define HAL_GFXMMU_MODULE_ENABLED */
|
||||||
|
#define HAL_JPEG_MODULE_ENABLED
|
||||||
|
/* #define HAL_OPAMP_MODULE_ENABLED */
|
||||||
|
/* #define HAL_OSPI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_OSPI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_I2S_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||||
|
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||||
|
/* #define HAL_LPTIM_MODULE_ENABLED */
|
||||||
|
#define HAL_LTDC_MODULE_ENABLED
|
||||||
|
#define HAL_QSPI_MODULE_ENABLED
|
||||||
|
/* #define HAL_RAMECC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_RNG_MODULE_ENABLED */
|
||||||
|
/* #define HAL_RTC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SAI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SD_MODULE_ENABLED */
|
||||||
|
/* #define HAL_MMC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SPI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SWPMI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_TIM_MODULE_ENABLED */
|
||||||
|
/* #define HAL_UART_MODULE_ENABLED */
|
||||||
|
/* #define HAL_USART_MODULE_ENABLED */
|
||||||
|
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
|
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||||
|
#define HAL_PCD_MODULE_ENABLED
|
||||||
|
#define HAL_HCD_MODULE_ENABLED
|
||||||
|
/* #define HAL_DFSDM_MODULE_ENABLED */
|
||||||
|
/* #define HAL_DSI_MODULE_ENABLED */
|
||||||
|
#define HAL_JPEG_MODULE_ENABLED
|
||||||
|
/* #define HAL_MDIOS_MODULE_ENABLED */
|
||||||
|
/* #define HAL_PSSI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_DTS_MODULE_ENABLED */
|
||||||
|
#define HAL_GPIO_MODULE_ENABLED
|
||||||
|
#define HAL_DMA_MODULE_ENABLED
|
||||||
|
#define HAL_MDMA_MODULE_ENABLED
|
||||||
|
#define HAL_RCC_MODULE_ENABLED
|
||||||
|
#define HAL_FLASH_MODULE_ENABLED
|
||||||
|
#define HAL_EXTI_MODULE_ENABLED
|
||||||
|
#define HAL_PWR_MODULE_ENABLED
|
||||||
|
#define HAL_I2C_MODULE_ENABLED
|
||||||
|
#define HAL_CORTEX_MODULE_ENABLED
|
||||||
|
#define HAL_HSEM_MODULE_ENABLED
|
||||||
|
|
||||||
|
/* ########################## 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 : FPGA case fixed to 60MHZ */
|
||||||
|
#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 oscillator (CSI) default value.
|
||||||
|
* This value is the default CSI value after Reset.
|
||||||
|
*/
|
||||||
|
#if !defined (CSI_VALUE)
|
||||||
|
#define CSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/
|
||||||
|
#endif /* CSI_VALUE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 (64000000UL) /*!< Value of the Internal oscillator in Hz*/
|
||||||
|
#endif /* HSI_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 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 */
|
||||||
|
|
||||||
|
#if !defined (LSI_VALUE)
|
||||||
|
#define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/
|
||||||
|
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||||
|
The real value may vary depending on the variations
|
||||||
|
in voltage and temperature.*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief External clock source for I2S peripheral
|
||||||
|
* This value is used by the I2S HAL module to compute the I2S 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 clock 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 */
|
||||||
|
#define USE_RTOS 0
|
||||||
|
#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */
|
||||||
|
#define USE_SPI_CRC 0U /*!< use CRC in SPI */
|
||||||
|
|
||||||
|
#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */
|
||||||
|
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */
|
||||||
|
#define USE_HAL_COMP_REGISTER_CALLBACKS 0U /* COMP register callback disabled */
|
||||||
|
#define USE_HAL_CORDIC_REGISTER_CALLBACKS 0U /* CORDIC register callback disabled */
|
||||||
|
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */
|
||||||
|
#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */
|
||||||
|
#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */
|
||||||
|
#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */
|
||||||
|
#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */
|
||||||
|
#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */
|
||||||
|
#define USE_HAL_DTS_REGISTER_CALLBACKS 0U /* DTS register callback disabled */
|
||||||
|
#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */
|
||||||
|
#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U /* FDCAN register callback disabled */
|
||||||
|
#define USE_HAL_FMAC_REGISTER_CALLBACKS 0U /* FMAC register callback disabled */
|
||||||
|
#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */
|
||||||
|
#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */
|
||||||
|
#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */
|
||||||
|
#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */
|
||||||
|
#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */
|
||||||
|
#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */
|
||||||
|
#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U /* GFXMMU register callback disabled */
|
||||||
|
#define USE_HAL_HRTIM_REGISTER_CALLBACKS 0U /* HRTIM register callback disabled */
|
||||||
|
#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */
|
||||||
|
#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */
|
||||||
|
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */
|
||||||
|
#define USE_HAL_JPEG_REGISTER_CALLBACKS 0U /* JPEG register callback disabled */
|
||||||
|
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */
|
||||||
|
#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */
|
||||||
|
#define USE_HAL_MDIOS_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */
|
||||||
|
#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */
|
||||||
|
#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */
|
||||||
|
#define USE_HAL_OSPI_REGISTER_CALLBACKS 0U /* OSPI register callback disabled */
|
||||||
|
#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */
|
||||||
|
#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */
|
||||||
|
#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */
|
||||||
|
#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */
|
||||||
|
#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */
|
||||||
|
#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */
|
||||||
|
#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */
|
||||||
|
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */
|
||||||
|
#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */
|
||||||
|
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */
|
||||||
|
#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
|
||||||
|
#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */
|
||||||
|
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
|
||||||
|
#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */
|
||||||
|
#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
|
||||||
|
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */
|
||||||
|
|
||||||
|
/* ########################### Ethernet Configuration ######################### */
|
||||||
|
#define ETH_TX_DESC_CNT 4U /* number of Ethernet Tx DMA descriptors */
|
||||||
|
#define ETH_RX_DESC_CNT 4U /* number of Ethernet Rx DMA descriptors */
|
||||||
|
|
||||||
|
#define ETH_MAC_ADDR0 (0x02UL)
|
||||||
|
#define ETH_MAC_ADDR1 (0x00UL)
|
||||||
|
#define ETH_MAC_ADDR2 (0x00UL)
|
||||||
|
#define ETH_MAC_ADDR3 (0x00UL)
|
||||||
|
#define ETH_MAC_ADDR4 (0x00UL)
|
||||||
|
#define ETH_MAC_ADDR5 (0x00UL)
|
||||||
|
|
||||||
|
/* ########################## Assert Selection ############################## */
|
||||||
|
/**
|
||||||
|
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||||
|
* HAL drivers code
|
||||||
|
*/
|
||||||
|
/* #define USE_FULL_ASSERT 1U */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief Include module's header file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAL_RCC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_rcc.h"
|
||||||
|
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_gpio.h"
|
||||||
|
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DMA_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_dma.h"
|
||||||
|
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_MDMA_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_mdma.h"
|
||||||
|
#endif /* HAL_MDMA_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_HASH_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_hash.h"
|
||||||
|
#endif /* HAL_HASH_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DCMI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_dcmi.h"
|
||||||
|
#endif /* HAL_DCMI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DMA2D_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_dma2d.h"
|
||||||
|
#endif /* HAL_DMA2D_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DSI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_dsi.h"
|
||||||
|
#endif /* HAL_DSI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DFSDM_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_dfsdm.h"
|
||||||
|
#endif /* HAL_DFSDM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DTS_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_dts.h"
|
||||||
|
#endif /* HAL_DTS_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_ETH_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_eth.h"
|
||||||
|
#endif /* HAL_ETH_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_ETH_LEGACY_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_eth_legacy.h"
|
||||||
|
#endif /* HAL_ETH_LEGACY_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_exti.h"
|
||||||
|
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_cortex.h"
|
||||||
|
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_ADC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_adc.h"
|
||||||
|
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_FDCAN_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_fdcan.h"
|
||||||
|
#endif /* HAL_FDCAN_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CEC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_cec.h"
|
||||||
|
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_COMP_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_comp.h"
|
||||||
|
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CORDIC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_cordic.h"
|
||||||
|
#endif /* HAL_CORDIC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CRC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_crc.h"
|
||||||
|
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_cryp.h"
|
||||||
|
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DAC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_dac.h"
|
||||||
|
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_flash.h"
|
||||||
|
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_GFXMMU_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_gfxmmu.h"
|
||||||
|
#endif /* HAL_GFXMMU_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_FMAC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_fmac.h"
|
||||||
|
#endif /* HAL_FMAC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_HRTIM_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_hrtim.h"
|
||||||
|
#endif /* HAL_HRTIM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_HSEM_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_hsem.h"
|
||||||
|
#endif /* HAL_HSEM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_sram.h"
|
||||||
|
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_NOR_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_nor.h"
|
||||||
|
#endif /* HAL_NOR_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_NAND_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_nand.h"
|
||||||
|
#endif /* HAL_NAND_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_I2C_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_i2c.h"
|
||||||
|
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_I2S_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_i2s.h"
|
||||||
|
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_iwdg.h"
|
||||||
|
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_JPEG_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_jpeg.h"
|
||||||
|
#endif /* HAL_JPEG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_MDIOS_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_mdios.h"
|
||||||
|
#endif /* HAL_MDIOS_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_MMC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_mmc.h"
|
||||||
|
#endif /* HAL_MMC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_lptim.h"
|
||||||
|
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_LTDC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_ltdc.h"
|
||||||
|
#endif /* HAL_LTDC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_OPAMP_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_opamp.h"
|
||||||
|
#endif /* HAL_OPAMP_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_OSPI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_ospi.h"
|
||||||
|
#endif /* HAL_OSPI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_OTFDEC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_otfdec.h"
|
||||||
|
#endif /* HAL_OTFDEC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_PSSI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_pssi.h"
|
||||||
|
#endif /* HAL_PSSI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_PWR_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_pwr.h"
|
||||||
|
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_QSPI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_qspi.h"
|
||||||
|
#endif /* HAL_QSPI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_RAMECC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_ramecc.h"
|
||||||
|
#endif /* HAL_RAMECC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_RNG_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_rng.h"
|
||||||
|
#endif /* HAL_RNG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_RTC_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_rtc.h"
|
||||||
|
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SAI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_sai.h"
|
||||||
|
#endif /* HAL_SAI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SD_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_sd.h"
|
||||||
|
#endif /* HAL_SD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SDRAM_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_sdram.h"
|
||||||
|
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SPI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_spi.h"
|
||||||
|
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_spdifrx.h"
|
||||||
|
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SWPMI_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_swpmi.h"
|
||||||
|
#endif /* HAL_SWPMI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_TIM_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_tim.h"
|
||||||
|
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_UART_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_uart.h"
|
||||||
|
#endif /* HAL_UART_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_USART_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_usart.h"
|
||||||
|
#endif /* HAL_USART_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_irda.h"
|
||||||
|
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_smartcard.h"
|
||||||
|
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_smbus.h"
|
||||||
|
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_wwdg.h"
|
||||||
|
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_PCD_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_pcd.h"
|
||||||
|
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_HCD_MODULE_ENABLED
|
||||||
|
#include "stm32h7xx_hal_hcd.h"
|
||||||
|
#endif /* HAL_HCD_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 /* STM32H7xx_HAL_CONF_H */
|
||||||
79
FW/Core/Inc/stm32h7xx_it.h
Normal file
79
FW/Core/Inc/stm32h7xx_it.h
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7xx_it.h
|
||||||
|
* @brief This file contains the headers of the interrupt handlers.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __STM32H7xx_IT_H
|
||||||
|
#define __STM32H7xx_IT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ET */
|
||||||
|
|
||||||
|
/* USER CODE END ET */
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EC */
|
||||||
|
|
||||||
|
/* USER CODE END EC */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EM */
|
||||||
|
|
||||||
|
/* USER CODE END EM */
|
||||||
|
|
||||||
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
|
void NMI_Handler(void);
|
||||||
|
void HardFault_Handler(void);
|
||||||
|
void MemManage_Handler(void);
|
||||||
|
void BusFault_Handler(void);
|
||||||
|
void UsageFault_Handler(void);
|
||||||
|
void SVC_Handler(void);
|
||||||
|
void DebugMon_Handler(void);
|
||||||
|
void PendSV_Handler(void);
|
||||||
|
void SysTick_Handler(void);
|
||||||
|
void DMA1_Stream3_IRQHandler(void);
|
||||||
|
void FDCAN2_IT0_IRQHandler(void);
|
||||||
|
void USART1_IRQHandler(void);
|
||||||
|
void USART2_IRQHandler(void);
|
||||||
|
void USART3_IRQHandler(void);
|
||||||
|
void UART4_IRQHandler(void);
|
||||||
|
void UART5_IRQHandler(void);
|
||||||
|
void TIM7_IRQHandler(void);
|
||||||
|
void USART6_IRQHandler(void);
|
||||||
|
void UART7_IRQHandler(void);
|
||||||
|
void LTDC_IRQHandler(void);
|
||||||
|
void OTG_FS_IRQHandler(void);
|
||||||
|
void LPUART1_IRQHandler(void);
|
||||||
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __STM32H7xx_IT_H */
|
||||||
18
FW/Core/Inc/task.h
Normal file
18
FW/Core/Inc/task.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef TASK_H_
|
||||||
|
#define TASK_H_
|
||||||
|
|
||||||
|
extern unsigned int sys_tick_1s_rdy;
|
||||||
|
|
||||||
|
extern unsigned int UserRequestReset ;
|
||||||
|
extern unsigned int SysLoopTick ;
|
||||||
|
|
||||||
|
extern void DoUpdataRtc();
|
||||||
|
extern void my_sys_tick(void);
|
||||||
|
extern void operation_finction(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
54
FW/Core/Inc/tim.h
Normal file
54
FW/Core/Inc/tim.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file tim.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the tim.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __TIM_H__
|
||||||
|
#define __TIM_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_TIM2_Init(void);
|
||||||
|
void MX_TIM3_Init(void);
|
||||||
|
void MX_TIM6_Init(void);
|
||||||
|
void MX_TIM7_Init(void);
|
||||||
|
void MX_TIM12_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __TIM_H__ */
|
||||||
|
|
||||||
57
FW/Core/Inc/usart.h
Normal file
57
FW/Core/Inc/usart.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file usart.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the usart.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 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 __USART_H__
|
||||||
|
#define __USART_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_LPUART1_UART_Init(void);
|
||||||
|
void MX_UART4_Init(void);
|
||||||
|
void MX_UART5_Init(void);
|
||||||
|
void MX_UART7_Init(void);
|
||||||
|
void MX_USART1_UART_Init(void);
|
||||||
|
void MX_USART2_UART_Init(void);
|
||||||
|
void MX_USART3_UART_Init(void);
|
||||||
|
void MX_USART6_UART_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __USART_H__ */
|
||||||
|
|
||||||
57
FW/Core/Src/dma.c
Normal file
57
FW/Core/Src/dma.c
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file dma.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of all the requested memory to memory DMA transfers.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "dma.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Configure DMA */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable DMA controller clock
|
||||||
|
*/
|
||||||
|
void MX_DMA_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Init with LL driver */
|
||||||
|
/* DMA controller clock enable */
|
||||||
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA2);
|
||||||
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1);
|
||||||
|
|
||||||
|
/* DMA interrupt init */
|
||||||
|
/* DMA1_Stream3_IRQn interrupt configuration */
|
||||||
|
NVIC_SetPriority(DMA1_Stream3_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(DMA1_Stream3_IRQn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 2 */
|
||||||
|
|
||||||
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
59
FW/Core/Src/dma2d.c
Normal file
59
FW/Core/Src/dma2d.c
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file dma2d.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the DMA2D instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "dma2d.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* DMA2D init function */
|
||||||
|
void MX_DMA2D_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN DMA2D_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_Init 0 */
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_DMA2D);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN DMA2D_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_Init 1 */
|
||||||
|
LL_DMA2D_SetMode(DMA2D, LL_DMA2D_MODE_M2M);
|
||||||
|
LL_DMA2D_SetOutputColorMode(DMA2D, LL_DMA2D_OUTPUT_MODE_ARGB8888);
|
||||||
|
LL_DMA2D_SetLineOffset(DMA2D, 0);
|
||||||
|
LL_DMA2D_FGND_SetColorMode(DMA2D, LL_DMA2D_INPUT_MODE_ARGB8888);
|
||||||
|
LL_DMA2D_FGND_SetAlphaMode(DMA2D, LL_DMA2D_ALPHA_MODE_REPLACE);
|
||||||
|
LL_DMA2D_FGND_SetAlpha(DMA2D, 0);
|
||||||
|
LL_DMA2D_FGND_SetLineOffset(DMA2D, 0);
|
||||||
|
LL_DMA2D_FGND_SetRBSwapMode(DMA2D, LL_DMA2D_RB_MODE_REGULAR);
|
||||||
|
LL_DMA2D_FGND_SetAlphaInvMode(DMA2D, LL_DMA2D_ALPHA_REGULAR);
|
||||||
|
LL_DMA2D_FGND_SetChrSubSampling(DMA2D, LL_DMA2D_CSS_444);
|
||||||
|
/* USER CODE BEGIN DMA2D_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
149
FW/Core/Src/fdcan.c
Normal file
149
FW/Core/Src/fdcan.c
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file fdcan.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the FDCAN instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "fdcan.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
FDCAN_HandleTypeDef hfdcan2;
|
||||||
|
|
||||||
|
/* FDCAN2 init function */
|
||||||
|
void MX_FDCAN2_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FDCAN2_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FDCAN2_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_Init 1 */
|
||||||
|
hfdcan2.Instance = FDCAN2;
|
||||||
|
hfdcan2.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
||||||
|
hfdcan2.Init.Mode = FDCAN_MODE_NORMAL;
|
||||||
|
hfdcan2.Init.AutoRetransmission = ENABLE;
|
||||||
|
hfdcan2.Init.TransmitPause = DISABLE;
|
||||||
|
hfdcan2.Init.ProtocolException = DISABLE;
|
||||||
|
hfdcan2.Init.NominalPrescaler = 53;
|
||||||
|
hfdcan2.Init.NominalSyncJumpWidth = 3;
|
||||||
|
hfdcan2.Init.NominalTimeSeg1 = 12;
|
||||||
|
hfdcan2.Init.NominalTimeSeg2 = 5;
|
||||||
|
hfdcan2.Init.DataPrescaler = 1;
|
||||||
|
hfdcan2.Init.DataSyncJumpWidth = 1;
|
||||||
|
hfdcan2.Init.DataTimeSeg1 = 1;
|
||||||
|
hfdcan2.Init.DataTimeSeg2 = 1;
|
||||||
|
hfdcan2.Init.MessageRAMOffset = 0;
|
||||||
|
hfdcan2.Init.StdFiltersNbr = 0;
|
||||||
|
hfdcan2.Init.ExtFiltersNbr = 0;
|
||||||
|
hfdcan2.Init.RxFifo0ElmtsNbr = 1;
|
||||||
|
hfdcan2.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
|
hfdcan2.Init.RxFifo1ElmtsNbr = 0;
|
||||||
|
hfdcan2.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
|
hfdcan2.Init.RxBuffersNbr = 0;
|
||||||
|
hfdcan2.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
|
||||||
|
hfdcan2.Init.TxEventsNbr = 0;
|
||||||
|
hfdcan2.Init.TxBuffersNbr = 0;
|
||||||
|
hfdcan2.Init.TxFifoQueueElmtsNbr = 1;
|
||||||
|
hfdcan2.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
|
||||||
|
hfdcan2.Init.TxElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
|
if (HAL_FDCAN_Init(&hfdcan2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN FDCAN2_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef* fdcanHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
if(fdcanHandle->Instance==FDCAN2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN FDCAN2_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_FDCAN;
|
||||||
|
PeriphClkInitStruct.FdcanClockSelection = RCC_FDCANCLKSOURCE_PLL;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FDCAN2 clock enable */
|
||||||
|
__HAL_RCC_FDCAN_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**FDCAN2 GPIO Configuration
|
||||||
|
PB12 ------> FDCAN2_RX
|
||||||
|
PB13 ------> FDCAN2_TX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_13;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_FDCAN2;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* FDCAN2 interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(FDCAN2_IT0_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(FDCAN2_IT0_IRQn);
|
||||||
|
/* USER CODE BEGIN FDCAN2_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef* fdcanHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(fdcanHandle->Instance==FDCAN2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN FDCAN2_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_FDCAN_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**FDCAN2 GPIO Configuration
|
||||||
|
PB12 ------> FDCAN2_RX
|
||||||
|
PB13 ------> FDCAN2_TX
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_12|GPIO_PIN_13);
|
||||||
|
|
||||||
|
/* FDCAN2 interrupt Deinit */
|
||||||
|
HAL_NVIC_DisableIRQ(FDCAN2_IT0_IRQn);
|
||||||
|
/* USER CODE BEGIN FDCAN2_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
365
FW/Core/Src/fmc.c
Normal file
365
FW/Core/Src/fmc.c
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : FMC.c
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the FMC peripheral.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "fmc.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
FMC_SDRAM_CommandTypeDef command;
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
SDRAM_HandleTypeDef hsdram1;
|
||||||
|
|
||||||
|
/* FMC initialization function */
|
||||||
|
void MX_FMC_Init(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN FMC_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FMC_Init 0 */
|
||||||
|
|
||||||
|
FMC_SDRAM_TimingTypeDef SdramTiming = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FMC_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FMC_Init 1 */
|
||||||
|
|
||||||
|
/** Perform the SDRAM1 memory initialization sequence
|
||||||
|
*/
|
||||||
|
hsdram1.Instance = FMC_SDRAM_DEVICE;
|
||||||
|
/* hsdram1.Init */
|
||||||
|
hsdram1.Init.SDBank = FMC_SDRAM_BANK1;
|
||||||
|
hsdram1.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9;
|
||||||
|
hsdram1.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13;
|
||||||
|
hsdram1.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_32;
|
||||||
|
hsdram1.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
|
||||||
|
hsdram1.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_3;
|
||||||
|
hsdram1.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
|
||||||
|
hsdram1.Init.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2;
|
||||||
|
hsdram1.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE;
|
||||||
|
hsdram1.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_0;
|
||||||
|
/* SdramTiming */
|
||||||
|
SdramTiming.LoadToActiveDelay = 2;
|
||||||
|
SdramTiming.ExitSelfRefreshDelay = 8;
|
||||||
|
SdramTiming.SelfRefreshTime = 6;
|
||||||
|
SdramTiming.RowCycleDelay = 6;
|
||||||
|
SdramTiming.WriteRecoveryTime = 4;
|
||||||
|
SdramTiming.RPDelay = 2;
|
||||||
|
SdramTiming.RCDDelay = 2;
|
||||||
|
|
||||||
|
if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler( );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FMC_Init 2 */
|
||||||
|
SDRAM_Initialization_Sequence(&hsdram1, &command);
|
||||||
|
/* USER CODE END FMC_Init 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t FMC_Initialized = 0;
|
||||||
|
|
||||||
|
static void HAL_FMC_MspInit(void){
|
||||||
|
/* USER CODE BEGIN FMC_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FMC_MspInit 0 */
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if (FMC_Initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FMC_Initialized = 1;
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_FMC;
|
||||||
|
PeriphClkInitStruct.FmcClockSelection = RCC_FMCCLKSOURCE_D1HCLK;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_FMC_CLK_ENABLE();
|
||||||
|
|
||||||
|
/** FMC GPIO Configuration
|
||||||
|
PI9 ------> FMC_D30
|
||||||
|
PI10 ------> FMC_D31
|
||||||
|
PF0 ------> FMC_A0
|
||||||
|
PF1 ------> FMC_A1
|
||||||
|
PF2 ------> FMC_A2
|
||||||
|
PF3 ------> FMC_A3
|
||||||
|
PF4 ------> FMC_A4
|
||||||
|
PF5 ------> FMC_A5
|
||||||
|
PC2_C ------> FMC_SDNE0
|
||||||
|
PC3_C ------> FMC_SDCKE0
|
||||||
|
PH5 ------> FMC_SDNWE
|
||||||
|
PF11 ------> FMC_SDNRAS
|
||||||
|
PF12 ------> FMC_A6
|
||||||
|
PF13 ------> FMC_A7
|
||||||
|
PF14 ------> FMC_A8
|
||||||
|
PF15 ------> FMC_A9
|
||||||
|
PG0 ------> FMC_A10
|
||||||
|
PG1 ------> FMC_A11
|
||||||
|
PE7 ------> FMC_D4
|
||||||
|
PE8 ------> FMC_D5
|
||||||
|
PE9 ------> FMC_D6
|
||||||
|
PE10 ------> FMC_D7
|
||||||
|
PE11 ------> FMC_D8
|
||||||
|
PE12 ------> FMC_D9
|
||||||
|
PE13 ------> FMC_D10
|
||||||
|
PE14 ------> FMC_D11
|
||||||
|
PE15 ------> FMC_D12
|
||||||
|
PH8 ------> FMC_D16
|
||||||
|
PH9 ------> FMC_D17
|
||||||
|
PH10 ------> FMC_D18
|
||||||
|
PH11 ------> FMC_D19
|
||||||
|
PH12 ------> FMC_D20
|
||||||
|
PD8 ------> FMC_D13
|
||||||
|
PD9 ------> FMC_D14
|
||||||
|
PD10 ------> FMC_D15
|
||||||
|
PD14 ------> FMC_D0
|
||||||
|
PD15 ------> FMC_D1
|
||||||
|
PG2 ------> FMC_A12
|
||||||
|
PG4 ------> FMC_BA0
|
||||||
|
PG5 ------> FMC_BA1
|
||||||
|
PG8 ------> FMC_SDCLK
|
||||||
|
PH13 ------> FMC_D21
|
||||||
|
PH14 ------> FMC_D22
|
||||||
|
PH15 ------> FMC_D23
|
||||||
|
PI0 ------> FMC_D24
|
||||||
|
PI1 ------> FMC_D25
|
||||||
|
PI2 ------> FMC_D26
|
||||||
|
PI3 ------> FMC_D27
|
||||||
|
PD0 ------> FMC_D2
|
||||||
|
PD1 ------> FMC_D3
|
||||||
|
PG15 ------> FMC_SDNCAS
|
||||||
|
PE0 ------> FMC_NBL0
|
||||||
|
PE1 ------> FMC_NBL1
|
||||||
|
PI4 ------> FMC_NBL2
|
||||||
|
PI5 ------> FMC_NBL3
|
||||||
|
PI6 ------> FMC_D28
|
||||||
|
PI7 ------> FMC_D29
|
||||||
|
*/
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_0|GPIO_PIN_1
|
||||||
|
|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|
||||||
|
|GPIO_PIN_6|GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|
||||||
|
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_11|GPIO_PIN_12
|
||||||
|
|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_4
|
||||||
|
|GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FMC_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FMC_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef* sdramHandle){
|
||||||
|
/* USER CODE BEGIN SDRAM_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SDRAM_MspInit 0 */
|
||||||
|
HAL_FMC_MspInit();
|
||||||
|
/* USER CODE BEGIN SDRAM_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SDRAM_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t FMC_DeInitialized = 0;
|
||||||
|
|
||||||
|
static void HAL_FMC_MspDeInit(void){
|
||||||
|
/* USER CODE BEGIN FMC_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FMC_MspDeInit 0 */
|
||||||
|
if (FMC_DeInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FMC_DeInitialized = 1;
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_FMC_CLK_DISABLE();
|
||||||
|
|
||||||
|
/** FMC GPIO Configuration
|
||||||
|
PI9 ------> FMC_D30
|
||||||
|
PI10 ------> FMC_D31
|
||||||
|
PF0 ------> FMC_A0
|
||||||
|
PF1 ------> FMC_A1
|
||||||
|
PF2 ------> FMC_A2
|
||||||
|
PF3 ------> FMC_A3
|
||||||
|
PF4 ------> FMC_A4
|
||||||
|
PF5 ------> FMC_A5
|
||||||
|
PC2_C ------> FMC_SDNE0
|
||||||
|
PC3_C ------> FMC_SDCKE0
|
||||||
|
PH5 ------> FMC_SDNWE
|
||||||
|
PF11 ------> FMC_SDNRAS
|
||||||
|
PF12 ------> FMC_A6
|
||||||
|
PF13 ------> FMC_A7
|
||||||
|
PF14 ------> FMC_A8
|
||||||
|
PF15 ------> FMC_A9
|
||||||
|
PG0 ------> FMC_A10
|
||||||
|
PG1 ------> FMC_A11
|
||||||
|
PE7 ------> FMC_D4
|
||||||
|
PE8 ------> FMC_D5
|
||||||
|
PE9 ------> FMC_D6
|
||||||
|
PE10 ------> FMC_D7
|
||||||
|
PE11 ------> FMC_D8
|
||||||
|
PE12 ------> FMC_D9
|
||||||
|
PE13 ------> FMC_D10
|
||||||
|
PE14 ------> FMC_D11
|
||||||
|
PE15 ------> FMC_D12
|
||||||
|
PH8 ------> FMC_D16
|
||||||
|
PH9 ------> FMC_D17
|
||||||
|
PH10 ------> FMC_D18
|
||||||
|
PH11 ------> FMC_D19
|
||||||
|
PH12 ------> FMC_D20
|
||||||
|
PD8 ------> FMC_D13
|
||||||
|
PD9 ------> FMC_D14
|
||||||
|
PD10 ------> FMC_D15
|
||||||
|
PD14 ------> FMC_D0
|
||||||
|
PD15 ------> FMC_D1
|
||||||
|
PG2 ------> FMC_A12
|
||||||
|
PG4 ------> FMC_BA0
|
||||||
|
PG5 ------> FMC_BA1
|
||||||
|
PG8 ------> FMC_SDCLK
|
||||||
|
PH13 ------> FMC_D21
|
||||||
|
PH14 ------> FMC_D22
|
||||||
|
PH15 ------> FMC_D23
|
||||||
|
PI0 ------> FMC_D24
|
||||||
|
PI1 ------> FMC_D25
|
||||||
|
PI2 ------> FMC_D26
|
||||||
|
PI3 ------> FMC_D27
|
||||||
|
PD0 ------> FMC_D2
|
||||||
|
PD1 ------> FMC_D3
|
||||||
|
PG15 ------> FMC_SDNCAS
|
||||||
|
PE0 ------> FMC_NBL0
|
||||||
|
PE1 ------> FMC_NBL1
|
||||||
|
PI4 ------> FMC_NBL2
|
||||||
|
PI5 ------> FMC_NBL3
|
||||||
|
PI6 ------> FMC_D28
|
||||||
|
PI7 ------> FMC_D29
|
||||||
|
*/
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOI, GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_0|GPIO_PIN_1
|
||||||
|
|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|
||||||
|
|GPIO_PIN_6|GPIO_PIN_7);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|
||||||
|
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_11|GPIO_PIN_12
|
||||||
|
|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_2|GPIO_PIN_3);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOH, GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_4
|
||||||
|
|GPIO_PIN_5|GPIO_PIN_8|GPIO_PIN_15);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOE, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FMC_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FMC_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef* sdramHandle){
|
||||||
|
/* USER CODE BEGIN SDRAM_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SDRAM_MspDeInit 0 */
|
||||||
|
HAL_FMC_MspDeInit();
|
||||||
|
/* USER CODE BEGIN SDRAM_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SDRAM_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
172
FW/Core/Src/gpio.c
Normal file
172
FW/Core/Src/gpio.c
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file gpio.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of all used GPIO pins.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "gpio.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Configure GPIO */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/** Configure pins as
|
||||||
|
* Analog
|
||||||
|
* Input
|
||||||
|
* Output
|
||||||
|
* EVENT_OUT
|
||||||
|
* EXTI
|
||||||
|
*/
|
||||||
|
void MX_GPIO_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
|
||||||
|
/* GPIO Ports Clock Enable */
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOE);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOI);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOC);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOF);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOH);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOA);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOB);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOG);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOE, LL_GPIO_PIN_3);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOI, LL_GPIO_PIN_8);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_1|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_8);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOH, LL_GPIO_PIN_7);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOG, LL_GPIO_PIN_3|LL_GPIO_PIN_13);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
LL_GPIO_SetOutputPin(GPIOD, LL_GPIO_PIN_11|LL_GPIO_PIN_12|LL_GPIO_PIN_13);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_2;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_8;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOI, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_13;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_1|LL_GPIO_PIN_4|LL_GPIO_PIN_5;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_12|LL_GPIO_PIN_13;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_8;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_13;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 2 */
|
||||||
|
|
||||||
|
/* USER CODE END 2 */
|
||||||
55
FW/Core/Src/iwdg.c
Normal file
55
FW/Core/Src/iwdg.c
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file iwdg.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the IWDG instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "iwdg.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* IWDG1 init function */
|
||||||
|
void MX_IWDG1_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN IWDG1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END IWDG1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN IWDG1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END IWDG1_Init 1 */
|
||||||
|
LL_IWDG_Enable(IWDG1);
|
||||||
|
LL_IWDG_EnableWriteAccess(IWDG1);
|
||||||
|
LL_IWDG_SetPrescaler(IWDG1, LL_IWDG_PRESCALER_16);
|
||||||
|
LL_IWDG_SetReloadCounter(IWDG1, 4095);
|
||||||
|
while (LL_IWDG_IsReady(IWDG1) != 1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
/* USER CODE BEGIN IWDG1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END IWDG1_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
85
FW/Core/Src/jpeg.c
Normal file
85
FW/Core/Src/jpeg.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file jpeg.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the JPEG instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "jpeg.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
JPEG_HandleTypeDef hjpeg;
|
||||||
|
|
||||||
|
/* JPEG init function */
|
||||||
|
void MX_JPEG_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN JPEG_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN JPEG_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_Init 1 */
|
||||||
|
hjpeg.Instance = JPEG;
|
||||||
|
if (HAL_JPEG_Init(&hjpeg) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN JPEG_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_JPEG_MspInit(JPEG_HandleTypeDef* jpegHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(jpegHandle->Instance==JPEG)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN JPEG_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspInit 0 */
|
||||||
|
/* JPEG clock enable */
|
||||||
|
__HAL_RCC_JPEG_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN JPEG_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_JPEG_MspDeInit(JPEG_HandleTypeDef* jpegHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(jpegHandle->Instance==JPEG)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN JPEG_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_JPEG_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN JPEG_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
360
FW/Core/Src/ltdc.c
Normal file
360
FW/Core/Src/ltdc.c
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file ltdc.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the LTDC instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "ltdc.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
#include "stm32h7xx_hal_ltdc.h"
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
LTDC_HandleTypeDef hltdc;
|
||||||
|
|
||||||
|
/* LTDC init function */
|
||||||
|
void MX_LTDC_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LTDC_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_Init 0 */
|
||||||
|
|
||||||
|
LTDC_LayerCfgTypeDef pLayerCfg = {0};
|
||||||
|
LTDC_LayerCfgTypeDef pLayerCfg1 = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LTDC_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_Init 1 */
|
||||||
|
hltdc.Instance = LTDC;
|
||||||
|
hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
|
||||||
|
hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
|
||||||
|
hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
|
||||||
|
hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
|
||||||
|
hltdc.Init.HorizontalSync = 0;
|
||||||
|
hltdc.Init.VerticalSync = 0;
|
||||||
|
hltdc.Init.AccumulatedHBP = 46;
|
||||||
|
hltdc.Init.AccumulatedVBP = 23;
|
||||||
|
hltdc.Init.AccumulatedActiveW = 846;
|
||||||
|
hltdc.Init.AccumulatedActiveH = 503;
|
||||||
|
hltdc.Init.TotalWidth = 1056;
|
||||||
|
hltdc.Init.TotalHeigh = 525;
|
||||||
|
hltdc.Init.Backcolor.Blue = 0;
|
||||||
|
hltdc.Init.Backcolor.Green = 0;
|
||||||
|
hltdc.Init.Backcolor.Red = 0;
|
||||||
|
if (HAL_LTDC_Init(&hltdc) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
pLayerCfg.WindowX0 = 0;
|
||||||
|
pLayerCfg.WindowX1 = 800;
|
||||||
|
pLayerCfg.WindowY0 = 0;
|
||||||
|
pLayerCfg.WindowY1 = 480;
|
||||||
|
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;
|
||||||
|
pLayerCfg.Alpha = 255;
|
||||||
|
pLayerCfg.Alpha0 = 0;
|
||||||
|
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
|
||||||
|
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
|
||||||
|
pLayerCfg.FBStartAdress = 0xC0000000;
|
||||||
|
pLayerCfg.ImageWidth = 800;
|
||||||
|
pLayerCfg.ImageHeight = 480;
|
||||||
|
pLayerCfg.Backcolor.Blue = 0;
|
||||||
|
pLayerCfg.Backcolor.Green = 0;
|
||||||
|
pLayerCfg.Backcolor.Red = 0;
|
||||||
|
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
pLayerCfg1.WindowX0 = 0;
|
||||||
|
pLayerCfg1.WindowX1 = 800;
|
||||||
|
pLayerCfg1.WindowY0 = 0;
|
||||||
|
pLayerCfg1.WindowY1 = 480;
|
||||||
|
pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;
|
||||||
|
pLayerCfg1.Alpha = 255;
|
||||||
|
pLayerCfg1.Alpha0 = 0;
|
||||||
|
pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
|
||||||
|
pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
|
||||||
|
pLayerCfg1.FBStartAdress = 0xC0177000;
|
||||||
|
pLayerCfg1.ImageWidth = 800;
|
||||||
|
pLayerCfg1.ImageHeight = 480;
|
||||||
|
pLayerCfg1.Backcolor.Blue = 0;
|
||||||
|
pLayerCfg1.Backcolor.Green = 0;
|
||||||
|
pLayerCfg1.Backcolor.Red = 0;
|
||||||
|
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN LTDC_Init 2 */
|
||||||
|
//HAL_LTDC_ProgramLineEvent(&hltdc,0);
|
||||||
|
//__HAL_LTDC_ENABLE_IT(&hltdc, LTDC_IT_LI);
|
||||||
|
/* USER CODE END LTDC_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_LTDC_MspInit(LTDC_HandleTypeDef* ltdcHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
if(ltdcHandle->Instance==LTDC)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LTDC_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3M = 1;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3N = 18;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3P = 2;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3Q = 2;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3R = 5;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_3;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOMEDIUM;
|
||||||
|
PeriphClkInitStruct.PLL3.PLL3FRACN = 6144;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LTDC clock enable */
|
||||||
|
__HAL_RCC_LTDC_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOI_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
/**LTDC GPIO Configuration
|
||||||
|
PE4 ------> LTDC_B0
|
||||||
|
PE5 ------> LTDC_G0
|
||||||
|
PE6 ------> LTDC_G1
|
||||||
|
PI11 ------> LTDC_G6
|
||||||
|
PF10 ------> LTDC_DE
|
||||||
|
PC0 ------> LTDC_R5
|
||||||
|
PA1 ------> LTDC_R2
|
||||||
|
PA2 ------> LTDC_R1
|
||||||
|
PH2 ------> LTDC_R0
|
||||||
|
PH4 ------> LTDC_G5
|
||||||
|
PA3 ------> LTDC_B5
|
||||||
|
PA4 ------> LTDC_VSYNC
|
||||||
|
PA5 ------> LTDC_R4
|
||||||
|
PA6 ------> LTDC_G2
|
||||||
|
PB0 ------> LTDC_R3
|
||||||
|
PB1 ------> LTDC_R6
|
||||||
|
PB10 ------> LTDC_G4
|
||||||
|
PG6 ------> LTDC_R7
|
||||||
|
PG7 ------> LTDC_CLK
|
||||||
|
PC6 ------> LTDC_HSYNC
|
||||||
|
PC9 ------> LTDC_B2
|
||||||
|
PA8 ------> LTDC_B3
|
||||||
|
PA10 ------> LTDC_B4
|
||||||
|
PD3 ------> LTDC_G7
|
||||||
|
PG10 ------> LTDC_G3
|
||||||
|
PG12 ------> LTDC_B1
|
||||||
|
PB8 ------> LTDC_B6
|
||||||
|
PB9 ------> LTDC_B7
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_6|GPIO_PIN_9;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4
|
||||||
|
|GPIO_PIN_5|GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_4;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_8|GPIO_PIN_9;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_12;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF13_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_3;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
HAL_I2CEx_EnableFastModePlus(SYSCFG_PMCR_I2C_PB8_FMP);
|
||||||
|
|
||||||
|
HAL_I2CEx_EnableFastModePlus(SYSCFG_PMCR_I2C_PB9_FMP);
|
||||||
|
|
||||||
|
/* LTDC interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(LTDC_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(LTDC_IRQn);
|
||||||
|
/* USER CODE BEGIN LTDC_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* ltdcHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(ltdcHandle->Instance==LTDC)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LTDC_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_LTDC_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**LTDC GPIO Configuration
|
||||||
|
PE4 ------> LTDC_B0
|
||||||
|
PE5 ------> LTDC_G0
|
||||||
|
PE6 ------> LTDC_G1
|
||||||
|
PI11 ------> LTDC_G6
|
||||||
|
PF10 ------> LTDC_DE
|
||||||
|
PC0 ------> LTDC_R5
|
||||||
|
PA1 ------> LTDC_R2
|
||||||
|
PA2 ------> LTDC_R1
|
||||||
|
PH2 ------> LTDC_R0
|
||||||
|
PH4 ------> LTDC_G5
|
||||||
|
PA3 ------> LTDC_B5
|
||||||
|
PA4 ------> LTDC_VSYNC
|
||||||
|
PA5 ------> LTDC_R4
|
||||||
|
PA6 ------> LTDC_G2
|
||||||
|
PB0 ------> LTDC_R3
|
||||||
|
PB1 ------> LTDC_R6
|
||||||
|
PB10 ------> LTDC_G4
|
||||||
|
PG6 ------> LTDC_R7
|
||||||
|
PG7 ------> LTDC_CLK
|
||||||
|
PC6 ------> LTDC_HSYNC
|
||||||
|
PC9 ------> LTDC_B2
|
||||||
|
PA8 ------> LTDC_B3
|
||||||
|
PA10 ------> LTDC_B4
|
||||||
|
PD3 ------> LTDC_G7
|
||||||
|
PG10 ------> LTDC_G3
|
||||||
|
PG12 ------> LTDC_B1
|
||||||
|
PB8 ------> LTDC_B6
|
||||||
|
PB9 ------> LTDC_B7
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOI, GPIO_PIN_11);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_10);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_6|GPIO_PIN_9);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4
|
||||||
|
|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_8|GPIO_PIN_10);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOH, GPIO_PIN_2|GPIO_PIN_4);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_10|GPIO_PIN_8
|
||||||
|
|GPIO_PIN_9);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_10|GPIO_PIN_12);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_3);
|
||||||
|
|
||||||
|
/* LTDC interrupt Deinit */
|
||||||
|
HAL_NVIC_DisableIRQ(LTDC_IRQn);
|
||||||
|
/* USER CODE BEGIN LTDC_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
338
FW/Core/Src/main.c
Normal file
338
FW/Core/Src/main.c
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file : main.c
|
||||||
|
* @brief : Main program body
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
#include "dma.h"
|
||||||
|
#include "dma2d.h"
|
||||||
|
#include "fatfs.h"
|
||||||
|
#include "fdcan.h"
|
||||||
|
#include "iwdg.h"
|
||||||
|
#include "jpeg.h"
|
||||||
|
#include "usart.h"
|
||||||
|
#include "ltdc.h"
|
||||||
|
#include "quadspi.h"
|
||||||
|
#include "rtc.h"
|
||||||
|
#include "spi.h"
|
||||||
|
#include "tim.h"
|
||||||
|
#include "usb_host.h"
|
||||||
|
#include "gpio.h"
|
||||||
|
#include "fmc.h"
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
#include "HW_config.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
#include "CnCpp.h"
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PTD */
|
||||||
|
|
||||||
|
/* USER CODE END PTD */
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PD */
|
||||||
|
|
||||||
|
/* USER CODE END PD */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PM */
|
||||||
|
|
||||||
|
/* USER CODE END PM */
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
|
/* USER CODE END PV */
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
void SystemClock_Config(void);
|
||||||
|
static void MPU_Config(void);
|
||||||
|
void MX_USB_HOST_Process(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN PFP */
|
||||||
|
static void MX_CRC_Init(void);
|
||||||
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
|
/* Private user code ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
/**
|
||||||
|
* @brief CRC Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_CRC_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN CRC_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END CRC_Init 0 */
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_CRC);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN CRC_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END CRC_Init 1 */
|
||||||
|
LL_CRC_SetInputDataReverseMode(CRC, LL_CRC_INDATA_REVERSE_NONE);
|
||||||
|
LL_CRC_SetOutputDataReverseMode(CRC, LL_CRC_OUTDATA_REVERSE_NONE);
|
||||||
|
LL_CRC_SetPolynomialCoef(CRC, LL_CRC_DEFAULT_CRC32_POLY);
|
||||||
|
LL_CRC_SetPolynomialSize(CRC, LL_CRC_POLYLENGTH_32B);
|
||||||
|
LL_CRC_SetInitialData(CRC, LL_CRC_DEFAULT_CRC_INITVALUE);
|
||||||
|
/* USER CODE BEGIN CRC_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END CRC_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void WaitSdramRdy()
|
||||||
|
{
|
||||||
|
volatile unsigned int aWait;
|
||||||
|
for(aWait=0; aWait<1000000; aWait++);
|
||||||
|
}
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The application entry point.
|
||||||
|
* @retval int
|
||||||
|
*/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/* MPU Configuration--------------------------------------------------------*/
|
||||||
|
MPU_Config();
|
||||||
|
/* Enable the CPU Cache */
|
||||||
|
|
||||||
|
/* Enable I-Cache---------------------------------------------------------*/
|
||||||
|
SCB_EnableICache();
|
||||||
|
|
||||||
|
/* Enable D-Cache---------------------------------------------------------*/
|
||||||
|
SCB_EnableDCache();
|
||||||
|
|
||||||
|
/* MCU Configuration--------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
|
HAL_Init();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Init */
|
||||||
|
|
||||||
|
/* USER CODE END Init */
|
||||||
|
|
||||||
|
/* Configure the system clock */
|
||||||
|
SystemClock_Config();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SysInit */
|
||||||
|
SystemCoreClockUpdate();
|
||||||
|
HAL_SYSTICK_Config(SystemCoreClock / 1000);//1ms
|
||||||
|
//HAL_Delay(100);
|
||||||
|
/* USER CODE END SysInit */
|
||||||
|
|
||||||
|
/* Initialize all configured peripherals */
|
||||||
|
MX_GPIO_Init();
|
||||||
|
WaitSdramRdy();
|
||||||
|
MX_DMA_Init();
|
||||||
|
MX_FMC_Init();
|
||||||
|
MX_QUADSPI_Init();
|
||||||
|
MX_FDCAN2_Init();
|
||||||
|
MX_USART1_UART_Init();
|
||||||
|
MX_USART2_UART_Init();
|
||||||
|
MX_USART3_UART_Init();
|
||||||
|
MX_UART4_Init();
|
||||||
|
MX_UART5_Init();
|
||||||
|
MX_USART6_UART_Init();
|
||||||
|
MX_UART7_Init();
|
||||||
|
MX_LPUART1_UART_Init();
|
||||||
|
MX_TIM2_Init();
|
||||||
|
MX_TIM3_Init();
|
||||||
|
MX_TIM12_Init();
|
||||||
|
MX_TIM6_Init();
|
||||||
|
MX_TIM7_Init();
|
||||||
|
MX_DMA2D_Init();
|
||||||
|
MX_LTDC_Init();
|
||||||
|
MX_SPI1_Init();
|
||||||
|
|
||||||
|
MX_IWDG1_Init();
|
||||||
|
|
||||||
|
MX_USB_DEVICE_Init();
|
||||||
|
HAL_Delay(5);
|
||||||
|
MX_USB_DEVICE_DeInit();
|
||||||
|
HAL_Delay(5);
|
||||||
|
UsbConfigSetState(0);
|
||||||
|
usb_is_host = 1;
|
||||||
|
|
||||||
|
MX_USB_HOST_Init();
|
||||||
|
MX_FATFS_Init();
|
||||||
|
|
||||||
|
//MX_JPEG_Init();
|
||||||
|
MX_RTC_Init();
|
||||||
|
MX_CRC_Init();
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
/* USER CODE BEGIN 2 */
|
||||||
|
HAL_Delay(10);
|
||||||
|
HW_init();
|
||||||
|
HAL_Delay(10);
|
||||||
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
|
/* Infinite loop */
|
||||||
|
/* USER CODE BEGIN WHILE */
|
||||||
|
CppGuiInit();
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
operation_finction();
|
||||||
|
/* USER CODE END WHILE */
|
||||||
|
MX_USB_HOST_Process();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 3 */
|
||||||
|
}
|
||||||
|
/* USER CODE END 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System Clock Configuration
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void SystemClock_Config(void)
|
||||||
|
{
|
||||||
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Supply configuration update enable
|
||||||
|
*/
|
||||||
|
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
|
||||||
|
|
||||||
|
/** Configure the main internal regulator output voltage
|
||||||
|
*/
|
||||||
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
|
||||||
|
|
||||||
|
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
|
||||||
|
|
||||||
|
/** Configure LSE Drive Capability
|
||||||
|
*/
|
||||||
|
HAL_PWR_EnableBkUpAccess();
|
||||||
|
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);
|
||||||
|
|
||||||
|
/** Initializes the RCC Oscillators according to the specified parameters
|
||||||
|
* in the RCC_OscInitTypeDef structure.
|
||||||
|
*/
|
||||||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE
|
||||||
|
|RCC_OSCILLATORTYPE_LSE;
|
||||||
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||||
|
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
||||||
|
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||||
|
RCC_OscInitStruct.PLL.PLLM = 1;
|
||||||
|
RCC_OscInitStruct.PLL.PLLN = 120;
|
||||||
|
RCC_OscInitStruct.PLL.PLLP = 2;
|
||||||
|
RCC_OscInitStruct.PLL.PLLQ = 20;
|
||||||
|
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||||
|
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3;
|
||||||
|
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
|
||||||
|
RCC_OscInitStruct.PLL.PLLFRACN = 0;
|
||||||
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes the CPU, AHB and APB buses clocks
|
||||||
|
*/
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||||
|
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|
||||||
|
|RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
|
||||||
|
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
|
||||||
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
|
||||||
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
|
||||||
|
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
|
||||||
|
|
||||||
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 4 */
|
||||||
|
|
||||||
|
/* USER CODE END 4 */
|
||||||
|
|
||||||
|
/* MPU Configuration */
|
||||||
|
|
||||||
|
void MPU_Config(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Disables the MPU */
|
||||||
|
LL_MPU_Disable();
|
||||||
|
|
||||||
|
/** Initializes and configures the Region and the memory to be protected
|
||||||
|
*/
|
||||||
|
LL_MPU_ConfigRegion(LL_MPU_REGION_NUMBER0, 0x87, 0x0, LL_MPU_REGION_SIZE_4GB|LL_MPU_TEX_LEVEL0|LL_MPU_REGION_NO_ACCESS|LL_MPU_INSTRUCTION_ACCESS_DISABLE|LL_MPU_ACCESS_SHAREABLE|LL_MPU_ACCESS_NOT_CACHEABLE|LL_MPU_ACCESS_NOT_BUFFERABLE);
|
||||||
|
|
||||||
|
/** Initializes and configures the Region and the memory to be protected
|
||||||
|
*/
|
||||||
|
LL_MPU_ConfigRegion(LL_MPU_REGION_NUMBER1, 0x0, 0xC0000000, LL_MPU_REGION_SIZE_64MB|LL_MPU_TEX_LEVEL0|LL_MPU_REGION_FULL_ACCESS|LL_MPU_INSTRUCTION_ACCESS_ENABLE|LL_MPU_ACCESS_NOT_SHAREABLE|LL_MPU_ACCESS_CACHEABLE|LL_MPU_ACCESS_BUFFERABLE);
|
||||||
|
/* Enables the MPU */
|
||||||
|
LL_MPU_Enable(LL_MPU_CTRL_PRIVILEGED_DEFAULT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function is executed in case of error occurrence.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void Error_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN Error_Handler_Debug */
|
||||||
|
/* User can add his own implementation to report the HAL error return state */
|
||||||
|
__disable_irq();
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
GPIOC->ODR ^=0x0020;
|
||||||
|
HAL_Delay(800);
|
||||||
|
}
|
||||||
|
/* USER CODE END Error_Handler_Debug */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
/**
|
||||||
|
* @brief Reports the name of the source file and the source line number
|
||||||
|
* where the assert_param error has occurred.
|
||||||
|
* @param file: pointer to the source file name
|
||||||
|
* @param line: assert_param error line source number
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void assert_failed(uint8_t *file, uint32_t line)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN 6 */
|
||||||
|
/* User can add his own implementation to report the file name and line number,
|
||||||
|
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||||
|
/* USER CODE END 6 */
|
||||||
|
}
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
212
FW/Core/Src/quadspi.c
Normal file
212
FW/Core/Src/quadspi.c
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file quadspi.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the QUADSPI instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "quadspi.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
QSPI_HandleTypeDef hqspi;
|
||||||
|
|
||||||
|
/* QUADSPI init function */
|
||||||
|
void MX_QUADSPI_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN QUADSPI_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END QUADSPI_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN QUADSPI_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END QUADSPI_Init 1 */
|
||||||
|
hqspi.Instance = QUADSPI;
|
||||||
|
hqspi.Init.ClockPrescaler = 9;
|
||||||
|
hqspi.Init.FifoThreshold = 4;
|
||||||
|
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
|
||||||
|
hqspi.Init.FlashSize = 24;
|
||||||
|
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_4_CYCLE;
|
||||||
|
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
|
||||||
|
hqspi.Init.FlashID = QSPI_FLASH_ID_1;
|
||||||
|
hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;
|
||||||
|
if (HAL_QSPI_Init(&hqspi) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN QUADSPI_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END QUADSPI_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_QSPI_MspInit(QSPI_HandleTypeDef* qspiHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
if(qspiHandle->Instance==QUADSPI)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN QUADSPI_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END QUADSPI_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_QSPI;
|
||||||
|
PeriphClkInitStruct.QspiClockSelection = RCC_QSPICLKSOURCE_D1HCLK;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* QUADSPI clock enable */
|
||||||
|
__HAL_RCC_QSPI_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**QUADSPI GPIO Configuration
|
||||||
|
PF6 ------> QUADSPI_BK1_IO3
|
||||||
|
PF7 ------> QUADSPI_BK1_IO2
|
||||||
|
PF8 ------> QUADSPI_BK1_IO0
|
||||||
|
PF9 ------> QUADSPI_BK1_IO1
|
||||||
|
PB2 ------> QUADSPI_CLK
|
||||||
|
PB6 ------> QUADSPI_BK1_NCS
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
|
||||||
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
|
||||||
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN QUADSPI_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END QUADSPI_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* qspiHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(qspiHandle->Instance==QUADSPI)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN QUADSPI_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END QUADSPI_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_QSPI_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**QUADSPI GPIO Configuration
|
||||||
|
PF6 ------> QUADSPI_BK1_IO3
|
||||||
|
PF7 ------> QUADSPI_BK1_IO2
|
||||||
|
PF8 ------> QUADSPI_BK1_IO0
|
||||||
|
PF9 ------> QUADSPI_BK1_IO1
|
||||||
|
PB2 ------> QUADSPI_CLK
|
||||||
|
PB6 ------> QUADSPI_BK1_NCS
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_2|GPIO_PIN_6);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN QUADSPI_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END QUADSPI_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
//QSPI发送命令
|
||||||
|
//instruction:要发送的指令
|
||||||
|
//address:发送到的目的地址
|
||||||
|
//dummyCycles:空指令周期数
|
||||||
|
// instructionMode:指令模式;QSPI_INSTRUCTION_NONE,QSPI_INSTRUCTION_1_LINE,QSPI_INSTRUCTION_2_LINE,QSPI_INSTRUCTION_4_LINE
|
||||||
|
// addressMode:地址模式; QSPI_ADDRESS_NONE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_2_LINE,QSPI_ADDRESS_4_LINE
|
||||||
|
// addressSize:地址长度;QSPI_ADDRESS_8_BITS,QSPI_ADDRESS_16_BITS,QSPI_ADDRESS_24_BITS,QSPI_ADDRESS_32_BITS
|
||||||
|
// dataMode:数据模式; QSPI_DATA_NONE,QSPI_DATA_1_LINE,QSPI_DATA_2_LINE,QSPI_DATA_4_LINE
|
||||||
|
|
||||||
|
void QSPI_Send_CMD(unsigned int instruction,unsigned int address,unsigned int dummyCycles,unsigned int instructionMode,unsigned int addressMode,unsigned int addressSize,unsigned int dataMode)
|
||||||
|
{
|
||||||
|
QSPI_CommandTypeDef Cmdhandler;
|
||||||
|
|
||||||
|
Cmdhandler.Instruction=instruction; //指令
|
||||||
|
Cmdhandler.Address=address; //地址
|
||||||
|
Cmdhandler.DummyCycles=dummyCycles; //设置空指令周期数
|
||||||
|
Cmdhandler.InstructionMode=instructionMode; //指令模式
|
||||||
|
Cmdhandler.AddressMode=addressMode; //地址模式
|
||||||
|
Cmdhandler.AddressSize=addressSize; //地址长度
|
||||||
|
Cmdhandler.DataMode=dataMode; //数据模式
|
||||||
|
Cmdhandler.SIOOMode=QSPI_SIOO_INST_EVERY_CMD; //每次都发送指令
|
||||||
|
Cmdhandler.AlternateByteMode=QSPI_ALTERNATE_BYTES_NONE; //无交替字节
|
||||||
|
Cmdhandler.DdrMode=QSPI_DDR_MODE_DISABLE; //关闭DDR模式
|
||||||
|
Cmdhandler.DdrHoldHalfCycle=QSPI_DDR_HHC_ANALOG_DELAY;
|
||||||
|
|
||||||
|
if(HAL_QSPI_Command(&hqspi,&Cmdhandler,5000) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//QSPI接收指定长度的数据
|
||||||
|
//buf:接收数据缓冲区首地址
|
||||||
|
//datalen:要传输的数据长度
|
||||||
|
//返回值:0,正常
|
||||||
|
// 其他,错误代码
|
||||||
|
unsigned char QSPI_Receive(unsigned char* buf,unsigned int datalen)
|
||||||
|
{
|
||||||
|
hqspi.Instance->DLR=datalen-1; //配置数据长度
|
||||||
|
if(HAL_QSPI_Receive(&hqspi,buf,5000)==HAL_OK) return 0; //接收数据
|
||||||
|
else return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//QSPI发送指定长度的数据
|
||||||
|
//buf:发送数据缓冲区首地址
|
||||||
|
//datalen:要传输的数据长度
|
||||||
|
//返回值:0,正常
|
||||||
|
// 其他,错误代码
|
||||||
|
unsigned char QSPI_Transmit(unsigned char* buf,unsigned int datalen)
|
||||||
|
{
|
||||||
|
hqspi.Instance->DLR=datalen-1; //配置数据长度
|
||||||
|
if(HAL_QSPI_Transmit(&hqspi,buf,5000)==HAL_OK) return 0; //发送数据
|
||||||
|
else return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
149
FW/Core/Src/rtc.c
Normal file
149
FW/Core/Src/rtc.c
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file rtc.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the RTC instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "rtc.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* RTC init function */
|
||||||
|
void MX_RTC_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN RTC_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END RTC_Init 0 */
|
||||||
|
|
||||||
|
LL_RTC_InitTypeDef RTC_InitStruct = {0};
|
||||||
|
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||||
|
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_RCC_EnableRTC();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN RTC_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END RTC_Init 1 */
|
||||||
|
RTC_InitStruct.HourFormat = LL_RTC_HOURFORMAT_24HOUR;
|
||||||
|
RTC_InitStruct.AsynchPrescaler = 127;
|
||||||
|
RTC_InitStruct.SynchPrescaler = 255;
|
||||||
|
LL_RTC_Init(RTC, &RTC_InitStruct);
|
||||||
|
/* USER CODE BEGIN RTC_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END RTC_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
LL_RTC_TimeTypeDef RTC_TimeStruct = {0};
|
||||||
|
LL_RTC_DateTypeDef RTC_DateStruct = {0};
|
||||||
|
|
||||||
|
void RTC_Config(void)
|
||||||
|
{
|
||||||
|
LL_RTC_InitTypeDef RTC_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_RTC_WaitForSynchro(RTC);
|
||||||
|
|
||||||
|
RTC_InitStruct.HourFormat = LL_RTC_HOURFORMAT_24HOUR;
|
||||||
|
RTC_InitStruct.AsynchPrescaler = 127;
|
||||||
|
RTC_InitStruct.SynchPrescaler = 255;
|
||||||
|
LL_RTC_Init(RTC, &RTC_InitStruct);
|
||||||
|
|
||||||
|
RTC_TimeStruct.TimeFormat = LL_RTC_HOURFORMAT_24HOUR;
|
||||||
|
RTC_TimeStruct.Hours = 0x10;
|
||||||
|
RTC_TimeStruct.Minutes = 0x25;
|
||||||
|
RTC_TimeStruct.Seconds = 0x02;
|
||||||
|
LL_RTC_TIME_Init(RTC, LL_RTC_FORMAT_BCD, &RTC_TimeStruct);
|
||||||
|
|
||||||
|
RTC_DateStruct.Year = 0x24;
|
||||||
|
RTC_DateStruct.Month = LL_RTC_MONTH_NOVEMBER;
|
||||||
|
RTC_DateStruct.Day = 0x05;
|
||||||
|
RTC_DateStruct.WeekDay = LL_RTC_WEEKDAY_TUESDAY;
|
||||||
|
LL_RTC_DATE_Init(RTC, LL_RTC_FORMAT_BCD, &RTC_DateStruct);
|
||||||
|
|
||||||
|
LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, 0x32F2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RTC_TimeShow(void)
|
||||||
|
{
|
||||||
|
/* Get the current Time */
|
||||||
|
RTC_TimeStruct.Hours = LL_RTC_TIME_GetHour(RTC);
|
||||||
|
RTC_TimeStruct.Minutes = LL_RTC_TIME_GetMinute(RTC);
|
||||||
|
RTC_TimeStruct.Seconds = LL_RTC_TIME_GetSecond(RTC);
|
||||||
|
|
||||||
|
RTC_DateStruct.Year = LL_RTC_DATE_GetYear(RTC);
|
||||||
|
RTC_DateStruct.Month = LL_RTC_DATE_GetMonth(RTC);
|
||||||
|
RTC_DateStruct.Day = LL_RTC_DATE_GetDay(RTC);
|
||||||
|
RTC_DateStruct.WeekDay = LL_RTC_DATE_GetWeekDay(RTC);
|
||||||
|
|
||||||
|
SystemDataTimeUpdata( RTC_DateStruct.Year,
|
||||||
|
RTC_DateStruct.Month,
|
||||||
|
RTC_DateStruct.Day,
|
||||||
|
RTC_TimeStruct.Hours,
|
||||||
|
RTC_TimeStruct.Minutes,
|
||||||
|
RTC_TimeStruct.Seconds
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rtc_init()
|
||||||
|
{
|
||||||
|
if(0x32F2 != (LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR0)))
|
||||||
|
{
|
||||||
|
RTC_Config();
|
||||||
|
RTC_TimeShow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RTC_TimeShow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RTC_DataTimeSet(unsigned char aY, unsigned char aM, unsigned char aD, unsigned char aH, unsigned char aMin, unsigned char aSec, unsigned char aWk)
|
||||||
|
{
|
||||||
|
if((!aY)||(!aM)||(!aD))return;
|
||||||
|
|
||||||
|
LL_RTC_WaitForSynchro(RTC);
|
||||||
|
|
||||||
|
RTC_TimeStruct.Hours = aH;
|
||||||
|
RTC_TimeStruct.Minutes = aMin;
|
||||||
|
RTC_TimeStruct.Seconds = aSec;
|
||||||
|
|
||||||
|
RTC_DateStruct.Year = aY;
|
||||||
|
RTC_DateStruct.Month = aM;
|
||||||
|
RTC_DateStruct.Day = aD;
|
||||||
|
|
||||||
|
RTC_DateStruct.WeekDay = aWk;
|
||||||
|
|
||||||
|
LL_RTC_DATE_Init(RTC,LL_RTC_FORMAT_BCD, &RTC_DateStruct);
|
||||||
|
LL_RTC_TIME_Init(RTC,LL_RTC_FORMAT_BCD, &RTC_TimeStruct);
|
||||||
|
|
||||||
|
LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, 0x32F2);
|
||||||
|
}
|
||||||
|
/* USER CODE END 1 */
|
||||||
99
FW/Core/Src/spi.c
Normal file
99
FW/Core/Src/spi.c
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file spi.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the SPI instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "spi.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* SPI1 init function */
|
||||||
|
void MX_SPI1_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SPI1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI1_Init 0 */
|
||||||
|
|
||||||
|
LL_SPI_InitTypeDef SPI_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI1;
|
||||||
|
PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SPI1);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOG);
|
||||||
|
/**SPI1 GPIO Configuration
|
||||||
|
PD7 ------> SPI1_MOSI
|
||||||
|
PG9 ------> SPI1_MISO
|
||||||
|
PG11 ------> SPI1_SCK
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
|
||||||
|
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_9|LL_GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
|
||||||
|
LL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SPI1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI1_Init 1 */
|
||||||
|
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
||||||
|
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
||||||
|
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
||||||
|
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
|
||||||
|
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE;
|
||||||
|
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
||||||
|
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV16;
|
||||||
|
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
|
||||||
|
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
||||||
|
SPI_InitStruct.CRCPoly = 0x0;
|
||||||
|
LL_SPI_Init(SPI1, &SPI_InitStruct);
|
||||||
|
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
||||||
|
LL_SPI_EnableNSSPulseMgt(SPI1);
|
||||||
|
/* USER CODE BEGIN SPI1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI1_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
81
FW/Core/Src/stm32h7xx_hal_msp.c
Normal file
81
FW/Core/Src/stm32h7xx_hal_msp.c
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7xx_hal_msp.c
|
||||||
|
* @brief This file provides code for the MSP Initialization
|
||||||
|
* and de-Initialization codes.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN TD */
|
||||||
|
|
||||||
|
/* USER CODE END TD */
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Define */
|
||||||
|
|
||||||
|
/* USER CODE END Define */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Macro */
|
||||||
|
|
||||||
|
/* USER CODE END Macro */
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
|
/* USER CODE END PV */
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
|
/* External functions --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ExternalFunctions */
|
||||||
|
|
||||||
|
/* USER CODE END ExternalFunctions */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
/**
|
||||||
|
* Initializes the Global MSP.
|
||||||
|
*/
|
||||||
|
void HAL_MspInit(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END MspInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
|
/* System interrupt init*/
|
||||||
|
|
||||||
|
/* USER CODE BEGIN MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
749
FW/Core/Src/stm32h7xx_it.c
Normal file
749
FW/Core/Src/stm32h7xx_it.c
Normal file
@@ -0,0 +1,749 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7xx_it.c
|
||||||
|
* @brief Interrupt Service Routines.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
#include "stm32h7xx_it.h"
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
#include "HW_config.h"
|
||||||
|
#include "uart_fecbus_drv.h"
|
||||||
|
#include "uart_fec_std_drv.h"
|
||||||
|
#include "uart_lp_test_drv.h"
|
||||||
|
#include "task.h"
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN TD */
|
||||||
|
|
||||||
|
/* USER CODE END TD */
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PD */
|
||||||
|
|
||||||
|
/* USER CODE END PD */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PM */
|
||||||
|
|
||||||
|
/* USER CODE END PM */
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
|
/* USER CODE END PV */
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
|
/* Private user code ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* External variables --------------------------------------------------------*/
|
||||||
|
extern HCD_HandleTypeDef hhcd_USB_OTG_FS;
|
||||||
|
extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
||||||
|
extern FDCAN_HandleTypeDef hfdcan2;
|
||||||
|
extern LTDC_HandleTypeDef hltdc;
|
||||||
|
/* USER CODE BEGIN EV */
|
||||||
|
|
||||||
|
/* USER CODE END EV */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Cortex Processor Interruption and Exception Handlers */
|
||||||
|
/******************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief This function handles Non maskable interrupt.
|
||||||
|
*/
|
||||||
|
void NMI_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE END NonMaskableInt_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Hard fault interrupt.
|
||||||
|
*/
|
||||||
|
void HardFault_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN HardFault_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END HardFault_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
||||||
|
/* USER CODE END W1_HardFault_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Memory management fault.
|
||||||
|
*/
|
||||||
|
void MemManage_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END MemoryManagement_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
|
||||||
|
/* USER CODE END W1_MemoryManagement_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Pre-fetch fault, memory access fault.
|
||||||
|
*/
|
||||||
|
void BusFault_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN BusFault_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END BusFault_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
|
||||||
|
/* USER CODE END W1_BusFault_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Undefined instruction or illegal state.
|
||||||
|
*/
|
||||||
|
void UsageFault_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN UsageFault_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END UsageFault_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
|
||||||
|
/* USER CODE END W1_UsageFault_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles System service call via SWI instruction.
|
||||||
|
*/
|
||||||
|
void SVC_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SVCall_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SVCall_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN SVCall_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SVCall_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Debug monitor.
|
||||||
|
*/
|
||||||
|
void DebugMon_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DebugMonitor_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DebugMonitor_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Pendable request for system service.
|
||||||
|
*/
|
||||||
|
void PendSV_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN PendSV_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END PendSV_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN PendSV_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END PendSV_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles System tick timer.
|
||||||
|
*/
|
||||||
|
void SysTick_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SysTick_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SysTick_IRQn 0 */
|
||||||
|
HAL_IncTick();
|
||||||
|
/* USER CODE BEGIN SysTick_IRQn 1 */
|
||||||
|
my_sys_tick();
|
||||||
|
/* USER CODE END SysTick_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* STM32H7xx Peripheral Interrupt Handlers */
|
||||||
|
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||||
|
/* For the available peripheral interrupt handler names, */
|
||||||
|
/* please refer to the startup file (startup_stm32h7xx.s). */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles DMA1 stream3 global interrupt.
|
||||||
|
*/
|
||||||
|
void DMA1_Stream3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DMA1_Stream3_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA1_Stream3_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN DMA1_Stream3_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA1_Stream3_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles FDCAN2 interrupt 0.
|
||||||
|
*/
|
||||||
|
void FDCAN2_IT0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN FDCAN2_IT0_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_IT0_IRQn 0 */
|
||||||
|
HAL_FDCAN_IRQHandler(&hfdcan2);
|
||||||
|
/* USER CODE BEGIN FDCAN2_IT0_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_IT0_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles USART1 global interrupt.
|
||||||
|
*/
|
||||||
|
void USART1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART1_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[1];
|
||||||
|
/* USER CODE END USART1_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN USART1_IRQn 1 */
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(USART1))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(USART1);
|
||||||
|
|
||||||
|
if(p_uart_info->rx_index < UART_RX_BUF_MAX)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_buf[p_uart_info->rx_index] = cc;
|
||||||
|
p_uart_info->rx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_IDLE(USART1))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_IDLE(USART1);
|
||||||
|
if(p_uart_info->rx_index)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_len = p_uart_info->rx_index;
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
p_uart_info->rx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(USART1))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(USART1);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(USART1);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(USART1))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(USART1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(USART1, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(USART1);
|
||||||
|
/* USER CODE END USART1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles USART2 global interrupt.
|
||||||
|
*/
|
||||||
|
void USART2_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART2_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[2];
|
||||||
|
/* USER CODE END USART2_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN USART2_IRQn 1 */
|
||||||
|
fecbus_rx_irq();
|
||||||
|
/*
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(USART2))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(USART2);
|
||||||
|
|
||||||
|
if(p_uart_info->rx_index < UART_RX_BUF_MAX)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_buf[p_uart_info->rx_index] = cc;
|
||||||
|
p_uart_info->rx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_IDLE(USART2))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_IDLE(USART2);
|
||||||
|
if(p_uart_info->rx_index)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_len = p_uart_info->rx_index;
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
p_uart_info->rx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(USART2))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(USART2);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(USART2);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(USART2))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(USART2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(USART2, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(USART2);
|
||||||
|
/* USER CODE END USART2_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles USART3 global interrupt.
|
||||||
|
*/
|
||||||
|
void USART3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART3_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[3];
|
||||||
|
/* USER CODE END USART3_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN USART3_IRQn 1 */
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(USART3))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(USART3);
|
||||||
|
|
||||||
|
if(p_uart_info->rx_index < UART_RX_BUF_MAX)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_buf[p_uart_info->rx_index] = cc;
|
||||||
|
p_uart_info->rx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_IDLE(USART3))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_IDLE(USART3);
|
||||||
|
if(p_uart_info->rx_index)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_len = p_uart_info->rx_index;
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
p_uart_info->rx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(USART3))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(USART3);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(USART3);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(USART3))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(USART3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(USART3, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(USART3);
|
||||||
|
/* USER CODE END USART3_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles UART4 global interrupt.
|
||||||
|
*/
|
||||||
|
void UART4_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN UART4_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[4];
|
||||||
|
/* USER CODE END UART4_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN UART4_IRQn 1 */
|
||||||
|
fec_std_rx_irq();
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(UART4))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(UART4);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(UART4);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(UART4))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(UART4);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(UART4, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(UART4);
|
||||||
|
/* USER CODE END UART4_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles UART5 global interrupt.
|
||||||
|
*/
|
||||||
|
void UART5_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN UART5_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[5];
|
||||||
|
/* USER CODE END UART5_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN UART5_IRQn 1 */
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(UART5))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(UART5);
|
||||||
|
|
||||||
|
if(p_uart_info->rx_index < UART_RX_BUF_MAX)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_buf[p_uart_info->rx_index] = cc;
|
||||||
|
p_uart_info->rx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_IDLE(UART5))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_IDLE(UART5);
|
||||||
|
if(p_uart_info->rx_index)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_len = p_uart_info->rx_index;
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
p_uart_info->rx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(UART5))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(UART5);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(UART5);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(UART5))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(UART5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(UART5, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(UART5);
|
||||||
|
/* USER CODE END UART5_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles TIM7 global interrupt.
|
||||||
|
*/
|
||||||
|
void TIM7_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM7_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM7_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN TIM7_IRQn 1 */
|
||||||
|
if(LL_TIM_IsActiveFlag_UPDATE(TIM7))
|
||||||
|
{
|
||||||
|
LL_TIM_ClearFlag_UPDATE(TIM7);
|
||||||
|
//GPIOC->ODR^=0x20;
|
||||||
|
}
|
||||||
|
/* USER CODE END TIM7_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles USART6 global interrupt.
|
||||||
|
*/
|
||||||
|
void USART6_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART6_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[6];
|
||||||
|
/* USER CODE END USART6_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN USART6_IRQn 1 */
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(USART6))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(USART6);
|
||||||
|
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
p_uart_info->rx_complete = 1;
|
||||||
|
p_uart_info->rx_buf[p_uart_info->rx_index] = cc;
|
||||||
|
p_uart_info->rx_index++;
|
||||||
|
p_uart_info->rx_len = p_uart_info->rx_index;
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(USART6))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(USART6);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(USART6);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(USART6))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(USART6);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(USART6, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(USART6);
|
||||||
|
/* USER CODE END USART6_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles UART7 global interrupt.
|
||||||
|
*/
|
||||||
|
void UART7_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN UART7_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[7];
|
||||||
|
/* USER CODE END UART7_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN UART7_IRQn 1 */
|
||||||
|
/*
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(UART7))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(UART7);
|
||||||
|
|
||||||
|
if(cc == UART_HEAD)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
}
|
||||||
|
else if(cc == UART_END)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_len = p_uart_info->rx_index;
|
||||||
|
p_uart_info->rx_complete = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(p_uart_info->rx_index < UART_RX_BUF_MAX)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_buf[p_uart_info->rx_index] = cc;
|
||||||
|
p_uart_info->rx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_IDLE(UART7))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_IDLE(UART7);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(UART7))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(UART7);
|
||||||
|
|
||||||
|
if(p_uart_info->rx_index < UART_RX_BUF_MAX)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_buf[p_uart_info->rx_index] = cc;
|
||||||
|
p_uart_info->rx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_IDLE(UART7))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_IDLE(UART7);
|
||||||
|
if(p_uart_info->rx_index)
|
||||||
|
{
|
||||||
|
p_uart_info->rx_len = p_uart_info->rx_index;
|
||||||
|
p_uart_info->rx_index = 0;
|
||||||
|
p_uart_info->rx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(UART7))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(UART7);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(UART7);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(UART7))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(UART7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(UART7, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(UART7);
|
||||||
|
/* USER CODE END UART7_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles LTDC global interrupt.
|
||||||
|
*/
|
||||||
|
void LTDC_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LTDC_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_IRQn 0 */
|
||||||
|
HAL_LTDC_IRQHandler(&hltdc);
|
||||||
|
/* USER CODE BEGIN LTDC_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles USB On The Go FS global interrupt.
|
||||||
|
*/
|
||||||
|
void OTG_FS_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN OTG_FS_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END OTG_FS_IRQn 0 */
|
||||||
|
HAL_HCD_IRQHandler(&hhcd_USB_OTG_FS);
|
||||||
|
/* USER CODE BEGIN OTG_FS_IRQn 1 */
|
||||||
|
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
|
||||||
|
/* USER CODE END OTG_FS_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles LPUART1 global interrupt.
|
||||||
|
*/
|
||||||
|
void LPUART1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LPUART1_IRQn 0 */
|
||||||
|
unsigned short cc;
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[0];
|
||||||
|
/* USER CODE END LPUART1_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN LPUART1_IRQn 1 */
|
||||||
|
test_rx_irq();
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsActiveFlag_TC(LPUART1))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(LPUART1);
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(LPUART1);
|
||||||
|
p_uart_info->tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_TXFE(LPUART1))
|
||||||
|
{
|
||||||
|
if(p_uart_info->tx_index >= p_uart_info->tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXFE(LPUART1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(LPUART1, p_uart_info->tx_buf[p_uart_info->tx_index]);
|
||||||
|
p_uart_info->tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(LPUART1);
|
||||||
|
/* USER CODE END LPUART1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
450
FW/Core/Src/system_stm32h7xx.c
Normal file
450
FW/Core/Src/system_stm32h7xx.c
Normal file
@@ -0,0 +1,450 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file system_stm32h7xx.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief CMSIS Cortex-Mx Device Peripheral Access Layer System Source File.
|
||||||
|
*
|
||||||
|
* This file provides two functions and one global variable to be called from
|
||||||
|
* user application:
|
||||||
|
* - SystemInit(): This function is called at startup just after reset and
|
||||||
|
* before branch to main program. This call is made inside
|
||||||
|
* the "startup_stm32h7xx.s" file.
|
||||||
|
*
|
||||||
|
* - SystemCoreClock variable: Contains the core clock, it can be used
|
||||||
|
* by the user application to setup the SysTick
|
||||||
|
* timer or configure other parameters.
|
||||||
|
*
|
||||||
|
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
|
||||||
|
* be called whenever the core clock is changed
|
||||||
|
* during program execution.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2017 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.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup CMSIS
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup stm32h7xx_system
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_System_Private_Includes
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stm32h7xx.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#if !defined (HSE_VALUE)
|
||||||
|
#define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */
|
||||||
|
#endif /* HSE_VALUE */
|
||||||
|
|
||||||
|
#if !defined (CSI_VALUE)
|
||||||
|
#define CSI_VALUE ((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
|
||||||
|
#endif /* CSI_VALUE */
|
||||||
|
|
||||||
|
#if !defined (HSI_VALUE)
|
||||||
|
#define HSI_VALUE ((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
|
||||||
|
#endif /* HSI_VALUE */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_System_Private_TypesDefinitions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_System_Private_Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************* Miscellaneous Configuration ************************/
|
||||||
|
/*!< Uncomment the following line if you need to use initialized data in D2 domain SRAM (AHB SRAM) */
|
||||||
|
/* #define DATA_IN_D2_SRAM */
|
||||||
|
|
||||||
|
/* Note: Following vector table addresses must be defined in line with linker
|
||||||
|
configuration. */
|
||||||
|
/*!< Uncomment the following line if you need to relocate the vector table
|
||||||
|
anywhere in FLASH BANK1 or AXI SRAM, else the vector table is kept at the automatic
|
||||||
|
remap of boot address selected */
|
||||||
|
/* #define USER_VECT_TAB_ADDRESS */
|
||||||
|
|
||||||
|
#if defined(USER_VECT_TAB_ADDRESS)
|
||||||
|
#if defined(DUAL_CORE) && defined(CORE_CM4)
|
||||||
|
/*!< Uncomment the following line if you need to relocate your vector Table
|
||||||
|
in D2 AXI SRAM else user remap will be done in FLASH BANK2. */
|
||||||
|
/* #define VECT_TAB_SRAM */
|
||||||
|
#if defined(VECT_TAB_SRAM)
|
||||||
|
#define VECT_TAB_BASE_ADDRESS D2_AXISRAM_BASE /*!< Vector Table base address field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#else
|
||||||
|
#define VECT_TAB_BASE_ADDRESS FLASH_BANK2_BASE /*!< Vector Table base address field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#endif /* VECT_TAB_SRAM */
|
||||||
|
#else
|
||||||
|
/*!< Uncomment the following line if you need to relocate your vector Table
|
||||||
|
in D1 AXI SRAM else user remap will be done in FLASH BANK1. */
|
||||||
|
/* #define VECT_TAB_SRAM */
|
||||||
|
#if defined(VECT_TAB_SRAM)
|
||||||
|
#define VECT_TAB_BASE_ADDRESS D1_AXISRAM_BASE /*!< Vector Table base address field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#else
|
||||||
|
#define VECT_TAB_BASE_ADDRESS FLASH_BANK1_BASE /*!< Vector Table base address field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#endif /* VECT_TAB_SRAM */
|
||||||
|
#endif /* DUAL_CORE && CORE_CM4 */
|
||||||
|
#endif /* USER_VECT_TAB_ADDRESS */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_System_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_System_Private_Variables
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* This variable is updated in three ways:
|
||||||
|
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||||
|
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
||||||
|
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||||
|
Note: If you use this function to configure the system clock; then there
|
||||||
|
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||||
|
variable is updated automatically.
|
||||||
|
*/
|
||||||
|
uint32_t SystemCoreClock = 64000000;
|
||||||
|
uint32_t SystemD2Clock = 64000000;
|
||||||
|
const uint8_t D1CorePrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_System_Private_FunctionPrototypes
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_System_Private_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Setup the microcontroller system
|
||||||
|
* Initialize the FPU setting and vector table location
|
||||||
|
* configuration.
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void SystemInit (void)
|
||||||
|
{
|
||||||
|
#if defined (DATA_IN_D2_SRAM)
|
||||||
|
__IO uint32_t tmpreg;
|
||||||
|
#endif /* DATA_IN_D2_SRAM */
|
||||||
|
|
||||||
|
/* FPU settings ------------------------------------------------------------*/
|
||||||
|
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||||
|
SCB->CPACR |= ((3UL << (10*2))|(3UL << (11*2))); /* set CP10 and CP11 Full Access */
|
||||||
|
#endif
|
||||||
|
/* Reset the RCC clock configuration to the default reset state ------------*/
|
||||||
|
|
||||||
|
/* Increasing the CPU frequency */
|
||||||
|
if(FLASH_LATENCY_DEFAULT > (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
|
||||||
|
{
|
||||||
|
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
|
||||||
|
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set HSION bit */
|
||||||
|
RCC->CR |= RCC_CR_HSION;
|
||||||
|
|
||||||
|
/* Reset CFGR register */
|
||||||
|
RCC->CFGR = 0x00000000;
|
||||||
|
|
||||||
|
/* Reset HSEON, HSECSSON, CSION, HSI48ON, CSIKERON, PLL1ON, PLL2ON and PLL3ON bits */
|
||||||
|
RCC->CR &= 0xEAF6ED7FU;
|
||||||
|
|
||||||
|
/* Decreasing the number of wait states because of lower CPU frequency */
|
||||||
|
if(FLASH_LATENCY_DEFAULT < (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
|
||||||
|
{
|
||||||
|
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
|
||||||
|
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(D3_SRAM_BASE)
|
||||||
|
/* Reset D1CFGR register */
|
||||||
|
RCC->D1CFGR = 0x00000000;
|
||||||
|
|
||||||
|
/* Reset D2CFGR register */
|
||||||
|
RCC->D2CFGR = 0x00000000;
|
||||||
|
|
||||||
|
/* Reset D3CFGR register */
|
||||||
|
RCC->D3CFGR = 0x00000000;
|
||||||
|
#else
|
||||||
|
/* Reset CDCFGR1 register */
|
||||||
|
RCC->CDCFGR1 = 0x00000000;
|
||||||
|
|
||||||
|
/* Reset CDCFGR2 register */
|
||||||
|
RCC->CDCFGR2 = 0x00000000;
|
||||||
|
|
||||||
|
/* Reset SRDCFGR register */
|
||||||
|
RCC->SRDCFGR = 0x00000000;
|
||||||
|
#endif
|
||||||
|
/* Reset PLLCKSELR register */
|
||||||
|
RCC->PLLCKSELR = 0x02020200;
|
||||||
|
|
||||||
|
/* Reset PLLCFGR register */
|
||||||
|
RCC->PLLCFGR = 0x01FF0000;
|
||||||
|
/* Reset PLL1DIVR register */
|
||||||
|
RCC->PLL1DIVR = 0x01010280;
|
||||||
|
/* Reset PLL1FRACR register */
|
||||||
|
RCC->PLL1FRACR = 0x00000000;
|
||||||
|
|
||||||
|
/* Reset PLL2DIVR register */
|
||||||
|
RCC->PLL2DIVR = 0x01010280;
|
||||||
|
|
||||||
|
/* Reset PLL2FRACR register */
|
||||||
|
|
||||||
|
RCC->PLL2FRACR = 0x00000000;
|
||||||
|
/* Reset PLL3DIVR register */
|
||||||
|
RCC->PLL3DIVR = 0x01010280;
|
||||||
|
|
||||||
|
/* Reset PLL3FRACR register */
|
||||||
|
RCC->PLL3FRACR = 0x00000000;
|
||||||
|
|
||||||
|
/* Reset HSEBYP bit */
|
||||||
|
RCC->CR &= 0xFFFBFFFFU;
|
||||||
|
|
||||||
|
/* Disable all interrupts */
|
||||||
|
RCC->CIER = 0x00000000;
|
||||||
|
|
||||||
|
#if (STM32H7_DEV_ID == 0x450UL)
|
||||||
|
/* dual core CM7 or single core line */
|
||||||
|
if((DBGMCU->IDCODE & 0xFFFF0000U) < 0x20000000U)
|
||||||
|
{
|
||||||
|
/* if stm32h7 revY*/
|
||||||
|
/* Change the switch matrix read issuing capability to 1 for the AXI SRAM target (Target 7) */
|
||||||
|
*((__IO uint32_t*)0x51008108) = 0x000000001U;
|
||||||
|
}
|
||||||
|
#endif /* STM32H7_DEV_ID */
|
||||||
|
|
||||||
|
#if defined(DATA_IN_D2_SRAM)
|
||||||
|
/* in case of initialized data in D2 SRAM (AHB SRAM), enable the D2 SRAM clock (AHB SRAM clock) */
|
||||||
|
#if defined(RCC_AHB2ENR_D2SRAM3EN)
|
||||||
|
RCC->AHB2ENR |= (RCC_AHB2ENR_D2SRAM1EN | RCC_AHB2ENR_D2SRAM2EN | RCC_AHB2ENR_D2SRAM3EN);
|
||||||
|
#elif defined(RCC_AHB2ENR_D2SRAM2EN)
|
||||||
|
RCC->AHB2ENR |= (RCC_AHB2ENR_D2SRAM1EN | RCC_AHB2ENR_D2SRAM2EN);
|
||||||
|
#else
|
||||||
|
RCC->AHB2ENR |= (RCC_AHB2ENR_AHBSRAM1EN | RCC_AHB2ENR_AHBSRAM2EN);
|
||||||
|
#endif /* RCC_AHB2ENR_D2SRAM3EN */
|
||||||
|
|
||||||
|
tmpreg = RCC->AHB2ENR;
|
||||||
|
(void) tmpreg;
|
||||||
|
#endif /* DATA_IN_D2_SRAM */
|
||||||
|
|
||||||
|
#if defined(DUAL_CORE) && defined(CORE_CM4)
|
||||||
|
/* Configure the Vector Table location add offset address for cortex-M4 ------------------*/
|
||||||
|
#if defined(USER_VECT_TAB_ADDRESS)
|
||||||
|
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal D2 AXI-RAM or in Internal FLASH */
|
||||||
|
#endif /* USER_VECT_TAB_ADDRESS */
|
||||||
|
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Disable the FMC bank1 (enabled after reset).
|
||||||
|
* This, prevents CPU speculation access on this bank which blocks the use of FMC during
|
||||||
|
* 24us. During this time the others FMC master (such as LTDC) cannot use it!
|
||||||
|
*/
|
||||||
|
FMC_Bank1_R->BTCR[0] = 0x000030D2;
|
||||||
|
|
||||||
|
/* Configure the Vector Table location -------------------------------------*/
|
||||||
|
#if defined(USER_VECT_TAB_ADDRESS)
|
||||||
|
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal D1 AXI-RAM or in Internal FLASH */
|
||||||
|
#endif /* USER_VECT_TAB_ADDRESS */
|
||||||
|
|
||||||
|
#endif /*DUAL_CORE && CORE_CM4*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update SystemCoreClock variable according to Clock Register Values.
|
||||||
|
* The SystemCoreClock variable contains the core clock , it can
|
||||||
|
* be used by the user application to setup the SysTick timer or configure
|
||||||
|
* other parameters.
|
||||||
|
*
|
||||||
|
* @note Each time the core clock changes, this function must be called
|
||||||
|
* to update SystemCoreClock variable value. Otherwise, any configuration
|
||||||
|
* based on this variable will be incorrect.
|
||||||
|
*
|
||||||
|
* @note - The system frequency computed by this function is not the real
|
||||||
|
* frequency in the chip. It is calculated based on the predefined
|
||||||
|
* constant and the selected clock source:
|
||||||
|
*
|
||||||
|
* - If SYSCLK source is CSI, SystemCoreClock will contain the CSI_VALUE(*)
|
||||||
|
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(**)
|
||||||
|
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
|
||||||
|
* - If SYSCLK source is PLL, SystemCoreClock will contain the CSI_VALUE(*),
|
||||||
|
* HSI_VALUE(**) or HSE_VALUE(***) multiplied/divided by the PLL factors.
|
||||||
|
*
|
||||||
|
* (*) CSI_VALUE is a constant defined in stm32h7xx_hal.h file (default value
|
||||||
|
* 4 MHz) but the real value may vary depending on the variations
|
||||||
|
* in voltage and temperature.
|
||||||
|
* (**) HSI_VALUE is a constant defined in stm32h7xx_hal.h file (default value
|
||||||
|
* 64 MHz) but the real value may vary depending on the variations
|
||||||
|
* in voltage and temperature.
|
||||||
|
*
|
||||||
|
* (***)HSE_VALUE is a constant defined in stm32h7xx_hal.h file (default value
|
||||||
|
* 25 MHz), user has to ensure that HSE_VALUE is same as the real
|
||||||
|
* frequency of the crystal used. Otherwise, this function may
|
||||||
|
* have wrong result.
|
||||||
|
*
|
||||||
|
* - The result of this function could be not correct when using fractional
|
||||||
|
* value for HSE crystal.
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void SystemCoreClockUpdate (void)
|
||||||
|
{
|
||||||
|
uint32_t pllp, pllsource, pllm, pllfracen, hsivalue, tmp;
|
||||||
|
uint32_t common_system_clock;
|
||||||
|
float_t fracn1, pllvco;
|
||||||
|
|
||||||
|
|
||||||
|
/* Get SYSCLK source -------------------------------------------------------*/
|
||||||
|
|
||||||
|
switch (RCC->CFGR & RCC_CFGR_SWS)
|
||||||
|
{
|
||||||
|
case RCC_CFGR_SWS_HSI: /* HSI used as system clock source */
|
||||||
|
common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RCC_CFGR_SWS_CSI: /* CSI used as system clock source */
|
||||||
|
common_system_clock = CSI_VALUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RCC_CFGR_SWS_HSE: /* HSE used as system clock source */
|
||||||
|
common_system_clock = HSE_VALUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RCC_CFGR_SWS_PLL1: /* PLL1 used as system clock source */
|
||||||
|
|
||||||
|
/* PLL_VCO = (HSE_VALUE or HSI_VALUE or CSI_VALUE/ PLLM) * PLLN
|
||||||
|
SYSCLK = PLL_VCO / PLLR
|
||||||
|
*/
|
||||||
|
pllsource = (RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC);
|
||||||
|
pllm = ((RCC->PLLCKSELR & RCC_PLLCKSELR_DIVM1)>> 4) ;
|
||||||
|
pllfracen = ((RCC->PLLCFGR & RCC_PLLCFGR_PLL1FRACEN)>>RCC_PLLCFGR_PLL1FRACEN_Pos);
|
||||||
|
fracn1 = (float_t)(uint32_t)(pllfracen* ((RCC->PLL1FRACR & RCC_PLL1FRACR_FRACN1)>> 3));
|
||||||
|
|
||||||
|
if (pllm != 0U)
|
||||||
|
{
|
||||||
|
switch (pllsource)
|
||||||
|
{
|
||||||
|
case RCC_PLLCKSELR_PLLSRC_HSI: /* HSI used as PLL clock source */
|
||||||
|
|
||||||
|
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)) ;
|
||||||
|
pllvco = ( (float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RCC_PLLCKSELR_PLLSRC_CSI: /* CSI used as PLL clock source */
|
||||||
|
pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RCC_PLLCKSELR_PLLSRC_HSE: /* HSE used as PLL clock source */
|
||||||
|
pllvco = ((float_t)HSE_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)) ;
|
||||||
|
pllvco = ((float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pllp = (((RCC->PLL1DIVR & RCC_PLL1DIVR_P1) >>9) + 1U ) ;
|
||||||
|
common_system_clock = (uint32_t)(float_t)(pllvco/(float_t)pllp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
common_system_clock = 0U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compute SystemClock frequency --------------------------------------------------*/
|
||||||
|
#if defined (RCC_D1CFGR_D1CPRE)
|
||||||
|
tmp = D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_D1CPRE)>> RCC_D1CFGR_D1CPRE_Pos];
|
||||||
|
|
||||||
|
/* common_system_clock frequency : CM7 CPU frequency */
|
||||||
|
common_system_clock >>= tmp;
|
||||||
|
|
||||||
|
/* SystemD2Clock frequency : CM4 CPU, AXI and AHBs Clock frequency */
|
||||||
|
SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_HPRE)>> RCC_D1CFGR_HPRE_Pos]) & 0x1FU));
|
||||||
|
|
||||||
|
#else
|
||||||
|
tmp = D1CorePrescTable[(RCC->CDCFGR1 & RCC_CDCFGR1_CDCPRE)>> RCC_CDCFGR1_CDCPRE_Pos];
|
||||||
|
|
||||||
|
/* common_system_clock frequency : CM7 CPU frequency */
|
||||||
|
common_system_clock >>= tmp;
|
||||||
|
|
||||||
|
/* SystemD2Clock frequency : AXI and AHBs Clock frequency */
|
||||||
|
SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[(RCC->CDCFGR1 & RCC_CDCFGR1_HPRE)>> RCC_CDCFGR1_HPRE_Pos]) & 0x1FU));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(DUAL_CORE) && defined(CORE_CM4)
|
||||||
|
SystemCoreClock = SystemD2Clock;
|
||||||
|
#else
|
||||||
|
SystemCoreClock = common_system_clock;
|
||||||
|
#endif /* DUAL_CORE && CORE_CM4 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
241
FW/Core/Src/tim.c
Normal file
241
FW/Core/Src/tim.c
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file tim.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the TIM instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* TIM2 init function */
|
||||||
|
void MX_TIM2_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM2_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_Init 0 */
|
||||||
|
|
||||||
|
LL_TIM_InitTypeDef TIM_InitStruct = {0};
|
||||||
|
LL_TIM_OC_InitTypeDef TIM_OC_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM2);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM2_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_Init 1 */
|
||||||
|
TIM_InitStruct.Prescaler = 249;
|
||||||
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
||||||
|
TIM_InitStruct.Autoreload = 254;
|
||||||
|
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
|
||||||
|
LL_TIM_Init(TIM2, &TIM_InitStruct);
|
||||||
|
LL_TIM_DisableARRPreload(TIM2);
|
||||||
|
LL_TIM_OC_EnablePreload(TIM2, LL_TIM_CHANNEL_CH1);
|
||||||
|
TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_PWM1;
|
||||||
|
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;
|
||||||
|
TIM_OC_InitStruct.OCNState = LL_TIM_OCSTATE_DISABLE;
|
||||||
|
TIM_OC_InitStruct.CompareValue = 0;
|
||||||
|
TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;
|
||||||
|
LL_TIM_OC_Init(TIM2, LL_TIM_CHANNEL_CH1, &TIM_OC_InitStruct);
|
||||||
|
LL_TIM_OC_DisableFast(TIM2, LL_TIM_CHANNEL_CH1);
|
||||||
|
LL_TIM_SetTriggerOutput(TIM2, LL_TIM_TRGO_RESET);
|
||||||
|
LL_TIM_DisableMasterSlaveMode(TIM2);
|
||||||
|
/* USER CODE BEGIN TIM2_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_Init 2 */
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOA);
|
||||||
|
/**TIM2 GPIO Configuration
|
||||||
|
PA15 (JTDI) ------> TIM2_CH1
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_1;
|
||||||
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
}
|
||||||
|
/* TIM3 init function */
|
||||||
|
void MX_TIM3_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM3_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM3_Init 0 */
|
||||||
|
|
||||||
|
LL_TIM_InitTypeDef TIM_InitStruct = {0};
|
||||||
|
LL_TIM_OC_InitTypeDef TIM_OC_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM3);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM3_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM3_Init 1 */
|
||||||
|
TIM_InitStruct.Prescaler = 699;
|
||||||
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
||||||
|
TIM_InitStruct.Autoreload = 254;
|
||||||
|
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
|
||||||
|
LL_TIM_Init(TIM3, &TIM_InitStruct);
|
||||||
|
LL_TIM_DisableARRPreload(TIM3);
|
||||||
|
LL_TIM_OC_EnablePreload(TIM3, LL_TIM_CHANNEL_CH2);
|
||||||
|
TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_PWM1;
|
||||||
|
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;
|
||||||
|
TIM_OC_InitStruct.OCNState = LL_TIM_OCSTATE_DISABLE;
|
||||||
|
TIM_OC_InitStruct.CompareValue = 0;
|
||||||
|
TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;
|
||||||
|
LL_TIM_OC_Init(TIM3, LL_TIM_CHANNEL_CH2, &TIM_OC_InitStruct);
|
||||||
|
LL_TIM_OC_DisableFast(TIM3, LL_TIM_CHANNEL_CH2);
|
||||||
|
LL_TIM_SetTriggerOutput(TIM3, LL_TIM_TRGO_RESET);
|
||||||
|
LL_TIM_DisableMasterSlaveMode(TIM3);
|
||||||
|
/* USER CODE BEGIN TIM3_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM3_Init 2 */
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOB);
|
||||||
|
/**TIM3 GPIO Configuration
|
||||||
|
PB5 ------> TIM3_CH2
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_5;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_2;
|
||||||
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
}
|
||||||
|
/* TIM6 init function */
|
||||||
|
void MX_TIM6_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM6_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM6_Init 0 */
|
||||||
|
|
||||||
|
LL_TIM_InitTypeDef TIM_InitStruct = {0};
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM6);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM6_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM6_Init 1 */
|
||||||
|
TIM_InitStruct.Prescaler = 23;
|
||||||
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
||||||
|
TIM_InitStruct.Autoreload = 65535;
|
||||||
|
LL_TIM_Init(TIM6, &TIM_InitStruct);
|
||||||
|
LL_TIM_DisableARRPreload(TIM6);
|
||||||
|
LL_TIM_SetOnePulseMode(TIM6, LL_TIM_ONEPULSEMODE_SINGLE);
|
||||||
|
LL_TIM_SetTriggerOutput(TIM6, LL_TIM_TRGO_RESET);
|
||||||
|
LL_TIM_DisableMasterSlaveMode(TIM6);
|
||||||
|
/* USER CODE BEGIN TIM6_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM6_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* TIM7 init function */
|
||||||
|
void MX_TIM7_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM7_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM7_Init 0 */
|
||||||
|
|
||||||
|
LL_TIM_InitTypeDef TIM_InitStruct = {0};
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM7);
|
||||||
|
|
||||||
|
/* TIM7 interrupt Init */
|
||||||
|
NVIC_SetPriority(TIM7_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(TIM7_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM7_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM7_Init 1 */
|
||||||
|
TIM_InitStruct.Prescaler = 23;
|
||||||
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
||||||
|
TIM_InitStruct.Autoreload = 65535;
|
||||||
|
LL_TIM_Init(TIM7, &TIM_InitStruct);
|
||||||
|
LL_TIM_DisableARRPreload(TIM7);
|
||||||
|
LL_TIM_SetTriggerOutput(TIM7, LL_TIM_TRGO_RESET);
|
||||||
|
LL_TIM_DisableMasterSlaveMode(TIM7);
|
||||||
|
/* USER CODE BEGIN TIM7_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM7_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* TIM12 init function */
|
||||||
|
void MX_TIM12_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM12_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM12_Init 0 */
|
||||||
|
|
||||||
|
LL_TIM_InitTypeDef TIM_InitStruct = {0};
|
||||||
|
LL_TIM_OC_InitTypeDef TIM_OC_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM12);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM12_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM12_Init 1 */
|
||||||
|
TIM_InitStruct.Prescaler = 249;
|
||||||
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
||||||
|
TIM_InitStruct.Autoreload = 254;
|
||||||
|
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
|
||||||
|
LL_TIM_Init(TIM12, &TIM_InitStruct);
|
||||||
|
LL_TIM_DisableARRPreload(TIM12);
|
||||||
|
LL_TIM_OC_EnablePreload(TIM12, LL_TIM_CHANNEL_CH1);
|
||||||
|
TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_PWM1;
|
||||||
|
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;
|
||||||
|
TIM_OC_InitStruct.OCNState = LL_TIM_OCSTATE_DISABLE;
|
||||||
|
TIM_OC_InitStruct.CompareValue = 0;
|
||||||
|
TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;
|
||||||
|
LL_TIM_OC_Init(TIM12, LL_TIM_CHANNEL_CH1, &TIM_OC_InitStruct);
|
||||||
|
LL_TIM_OC_DisableFast(TIM12, LL_TIM_CHANNEL_CH1);
|
||||||
|
LL_TIM_SetTriggerOutput(TIM12, LL_TIM_TRGO_RESET);
|
||||||
|
LL_TIM_DisableMasterSlaveMode(TIM12);
|
||||||
|
/* USER CODE BEGIN TIM12_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM12_Init 2 */
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOH);
|
||||||
|
/**TIM12 GPIO Configuration
|
||||||
|
PH6 ------> TIM12_CH1
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_2;
|
||||||
|
LL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
733
FW/Core/Src/usart.c
Normal file
733
FW/Core/Src/usart.c
Normal file
@@ -0,0 +1,733 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file usart.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the USART instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "usart.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* LPUART1 init function */
|
||||||
|
|
||||||
|
void MX_LPUART1_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LPUART1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_Init 0 */
|
||||||
|
|
||||||
|
LL_LPUART_InitTypeDef LPUART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LPUART1;
|
||||||
|
PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_D3PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB4_GRP1_EnableClock(LL_APB4_GRP1_PERIPH_LPUART1);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOA);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOB);
|
||||||
|
/**LPUART1 GPIO Configuration
|
||||||
|
PA9 ------> LPUART1_TX
|
||||||
|
PB7 ------> LPUART1_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_9;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_3;
|
||||||
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
||||||
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* LPUART1 interrupt Init */
|
||||||
|
NVIC_SetPriority(LPUART1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(LPUART1_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LPUART1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_Init 1 */
|
||||||
|
LPUART_InitStruct.PrescalerValue = LL_LPUART_PRESCALER_DIV1;
|
||||||
|
LPUART_InitStruct.BaudRate = 57600;
|
||||||
|
LPUART_InitStruct.DataWidth = LL_LPUART_DATAWIDTH_8B;
|
||||||
|
LPUART_InitStruct.StopBits = LL_LPUART_STOPBITS_1;
|
||||||
|
LPUART_InitStruct.Parity = LL_LPUART_PARITY_NONE;
|
||||||
|
LPUART_InitStruct.TransferDirection = LL_LPUART_DIRECTION_TX_RX;
|
||||||
|
LPUART_InitStruct.HardwareFlowControl = LL_LPUART_HWCONTROL_NONE;
|
||||||
|
LL_LPUART_Init(LPUART1, &LPUART_InitStruct);
|
||||||
|
LL_LPUART_SetTXFIFOThreshold(LPUART1, LL_LPUART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_LPUART_SetRXFIFOThreshold(LPUART1, LL_LPUART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_LPUART_EnableFIFO(LPUART1);
|
||||||
|
LL_LPUART_SetRXPinLevel(LPUART1, LL_LPUART_RXPIN_LEVEL_INVERTED);
|
||||||
|
LL_LPUART_SetTXPinLevel(LPUART1, LL_LPUART_TXPIN_LEVEL_INVERTED);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType LPUART1 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType LPUART1 */
|
||||||
|
|
||||||
|
LL_LPUART_Enable(LPUART1);
|
||||||
|
|
||||||
|
/* Polling LPUART1 initialisation */
|
||||||
|
while((!(LL_LPUART_IsActiveFlag_TEACK(LPUART1))) || (!(LL_LPUART_IsActiveFlag_REACK(LPUART1))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN LPUART1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* UART4 init function */
|
||||||
|
void MX_UART4_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN UART4_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END UART4_Init 0 */
|
||||||
|
|
||||||
|
LL_USART_InitTypeDef UART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_UART4;
|
||||||
|
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_UART4);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOA);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOC);
|
||||||
|
/**UART4 GPIO Configuration
|
||||||
|
PA0 ------> UART4_TX
|
||||||
|
PC11 ------> UART4_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
||||||
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* UART4 interrupt Init */
|
||||||
|
NVIC_SetPriority(UART4_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(UART4_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN UART4_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END UART4_Init 1 */
|
||||||
|
UART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||||
|
UART_InitStruct.BaudRate = 19200;
|
||||||
|
UART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||||
|
UART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||||
|
UART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||||
|
UART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||||
|
UART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||||
|
UART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||||
|
LL_USART_Init(UART4, &UART_InitStruct);
|
||||||
|
LL_USART_EnableFIFO(UART4);
|
||||||
|
LL_USART_SetTXFIFOThreshold(UART4, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_SetRXFIFOThreshold(UART4, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_ConfigAsyncMode(UART4);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType UART4 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType UART4 */
|
||||||
|
|
||||||
|
LL_USART_Enable(UART4);
|
||||||
|
|
||||||
|
/* Polling UART4 initialisation */
|
||||||
|
while((!(LL_USART_IsActiveFlag_TEACK(UART4))) || (!(LL_USART_IsActiveFlag_REACK(UART4))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN UART4_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END UART4_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* UART5 init function */
|
||||||
|
void MX_UART5_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN UART5_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END UART5_Init 0 */
|
||||||
|
|
||||||
|
LL_USART_InitTypeDef UART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_UART5;
|
||||||
|
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_UART5);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOC);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
|
||||||
|
/**UART5 GPIO Configuration
|
||||||
|
PC12 ------> UART5_TX
|
||||||
|
PD2 ------> UART5_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_12;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_2;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
||||||
|
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* UART5 interrupt Init */
|
||||||
|
NVIC_SetPriority(UART5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(UART5_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN UART5_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END UART5_Init 1 */
|
||||||
|
UART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||||
|
UART_InitStruct.BaudRate = 57600;
|
||||||
|
UART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||||
|
UART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||||
|
UART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||||
|
UART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||||
|
UART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||||
|
UART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||||
|
LL_USART_Init(UART5, &UART_InitStruct);
|
||||||
|
LL_USART_EnableFIFO(UART5);
|
||||||
|
LL_USART_SetTXFIFOThreshold(UART5, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_SetRXFIFOThreshold(UART5, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_ConfigAsyncMode(UART5);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType UART5 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType UART5 */
|
||||||
|
|
||||||
|
LL_USART_Enable(UART5);
|
||||||
|
|
||||||
|
/* Polling UART5 initialisation */
|
||||||
|
while((!(LL_USART_IsActiveFlag_TEACK(UART5))) || (!(LL_USART_IsActiveFlag_REACK(UART5))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN UART5_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END UART5_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* UART7 init function */
|
||||||
|
void MX_UART7_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN UART7_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END UART7_Init 0 */
|
||||||
|
|
||||||
|
LL_USART_InitTypeDef UART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_UART7;
|
||||||
|
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_UART7);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOB);
|
||||||
|
/**UART7 GPIO Configuration
|
||||||
|
PB3 (JTDO/TRACESWO) ------> UART7_RX
|
||||||
|
PB4 (NJTRST) ------> UART7_TX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_11;
|
||||||
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* UART7 interrupt Init */
|
||||||
|
NVIC_SetPriority(UART7_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(UART7_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN UART7_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END UART7_Init 1 */
|
||||||
|
UART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||||
|
UART_InitStruct.BaudRate = 57600;
|
||||||
|
UART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||||
|
UART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||||
|
UART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||||
|
UART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||||
|
UART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||||
|
UART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||||
|
LL_USART_Init(UART7, &UART_InitStruct);
|
||||||
|
LL_USART_EnableFIFO(UART7);
|
||||||
|
LL_USART_SetTXFIFOThreshold(UART7, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_SetRXFIFOThreshold(UART7, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_ConfigAsyncMode(UART7);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType UART7 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType UART7 */
|
||||||
|
|
||||||
|
LL_USART_Enable(UART7);
|
||||||
|
|
||||||
|
/* Polling UART7 initialisation */
|
||||||
|
while((!(LL_USART_IsActiveFlag_TEACK(UART7))) || (!(LL_USART_IsActiveFlag_REACK(UART7))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN UART7_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END UART7_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* USART1 init function */
|
||||||
|
|
||||||
|
void MX_USART1_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART1_Init 0 */
|
||||||
|
|
||||||
|
LL_USART_InitTypeDef USART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1;
|
||||||
|
PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_D2PCLK2;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOB);
|
||||||
|
/**USART1 GPIO Configuration
|
||||||
|
PB14 ------> USART1_TX
|
||||||
|
PB15 ------> USART1_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_14;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
|
||||||
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
|
||||||
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USART1 interrupt Init */
|
||||||
|
NVIC_SetPriority(USART1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(USART1_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART1_Init 1 */
|
||||||
|
USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||||
|
USART_InitStruct.BaudRate = 115200;
|
||||||
|
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||||
|
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||||
|
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||||
|
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||||
|
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||||
|
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||||
|
LL_USART_Init(USART1, &USART_InitStruct);
|
||||||
|
LL_USART_SetTXFIFOThreshold(USART1, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_SetRXFIFOThreshold(USART1, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_EnableFIFO(USART1);
|
||||||
|
LL_USART_ConfigAsyncMode(USART1);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType USART1 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType USART1 */
|
||||||
|
|
||||||
|
LL_USART_Enable(USART1);
|
||||||
|
|
||||||
|
/* Polling USART1 initialisation */
|
||||||
|
while((!(LL_USART_IsActiveFlag_TEACK(USART1))) || (!(LL_USART_IsActiveFlag_REACK(USART1))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN USART1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END USART1_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* USART2 init function */
|
||||||
|
|
||||||
|
void MX_USART2_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART2_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_Init 0 */
|
||||||
|
|
||||||
|
LL_USART_InitTypeDef USART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART2;
|
||||||
|
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
|
||||||
|
/**USART2 GPIO Configuration
|
||||||
|
PD4 ------> USART2_DE
|
||||||
|
PD5 ------> USART2_TX
|
||||||
|
PD6 ------> USART2_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_4|LL_GPIO_PIN_5;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
|
||||||
|
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
|
||||||
|
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USART2 interrupt Init */
|
||||||
|
NVIC_SetPriority(USART2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(USART2_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART2_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_Init 1 */
|
||||||
|
USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||||
|
USART_InitStruct.BaudRate = 19200;
|
||||||
|
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||||
|
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||||
|
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||||
|
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||||
|
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||||
|
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||||
|
LL_USART_Init(USART2, &USART_InitStruct);
|
||||||
|
LL_USART_SetTXFIFOThreshold(USART2, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_SetRXFIFOThreshold(USART2, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_EnableDEMode(USART2);
|
||||||
|
LL_USART_SetDESignalPolarity(USART2, LL_USART_DE_POLARITY_HIGH);
|
||||||
|
LL_USART_SetDEAssertionTime(USART2, 8);
|
||||||
|
LL_USART_SetDEDeassertionTime(USART2, 8);
|
||||||
|
LL_USART_EnableFIFO(USART2);
|
||||||
|
LL_USART_ConfigAsyncMode(USART2);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType USART2 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType USART2 */
|
||||||
|
|
||||||
|
LL_USART_Enable(USART2);
|
||||||
|
|
||||||
|
/* Polling USART2 initialisation */
|
||||||
|
while((!(LL_USART_IsActiveFlag_TEACK(USART2))) || (!(LL_USART_IsActiveFlag_REACK(USART2))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN USART2_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* USART3 init function */
|
||||||
|
|
||||||
|
void MX_USART3_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART3_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_Init 0 */
|
||||||
|
|
||||||
|
LL_USART_InitTypeDef USART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART3;
|
||||||
|
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOB);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOC);
|
||||||
|
/**USART3 GPIO Configuration
|
||||||
|
PB11 ------> USART3_RX
|
||||||
|
PC10 ------> USART3_TX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
|
||||||
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_10;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USART3 DMA Init */
|
||||||
|
|
||||||
|
/* USART3_RX Init */
|
||||||
|
LL_DMA_SetPeriphRequest(DMA2, LL_DMA_STREAM_3, LL_DMAMUX1_REQ_USART3_RX);
|
||||||
|
|
||||||
|
LL_DMA_SetDataTransferDirection(DMA2, LL_DMA_STREAM_3, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
|
||||||
|
|
||||||
|
LL_DMA_SetStreamPriorityLevel(DMA2, LL_DMA_STREAM_3, LL_DMA_PRIORITY_LOW);
|
||||||
|
|
||||||
|
LL_DMA_SetMode(DMA2, LL_DMA_STREAM_3, LL_DMA_MODE_NORMAL);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphIncMode(DMA2, LL_DMA_STREAM_3, LL_DMA_PERIPH_NOINCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetMemoryIncMode(DMA2, LL_DMA_STREAM_3, LL_DMA_MEMORY_INCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphSize(DMA2, LL_DMA_STREAM_3, LL_DMA_PDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_SetMemorySize(DMA2, LL_DMA_STREAM_3, LL_DMA_MDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_DisableFifoMode(DMA2, LL_DMA_STREAM_3);
|
||||||
|
|
||||||
|
/* USART3_TX Init */
|
||||||
|
LL_DMA_SetPeriphRequest(DMA1, LL_DMA_STREAM_3, LL_DMAMUX1_REQ_USART3_TX);
|
||||||
|
|
||||||
|
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_STREAM_3, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
|
||||||
|
|
||||||
|
LL_DMA_SetStreamPriorityLevel(DMA1, LL_DMA_STREAM_3, LL_DMA_PRIORITY_LOW);
|
||||||
|
|
||||||
|
LL_DMA_SetMode(DMA1, LL_DMA_STREAM_3, LL_DMA_MODE_NORMAL);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_STREAM_3, LL_DMA_PERIPH_NOINCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_STREAM_3, LL_DMA_MEMORY_INCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphSize(DMA1, LL_DMA_STREAM_3, LL_DMA_PDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_SetMemorySize(DMA1, LL_DMA_STREAM_3, LL_DMA_MDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_DisableFifoMode(DMA1, LL_DMA_STREAM_3);
|
||||||
|
|
||||||
|
/* USART3 interrupt Init */
|
||||||
|
NVIC_SetPriority(USART3_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(USART3_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART3_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_Init 1 */
|
||||||
|
USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||||
|
USART_InitStruct.BaudRate = 57600;
|
||||||
|
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||||
|
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||||
|
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||||
|
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||||
|
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||||
|
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||||
|
LL_USART_Init(USART3, &USART_InitStruct);
|
||||||
|
LL_USART_SetTXFIFOThreshold(USART3, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_SetRXFIFOThreshold(USART3, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_EnableFIFO(USART3);
|
||||||
|
LL_USART_ConfigAsyncMode(USART3);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType USART3 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType USART3 */
|
||||||
|
|
||||||
|
LL_USART_Enable(USART3);
|
||||||
|
|
||||||
|
/* Polling USART3 initialisation */
|
||||||
|
while((!(LL_USART_IsActiveFlag_TEACK(USART3))) || (!(LL_USART_IsActiveFlag_REACK(USART3))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN USART3_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
/* USART6 init function */
|
||||||
|
|
||||||
|
void MX_USART6_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART6_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART6_Init 0 */
|
||||||
|
|
||||||
|
LL_USART_InitTypeDef USART_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART6;
|
||||||
|
PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_D2PCLK2;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART6);
|
||||||
|
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOC);
|
||||||
|
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOG);
|
||||||
|
/**USART6 GPIO Configuration
|
||||||
|
PC7 ------> USART6_RX
|
||||||
|
PG14 ------> USART6_TX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_14;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
|
||||||
|
LL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USART6 interrupt Init */
|
||||||
|
NVIC_SetPriority(USART6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(USART6_IRQn);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART6_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART6_Init 1 */
|
||||||
|
USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||||
|
USART_InitStruct.BaudRate = 9600;
|
||||||
|
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||||
|
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||||
|
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||||
|
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||||
|
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||||
|
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||||
|
LL_USART_Init(USART6, &USART_InitStruct);
|
||||||
|
LL_USART_SetTXFIFOThreshold(USART6, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_SetRXFIFOThreshold(USART6, LL_USART_FIFOTHRESHOLD_1_8);
|
||||||
|
LL_USART_EnableFIFO(USART6);
|
||||||
|
LL_USART_ConfigAsyncMode(USART6);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN WKUPType USART6 */
|
||||||
|
|
||||||
|
/* USER CODE END WKUPType USART6 */
|
||||||
|
|
||||||
|
LL_USART_Enable(USART6);
|
||||||
|
|
||||||
|
/* Polling USART6 initialisation */
|
||||||
|
while((!(LL_USART_IsActiveFlag_TEACK(USART6))) || (!(LL_USART_IsActiveFlag_REACK(USART6))))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN USART6_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END USART6_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
709
FW/Core/my_src/HW_config.c
Normal file
709
FW/Core/my_src/HW_config.c
Normal file
@@ -0,0 +1,709 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "fdcan.h"
|
||||||
|
#include "fdcan_task.h"
|
||||||
|
#include "HW_Config.h"
|
||||||
|
#include "W25Qxx.h"
|
||||||
|
#include "internal_flash.h"
|
||||||
|
#include "user_norflash.h"
|
||||||
|
#include "load_gui_lib.h"
|
||||||
|
#include "uart_printer_drv.h"
|
||||||
|
|
||||||
|
#define USER_UART_NUM 8
|
||||||
|
|
||||||
|
extern void MX_FDCAN2_Init(void);
|
||||||
|
|
||||||
|
uid_union uid_value;
|
||||||
|
|
||||||
|
uart_info_8bit_struct uart_info_8bit[USER_UART_NUM];
|
||||||
|
//LPUART1--eth 57600,USART1--wifi 115200,USART2--fecbus 9600,USART3--canouter 57600,UART4--linkage 19200,UART5--memory 57600,USART6--print 9600,UART7--switch 57600
|
||||||
|
unsigned char * const p_user_uart[USER_UART_NUM] = {LPUART1,USART1,USART2,USART3,UART4,UART5,USART6,UART7};
|
||||||
|
const unsigned int uart_tx_complete_timeup[USER_UART_NUM] = {3,17,17,3,9,3,20,3};//1ms 16bytes FIFO
|
||||||
|
|
||||||
|
unsigned int lcd_update_flag = 0;
|
||||||
|
unsigned int usb_is_host = 0;
|
||||||
|
|
||||||
|
//unsigned char TEXT_Buffer[]={"ABC12365478903678913"};
|
||||||
|
#define SIZE sizeof(TEXT_Buffer)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Perform the SDRAM exernal memory inialization sequence
|
||||||
|
* @param hsdram: SDRAM handle
|
||||||
|
* @param Command: Pointer to SDRAM command structure
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief Perform the SDRAM exernal memory inialization sequence
|
||||||
|
* @param hsdram: SDRAM handle
|
||||||
|
* @param Command: Pointer to SDRAM command structure
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command)
|
||||||
|
{
|
||||||
|
__IO uint32_t tmpmrd =0;
|
||||||
|
/* Step 1: Configure a clock configuration enable command */
|
||||||
|
Command->CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
|
||||||
|
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
|
||||||
|
Command->AutoRefreshNumber = 1;
|
||||||
|
Command->ModeRegisterDefinition = 0;
|
||||||
|
|
||||||
|
/* Send the command */
|
||||||
|
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
|
||||||
|
|
||||||
|
/* Step 2: Insert 100 us minimum delay */
|
||||||
|
/* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
|
||||||
|
HAL_Delay(1);
|
||||||
|
|
||||||
|
/* Step 3: Configure a PALL (precharge all) command */
|
||||||
|
Command->CommandMode = FMC_SDRAM_CMD_PALL;
|
||||||
|
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
|
||||||
|
Command->AutoRefreshNumber = 1;
|
||||||
|
Command->ModeRegisterDefinition = 0;
|
||||||
|
|
||||||
|
/* Send the command */
|
||||||
|
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
|
||||||
|
|
||||||
|
/* Step 4 : Configure a Auto-Refresh command */
|
||||||
|
Command->CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
|
||||||
|
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
|
||||||
|
Command->AutoRefreshNumber = 8;
|
||||||
|
Command->ModeRegisterDefinition = 0;
|
||||||
|
|
||||||
|
/* Send the command */
|
||||||
|
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
|
||||||
|
|
||||||
|
/* Step 5: Program the external memory mode register */
|
||||||
|
tmpmrd = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_1 |
|
||||||
|
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |
|
||||||
|
SDRAM_MODEREG_CAS_LATENCY_3 |
|
||||||
|
SDRAM_MODEREG_OPERATING_MODE_STANDARD |
|
||||||
|
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;
|
||||||
|
|
||||||
|
Command->CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
|
||||||
|
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
|
||||||
|
Command->AutoRefreshNumber = 1;
|
||||||
|
Command->ModeRegisterDefinition = tmpmrd;
|
||||||
|
|
||||||
|
/* Send the command */
|
||||||
|
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
|
||||||
|
|
||||||
|
/* Step 6: Set the refresh rate counter */
|
||||||
|
/* Set the device refresh rate */
|
||||||
|
HAL_SDRAM_ProgramRefreshRate(hsdram, REFRESH_COUNT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FDCAN2_Initialization_Sequence(void)
|
||||||
|
{
|
||||||
|
FDCAN_FilterTypeDef sFilterConfig;
|
||||||
|
|
||||||
|
/*##-2- Configure the CAN Filter ###########################################*/
|
||||||
|
/* Configure Rx filter */
|
||||||
|
sFilterConfig.IdType = FDCAN_EXTENDED_ID;
|
||||||
|
sFilterConfig.FilterIndex = 0;
|
||||||
|
sFilterConfig.FilterType = FDCAN_FILTER_MASK;
|
||||||
|
sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
|
||||||
|
sFilterConfig.FilterID1 = 0x0000;
|
||||||
|
sFilterConfig.FilterID2 = 0x0000;
|
||||||
|
|
||||||
|
if(HAL_FDCAN_ConfigFilter(&hfdcan2, &sFilterConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
/* Filter configuration Error */
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
//HAL_FDCAN_Stop(p_fdcan_handle);
|
||||||
|
/*##-3- Start the CAN peripheral ###########################################*/
|
||||||
|
if (HAL_FDCAN_Start(&hfdcan2) != HAL_OK)
|
||||||
|
{
|
||||||
|
/* Start Error */
|
||||||
|
//Error_Handler();
|
||||||
|
HAL_Delay(100);
|
||||||
|
HAL_FDCAN_Start(&hfdcan2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*##-4- Activate CAN RX TX notification #######################################*/
|
||||||
|
if (HAL_FDCAN_ActivateNotification(&hfdcan2, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0) != HAL_OK)
|
||||||
|
{
|
||||||
|
/* Notification Error */
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HAL_FDCAN_ActivateNotification(&hfdcan2, FDCAN_IT_TX_FIFO_EMPTY, 0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int FDCAN2_Reinit(void)
|
||||||
|
{
|
||||||
|
FDCAN_FilterTypeDef sFilterConfig;
|
||||||
|
|
||||||
|
MX_FDCAN2_Init();
|
||||||
|
|
||||||
|
sFilterConfig.IdType = FDCAN_EXTENDED_ID;
|
||||||
|
sFilterConfig.FilterIndex = 0;
|
||||||
|
sFilterConfig.FilterType = FDCAN_FILTER_MASK;
|
||||||
|
sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
|
||||||
|
sFilterConfig.FilterID1 = 0x0000;
|
||||||
|
sFilterConfig.FilterID2 = 0x0000;
|
||||||
|
|
||||||
|
if(HAL_FDCAN_ConfigFilter(&hfdcan2, &sFilterConfig) != HAL_OK)return 2;
|
||||||
|
HAL_FDCAN_Start(&hfdcan2);
|
||||||
|
HAL_FDCAN_ActivateNotification(&hfdcan2, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0);
|
||||||
|
HAL_FDCAN_ActivateNotification(&hfdcan2, FDCAN_IT_TX_FIFO_EMPTY, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_uuid(void)
|
||||||
|
{
|
||||||
|
uid_value.val_32[0] = LL_GetUID_Word0();
|
||||||
|
uid_value.val_32[1] = LL_GetUID_Word1();
|
||||||
|
uid_value.val_32[2] = LL_GetUID_Word2();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short get_open_password(void)
|
||||||
|
{
|
||||||
|
unsigned int pwd;
|
||||||
|
unsigned short res;
|
||||||
|
|
||||||
|
pwd = uid_value.val_32[0];
|
||||||
|
pwd^= uid_value.val_32[1];
|
||||||
|
pwd^= uid_value.val_32[2];
|
||||||
|
|
||||||
|
res = (pwd>>16)&0xFFFF;
|
||||||
|
res^= (pwd&0xFFFF);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HW_init(void)
|
||||||
|
{
|
||||||
|
unsigned int addr = 0;
|
||||||
|
unsigned int zk_addr = 0;
|
||||||
|
unsigned int value = 0;
|
||||||
|
unsigned int i = 0,x = 0,y = 0, a = 0;
|
||||||
|
|
||||||
|
get_uuid();
|
||||||
|
factory_prm.pwr = get_open_password();
|
||||||
|
read_factory_prm();
|
||||||
|
|
||||||
|
//LCD RST
|
||||||
|
LL_GPIO_SetOutputPin(GPIOE,LL_GPIO_PIN_3);//not rst
|
||||||
|
|
||||||
|
//TIM2 relay
|
||||||
|
LL_TIM_CC_EnableChannel(TIM2,LL_TIM_CHANNEL_CH1);
|
||||||
|
LL_TIM_OC_SetCompareCH1(TIM2,0);
|
||||||
|
LL_TIM_EnableAllOutputs(TIM2);
|
||||||
|
//LL_TIM_EnableIT_UPDATE(TIM2);
|
||||||
|
LL_TIM_EnableCounter(TIM2);
|
||||||
|
|
||||||
|
//TIM3 LCD_BL
|
||||||
|
LL_TIM_CC_EnableChannel(TIM3,LL_TIM_CHANNEL_CH2);
|
||||||
|
LL_TIM_OC_SetCompareCH2(TIM3,255);//bl
|
||||||
|
LL_TIM_EnableAllOutputs(TIM3);
|
||||||
|
LL_TIM_EnableCounter(TIM3);
|
||||||
|
|
||||||
|
//TIM7 random
|
||||||
|
//LL_TIM_EnableIT_UPDATE(TIM7);
|
||||||
|
LL_TIM_EnableCounter(TIM7);
|
||||||
|
|
||||||
|
//TIM12 relay
|
||||||
|
LL_TIM_CC_EnableChannel(TIM12,LL_TIM_CHANNEL_CH1);
|
||||||
|
LL_TIM_OC_SetCompareCH1(TIM12,0);
|
||||||
|
LL_TIM_EnableAllOutputs(TIM12);
|
||||||
|
//LL_TIM_EnableIT_UPDATE(TIM2);
|
||||||
|
LL_TIM_EnableCounter(TIM12);
|
||||||
|
|
||||||
|
//LPUART1
|
||||||
|
LL_USART_EnableIT_RXNE(LPUART1);
|
||||||
|
LL_USART_ClearFlag_IDLE(LPUART1);
|
||||||
|
//LL_USART_EnableIT_IDLE(LPUART1);
|
||||||
|
uart_info_8bit[0].tx_complete = 1;
|
||||||
|
|
||||||
|
//UART1
|
||||||
|
LL_USART_EnableIT_RXNE(USART1);
|
||||||
|
LL_USART_ClearFlag_IDLE(USART1);
|
||||||
|
LL_USART_EnableIT_IDLE(USART1);
|
||||||
|
uart_info_8bit[1].tx_complete = 1;
|
||||||
|
|
||||||
|
//UART2
|
||||||
|
LL_USART_EnableIT_RXNE(USART2);
|
||||||
|
LL_USART_ClearFlag_IDLE(USART2);
|
||||||
|
//LL_USART_EnableIT_IDLE(USART2);
|
||||||
|
uart_info_8bit[2].tx_complete = 1;
|
||||||
|
|
||||||
|
//UART3
|
||||||
|
LL_USART_EnableIT_RXNE(USART3);
|
||||||
|
LL_USART_ClearFlag_IDLE(USART3);
|
||||||
|
LL_USART_EnableIT_IDLE(USART3);
|
||||||
|
uart_info_8bit[3].tx_complete = 1;
|
||||||
|
|
||||||
|
//UART4
|
||||||
|
LL_USART_EnableIT_RXNE(UART4);
|
||||||
|
LL_USART_ClearFlag_IDLE(UART4);
|
||||||
|
//LL_USART_EnableIT_IDLE(UART4);
|
||||||
|
uart_info_8bit[4].tx_complete = 1;
|
||||||
|
|
||||||
|
//UART5
|
||||||
|
LL_USART_EnableIT_RXNE(UART5);
|
||||||
|
LL_USART_ClearFlag_IDLE(UART5);
|
||||||
|
LL_USART_EnableIT_IDLE(UART5);
|
||||||
|
uart_info_8bit[5].tx_complete = 1;
|
||||||
|
|
||||||
|
//UART6
|
||||||
|
LL_USART_EnableIT_RXNE(USART6);
|
||||||
|
uart_info_8bit[6].tx_complete = 1;
|
||||||
|
|
||||||
|
//UART7
|
||||||
|
LL_USART_EnableIT_RXNE(UART7);
|
||||||
|
LL_USART_ClearFlag_IDLE(UART7);
|
||||||
|
LL_USART_EnableIT_IDLE(UART7);
|
||||||
|
uart_info_8bit[7].tx_complete = 1;
|
||||||
|
|
||||||
|
//fdcan2
|
||||||
|
FDCAN2_Initialization_Sequence();
|
||||||
|
can_prm_init();
|
||||||
|
|
||||||
|
//LTDC
|
||||||
|
LTDC_Init();
|
||||||
|
//LTDC->IER |= LTDC_IER_LIE;
|
||||||
|
|
||||||
|
//RTC
|
||||||
|
rtc_init();
|
||||||
|
|
||||||
|
//I2C
|
||||||
|
//write_user_eeprom(0, 0x1005, TEXT_Buffer, 16);
|
||||||
|
//write_user_eeprom(1, 0x10001, &TEXT_Buffer[1], 16);
|
||||||
|
|
||||||
|
//USBFS
|
||||||
|
usb_is_host = 1;
|
||||||
|
|
||||||
|
//QSPI-HW 24Mhz
|
||||||
|
nor_flash_init();
|
||||||
|
//W25QXX_Init();
|
||||||
|
//nor_erase_sector(0,0);
|
||||||
|
//nor_write_byte(0,0x403,TEXT_Buffer,16);
|
||||||
|
//nor_write_byte(1,0x207,TEXT_Buffer,16);
|
||||||
|
|
||||||
|
//LCD
|
||||||
|
LTDC_Layer_Switch(1,0);
|
||||||
|
//LTDC_Layer_Switch(0,1);
|
||||||
|
addr = 0xC0000000 + 480*800*4;
|
||||||
|
for(y=0;y<480;y++){
|
||||||
|
for(x=0;x<800;x++){
|
||||||
|
*(unsigned int*)addr = 0;
|
||||||
|
addr+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_prm_init();
|
||||||
|
|
||||||
|
//device_init
|
||||||
|
printer_init();
|
||||||
|
|
||||||
|
//------------------------test-----------------------------------------
|
||||||
|
/*
|
||||||
|
for(i=0;i<480;i++){
|
||||||
|
addr = 50*4 + 0xC0000000 + (800*i*4);
|
||||||
|
*(unsigned int*)addr = 0xFF00FF00;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
addr = 0xC0177000 + (10*800*4);
|
||||||
|
for(y=0;y<10;y++){
|
||||||
|
for(x=0;x<800;x++){
|
||||||
|
*(unsigned int*)addr = 0xFF000080;
|
||||||
|
addr+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addr = 0xC0177000 + (20*800*4);
|
||||||
|
for(y=0;y<10;y++){
|
||||||
|
for(x=0;x<800;x++){
|
||||||
|
*(unsigned int*)addr = 0xFF000040;
|
||||||
|
addr+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addr = 0xC0177000 + (30*800*4);
|
||||||
|
for(y=0;y<10;y++){
|
||||||
|
for(x=0;x<800;x++){
|
||||||
|
*(unsigned int*)addr = 0xFF000020;
|
||||||
|
addr+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addr = 0xC0177000 + (40*800*4);
|
||||||
|
for(y=0;y<10;y++){
|
||||||
|
for(x=0;x<800;x++){
|
||||||
|
*(unsigned int*)addr = 0xFF000010;
|
||||||
|
addr+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
LCD_ShowString(0,240,200,24,24,"SD");
|
||||||
|
//while(1);
|
||||||
|
|
||||||
|
//erase_internal_one_sector(ADDR_FLASH_SECTOR_6_BANK2);
|
||||||
|
//write_internal_flash(ADDR_FLASH_SECTOR_6_BANK2,FlashWord);
|
||||||
|
LCD_ShowString(20,200,200,24,24,"SD");
|
||||||
|
Show_Str(20,100,720,24,"STM32H7¿ª0123456789abcuodij·¢111°å",24,0);//
|
||||||
|
gui_write_string24(20,130,0xFFFF0000,0xFF00FF00,"Óû§²Î845ÊýSWEIÉèawÖÃ");
|
||||||
|
|
||||||
|
load_pic_16x16_to_dispaly_layer(100,200,45);
|
||||||
|
load_pic_16x16_to_dispaly_layer(140,200,8);
|
||||||
|
load_pic_24x24_to_dispaly_layer(100,230,101);
|
||||||
|
load_pic_24x24_to_dispaly_layer(140,230,14);
|
||||||
|
load_pic_32x32_to_dispaly_layer(100,260,30);
|
||||||
|
load_pic_32x32_to_dispaly_layer(140,260,15);
|
||||||
|
*/
|
||||||
|
//nor_read_byte(0,0x009C0000,TEXT_Buffer,16);
|
||||||
|
|
||||||
|
//hw_sdram_test();
|
||||||
|
|
||||||
|
gbk_nor_load_to_sdram();
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_tx_trigger(unsigned int uart_ord)
|
||||||
|
{
|
||||||
|
if(uart_ord > 7)return;
|
||||||
|
|
||||||
|
uart_info_8bit[uart_ord].tx_index = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete_delay_flag = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete_delay_tick = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_none_buf = 0;
|
||||||
|
|
||||||
|
LL_USART_ClearFlag_TC(p_user_uart[uart_ord]);
|
||||||
|
LL_USART_EnableIT_TC(p_user_uart[uart_ord]);
|
||||||
|
LL_USART_EnableIT_TXFE(p_user_uart[uart_ord]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_tx_load_data(unsigned int uart_ord, unsigned char * p_data, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned char * pdata;
|
||||||
|
|
||||||
|
if(uart_ord > 7)return;
|
||||||
|
|
||||||
|
pdata = p_data;
|
||||||
|
|
||||||
|
uart_info_8bit[uart_ord].tx_index = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_none_buf = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_len = len;
|
||||||
|
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
uart_info_8bit[uart_ord].tx_buf[i] = *pdata;
|
||||||
|
pdata++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_uart_tx_complete(unsigned int uart_ord)
|
||||||
|
{
|
||||||
|
if(uart_ord > 7)return 0;
|
||||||
|
|
||||||
|
return uart_info_8bit[uart_ord].tx_complete;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_uart_tx_complete_delay_flag(unsigned int uart_ord)
|
||||||
|
{
|
||||||
|
if(uart_ord > 7)return 0;
|
||||||
|
|
||||||
|
return uart_info_8bit[uart_ord].tx_complete_delay_flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_tx_complete_delay(void)//1ms
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0;i<USER_UART_NUM;i++){
|
||||||
|
if(get_uart_tx_complete(i)){
|
||||||
|
if(0 == uart_info_8bit[i].tx_complete_delay_flag){
|
||||||
|
uart_info_8bit[i].tx_complete_delay_tick++;
|
||||||
|
if(uart_info_8bit[i].tx_complete_delay_tick > uart_tx_complete_timeup[i]){
|
||||||
|
uart_info_8bit[i].tx_complete_delay_tick = 0;
|
||||||
|
uart_info_8bit[i].tx_complete_delay_flag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_tx_over(unsigned int uart_ord, unsigned char * p_data, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned char * pdata;
|
||||||
|
|
||||||
|
if(uart_ord > 7)return;
|
||||||
|
|
||||||
|
pdata = p_data;
|
||||||
|
|
||||||
|
uart_info_8bit[uart_ord].tx_index = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete_delay_flag = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete_delay_tick = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_none_buf = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_len = len;
|
||||||
|
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
uart_info_8bit[uart_ord].tx_buf[i] = *pdata;
|
||||||
|
pdata++;
|
||||||
|
}
|
||||||
|
|
||||||
|
uart_tx_trigger(uart_ord);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_load_txbuf(unsigned int uart_ord, unsigned char * p_data, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned char * pdata;
|
||||||
|
|
||||||
|
if(uart_ord > 7)return;
|
||||||
|
|
||||||
|
pdata = p_data;
|
||||||
|
|
||||||
|
uart_info_8bit[uart_ord].tx_index = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete_delay_flag = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_complete_delay_tick = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_none_buf = 0;
|
||||||
|
uart_info_8bit[uart_ord].tx_len = len;
|
||||||
|
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
uart_info_8bit[uart_ord].tx_buf[i] = *pdata;
|
||||||
|
pdata++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_irq_handle(USART_TypeDef * USARTx)
|
||||||
|
{
|
||||||
|
unsigned short cc;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for(i=0;i<8;i++){
|
||||||
|
if(USARTx == p_user_uart[i])break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(USARTx))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(USARTx);
|
||||||
|
|
||||||
|
if(uart_info_8bit[i].rx_index < UART_RX_BUF_MAX)
|
||||||
|
{
|
||||||
|
uart_info_8bit[i].rx_buf[uart_info_8bit[i].rx_index] = cc;
|
||||||
|
uart_info_8bit[i].rx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_IDLE(USARTx))
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_IDLE(USARTx);
|
||||||
|
if(uart_info_8bit[i].rx_index)
|
||||||
|
{
|
||||||
|
uart_info_8bit[i].rx_len = uart_info_8bit[i].rx_index;
|
||||||
|
uart_info_8bit[i].rx_index = 0;
|
||||||
|
uart_info_8bit[i].rx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
if(LL_USART_IsEnabledIT_TC(USARTx))//LL_USART_IsActiveFlag_TC
|
||||||
|
{
|
||||||
|
LL_USART_ClearFlag_TC(USARTx);
|
||||||
|
if(uart_info_8bit[i].tx_index >= uart_info_8bit[i].tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TC(USARTx);
|
||||||
|
uart_info_8bit[i].tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LL_USART_IsEnabledIT_TXE_TXFNF(USARTx))//LL_USART_IsActiveFlag_TXE_TXFNF
|
||||||
|
{
|
||||||
|
if(uart_info_8bit[i].tx_index >= uart_info_8bit[i].tx_len)
|
||||||
|
{
|
||||||
|
LL_USART_DisableIT_TXE_TXFNF(USARTx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_USART_TransmitData8(USARTx, uart_info_8bit[i].tx_buf[uart_info_8bit[i].tx_index]);
|
||||||
|
uart_info_8bit[i].tx_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
LL_USART_ClearFlag_ORE(USARTx);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short crc16_data(unsigned char* p_data,unsigned int data_length)
|
||||||
|
{
|
||||||
|
unsigned int x = 0,y = 0;
|
||||||
|
unsigned short crc = 0xFFFF;
|
||||||
|
unsigned char data = 0;
|
||||||
|
|
||||||
|
for(x=0;x<data_length;x++){
|
||||||
|
data = (* p_data);
|
||||||
|
crc ^= data;
|
||||||
|
for(y=0;y<8;y++){
|
||||||
|
if(crc & 0x01){
|
||||||
|
crc>>=1;
|
||||||
|
crc ^= 0xA001;
|
||||||
|
}else{
|
||||||
|
crc>>=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p_data++;
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int check_crc(unsigned char* p_data,unsigned int data_length)
|
||||||
|
{
|
||||||
|
uint16_t crc_data = 0;
|
||||||
|
|
||||||
|
if(data_length < 2)return 0;
|
||||||
|
|
||||||
|
crc_data = *(p_data + data_length - 1);
|
||||||
|
crc_data<<=8;
|
||||||
|
crc_data |= *(p_data + data_length - 2);
|
||||||
|
|
||||||
|
if(crc_data == crc16_data(p_data,(data_length - 2))){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char sum8_data(unsigned char* p_data,unsigned int data_length)
|
||||||
|
{
|
||||||
|
unsigned int x = 0;
|
||||||
|
unsigned char sum = 0;
|
||||||
|
|
||||||
|
for(x=0;x<data_length;x++){
|
||||||
|
sum+= (* p_data);
|
||||||
|
p_data++;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int check_sum8(unsigned char* p_data,unsigned int data_length)
|
||||||
|
{
|
||||||
|
uint8_t sum = 0;
|
||||||
|
|
||||||
|
sum = *(p_data + data_length);
|
||||||
|
|
||||||
|
if(sum == sum8_data(p_data,data_length)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int check_open_password(unsigned int check_value)
|
||||||
|
{
|
||||||
|
if(check_value == factory_prm.pwr){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int check_open_password_isenable(void)
|
||||||
|
{
|
||||||
|
return factory_prm.open_password_isenable;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int check_auth_function_isenable(void)
|
||||||
|
{
|
||||||
|
return factory_prm.auth_function_isenable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_open_password_isover(void)
|
||||||
|
{
|
||||||
|
factory_prm.open_password_isenable = 0;
|
||||||
|
write_factory_prm();
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_auth_function_able(unsigned int able)
|
||||||
|
{
|
||||||
|
if(able > 1)return;
|
||||||
|
factory_prm.auth_function_isenable = able;
|
||||||
|
write_factory_prm();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc)
|
||||||
|
{
|
||||||
|
lcd_update_flag = 1;
|
||||||
|
__HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_LI);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Function Name : Crc32Cal
|
||||||
|
* Description : CRC
|
||||||
|
* Input : SourceData,Length
|
||||||
|
* Output : None
|
||||||
|
* Return : none
|
||||||
|
*******************************************************************************/
|
||||||
|
unsigned int Crc32Cal(unsigned int * SourceData, unsigned int Length)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
CRC->CR |= CRC_CR_RESET;
|
||||||
|
|
||||||
|
for (i = 0; i < Length; ++i)
|
||||||
|
{
|
||||||
|
CRC->DR = *SourceData;
|
||||||
|
SourceData++;
|
||||||
|
}
|
||||||
|
return CRC->DR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Crc32Reset(void)
|
||||||
|
{
|
||||||
|
CRC->CR |= CRC_CR_RESET;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Crc32Feed(unsigned int aVal)
|
||||||
|
{
|
||||||
|
CRC->DR = aVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int Crc32GetResult()
|
||||||
|
{
|
||||||
|
return CRC->DR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_host_to_device(void)
|
||||||
|
{
|
||||||
|
if(usb_is_host){
|
||||||
|
MX_FATFS_DeInit();
|
||||||
|
HAL_Delay(5);
|
||||||
|
HAL_NVIC_ClearPendingIRQ(OTG_FS_IRQn);
|
||||||
|
HAL_NVIC_DisableIRQ(OTG_FS_IRQn);
|
||||||
|
MX_USB_HOST_DeInit();
|
||||||
|
HAL_Delay(10);
|
||||||
|
|
||||||
|
MX_USB_DEVICE_Init();
|
||||||
|
HAL_Delay(5);
|
||||||
|
|
||||||
|
usb_is_host = 0;
|
||||||
|
|
||||||
|
UsbConfigSetState(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_device_to_host(void)
|
||||||
|
{
|
||||||
|
if(0 == usb_is_host){
|
||||||
|
HAL_NVIC_ClearPendingIRQ(OTG_FS_IRQn);
|
||||||
|
HAL_NVIC_DisableIRQ(OTG_FS_IRQn);
|
||||||
|
MX_USB_DEVICE_DeInit();
|
||||||
|
HAL_Delay(5);
|
||||||
|
|
||||||
|
UsbConfigSetState(0);
|
||||||
|
|
||||||
|
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
|
||||||
|
HAL_NVIC_ClearPendingIRQ(OTG_FS_IRQn);
|
||||||
|
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
|
||||||
|
|
||||||
|
MX_USB_HOST_Init();
|
||||||
|
MX_FATFS_Init();
|
||||||
|
HAL_Delay(5);
|
||||||
|
|
||||||
|
usb_is_host = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
118
FW/Core/my_src/HW_config.h
Normal file
118
FW/Core/my_src/HW_config.h
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
#ifndef HW_CONFIG_H_
|
||||||
|
#define HW_CONFIG_H_
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#define UART_RX_BUF_MAX 512//272
|
||||||
|
#define UART_TX_BUF_MAX 512//128
|
||||||
|
|
||||||
|
#define USB_CDC_BUF_MAX 272
|
||||||
|
|
||||||
|
typedef struct uart_def_8bit
|
||||||
|
{
|
||||||
|
unsigned char rx_buf[UART_RX_BUF_MAX];
|
||||||
|
unsigned short rx_len;
|
||||||
|
unsigned short rx_index;
|
||||||
|
unsigned short rx_complete;
|
||||||
|
unsigned short rsv;
|
||||||
|
|
||||||
|
unsigned char tx_buf[UART_TX_BUF_MAX];
|
||||||
|
unsigned short tx_len;
|
||||||
|
unsigned short tx_index;
|
||||||
|
unsigned short tx_none_buf;
|
||||||
|
unsigned short tx_complete;
|
||||||
|
unsigned short tx_complete_delay_flag;
|
||||||
|
unsigned short tx_complete_delay_tick;
|
||||||
|
}uart_info_8bit_struct;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned char rx_buf[USB_CDC_BUF_MAX];
|
||||||
|
unsigned int rx_len;
|
||||||
|
unsigned int rx_complete;
|
||||||
|
|
||||||
|
unsigned char tx_buf[USB_CDC_BUF_MAX];
|
||||||
|
unsigned int tx_len;
|
||||||
|
unsigned int tx_complete;
|
||||||
|
unsigned int tx_complete_delay_flag;
|
||||||
|
unsigned int tx_complete_delay_tick;
|
||||||
|
}T_usb_cdc_data_struct;
|
||||||
|
|
||||||
|
typedef union{
|
||||||
|
unsigned char D8[256];
|
||||||
|
unsigned int D32[64];
|
||||||
|
}TdataType;
|
||||||
|
|
||||||
|
typedef union{
|
||||||
|
uint32_t val_32[3];
|
||||||
|
uint8_t val_8[12];
|
||||||
|
}uid_union;
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
typedef enum {PASSED = 0, FAILED = !PASSED} TestStatus_t;
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
#define SDRAM_BANK_ADDR ((uint32_t)0xC0000000)
|
||||||
|
|
||||||
|
/* #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_8 */
|
||||||
|
/* #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_16 */
|
||||||
|
#define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_32
|
||||||
|
|
||||||
|
#define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_2
|
||||||
|
/* #define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_3 */
|
||||||
|
|
||||||
|
#define SDRAM_TIMEOUT ((uint32_t)0xFFFF)
|
||||||
|
|
||||||
|
//刷新频率计数器(以SDCLK频率计数),计算方法:
|
||||||
|
//COUNT=SDRAM刷新周期/行数-20=SDRAM刷新周期(us)*SDCLK频率(Mhz)/行数
|
||||||
|
//我们使用的SDRAM刷新周期为64ms,SDCLK=240/3=80Mhz,行数为8192(2^13).
|
||||||
|
//所以,COUNT=64*1000*80/8192-20=677
|
||||||
|
#define REFRESH_COUNT ((uint32_t)625) /* SDRAM refresh counter */
|
||||||
|
|
||||||
|
#define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000)
|
||||||
|
#define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001)
|
||||||
|
#define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002)
|
||||||
|
#define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004)
|
||||||
|
#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000)
|
||||||
|
#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008)
|
||||||
|
#define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020)
|
||||||
|
#define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030)
|
||||||
|
#define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000)
|
||||||
|
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
|
||||||
|
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200)
|
||||||
|
|
||||||
|
extern uid_union uid_value;
|
||||||
|
|
||||||
|
extern unsigned int usb_is_host;
|
||||||
|
|
||||||
|
extern uart_info_8bit_struct uart_info_8bit[8];
|
||||||
|
extern T_usb_cdc_data_struct usb_cdc_data;
|
||||||
|
|
||||||
|
extern void uart_tx_trigger(unsigned int uart_ord);
|
||||||
|
extern void uart_tx_load_data(unsigned int uart_ord, unsigned char * p_data, unsigned int len);
|
||||||
|
extern unsigned int get_uart_tx_complete(unsigned int uart_ord);
|
||||||
|
extern unsigned int get_uart_tx_complete_delay_flag(unsigned int uart_ord);
|
||||||
|
extern void uart_tx_complete_delay(void);
|
||||||
|
extern void uart_tx_over(unsigned int uart_ord, unsigned char * p_data, unsigned int len);
|
||||||
|
extern void uart_load_txbuf(unsigned int uart_ord, unsigned char * p_data, unsigned int len);
|
||||||
|
|
||||||
|
extern void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command);
|
||||||
|
extern void HW_init(void);
|
||||||
|
|
||||||
|
extern unsigned int check_sum8(unsigned char* p_data,unsigned int data_length);
|
||||||
|
|
||||||
|
extern unsigned int check_open_password(unsigned int check_value);
|
||||||
|
extern unsigned int check_open_password_isenable(void);
|
||||||
|
extern unsigned int check_auth_function_isenable(void);
|
||||||
|
extern void set_open_password_isover(void);
|
||||||
|
extern void set_auth_function_able(unsigned int able);
|
||||||
|
|
||||||
|
extern void usb_host_to_device(void);
|
||||||
|
extern void usb_device_to_host(void);
|
||||||
|
|
||||||
|
extern unsigned int Crc32Cal(unsigned int * SourceData, unsigned int Length);
|
||||||
|
extern void Crc32Reset(void);
|
||||||
|
extern void Crc32Feed(unsigned int aVal);
|
||||||
|
extern unsigned int Crc32GetResult();
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
1094
FW/Core/my_src/HW_test_task.c
Normal file
1094
FW/Core/my_src/HW_test_task.c
Normal file
File diff suppressed because it is too large
Load Diff
17
FW/Core/my_src/HW_test_task.h
Normal file
17
FW/Core/my_src/HW_test_task.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef __HW_TEST_TASK_H
|
||||||
|
#define __HW_TEST_TASK_H
|
||||||
|
|
||||||
|
extern unsigned int hw_test_mode;
|
||||||
|
extern unsigned char rx_text_buf[32];
|
||||||
|
|
||||||
|
extern unsigned int hw_test_init(void);
|
||||||
|
extern unsigned int hw_test_deinit(void);
|
||||||
|
extern unsigned int hw_uart_test(void);
|
||||||
|
extern unsigned int hw_eeprom_test(void);
|
||||||
|
extern unsigned int hw_nor_flash_test(void);
|
||||||
|
extern unsigned int hw_sdram_test(void);
|
||||||
|
extern void hw_print_test(void);
|
||||||
|
extern void hw_relay_test(void);
|
||||||
|
extern void hw_lcd_test(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
373
FW/Core/my_src/I2C_eeprom.c
Normal file
373
FW/Core/my_src/I2C_eeprom.c
Normal file
@@ -0,0 +1,373 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "I2C_eeprom.h"
|
||||||
|
|
||||||
|
//--------------------------724KHz-----------------sys:480MHz--------stm32H743-----------------
|
||||||
|
|
||||||
|
#define I2C_ADDR_READ 0xA1
|
||||||
|
#define I2C_ADDR_WRITE 0xA0
|
||||||
|
|
||||||
|
#define I2C_WP_PT() LL_GPIO_SetOutputPin(GPIOD,LL_GPIO_PIN_11)
|
||||||
|
#define I2C_WP_UNPT() LL_GPIO_ResetOutputPin(GPIOD,LL_GPIO_PIN_11)
|
||||||
|
|
||||||
|
#define I2C_SCL_HI() LL_GPIO_SetOutputPin(GPIOD,LL_GPIO_PIN_12)
|
||||||
|
#define I2C_SCL_LO() LL_GPIO_ResetOutputPin(GPIOD,LL_GPIO_PIN_12)
|
||||||
|
|
||||||
|
#define I2C_SDA_HI() LL_GPIO_SetOutputPin(GPIOD,LL_GPIO_PIN_13)
|
||||||
|
#define I2C_SDA_LO() LL_GPIO_ResetOutputPin(GPIOD,LL_GPIO_PIN_13)
|
||||||
|
|
||||||
|
#define SDA_VALUE() ((0x2000 & GPIOD->IDR)>>13)
|
||||||
|
|
||||||
|
static volatile unsigned short delay_4_pgm;
|
||||||
|
|
||||||
|
static volatile unsigned char delay_x_tick;
|
||||||
|
|
||||||
|
static void delay_x(void)
|
||||||
|
{
|
||||||
|
for(delay_x_tick=0;delay_x_tick<16;delay_x_tick++);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I2C_SCL_hi(void)
|
||||||
|
{
|
||||||
|
I2C_SCL_HI();delay_x();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I2C_SCL_lo(void)
|
||||||
|
{
|
||||||
|
I2C_SCL_LO();delay_x();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I2C_SDA_hi(void)
|
||||||
|
{
|
||||||
|
I2C_SDA_HI();delay_x();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I2C_SDA_lo(void)
|
||||||
|
{
|
||||||
|
I2C_SDA_LO();delay_x();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wait(void)
|
||||||
|
{
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I2C_start(void)
|
||||||
|
{
|
||||||
|
I2C_SCL_lo(); //SCL low
|
||||||
|
wait();
|
||||||
|
I2C_SDA_lo(); //SDA low
|
||||||
|
wait();
|
||||||
|
I2C_SDA_hi(); //SDA high
|
||||||
|
wait();
|
||||||
|
I2C_SCL_hi(); //SCL high
|
||||||
|
wait();
|
||||||
|
I2C_SDA_lo(); //SDA goes low before the clock
|
||||||
|
wait();
|
||||||
|
I2C_SCL_lo(); //SCL low
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I2C_stop(void)
|
||||||
|
{
|
||||||
|
I2C_SDA_lo(); //SDA low
|
||||||
|
wait();
|
||||||
|
I2C_SCL_hi(); //SCL high
|
||||||
|
wait();
|
||||||
|
I2C_SDA_hi(); //SDA goes from low to high when SCL is already high,
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char I2C_send_byte(unsigned char bb)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned char noack;
|
||||||
|
unsigned char b,s;
|
||||||
|
b=bb;
|
||||||
|
for (i=8; i>0; i--)
|
||||||
|
{
|
||||||
|
I2C_SCL_lo(); //Reset SCL
|
||||||
|
wait();
|
||||||
|
s = b >> 7; //Send data to SDA pin
|
||||||
|
if(1==(s & 0x01))I2C_SDA_hi();else I2C_SDA_lo();
|
||||||
|
wait();
|
||||||
|
I2C_SCL_hi(); //Set SCL
|
||||||
|
wait();
|
||||||
|
I2C_SCL_lo(); //Reset SCL
|
||||||
|
wait();
|
||||||
|
b<<=1; //Rotate data
|
||||||
|
}
|
||||||
|
I2C_SDA_hi();
|
||||||
|
I2C_SCL_lo(); //Reset SCL
|
||||||
|
wait();
|
||||||
|
I2C_SCL_hi(); //Set SCL
|
||||||
|
wait();
|
||||||
|
delay_x();
|
||||||
|
delay_x();
|
||||||
|
noack = SDA_VALUE(); //Check SDA for ACKN
|
||||||
|
wait();
|
||||||
|
I2C_SCL_lo();
|
||||||
|
wait();
|
||||||
|
I2C_SDA_lo();
|
||||||
|
wait();
|
||||||
|
return(noack);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char I2C_read_byte(unsigned char ackn)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned char ReceivedByte;
|
||||||
|
|
||||||
|
ReceivedByte=0x0000;
|
||||||
|
I2C_SDA_hi(); //Make SDA an input
|
||||||
|
I2C_SCL_lo(); //Reset SCL
|
||||||
|
for (i=8; i>0; i--)
|
||||||
|
{
|
||||||
|
wait();
|
||||||
|
I2C_SCL_hi(); //Set SCL
|
||||||
|
ReceivedByte <<= 1; //Rotate data
|
||||||
|
ReceivedByte |= SDA_VALUE(); //Read SDA -> data
|
||||||
|
wait();
|
||||||
|
I2C_SCL_lo(); //Reset SCL
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
if(0==ackn)I2C_SDA_lo();else I2C_SDA_hi(); //SDA = ACK bit
|
||||||
|
wait();
|
||||||
|
I2C_SCL_hi(); //Set SCL
|
||||||
|
wait();
|
||||||
|
I2C_SCL_lo(); //Reset SCL
|
||||||
|
wait();
|
||||||
|
return(ReceivedByte);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int I2C_byte_write_via_page(unsigned int chip_cs, unsigned int addr, unsigned char *p, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char addr_hi,addr_lo;
|
||||||
|
unsigned int i2c_page_size;
|
||||||
|
unsigned char i2c_addr_write_cmd;
|
||||||
|
unsigned char offset;
|
||||||
|
|
||||||
|
if(chip_cs){
|
||||||
|
i2c_page_size = I2C_PAGE_SIZE_24M01;
|
||||||
|
}else{
|
||||||
|
i2c_page_size = I2C_PAGE_SIZE_24512;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = addr & (i2c_page_size - 1);
|
||||||
|
if((offset + len) > i2c_page_size)return 1;
|
||||||
|
|
||||||
|
if(chip_cs)i2c_addr_write_cmd = I2C_ADDR_WRITE | 0x08 | ((addr&0x00010000)>>15);
|
||||||
|
else i2c_addr_write_cmd = I2C_ADDR_WRITE;
|
||||||
|
|
||||||
|
I2C_WP_UNPT();
|
||||||
|
|
||||||
|
addr_hi = (unsigned char)(addr >> 8);
|
||||||
|
addr_lo = (unsigned char)(addr);
|
||||||
|
|
||||||
|
I2C_start();
|
||||||
|
if(!I2C_send_byte(i2c_addr_write_cmd))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_hi))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_lo))
|
||||||
|
{
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
data=*p;
|
||||||
|
I2C_send_byte(data);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}else return 1;
|
||||||
|
}else return 1;
|
||||||
|
}else return 1;
|
||||||
|
I2C_stop();
|
||||||
|
|
||||||
|
//for(delay_4_pgm = 0; delay_4_pgm < 8000; delay_4_pgm++);
|
||||||
|
|
||||||
|
I2C_WP_PT();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int I2C_page_write(unsigned int chip_cs, unsigned int addr, unsigned char *p)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char addr_hi,addr_lo;
|
||||||
|
unsigned int i2c_page_size;
|
||||||
|
unsigned char i2c_addr_write_cmd;
|
||||||
|
|
||||||
|
if(chip_cs){
|
||||||
|
i2c_page_size = I2C_PAGE_SIZE_24M01;
|
||||||
|
addr_hi = (unsigned char)(addr >> 8);
|
||||||
|
addr_lo = 0;
|
||||||
|
}else{
|
||||||
|
i2c_page_size = I2C_PAGE_SIZE_24512;
|
||||||
|
addr_hi = (unsigned char)(addr >> 8);
|
||||||
|
addr_lo = (unsigned char)(addr & 0x80);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(chip_cs)i2c_addr_write_cmd = I2C_ADDR_WRITE | 0x08 | ((addr&0x00010000)>>15);
|
||||||
|
else i2c_addr_write_cmd = I2C_ADDR_WRITE;
|
||||||
|
|
||||||
|
I2C_WP_UNPT();
|
||||||
|
|
||||||
|
I2C_start();
|
||||||
|
if(!I2C_send_byte(i2c_addr_write_cmd))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_hi))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_lo))
|
||||||
|
{
|
||||||
|
for(i=0;i<i2c_page_size;i++)
|
||||||
|
{
|
||||||
|
data=*p;
|
||||||
|
I2C_send_byte(data);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}else return 1;
|
||||||
|
}else return 1;
|
||||||
|
}else return 1;
|
||||||
|
I2C_stop();
|
||||||
|
|
||||||
|
//for(delay_4_pgm = 0; delay_4_pgm < 8000; delay_4_pgm++);
|
||||||
|
|
||||||
|
I2C_WP_PT();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int I2C_page_read(unsigned int chip_cs, unsigned int addr, unsigned char *p, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned char addr_hi,addr_lo;
|
||||||
|
unsigned int i2c_page_size;
|
||||||
|
unsigned int chip_size;
|
||||||
|
unsigned char i2c_addr_write_cmd;
|
||||||
|
unsigned char i2c_addr_read_cmd;
|
||||||
|
|
||||||
|
if(chip_cs){
|
||||||
|
i2c_page_size = I2C_PAGE_SIZE_24M01;
|
||||||
|
chip_size = I2C_CHIP_SIZE_24M01;
|
||||||
|
}else{
|
||||||
|
i2c_page_size = I2C_PAGE_SIZE_24512;
|
||||||
|
chip_size = I2C_CHIP_SIZE_24512;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((addr + len) > chip_size)return 1;
|
||||||
|
|
||||||
|
if(chip_cs){
|
||||||
|
i2c_addr_write_cmd = I2C_ADDR_WRITE | 0x08 | ((addr&0x00010000)>>15);
|
||||||
|
i2c_addr_read_cmd = I2C_ADDR_READ | 0x08 | ((addr&0x00010000)>>15);
|
||||||
|
}else{
|
||||||
|
i2c_addr_write_cmd = I2C_ADDR_WRITE;
|
||||||
|
i2c_addr_read_cmd = I2C_ADDR_READ;
|
||||||
|
}
|
||||||
|
|
||||||
|
addr_hi = (unsigned char)(addr >> 8);
|
||||||
|
addr_lo = (unsigned char)(addr);
|
||||||
|
|
||||||
|
I2C_start();
|
||||||
|
if(!I2C_send_byte(i2c_addr_write_cmd))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_hi))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_lo))
|
||||||
|
{
|
||||||
|
I2C_stop();
|
||||||
|
I2C_start();
|
||||||
|
I2C_send_byte(i2c_addr_read_cmd);
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
if(i<(len - 1))
|
||||||
|
{
|
||||||
|
*p=I2C_read_byte(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*p=I2C_read_byte(1);
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}else return 1;
|
||||||
|
}else return 1;
|
||||||
|
}else return 1;
|
||||||
|
I2C_stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void I2C_page_write(unsigned int page_addr, unsigned char *p)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char addr_hi,addr_lo;
|
||||||
|
|
||||||
|
I2C_WP_UNPT();
|
||||||
|
|
||||||
|
addr_hi = (unsigned char)(page_addr >> 8);
|
||||||
|
addr_lo = (unsigned char)(page_addr&0xFF);
|
||||||
|
|
||||||
|
I2C_start();
|
||||||
|
if(!I2C_send_byte(I2C_addr_write))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_hi))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_lo))
|
||||||
|
{
|
||||||
|
for(i=0;i<I2C_PAGE_SIZE;i++)
|
||||||
|
{
|
||||||
|
data=*p;
|
||||||
|
I2C_send_byte(data);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I2C_stop();
|
||||||
|
|
||||||
|
for(delay_4_pgm = 0; delay_4_pgm < 8000; delay_4_pgm++);
|
||||||
|
|
||||||
|
I2C_WP_PT();
|
||||||
|
}
|
||||||
|
|
||||||
|
void I2C_page_read(unsigned int page_addr, unsigned char *p)
|
||||||
|
{
|
||||||
|
unsigned char i;
|
||||||
|
unsigned char addr_hi,addr_lo;
|
||||||
|
|
||||||
|
addr_hi = (unsigned char)(page_addr >> 8);
|
||||||
|
addr_lo = (unsigned char)(page_addr&0xFF);
|
||||||
|
|
||||||
|
I2C_start();
|
||||||
|
if(!I2C_send_byte(I2C_addr_write))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_hi))
|
||||||
|
{
|
||||||
|
if(!I2C_send_byte(addr_lo))
|
||||||
|
{
|
||||||
|
I2C_stop();
|
||||||
|
I2C_start();
|
||||||
|
I2C_send_byte(I2C_addr_read);
|
||||||
|
for(i=0;i<I2C_PAGE_SIZE;i++)
|
||||||
|
{
|
||||||
|
if(i<(I2C_PAGE_SIZE - 1))
|
||||||
|
{
|
||||||
|
*p=I2C_read_byte(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*p=I2C_read_byte(1);
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I2C_stop();
|
||||||
|
}
|
||||||
|
*/
|
||||||
20
FW/Core/my_src/I2C_eeprom.h
Normal file
20
FW/Core/my_src/I2C_eeprom.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef I2C_EEPROM_H_
|
||||||
|
#define I2C_EEPROM_H_
|
||||||
|
|
||||||
|
#define I2C_PAGE_SIZE_24256 64
|
||||||
|
#define I2C_PAGE_NUM_24256 512
|
||||||
|
#define I2C_CHIP_SIZE_24256 (I2C_PAGE_NUM_24256*I2C_PAGE_SIZE_24512)
|
||||||
|
|
||||||
|
#define I2C_PAGE_SIZE_24512 128
|
||||||
|
#define I2C_PAGE_NUM_24512 512
|
||||||
|
#define I2C_CHIP_SIZE_24512 (I2C_PAGE_NUM_24512*I2C_PAGE_SIZE_24512)
|
||||||
|
|
||||||
|
#define I2C_PAGE_SIZE_24M01 256
|
||||||
|
#define I2C_PAGE_NUM_24M01 512
|
||||||
|
#define I2C_CHIP_SIZE_24M01 (I2C_PAGE_NUM_24M01*I2C_PAGE_SIZE_24M01)
|
||||||
|
|
||||||
|
extern unsigned int I2C_byte_write_via_page(unsigned int chip_cs, unsigned int addr, unsigned char *p, unsigned int len);
|
||||||
|
extern unsigned int I2C_page_write(unsigned int chip_cs, unsigned int addr, unsigned char *p);
|
||||||
|
extern unsigned int I2C_page_read(unsigned int chip_cs, unsigned int addr, unsigned char *p, unsigned int len);
|
||||||
|
|
||||||
|
#endif
|
||||||
563
FW/Core/my_src/W25Qxx_iodrv.c
Normal file
563
FW/Core/my_src/W25Qxx_iodrv.c
Normal file
@@ -0,0 +1,563 @@
|
|||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#define W25Q128_FLASH_SIZE 0x01000000
|
||||||
|
#define W25Q128_ADDR_BIT_NUM 24
|
||||||
|
|
||||||
|
#define NOR_FLASH_SIZE W25Q128_FLASH_SIZE
|
||||||
|
#define NOR_FLASH_ADDR_BIT_NUM W25Q128_ADDR_BIT_NUM
|
||||||
|
|
||||||
|
#define FLASH_WP_H() LL_GPIO_SetOutputPin(GPIOG,LL_GPIO_PIN_13)
|
||||||
|
#define FLASH_WP_L() LL_GPIO_ResetOutputPin(GPIOG,LL_GPIO_PIN_13)
|
||||||
|
#define FLASH_HOLD_H() LL_GPIO_SetOutputPin(GPIOE,LL_GPIO_PIN_2)
|
||||||
|
#define FLASH_HOLD_L() LL_GPIO_ResetOutputPin(GPIOE,LL_GPIO_PIN_2)
|
||||||
|
|
||||||
|
#define xSPI_CS_HI() LL_GPIO_SetOutputPin(GPIOA,LL_GPIO_PIN_15)
|
||||||
|
#define xSPI_CS_LO() LL_GPIO_ResetOutputPin(GPIOA,LL_GPIO_PIN_15)
|
||||||
|
|
||||||
|
#define xSPI_CLK_HI() LL_GPIO_SetOutputPin(GPIOG,LL_GPIO_PIN_11)
|
||||||
|
#define xSPI_CLK_LO() LL_GPIO_ResetOutputPin(GPIOG,LL_GPIO_PIN_11)
|
||||||
|
|
||||||
|
#define xSPI_SET_MISO_INPUT() GPIOG->MODER&=~0x000C0000
|
||||||
|
#define xSPI_SET_MISO_OUTPUT() GPIOG->MODER|=0x00040000
|
||||||
|
|
||||||
|
#define xSPI_SET_MOSI_INPUT() GPIOD->MODER&=~0x0000C000
|
||||||
|
#define xSPI_SET_MOSI_OUTPUT() GPIOD->MODER|=0x00004000
|
||||||
|
|
||||||
|
#define xSPI_GET_MISO() LL_GPIO_IsInputPinSet(GPIOG,LL_GPIO_PIN_9)
|
||||||
|
#define xSPI_MOSI_HI() GPIOD->ODR|=(1<<7)
|
||||||
|
#define xSPI_MOSI_LO() GPIOD->ODR&=~(1<<7)
|
||||||
|
|
||||||
|
#define xSPI_SET_DATA_INPUT() (GPIOG->MODER&=~0x0C0C0000,GPIOE->MODER&=~0x00000030,GPIOD->MODER&=~0x0000C000)
|
||||||
|
#define xSPI_SET_DATA_OUTPUT() (GPIOG->MODER|=0x04040000,GPIOE->MODER|=0x00000010,GPIOD->MODER|=0x00004000)
|
||||||
|
|
||||||
|
#define xSPI_DIN() (((GPIOE->IDR&0x0004)<<1)|((GPIOG->IDR&0x2000)>>11)|((GPIOG->IDR&0x0200)>>8)|((GPIOD->IDR&0x0080)>>7))
|
||||||
|
|
||||||
|
#define xSPI_D0_HI() LL_GPIO_SetOutputPin(GPIOD,LL_GPIO_PIN_7)
|
||||||
|
#define xSPI_D0_LO() LL_GPIO_ResetOutputPin(GPIOD,LL_GPIO_PIN_7)
|
||||||
|
#define xSPI_D1_HI() LL_GPIO_SetOutputPin(GPIOG,LL_GPIO_PIN_9)
|
||||||
|
#define xSPI_D1_LO() LL_GPIO_ResetOutputPin(GPIOG,LL_GPIO_PIN_9)
|
||||||
|
#define xSPI_D2_HI() LL_GPIO_SetOutputPin(GPIOG,LL_GPIO_PIN_13)
|
||||||
|
#define xSPI_D2_LO() LL_GPIO_ResetOutputPin(GPIOG,LL_GPIO_PIN_13)
|
||||||
|
#define xSPI_D3_HI() LL_GPIO_SetOutputPin(GPIOE,LL_GPIO_PIN_2)
|
||||||
|
#define xSPI_D3_LO() LL_GPIO_ResetOutputPin(GPIOE,LL_GPIO_PIN_2)
|
||||||
|
|
||||||
|
static void flash_reset(void);
|
||||||
|
static void flash_write_enable(void);
|
||||||
|
static void flash_write_disable(void);
|
||||||
|
static void flash_quad_enable(void);
|
||||||
|
static void flash_quad_disable(void);
|
||||||
|
static uint8_t flash_read_sr1(void);
|
||||||
|
static uint8_t flash_read_sr2(void);
|
||||||
|
|
||||||
|
static void wait(void)
|
||||||
|
{
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25q_IO_setup(void)
|
||||||
|
{
|
||||||
|
static uint8_t val = 0;
|
||||||
|
uint32_t i = 0;
|
||||||
|
/*
|
||||||
|
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
|
||||||
|
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOD);
|
||||||
|
|
||||||
|
//PD6 PC10 12 13 14 15
|
||||||
|
GPIOC->MODER &=~0xFF300000;
|
||||||
|
GPIOD->MODER &=~0x00003000;
|
||||||
|
GPIOC->MODER |= 0x00100000;
|
||||||
|
GPIOD->MODER |= 0x00001000; //PD6,PC10 GPIO Output Mode
|
||||||
|
|
||||||
|
GPIOC->OTYPER &=~0x0000F400; //Output push-pull
|
||||||
|
GPIOD->OTYPER &=~0x00000040;
|
||||||
|
GPIOC->OSPEEDR |= 0xFF300000; //Very High speed
|
||||||
|
GPIOD->OSPEEDR |= 0x00003000;
|
||||||
|
*/
|
||||||
|
xSPI_CS_HI();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
|
||||||
|
xSPI_SET_DATA_OUTPUT();
|
||||||
|
FLASH_WP_H();
|
||||||
|
FLASH_HOLD_H();
|
||||||
|
for(i=0;i<10000;i++);
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_SET_DATA_INPUT();
|
||||||
|
|
||||||
|
flash_reset();
|
||||||
|
|
||||||
|
xSPI_SET_DATA_OUTPUT();
|
||||||
|
FLASH_WP_H();
|
||||||
|
FLASH_HOLD_H();
|
||||||
|
for(i=0;i<10000;i++);
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_SET_DATA_INPUT();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
val = flash_read_sr1();
|
||||||
|
}while(val&0x01);
|
||||||
|
|
||||||
|
val = flash_read_sr2();
|
||||||
|
if(!(val&0x02))
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
flash_quad_enable();
|
||||||
|
val = flash_read_sr2();
|
||||||
|
}while(!(val&0x02));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t QSPI_D0123_read(void)
|
||||||
|
{
|
||||||
|
return(xSPI_DIN());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QSPI_D0123_write(uint8_t x)
|
||||||
|
{
|
||||||
|
if(x&0x01)
|
||||||
|
{
|
||||||
|
xSPI_D0_HI();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xSPI_D0_LO();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x&0x02)
|
||||||
|
{
|
||||||
|
xSPI_D1_HI();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xSPI_D1_LO();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x&0x04)
|
||||||
|
{
|
||||||
|
xSPI_D2_HI();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xSPI_D2_LO();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x&0x08)
|
||||||
|
{
|
||||||
|
xSPI_D3_HI();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xSPI_D3_LO();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void xspi_write_byte(uint8_t data)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
xSPI_SET_MOSI_OUTPUT();
|
||||||
|
for(i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
if(data & 0x80)xSPI_MOSI_HI();
|
||||||
|
else xSPI_MOSI_LO();
|
||||||
|
|
||||||
|
xSPI_CLK_HI();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
data<<=1;
|
||||||
|
}
|
||||||
|
xSPI_MOSI_LO();
|
||||||
|
xSPI_SET_MOSI_INPUT();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t xspi_read_byte(void)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
uint8_t data = 0;
|
||||||
|
for(i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
wait();
|
||||||
|
data<<=1;
|
||||||
|
if(xSPI_GET_MISO())data |= 0x01;
|
||||||
|
xSPI_CLK_HI();
|
||||||
|
wait();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void xspi_quad_write_byte(uint8_t data)
|
||||||
|
{
|
||||||
|
xSPI_SET_DATA_OUTPUT();
|
||||||
|
QSPI_D0123_write(data>>4);
|
||||||
|
xSPI_CLK_HI();
|
||||||
|
wait();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
QSPI_D0123_write(data);
|
||||||
|
xSPI_CLK_HI();
|
||||||
|
wait();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_SET_DATA_INPUT();
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t xspi_quad_read_byte(void)
|
||||||
|
{
|
||||||
|
uint8_t data;
|
||||||
|
|
||||||
|
data = QSPI_D0123_read();
|
||||||
|
xSPI_CLK_HI();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
data<<=4;
|
||||||
|
data |= QSPI_D0123_read();
|
||||||
|
xSPI_CLK_HI();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void flash_write_enable(void)
|
||||||
|
{
|
||||||
|
uint32_t i = 0;
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x06);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
for(i=0;i<10000;i++);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void flash_write_disable(void)
|
||||||
|
{
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x04);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t flash_read_sr1(void)
|
||||||
|
{
|
||||||
|
uint8_t sr1;
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x05);
|
||||||
|
|
||||||
|
sr1 = xspi_read_byte();
|
||||||
|
wait();
|
||||||
|
xSPI_CS_HI();
|
||||||
|
return sr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t flash_read_sr2(void)
|
||||||
|
{
|
||||||
|
uint8_t sr2;
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x35);
|
||||||
|
|
||||||
|
sr2 = xspi_read_byte();
|
||||||
|
wait();
|
||||||
|
xSPI_CS_HI();
|
||||||
|
return sr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_write_sr(uint8_t sr1,uint8_t sr2)
|
||||||
|
{
|
||||||
|
flash_write_enable();
|
||||||
|
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x01);
|
||||||
|
xspi_write_byte(sr1);
|
||||||
|
xspi_write_byte(sr2);
|
||||||
|
wait();
|
||||||
|
xSPI_CS_HI();
|
||||||
|
|
||||||
|
flash_write_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void flash_quad_enable(void)
|
||||||
|
{
|
||||||
|
flash_write_enable();
|
||||||
|
flash_write_sr(0x00,0x02);
|
||||||
|
flash_write_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void flash_quad_disable(void)
|
||||||
|
{
|
||||||
|
flash_write_enable();
|
||||||
|
flash_write_sr(0x00,0x00);
|
||||||
|
flash_write_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t get_flash_write_status(void)
|
||||||
|
{
|
||||||
|
return(flash_read_sr1() & 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int flash_quad_read_data(unsigned int addr, unsigned char * p_data,unsigned int len)//p_data >=256byte
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
if((addr + len) > NOR_FLASH_SIZE)return 1;
|
||||||
|
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
xspi_write_byte(0x6b);
|
||||||
|
xspi_write_byte((addr>>16)&0xff);
|
||||||
|
xspi_write_byte((addr>>8)&0xff);
|
||||||
|
xspi_write_byte(addr&0xff);
|
||||||
|
xspi_write_byte(0);
|
||||||
|
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
p_data[i] = xspi_quad_read_byte();
|
||||||
|
}
|
||||||
|
xSPI_CS_HI();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* flash_quad_read_page(uint32_t addr)
|
||||||
|
{
|
||||||
|
uint32_t i = 0;
|
||||||
|
unsigned int addr_page = addr & 0xFFFFFF00;
|
||||||
|
static uint8_t p_data[288];
|
||||||
|
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
xspi_write_byte(0x6b);
|
||||||
|
xspi_write_byte((addr_page>>16)&0xff);
|
||||||
|
xspi_write_byte((addr_page>>8)&0xff);
|
||||||
|
xspi_write_byte(addr_page&0xff);
|
||||||
|
xspi_write_byte(0);
|
||||||
|
|
||||||
|
for(i=0;i<256;i++)
|
||||||
|
{
|
||||||
|
p_data[i] = xspi_quad_read_byte();
|
||||||
|
}
|
||||||
|
xSPI_CS_HI();
|
||||||
|
return &p_data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_quad_program_page(uint32_t addr,uint8_t* p_data)
|
||||||
|
{
|
||||||
|
uint32_t i = 0;
|
||||||
|
unsigned int addr_page = addr & 0xFFFFFF00;
|
||||||
|
//flash_quad_enable();
|
||||||
|
//do{
|
||||||
|
//i = flash_read_sr1();
|
||||||
|
//}while(i&0x01);
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x32);
|
||||||
|
xspi_write_byte((addr_page>>16)&0xff);
|
||||||
|
xspi_write_byte((addr_page>>8)&0xff);
|
||||||
|
xspi_write_byte(addr_page&0xff);
|
||||||
|
|
||||||
|
for(i=0;i<256;i++)
|
||||||
|
{
|
||||||
|
xspi_quad_write_byte(*p_data);
|
||||||
|
p_data++;
|
||||||
|
}
|
||||||
|
xSPI_CS_HI();
|
||||||
|
flash_write_disable();
|
||||||
|
|
||||||
|
do{
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
i = flash_read_sr1();
|
||||||
|
}while(i&0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_quad_program_page_no_wait(uint32_t addr,uint8_t* p_data)
|
||||||
|
{
|
||||||
|
uint32_t i = 0;
|
||||||
|
unsigned int addr_page = addr & 0xFFFFFF00;
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x32);
|
||||||
|
xspi_write_byte((addr_page>>16)&0xff);
|
||||||
|
xspi_write_byte((addr_page>>8)&0xff);
|
||||||
|
xspi_write_byte(addr_page&0xff);
|
||||||
|
|
||||||
|
for(i=0;i<256;i++)
|
||||||
|
{
|
||||||
|
xspi_quad_write_byte(*p_data);
|
||||||
|
p_data++;
|
||||||
|
}
|
||||||
|
xSPI_CS_HI();
|
||||||
|
flash_write_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int flash_quad_program_no_wait(uint32_t addr,uint8_t* p_data,unsigned int len)
|
||||||
|
{
|
||||||
|
uint32_t i = 0;
|
||||||
|
|
||||||
|
if(((addr&0xFF) + len) > 0x100)return 1;
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x32);
|
||||||
|
xspi_write_byte((addr>>16)&0xff);
|
||||||
|
xspi_write_byte((addr>>8)&0xff);
|
||||||
|
xspi_write_byte(addr&0xff);
|
||||||
|
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
xspi_quad_write_byte(*p_data);
|
||||||
|
p_data++;
|
||||||
|
}
|
||||||
|
xSPI_CS_HI();
|
||||||
|
flash_write_disable();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_sector_erase(uint32_t addr)
|
||||||
|
{
|
||||||
|
unsigned char val = 1;
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int addr_sector = addr & 0xFFFFF000;
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x20);
|
||||||
|
xspi_write_byte((addr_sector&0x00FF0000)>>16);
|
||||||
|
xspi_write_byte((addr_sector&0x0000FF00)>>8);
|
||||||
|
xspi_write_byte(addr_sector&0x000000FF);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
flash_write_disable();
|
||||||
|
|
||||||
|
while(val)
|
||||||
|
{
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
val = (flash_read_sr1() & 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<10000;i++)__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_sector_erase_no_wait(uint32_t addr)
|
||||||
|
{
|
||||||
|
unsigned char val = 1;
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int addr_sector = addr & 0xFFFFF000;
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x20);
|
||||||
|
xspi_write_byte((addr_sector&0x00FF0000)>>16);
|
||||||
|
xspi_write_byte((addr_sector&0x0000FF00)>>8);
|
||||||
|
xspi_write_byte(addr_sector&0x000000FF);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
flash_write_disable();
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_full_chip_erase(void) // erase chip
|
||||||
|
{
|
||||||
|
uint8_t val = 1;
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x60);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
while(val)
|
||||||
|
{
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
val = (flash_read_sr1() & 0x01);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_full_chip_erase_no_wait(void) // erase chip
|
||||||
|
{
|
||||||
|
uint8_t val = 1;
|
||||||
|
|
||||||
|
flash_write_enable();
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x60);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void flash_reset(void)
|
||||||
|
{
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x66);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x99);
|
||||||
|
xSPI_CS_HI();
|
||||||
|
|
||||||
|
HAL_Delay(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_read_id(uint8_t *p_ddata)
|
||||||
|
{
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x90); // cmd
|
||||||
|
xspi_write_byte(0); // h
|
||||||
|
xspi_write_byte(0); // m
|
||||||
|
xspi_write_byte(0); // l
|
||||||
|
|
||||||
|
*p_ddata = xspi_read_byte();
|
||||||
|
p_ddata++;
|
||||||
|
*p_ddata = xspi_read_byte();
|
||||||
|
//wait();
|
||||||
|
xSPI_CS_HI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void flash_quad_read_id(uint8_t *p_ddata)
|
||||||
|
{
|
||||||
|
xSPI_CLK_LO();
|
||||||
|
xSPI_CS_LO();
|
||||||
|
wait();
|
||||||
|
xspi_write_byte(0x94); // cmd
|
||||||
|
xspi_quad_write_byte(0); // h
|
||||||
|
xspi_quad_write_byte(0); // m
|
||||||
|
xspi_quad_write_byte(0); // l
|
||||||
|
xspi_quad_write_byte(0xff); // h
|
||||||
|
xspi_quad_write_byte(0); // m
|
||||||
|
xspi_quad_write_byte(0);
|
||||||
|
|
||||||
|
*p_ddata = xspi_quad_read_byte();
|
||||||
|
p_ddata++;
|
||||||
|
*p_ddata = xspi_quad_read_byte();
|
||||||
|
wait();
|
||||||
|
xSPI_CS_HI();
|
||||||
|
}
|
||||||
16
FW/Core/my_src/W25Qxx_iodrv.h
Normal file
16
FW/Core/my_src/W25Qxx_iodrv.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include "stm32h7xx.h"
|
||||||
|
|
||||||
|
extern void w25q_IO_setup(void);
|
||||||
|
|
||||||
|
extern uint8_t get_flash_write_status(void);
|
||||||
|
extern void flash_full_chip_erase(void);
|
||||||
|
extern void flash_full_chip_erase_no_wait(void);
|
||||||
|
extern void flash_sector_erase(uint32_t addr);
|
||||||
|
extern void flash_sector_erase_no_wait(uint32_t addr);
|
||||||
|
extern uint8_t* flash_read(uint32_t addr,uint8_t len);
|
||||||
|
//extern uint8_t* flash_read_page(uint32_t addr);
|
||||||
|
//extern void flash_program_page(uint32_t addr,uint8_t* data_point);
|
||||||
|
extern uint8_t* flash_quad_read_page(uint32_t addr);
|
||||||
|
extern unsigned int flash_quad_read_data(unsigned int addr, unsigned char * p_data,unsigned int len);
|
||||||
|
extern void flash_quad_program_page(uint32_t addr,uint8_t* p_data);
|
||||||
|
extern void flash_quad_program_page_no_wait(uint32_t addr,uint8_t* p_data);
|
||||||
3191
FW/Core/my_src/cJSON.c
Normal file
3191
FW/Core/my_src/cJSON.c
Normal file
File diff suppressed because it is too large
Load Diff
306
FW/Core/my_src/cJSON.h
Normal file
306
FW/Core/my_src/cJSON.h
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cJSON__h
|
||||||
|
#define cJSON__h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||||
|
#define __WINDOWS__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
|
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||||
|
|
||||||
|
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||||
|
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||||
|
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||||
|
|
||||||
|
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||||
|
|
||||||
|
setting default visibility to hidden by adding
|
||||||
|
-fvisibility=hidden (for gcc)
|
||||||
|
or
|
||||||
|
-xldscope=hidden (for sun cc)
|
||||||
|
to CFLAGS
|
||||||
|
|
||||||
|
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CJSON_CDECL __cdecl
|
||||||
|
#define CJSON_STDCALL __stdcall
|
||||||
|
|
||||||
|
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||||
|
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_EXPORT_SYMBOLS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CJSON_HIDE_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||||
|
#endif
|
||||||
|
#else /* !__WINDOWS__ */
|
||||||
|
#define CJSON_CDECL
|
||||||
|
#define CJSON_STDCALL
|
||||||
|
|
||||||
|
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||||
|
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||||
|
#else
|
||||||
|
#define CJSON_PUBLIC(type) type
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* project version */
|
||||||
|
#define CJSON_VERSION_MAJOR 1
|
||||||
|
#define CJSON_VERSION_MINOR 7
|
||||||
|
#define CJSON_VERSION_PATCH 18
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* cJSON Types: */
|
||||||
|
#define cJSON_Invalid (0)
|
||||||
|
#define cJSON_False (1 << 0)
|
||||||
|
#define cJSON_True (1 << 1)
|
||||||
|
#define cJSON_NULL (1 << 2)
|
||||||
|
#define cJSON_Number (1 << 3)
|
||||||
|
#define cJSON_String (1 << 4)
|
||||||
|
#define cJSON_Array (1 << 5)
|
||||||
|
#define cJSON_Object (1 << 6)
|
||||||
|
#define cJSON_Raw (1 << 7) /* raw json */
|
||||||
|
|
||||||
|
#define cJSON_IsReference 256
|
||||||
|
#define cJSON_StringIsConst 512
|
||||||
|
|
||||||
|
/* The cJSON structure: */
|
||||||
|
typedef struct cJSON
|
||||||
|
{
|
||||||
|
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||||
|
struct cJSON *next;
|
||||||
|
struct cJSON *prev;
|
||||||
|
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||||
|
struct cJSON *child;
|
||||||
|
|
||||||
|
/* The type of the item, as above. */
|
||||||
|
int type;
|
||||||
|
|
||||||
|
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||||
|
char *valuestring;
|
||||||
|
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||||
|
int valueint;
|
||||||
|
/* The item's number, if type==cJSON_Number */
|
||||||
|
double valuedouble;
|
||||||
|
|
||||||
|
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||||
|
char *string;
|
||||||
|
} cJSON;
|
||||||
|
|
||||||
|
typedef struct cJSON_Hooks
|
||||||
|
{
|
||||||
|
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||||
|
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||||
|
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||||
|
} cJSON_Hooks;
|
||||||
|
|
||||||
|
typedef int cJSON_bool;
|
||||||
|
|
||||||
|
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||||
|
* This is to prevent stack overflows. */
|
||||||
|
#ifndef CJSON_NESTING_LIMIT
|
||||||
|
#define CJSON_NESTING_LIMIT 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Limits the length of circular references can be before cJSON rejects to parse them.
|
||||||
|
* This is to prevent stack overflows. */
|
||||||
|
#ifndef CJSON_CIRCULAR_LIMIT
|
||||||
|
#define CJSON_CIRCULAR_LIMIT 10000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* returns the version of cJSON as a string */
|
||||||
|
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||||
|
|
||||||
|
/* Supply malloc, realloc and free functions to cJSON */
|
||||||
|
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||||
|
|
||||||
|
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||||
|
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
|
||||||
|
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||||
|
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||||
|
|
||||||
|
/* Render a cJSON entity to text for transfer/storage. */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||||
|
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||||
|
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||||
|
/* Delete a cJSON entity and all subentities. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
|
||||||
|
|
||||||
|
/* Returns the number of items in an array (or object). */
|
||||||
|
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||||
|
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||||
|
/* Get item "string" from object. Case insensitive. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||||
|
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||||
|
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||||
|
|
||||||
|
/* Check item type and return its value */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
|
||||||
|
|
||||||
|
/* These functions check the type of an item */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||||
|
|
||||||
|
/* These calls create a cJSON item of the appropriate type. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
|
||||||
|
/* raw json */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
|
||||||
|
|
||||||
|
/* Create a string where valuestring references a string so
|
||||||
|
* it will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
|
||||||
|
/* Create an object/array that only references it's elements so
|
||||||
|
* they will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
|
||||||
|
|
||||||
|
/* These utilities create an Array of count items.
|
||||||
|
* The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
|
||||||
|
|
||||||
|
/* Append item to the specified array/object. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||||
|
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||||
|
* writing to `item->string` */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
|
||||||
|
/* Remove/Detach items from Arrays/Objects. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
|
||||||
|
/* Update array items. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||||
|
|
||||||
|
/* Duplicate a cJSON item */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||||
|
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||||
|
* need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||||
|
* The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||||
|
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||||
|
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||||
|
|
||||||
|
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
|
||||||
|
* The input pointer json cannot point to a read-only address area, such as a string constant,
|
||||||
|
* but should point to a readable and writable address area. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||||
|
|
||||||
|
/* Helper functions for creating and adding items to an object at the same time.
|
||||||
|
* They return the added item or NULL on failure. */
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
|
||||||
|
|
||||||
|
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||||
|
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||||
|
/* helper for the cJSON_SetNumberValue macro */
|
||||||
|
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||||
|
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||||
|
/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
|
||||||
|
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
|
||||||
|
|
||||||
|
/* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/
|
||||||
|
#define cJSON_SetBoolValue(object, boolValue) ( \
|
||||||
|
(object != NULL && ((object)->type & (cJSON_False|cJSON_True))) ? \
|
||||||
|
(object)->type=((object)->type &(~(cJSON_False|cJSON_True)))|((boolValue)?cJSON_True:cJSON_False) : \
|
||||||
|
cJSON_Invalid\
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Macro for iterating over an array or object */
|
||||||
|
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||||
|
|
||||||
|
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||||
|
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||||
|
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
22
FW/Core/my_src/delay.c
Normal file
22
FW/Core/my_src/delay.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "stm32h7xx.h"
|
||||||
|
#include "stm32h7xx_ll_tim.h"
|
||||||
|
|
||||||
|
void delay_us(unsigned int nus)
|
||||||
|
{
|
||||||
|
LL_TIM_SetCounter(TIM6,0);
|
||||||
|
LL_TIM_SetAutoReload(TIM6,(10*nus-1));
|
||||||
|
LL_TIM_EnableCounter(TIM6);
|
||||||
|
while(!(LL_TIM_IsActiveFlag_UPDATE(TIM6))){
|
||||||
|
;
|
||||||
|
}
|
||||||
|
LL_TIM_ClearFlag_UPDATE(TIM6);
|
||||||
|
LL_TIM_DisableCounter(TIM6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void delay_ms(unsigned int nms)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
for(i=0;i<nms;i++){
|
||||||
|
delay_us(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
FW/Core/my_src/delay.h
Normal file
7
FW/Core/my_src/delay.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef __DELAY_H
|
||||||
|
#define __DELAY_H
|
||||||
|
|
||||||
|
extern void delay_us(unsigned int nus);
|
||||||
|
extern void delay_ms(unsigned int nms);
|
||||||
|
|
||||||
|
#endif
|
||||||
228
FW/Core/my_src/fdcan_task.c
Normal file
228
FW/Core/my_src/fdcan_task.c
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "fdcan.h"
|
||||||
|
#include "fdcan_task.h"
|
||||||
|
#include "HW_test_task.h"
|
||||||
|
|
||||||
|
#define CAN_STANDARD_ID 0x0301//0x07FF
|
||||||
|
#define CAN_EXTEND_ID 0x155c6aa6//0x1FFFFFFF
|
||||||
|
|
||||||
|
//FIFO0回调函数
|
||||||
|
FDCAN_RxHeaderTypeDef FDCAN_RxHeader;
|
||||||
|
FDCAN_TxHeaderTypeDef FDCAN_TxHeader;
|
||||||
|
|
||||||
|
can_info_struct can_handle;
|
||||||
|
|
||||||
|
void fdcan_test_task(void);
|
||||||
|
|
||||||
|
void can_sent(can_info_struct * can_handle)
|
||||||
|
{
|
||||||
|
FDCAN_HandleTypeDef * p_fdcan_handle;
|
||||||
|
FDCAN_TxHeaderTypeDef * p_fdcan_tx_handle;
|
||||||
|
|
||||||
|
if(can_handle->tx_len > 8)return;
|
||||||
|
|
||||||
|
p_fdcan_handle = &hfdcan2;
|
||||||
|
p_fdcan_tx_handle = &FDCAN_TxHeader;
|
||||||
|
|
||||||
|
/*##-4- Start the Transmission process #####################################*/
|
||||||
|
if(READ_BIT(p_fdcan_handle->Instance->CCCR, FDCAN_CCCR_DAR)){
|
||||||
|
HAL_FDCAN_Stop(p_fdcan_handle);
|
||||||
|
CLEAR_BIT(p_fdcan_handle->Instance->CCCR, FDCAN_CCCR_DAR);//AUTO retransmission
|
||||||
|
HAL_FDCAN_Start(p_fdcan_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
p_fdcan_tx_handle->Identifier = can_handle->tx_cmd; //32位ID
|
||||||
|
p_fdcan_tx_handle->IdType = FDCAN_EXTENDED_ID;
|
||||||
|
p_fdcan_tx_handle->TxFrameType = FDCAN_DATA_FRAME; //数据帧
|
||||||
|
p_fdcan_tx_handle->DataLength = (can_handle->tx_len<<16); //数据长度
|
||||||
|
p_fdcan_tx_handle->ErrorStateIndicator = FDCAN_ESI_ACTIVE;
|
||||||
|
p_fdcan_tx_handle->BitRateSwitch = FDCAN_BRS_OFF; //关闭速率切换
|
||||||
|
p_fdcan_tx_handle->FDFormat = FDCAN_CLASSIC_CAN; //传统的CAN模式
|
||||||
|
p_fdcan_tx_handle->TxEventFifoControl = FDCAN_NO_TX_EVENTS; //无发送事件
|
||||||
|
p_fdcan_tx_handle->MessageMarker = 0;
|
||||||
|
|
||||||
|
/* Request transmission */
|
||||||
|
if(HAL_FDCAN_AddMessageToTxFifoQ(p_fdcan_handle, p_fdcan_tx_handle, can_handle->tx_buf) != HAL_OK)
|
||||||
|
{
|
||||||
|
/* Transmission request Error */
|
||||||
|
//Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait transmission complete */
|
||||||
|
//while(HAL_CAN_GetTxMailboxesFreeLevel(&CanHandle) != 3)
|
||||||
|
//{
|
||||||
|
//__nop();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
void can_send_time_handle(void)//100ms
|
||||||
|
{
|
||||||
|
if(0 == can_handle.tx_complete){
|
||||||
|
can_handle.tx_timer_count++;
|
||||||
|
if(can_handle.tx_timer_count > 2){
|
||||||
|
can_handle.tx_timer_count = 0;
|
||||||
|
can_handle.tx_complete = 1;
|
||||||
|
|
||||||
|
HAL_FDCAN_Stop(&hfdcan2);
|
||||||
|
FDCAN2_Reinit();
|
||||||
|
/*
|
||||||
|
HAL_Delay(5);
|
||||||
|
HAL_FDCAN_Start(&hfdcan2);
|
||||||
|
|
||||||
|
if(!READ_BIT(hfdcan2.Instance->CCCR, FDCAN_CCCR_DAR)){
|
||||||
|
SET_BIT(hfdcan2.Instance->CCCR, FDCAN_CCCR_DAR);//NO AUTO retransmission
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void can_tx_task(void)
|
||||||
|
{
|
||||||
|
if(can_handle.tx_msg_falg){
|
||||||
|
if(can_handle.tx_complete){
|
||||||
|
can_handle.tx_complete = 0;
|
||||||
|
|
||||||
|
can_sent(&can_handle);
|
||||||
|
|
||||||
|
can_handle.tx_msg_falg = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void can_task(void)
|
||||||
|
{
|
||||||
|
can_tx_task();
|
||||||
|
|
||||||
|
fdcan_test_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
void can_prm_init(void)
|
||||||
|
{
|
||||||
|
can_handle.rx_complete = 0;
|
||||||
|
|
||||||
|
can_handle.tx_msg_falg = 0;
|
||||||
|
can_handle.tx_complete = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void can_send_test(void)
|
||||||
|
{
|
||||||
|
can_handle.tx_msg_falg = 1;
|
||||||
|
|
||||||
|
can_handle.tx_cmd = CAN_EXTEND_ID;
|
||||||
|
|
||||||
|
can_handle.tx_buf[0] = 0x01;
|
||||||
|
can_handle.tx_buf[1] = 0x06;
|
||||||
|
can_handle.tx_buf[2] = 0xF0;
|
||||||
|
can_handle.tx_buf[3] = 0x55;
|
||||||
|
can_handle.tx_buf[4] = 0xaa;
|
||||||
|
can_handle.tx_buf[5] = 0xc0;
|
||||||
|
can_handle.tx_buf[6] = 0x40;
|
||||||
|
can_handle.tx_buf[7] = 0x88;
|
||||||
|
|
||||||
|
can_handle.tx_len = 8;
|
||||||
|
can_handle.tx_timer_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int internal_can_send_data(unsigned int head, unsigned char * pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
if(len > 8)return 1;
|
||||||
|
if(can_handle.tx_msg_falg)return 1;
|
||||||
|
//if(!can_handle.tx_complete)return 1;
|
||||||
|
if(!can_handle.tx_complete_delay_flag)return 1;
|
||||||
|
|
||||||
|
can_handle.tx_msg_falg = 1;
|
||||||
|
can_handle.tx_cmd = head;
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
can_handle.tx_buf[i] = pdata[i];
|
||||||
|
|
||||||
|
can_handle.tx_complete_delay_tick = 0;
|
||||||
|
can_handle.tx_complete_delay_flag = 0;
|
||||||
|
|
||||||
|
can_handle.tx_len = len;
|
||||||
|
can_handle.tx_timer_count = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_can_tx_complete(void)
|
||||||
|
{
|
||||||
|
//return can_handle.tx_complete;
|
||||||
|
return can_handle.tx_complete_delay_flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_can_tx_complete_delay_flag(void)
|
||||||
|
{
|
||||||
|
return can_handle.tx_complete_delay_flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
void can_tx_complete_delay(void)//1ms
|
||||||
|
{
|
||||||
|
if(can_handle.tx_complete){
|
||||||
|
if(0 == can_handle.tx_complete_delay_flag){
|
||||||
|
can_handle.tx_complete_delay_tick++;
|
||||||
|
if(can_handle.tx_complete_delay_tick > 2){
|
||||||
|
can_handle.tx_complete_delay_tick = 0;
|
||||||
|
can_handle.tx_complete_delay_flag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_FDCAN_TxFifoEmptyCallback(FDCAN_HandleTypeDef *hfdcan)
|
||||||
|
{
|
||||||
|
if(hfdcan == (&hfdcan2)){
|
||||||
|
can_handle.tx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs)
|
||||||
|
{
|
||||||
|
unsigned int i=0;
|
||||||
|
unsigned char rxdata[8];
|
||||||
|
|
||||||
|
if(hfdcan == (&hfdcan2)){
|
||||||
|
if((RxFifo0ITs&FDCAN_IT_RX_FIFO0_NEW_MESSAGE)!=RESET) //FIFO1新数据中断
|
||||||
|
{
|
||||||
|
//提取FIFO0中接收到的数据
|
||||||
|
HAL_FDCAN_GetRxMessage(hfdcan,FDCAN_RX_FIFO0,&FDCAN_RxHeader,can_handle.rx_buf);
|
||||||
|
|
||||||
|
if(FDCAN_EXTENDED_ID == FDCAN_RxHeader.IdType){
|
||||||
|
can_handle.rx_len = FDCAN_RxHeader.DataLength>>16;
|
||||||
|
if(can_handle.rx_len <= 8){
|
||||||
|
can_handle.rx_complete = 1;
|
||||||
|
can_handle.rx_cmd = FDCAN_RxHeader.Identifier;
|
||||||
|
LoadInnerCanRxMsg(can_handle.rx_cmd, can_handle.rx_buf, can_handle.rx_len);
|
||||||
|
|
||||||
|
if(hw_test_mode){
|
||||||
|
if(0xFA == (can_handle.rx_cmd & 0xFF)){
|
||||||
|
if(0x23 == can_handle.rx_buf[3]){
|
||||||
|
rx_text_buf[31] = 0xA5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//HAL_FDCAN_ActivateNotification(hfdcan,FDCAN_IT_RX_FIFO0_NEW_MESSAGE,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fdcan_test_task(void)
|
||||||
|
{
|
||||||
|
if(hw_test_mode){
|
||||||
|
if(get_can_tx_complete_delay_flag()){
|
||||||
|
if(0xA5 == rx_text_buf[31]){
|
||||||
|
rx_text_buf[31] = 0;
|
||||||
|
rx_text_buf[0] = 0xA0;
|
||||||
|
rx_text_buf[1] = 0x02;
|
||||||
|
rx_text_buf[2] = 0;
|
||||||
|
rx_text_buf[3] = 0x23;
|
||||||
|
rx_text_buf[4] = 1;
|
||||||
|
internal_can_send_data(0xFA, rx_text_buf, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
44
FW/Core/my_src/fdcan_task.h
Normal file
44
FW/Core/my_src/fdcan_task.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
typedef union can_ide
|
||||||
|
{
|
||||||
|
unsigned int D32;
|
||||||
|
unsigned char D8[4];
|
||||||
|
struct{
|
||||||
|
unsigned int Cmd :8;
|
||||||
|
unsigned int dAddr :7;
|
||||||
|
unsigned int sAddr :7;
|
||||||
|
unsigned int dLvl :3;
|
||||||
|
unsigned int sLvl :2;
|
||||||
|
unsigned int Pri :2;
|
||||||
|
unsigned int Dump :3;
|
||||||
|
}BitF;
|
||||||
|
}can_ide_struct;
|
||||||
|
|
||||||
|
typedef struct can_def
|
||||||
|
{
|
||||||
|
unsigned int rx_cmd;
|
||||||
|
unsigned char rx_buf[8];
|
||||||
|
unsigned int rx_len;
|
||||||
|
unsigned int rx_complete;
|
||||||
|
|
||||||
|
unsigned int tx_cmd;
|
||||||
|
unsigned char tx_buf[8];
|
||||||
|
unsigned int tx_len;
|
||||||
|
unsigned int tx_complete;
|
||||||
|
unsigned int tx_complete_delay_flag;
|
||||||
|
unsigned int tx_complete_delay_tick;
|
||||||
|
unsigned int tx_err;
|
||||||
|
unsigned int tx_msg_falg;
|
||||||
|
unsigned int tx_tick;
|
||||||
|
unsigned int tx_timer_count;
|
||||||
|
}can_info_struct;
|
||||||
|
|
||||||
|
extern can_info_struct can_handle;
|
||||||
|
|
||||||
|
extern void can_prm_init(void);
|
||||||
|
extern void can_send_time_handle(void);
|
||||||
|
extern void can_task(void);
|
||||||
|
|
||||||
|
extern unsigned int internal_can_send_data(unsigned int head, unsigned char * pdata, unsigned int len);
|
||||||
|
extern unsigned int get_can_tx_complete(void);
|
||||||
|
extern unsigned int get_can_tx_complete_delay_flag(void);
|
||||||
|
extern void can_tx_complete_delay(void);
|
||||||
405
FW/Core/my_src/file_cache.c
Normal file
405
FW/Core/my_src/file_cache.c
Normal file
@@ -0,0 +1,405 @@
|
|||||||
|
#include "file_cache.h"
|
||||||
|
#include "sdram_addr_map.h"
|
||||||
|
#include "lcd_base_display.h"
|
||||||
|
|
||||||
|
static uint32_t const sdram_cache_buffer_address = SDRAM_BUF_CACHE_ADDRESS;
|
||||||
|
|
||||||
|
uint8_t sector[512];
|
||||||
|
uint32_t BytesRead;
|
||||||
|
|
||||||
|
unsigned int load_file_to_sdramcache(const TCHAR* path, unsigned int cache_buffer_address, int *pState)
|
||||||
|
{
|
||||||
|
uint32_t index = 0, file_size = 0, size = 0, i1 = 0;
|
||||||
|
uint32_t BmpAddress;
|
||||||
|
uint32_t Address = cache_buffer_address;
|
||||||
|
FIL F1;
|
||||||
|
|
||||||
|
if(pState != 0)return 0;
|
||||||
|
|
||||||
|
if(f_open (&F1, path, FA_READ)){
|
||||||
|
/* Set the Text Color */
|
||||||
|
set_font_color(0xFFFF0000, 0xFFFFFFFF);
|
||||||
|
|
||||||
|
*pState = -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
file_size = F1.obj.objsize;
|
||||||
|
size = file_size;
|
||||||
|
if(0 == size){
|
||||||
|
*pState = -2;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
do{
|
||||||
|
//256*2
|
||||||
|
if (size < 512){
|
||||||
|
i1 = size;
|
||||||
|
}else{
|
||||||
|
i1 = 512;//256*2
|
||||||
|
}
|
||||||
|
size -= i1;
|
||||||
|
|
||||||
|
f_read (&F1, sector, i1, &BytesRead);
|
||||||
|
|
||||||
|
for (index = 0; index < i1; index++){
|
||||||
|
*(__IO uint8_t*) (Address) = *(__IO uint8_t *)BmpAddress;
|
||||||
|
|
||||||
|
BmpAddress++;
|
||||||
|
Address++;
|
||||||
|
}
|
||||||
|
|
||||||
|
BmpAddress = (uint32_t)sector;
|
||||||
|
}while (size > 0);
|
||||||
|
|
||||||
|
f_close (&F1);
|
||||||
|
*pState =0;
|
||||||
|
return file_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_bmpfile_to_sdramcache(const TCHAR* path,uint32_t cache_buffer_address)
|
||||||
|
{
|
||||||
|
uint32_t index = 0, size = 0, i1 = 0;
|
||||||
|
uint32_t BmpAddress;
|
||||||
|
uint32_t Address = cache_buffer_address;
|
||||||
|
FIL F1;
|
||||||
|
|
||||||
|
if(f_open (&F1, path, FA_READ))
|
||||||
|
{
|
||||||
|
set_font_color(0xFFFF0000, 0xFFFFFFFF);
|
||||||
|
|
||||||
|
LCD_ShowString(20,360,400,24,24,"File type or name not supported!");
|
||||||
|
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
f_read (&F1, sector, 32, &BytesRead);
|
||||||
|
|
||||||
|
BmpAddress = (uint32_t)sector;
|
||||||
|
|
||||||
|
/* Read bitmap size */
|
||||||
|
size = *(uint16_t *) (BmpAddress + 2);
|
||||||
|
size |= (*(uint16_t *) (BmpAddress + 4)) << 16;
|
||||||
|
|
||||||
|
/* Get bitmap data address offset */
|
||||||
|
index = *(uint16_t *) (BmpAddress + 10);
|
||||||
|
index |= (*(uint16_t *) (BmpAddress + 12)) << 16;
|
||||||
|
|
||||||
|
f_close (&F1);
|
||||||
|
|
||||||
|
f_open (&F1, path, FA_READ);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (size < 512)//256*2
|
||||||
|
{
|
||||||
|
i1 = size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i1 = 512;//256*2
|
||||||
|
}
|
||||||
|
size -= i1;
|
||||||
|
|
||||||
|
f_read (&F1, sector, i1, &BytesRead);
|
||||||
|
|
||||||
|
for (index = 0; index < i1; index++)
|
||||||
|
{
|
||||||
|
*(__IO uint8_t*) (Address) = *(__IO uint8_t *)BmpAddress;
|
||||||
|
|
||||||
|
BmpAddress++;
|
||||||
|
Address++;
|
||||||
|
}
|
||||||
|
|
||||||
|
BmpAddress = (uint32_t)sector;
|
||||||
|
}
|
||||||
|
while (size > 0);
|
||||||
|
|
||||||
|
f_close (&F1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_bmpfile_sdramcache_to_sdramaddress(uint32_t BmpCacheAddress,Bmp_Parameter_TypeDef* bmp_parameter)//24bit bmp
|
||||||
|
{
|
||||||
|
uint16_t temp_rg;
|
||||||
|
uint16_t temp_b;
|
||||||
|
uint32_t temp;
|
||||||
|
|
||||||
|
uint16_t temp_r;
|
||||||
|
uint16_t temp_g;
|
||||||
|
|
||||||
|
uint32_t index = 0, size = 0, width = 0, height = 0, bit_pixel = 0;
|
||||||
|
uint32_t Address;
|
||||||
|
uint32_t currentline = 0, linenumber = 0;
|
||||||
|
|
||||||
|
uint32_t read_width = 0;
|
||||||
|
uint32_t index_width = 0;
|
||||||
|
uint32_t index_height = 0;
|
||||||
|
|
||||||
|
uint32_t fifo_32bit = 0;
|
||||||
|
uint32_t point_32bit_data = 0;
|
||||||
|
uint32_t bit1_index = 0;
|
||||||
|
uint32_t bit1_size = 0;
|
||||||
|
uint32_t bit4_index = 0;
|
||||||
|
uint32_t bit4_size = 0;
|
||||||
|
uint32_t Bmp4BitColor = 0;
|
||||||
|
uint32_t read_width_index = 0;
|
||||||
|
uint32_t max_value = 0;
|
||||||
|
uint32_t i = 0;
|
||||||
|
|
||||||
|
Address = bmp_parameter->start_address;
|
||||||
|
|
||||||
|
/* Read bitmap size */
|
||||||
|
size = *(__IO uint16_t *) (BmpCacheAddress + 2);
|
||||||
|
size |= (*(__IO uint16_t *) (BmpCacheAddress + 4)) << 16;
|
||||||
|
|
||||||
|
/* Get bitmap data address offset */
|
||||||
|
index = *(__IO uint16_t *) (BmpCacheAddress + 10);
|
||||||
|
index |= (*(__IO uint16_t *) (BmpCacheAddress + 12)) << 16;
|
||||||
|
|
||||||
|
/* Read bitmap width */
|
||||||
|
width = *(uint16_t *) (BmpCacheAddress + 18);
|
||||||
|
width |= (*(uint16_t *) (BmpCacheAddress + 20)) << 16;
|
||||||
|
|
||||||
|
/* Read bitmap height */
|
||||||
|
height = *(uint16_t *) (BmpCacheAddress + 22);
|
||||||
|
height |= (*(uint16_t *) (BmpCacheAddress + 24)) << 16;
|
||||||
|
|
||||||
|
bmp_parameter->pic_width = width;
|
||||||
|
bmp_parameter->pic_height= height;
|
||||||
|
|
||||||
|
/* Read bit/pixel */
|
||||||
|
bit_pixel = *(uint16_t *) (BmpCacheAddress + 28);
|
||||||
|
|
||||||
|
/* compute the real size of the picture (without the header)) */
|
||||||
|
size = (size - index);
|
||||||
|
|
||||||
|
/* bypass the bitmap header */
|
||||||
|
BmpCacheAddress += index;
|
||||||
|
|
||||||
|
//16bit bmp
|
||||||
|
if(16 == bit_pixel)
|
||||||
|
{
|
||||||
|
if(width & 0x01)
|
||||||
|
{
|
||||||
|
read_width = width + 1;// 2 byte
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
read_width = width + 0;
|
||||||
|
}
|
||||||
|
size = read_width*height*2;
|
||||||
|
BmpCacheAddress+=(size-(read_width*2));
|
||||||
|
|
||||||
|
for(index_height = 0; index_height < height; index_height++)
|
||||||
|
{
|
||||||
|
for(index_width = 0; index_width < width; index_width++)
|
||||||
|
{
|
||||||
|
temp = *(__IO uint16_t *)BmpCacheAddress;
|
||||||
|
temp_r = (temp&0x7C00)>>7;
|
||||||
|
temp_g = (temp&0x03E0)>>2;
|
||||||
|
temp_b = (temp&0x001F)<<3;
|
||||||
|
temp = temp_r;
|
||||||
|
temp<<=8;
|
||||||
|
temp|=temp_g;
|
||||||
|
temp<<=8;
|
||||||
|
temp|=temp_b;
|
||||||
|
*(__IO uint32_t*) (Address) = (temp | 0xFF000000);
|
||||||
|
//jump on point pixel
|
||||||
|
BmpCacheAddress+=2;
|
||||||
|
Address+=4;
|
||||||
|
}
|
||||||
|
BmpCacheAddress-=((read_width + width)*2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//24bit bmp
|
||||||
|
else if(24 == bit_pixel)
|
||||||
|
{
|
||||||
|
if((width * 3) & 0x03)
|
||||||
|
{
|
||||||
|
read_width = (((width * 3)>>2) + 1)<<2;// 4 byte
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
read_width = width * 3;
|
||||||
|
}
|
||||||
|
size = read_width*height;
|
||||||
|
BmpCacheAddress+=(size-read_width);
|
||||||
|
|
||||||
|
for(index_height = 0; index_height < height; index_height++)
|
||||||
|
{
|
||||||
|
for(index_width = 0; index_width < width; index_width++)
|
||||||
|
{
|
||||||
|
temp_b = *(__IO uint8_t *)BmpCacheAddress;
|
||||||
|
BmpCacheAddress++;
|
||||||
|
temp_g = *(__IO uint8_t *)BmpCacheAddress;
|
||||||
|
BmpCacheAddress++;
|
||||||
|
temp_r = *(__IO uint8_t *)BmpCacheAddress;
|
||||||
|
BmpCacheAddress++;
|
||||||
|
temp = temp_r;
|
||||||
|
temp<<=8;
|
||||||
|
temp|=temp_g;
|
||||||
|
temp<<=8;
|
||||||
|
temp|=temp_b;
|
||||||
|
*(__IO uint32_t*) (Address) = (temp | 0xFF000000);
|
||||||
|
//jump on point pixel
|
||||||
|
Address+=4;
|
||||||
|
}
|
||||||
|
BmpCacheAddress-=(read_width + width * 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//4bit bmp
|
||||||
|
else if(4 == bit_pixel)
|
||||||
|
{
|
||||||
|
if(width & 0x07)
|
||||||
|
{
|
||||||
|
read_width = (width>>3) + 1;//read length 32bit
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
read_width = (width>>3) + 0;
|
||||||
|
}
|
||||||
|
size = read_width * height * 4;// 4 byte
|
||||||
|
BmpCacheAddress +=(size - (read_width * 4));//from bottom to top
|
||||||
|
bit4_size = width * height;//total 4bit size
|
||||||
|
index_height = height;
|
||||||
|
read_width_index = read_width;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
point_32bit_data = (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
point_32bit_data = (point_32bit_data<<8) | (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
point_32bit_data = (point_32bit_data<<8) | (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
point_32bit_data = (point_32bit_data<<8) | (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
|
||||||
|
read_width_index--;
|
||||||
|
if(0 == read_width_index)
|
||||||
|
{
|
||||||
|
max_value = width - ((read_width-1)<<3);
|
||||||
|
read_width_index = read_width;
|
||||||
|
index_height--;
|
||||||
|
BmpCacheAddress -=(read_width * 4 * 2);//read from bottom address to top address
|
||||||
|
if(0 == index_height)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
max_value = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0;i < max_value;i++)
|
||||||
|
{
|
||||||
|
switch((point_32bit_data & 0xF0000000)>>28){
|
||||||
|
case 0 : *(__IO uint32_t*)(Address) = 0xFF000000;break;
|
||||||
|
case 1 : *(__IO uint32_t*)(Address) = 0xFF800000;break;
|
||||||
|
case 2 : *(__IO uint32_t*)(Address) = 0xFF008000;break;
|
||||||
|
case 3 : *(__IO uint32_t*)(Address) = 0xFF808000;break;
|
||||||
|
case 4 : *(__IO uint32_t*)(Address) = 0xFF000080;break;
|
||||||
|
case 5 : *(__IO uint32_t*)(Address) = 0xFF800080;break;
|
||||||
|
case 6 : *(__IO uint32_t*)(Address) = 0xFF008080;break;
|
||||||
|
case 7 : *(__IO uint32_t*)(Address) = 0xFF808080;break;
|
||||||
|
case 8 : *(__IO uint32_t*)(Address) = 0xFFC0C0C0;break;
|
||||||
|
case 9 : *(__IO uint32_t*)(Address) = 0xFFFF0000;break;
|
||||||
|
case 10: *(__IO uint32_t*)(Address) = 0xFF00FF00;break;
|
||||||
|
case 11: *(__IO uint32_t*)(Address) = 0xFFFFFF00;break;
|
||||||
|
case 12: *(__IO uint32_t*)(Address) = 0xFF0000FF;break;
|
||||||
|
case 13: *(__IO uint32_t*)(Address) = 0xFFFF00FF;break;
|
||||||
|
case 14: *(__IO uint32_t*)(Address) = 0xFF00FFFF;break;
|
||||||
|
case 15: *(__IO uint32_t*)(Address) = 0xFFFFFFFF;break;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
point_32bit_data<<=4;
|
||||||
|
bit4_index++;
|
||||||
|
Address+=4;
|
||||||
|
if(bit4_index == bit4_size)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}while(bit4_index < bit4_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
//1bit bmp
|
||||||
|
else if(1 == bit_pixel)
|
||||||
|
{
|
||||||
|
if(width & 0x1F)
|
||||||
|
{
|
||||||
|
read_width = (width>>5) + 1;//read length 32bit
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
read_width = (width>>5) + 0;
|
||||||
|
}
|
||||||
|
size = read_width * height * 4;// 4 byte
|
||||||
|
BmpCacheAddress +=(size - (read_width * 4));//from bottom to top
|
||||||
|
bit1_size = width * height;//total bit size
|
||||||
|
index_height = height;
|
||||||
|
read_width_index = read_width;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
point_32bit_data = (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
point_32bit_data = (point_32bit_data<<8) | (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
point_32bit_data = (point_32bit_data<<8) | (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
point_32bit_data = (point_32bit_data<<8) | (*(__IO uint8_t *)BmpCacheAddress);
|
||||||
|
BmpCacheAddress++;
|
||||||
|
|
||||||
|
read_width_index--;
|
||||||
|
if(0 == read_width_index)
|
||||||
|
{
|
||||||
|
max_value = width - ((read_width-1)<<5);
|
||||||
|
read_width_index = read_width;
|
||||||
|
index_height--;
|
||||||
|
BmpCacheAddress -=(read_width * 4 * 2);//read from bottom address to top address
|
||||||
|
if(0 == index_height)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
max_value = 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0;i < max_value;i++)
|
||||||
|
{
|
||||||
|
fifo_32bit<<=1;
|
||||||
|
if(point_32bit_data & 0x80000000)
|
||||||
|
{
|
||||||
|
fifo_32bit|=0x01;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fifo_32bit&=~0x01;
|
||||||
|
}
|
||||||
|
point_32bit_data<<=1;
|
||||||
|
bit1_index++;
|
||||||
|
if(!(bit1_index & 0x1f))
|
||||||
|
{
|
||||||
|
*(__IO uint32_t*)(Address) = fifo_32bit;
|
||||||
|
Address+=4;
|
||||||
|
}
|
||||||
|
else if(bit1_index == bit1_size)
|
||||||
|
{
|
||||||
|
fifo_32bit<<=(32-(bit1_index & 0x1F));
|
||||||
|
*(__IO uint32_t*)(Address) = fifo_32bit;
|
||||||
|
Address+=4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}while(bit1_index < bit1_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_bmpfile_to_sdram(Bmp_Parameter_TypeDef* BmpFileParameter)
|
||||||
|
{
|
||||||
|
load_bmpfile_to_sdramcache((const char *)BmpFileParameter->name_str,sdram_cache_buffer_address);
|
||||||
|
load_bmpfile_sdramcache_to_sdramaddress(sdram_cache_buffer_address,BmpFileParameter);
|
||||||
|
}
|
||||||
5
FW/Core/my_src/file_cache.h
Normal file
5
FW/Core/my_src/file_cache.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#include "ff.h"
|
||||||
|
#include "load_gui_lib.h"
|
||||||
|
|
||||||
|
extern void load_bmpfile_to_sdram(Bmp_Parameter_TypeDef* BmpFileParameter);
|
||||||
|
extern unsigned int load_file_to_sdramcache(const TCHAR* path,unsigned int cache_buffer_address, int *State);
|
||||||
403
FW/Core/my_src/font.h
Normal file
403
FW/Core/my_src/font.h
Normal file
@@ -0,0 +1,403 @@
|
|||||||
|
#ifndef __FONT_H
|
||||||
|
#define __FONT_H
|
||||||
|
//常用ASCII表
|
||||||
|
//偏移量32
|
||||||
|
//ASCII字符集: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
|
||||||
|
//PC2LCD2002取模方式设置:阴码+逐列式+顺向+C51格式
|
||||||
|
//总共:3个字符集(12*12、16*16、24*24和32*32),用户可以自行新增其他分辨率的字符集。
|
||||||
|
//每个字符所占用的字节数为:(size/8+((size%8)?1:0))*(size/2),其中size:是字库生成时的点阵大小(12/16/24/32...)
|
||||||
|
|
||||||
|
//12*12 ASCII字符集点阵
|
||||||
|
const unsigned char asc2_1206[95][12]={
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x3F,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
|
||||||
|
{0x00,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x40,0x00,0x00,0x00},/*""",2*/
|
||||||
|
{0x09,0x00,0x0B,0xC0,0x3D,0x00,0x0B,0xC0,0x3D,0x00,0x09,0x00},/*"#",3*/
|
||||||
|
{0x18,0xC0,0x24,0x40,0x7F,0xE0,0x22,0x40,0x31,0x80,0x00,0x00},/*"$",4*/
|
||||||
|
{0x18,0x00,0x24,0xC0,0x1B,0x00,0x0D,0x80,0x32,0x40,0x01,0x80},/*"%",5*/
|
||||||
|
{0x03,0x80,0x1C,0x40,0x27,0x40,0x1C,0x80,0x07,0x40,0x00,0x40},/*"&",6*/
|
||||||
|
{0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x40,0x20},/*"(",8*/
|
||||||
|
{0x00,0x00,0x40,0x20,0x20,0x40,0x1F,0x80,0x00,0x00,0x00,0x00},/*")",9*/
|
||||||
|
{0x09,0x00,0x06,0x00,0x1F,0x80,0x06,0x00,0x09,0x00,0x00,0x00},/*"*",10*/
|
||||||
|
{0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x00,0x00},/*"+",11*/
|
||||||
|
{0x00,0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
|
||||||
|
{0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"-",13*/
|
||||||
|
{0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
|
||||||
|
{0x00,0x20,0x01,0xC0,0x06,0x00,0x38,0x00,0x40,0x00,0x00,0x00},/*"/",15*/
|
||||||
|
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"0",16*/
|
||||||
|
{0x00,0x00,0x10,0x40,0x3F,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"1",17*/
|
||||||
|
{0x18,0xC0,0x21,0x40,0x22,0x40,0x24,0x40,0x18,0x40,0x00,0x00},/*"2",18*/
|
||||||
|
{0x10,0x80,0x20,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"3",19*/
|
||||||
|
{0x02,0x00,0x0D,0x00,0x11,0x00,0x3F,0xC0,0x01,0x40,0x00,0x00},/*"4",20*/
|
||||||
|
{0x3C,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x23,0x80,0x00,0x00},/*"5",21*/
|
||||||
|
{0x1F,0x80,0x24,0x40,0x24,0x40,0x34,0x40,0x03,0x80,0x00,0x00},/*"6",22*/
|
||||||
|
{0x30,0x00,0x20,0x00,0x27,0xC0,0x38,0x00,0x20,0x00,0x00,0x00},/*"7",23*/
|
||||||
|
{0x1B,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"8",24*/
|
||||||
|
{0x1C,0x00,0x22,0xC0,0x22,0x40,0x22,0x40,0x1F,0x80,0x00,0x00},/*"9",25*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x04,0x60,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
|
||||||
|
{0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40},/*"<",28*/
|
||||||
|
{0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x00,0x00},/*"=",29*/
|
||||||
|
{0x00,0x00,0x40,0x40,0x20,0x80,0x11,0x00,0x0A,0x00,0x04,0x00},/*">",30*/
|
||||||
|
{0x18,0x00,0x20,0x00,0x23,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"?",31*/
|
||||||
|
{0x1F,0x80,0x20,0x40,0x27,0x40,0x29,0x40,0x1F,0x40,0x00,0x00},/*"@",32*/
|
||||||
|
{0x00,0x40,0x07,0xC0,0x39,0x00,0x0F,0x00,0x01,0xC0,0x00,0x40},/*"A",33*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"B",34*/
|
||||||
|
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0x80,0x00,0x00},/*"C",35*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"D",36*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x40,0x30,0xC0,0x00,0x00},/*"E",37*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x00,0x30,0x00,0x00,0x00},/*"F",38*/
|
||||||
|
{0x0F,0x00,0x10,0x80,0x20,0x40,0x22,0x40,0x33,0x80,0x02,0x00},/*"G",39*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x04,0x00,0x04,0x00,0x3F,0xC0,0x20,0x40},/*"H",40*/
|
||||||
|
{0x20,0x40,0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x00,0x00},/*"I",41*/
|
||||||
|
{0x00,0x60,0x20,0x20,0x20,0x20,0x3F,0xC0,0x20,0x00,0x20,0x00},/*"J",42*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x0B,0x00,0x30,0xC0,0x20,0x40},/*"K",43*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x20,0x40,0x00,0x40,0x00,0x40,0x00,0xC0},/*"L",44*/
|
||||||
|
{0x3F,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x3F,0xC0,0x00,0x00},/*"M",45*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x0C,0x40,0x23,0x00,0x3F,0xC0,0x20,0x00},/*"N",46*/
|
||||||
|
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"O",47*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"P",48*/
|
||||||
|
{0x1F,0x80,0x21,0x40,0x21,0x40,0x20,0xE0,0x1F,0xA0,0x00,0x00},/*"Q",49*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x26,0x00,0x19,0xC0,0x00,0x40},/*"R",50*/
|
||||||
|
{0x18,0xC0,0x24,0x40,0x24,0x40,0x22,0x40,0x31,0x80,0x00,0x00},/*"S",51*/
|
||||||
|
{0x30,0x00,0x20,0x40,0x3F,0xC0,0x20,0x40,0x30,0x00,0x00,0x00},/*"T",52*/
|
||||||
|
{0x20,0x00,0x3F,0x80,0x00,0x40,0x00,0x40,0x3F,0x80,0x20,0x00},/*"U",53*/
|
||||||
|
{0x20,0x00,0x3E,0x00,0x01,0xC0,0x07,0x00,0x38,0x00,0x20,0x00},/*"V",54*/
|
||||||
|
{0x38,0x00,0x07,0xC0,0x3C,0x00,0x07,0xC0,0x38,0x00,0x00,0x00},/*"W",55*/
|
||||||
|
{0x20,0x40,0x39,0xC0,0x06,0x00,0x39,0xC0,0x20,0x40,0x00,0x00},/*"X",56*/
|
||||||
|
{0x20,0x00,0x38,0x40,0x07,0xC0,0x38,0x40,0x20,0x00,0x00,0x00},/*"Y",57*/
|
||||||
|
{0x30,0x40,0x21,0xC0,0x26,0x40,0x38,0x40,0x20,0xC0,0x00,0x00},/*"Z",58*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x7F,0xE0,0x40,0x20,0x40,0x20,0x00,0x00},/*"[",59*/
|
||||||
|
{0x00,0x00,0x70,0x00,0x0C,0x00,0x03,0x80,0x00,0x40,0x00,0x00},/*"\",60*/
|
||||||
|
{0x00,0x00,0x40,0x20,0x40,0x20,0x7F,0xE0,0x00,0x00,0x00,0x00},/*"]",61*/
|
||||||
|
{0x00,0x00,0x20,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
|
||||||
|
{0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10},/*"_",63*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
|
||||||
|
{0x00,0x00,0x02,0x80,0x05,0x40,0x05,0x40,0x03,0xC0,0x00,0x40},/*"a",65*/
|
||||||
|
{0x20,0x00,0x3F,0xC0,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"b",66*/
|
||||||
|
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x06,0x40,0x00,0x00},/*"c",67*/
|
||||||
|
{0x00,0x00,0x03,0x80,0x04,0x40,0x24,0x40,0x3F,0xC0,0x00,0x40},/*"d",68*/
|
||||||
|
{0x00,0x00,0x03,0x80,0x05,0x40,0x05,0x40,0x03,0x40,0x00,0x00},/*"e",69*/
|
||||||
|
{0x00,0x00,0x04,0x40,0x1F,0xC0,0x24,0x40,0x24,0x40,0x20,0x00},/*"f",70*/
|
||||||
|
{0x00,0x00,0x02,0xE0,0x05,0x50,0x05,0x50,0x06,0x50,0x04,0x20},/*"g",71*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"h",72*/
|
||||||
|
{0x00,0x00,0x04,0x40,0x27,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"i",73*/
|
||||||
|
{0x00,0x10,0x00,0x10,0x04,0x10,0x27,0xE0,0x00,0x00,0x00,0x00},/*"j",74*/
|
||||||
|
{0x20,0x40,0x3F,0xC0,0x01,0x40,0x07,0x00,0x04,0xC0,0x04,0x40},/*"k",75*/
|
||||||
|
{0x20,0x40,0x20,0x40,0x3F,0xC0,0x00,0x40,0x00,0x40,0x00,0x00},/*"l",76*/
|
||||||
|
{0x07,0xC0,0x04,0x00,0x07,0xC0,0x04,0x00,0x03,0xC0,0x00,0x00},/*"m",77*/
|
||||||
|
{0x04,0x40,0x07,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"n",78*/
|
||||||
|
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"o",79*/
|
||||||
|
{0x04,0x10,0x07,0xF0,0x04,0x50,0x04,0x40,0x03,0x80,0x00,0x00},/*"p",80*/
|
||||||
|
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x50,0x07,0xF0,0x00,0x10},/*"q",81*/
|
||||||
|
{0x04,0x40,0x07,0xC0,0x02,0x40,0x04,0x00,0x04,0x00,0x00,0x00},/*"r",82*/
|
||||||
|
{0x00,0x00,0x06,0x40,0x05,0x40,0x05,0x40,0x04,0xC0,0x00,0x00},/*"s",83*/
|
||||||
|
{0x00,0x00,0x04,0x00,0x1F,0x80,0x04,0x40,0x00,0x40,0x00,0x00},/*"t",84*/
|
||||||
|
{0x04,0x00,0x07,0x80,0x00,0x40,0x04,0x40,0x07,0xC0,0x00,0x40},/*"u",85*/
|
||||||
|
{0x04,0x00,0x07,0x00,0x04,0xC0,0x01,0x80,0x06,0x00,0x04,0x00},/*"v",86*/
|
||||||
|
{0x06,0x00,0x01,0xC0,0x07,0x00,0x01,0xC0,0x06,0x00,0x00,0x00},/*"w",87*/
|
||||||
|
{0x04,0x40,0x06,0xC0,0x01,0x00,0x06,0xC0,0x04,0x40,0x00,0x00},/*"x",88*/
|
||||||
|
{0x04,0x10,0x07,0x10,0x04,0xE0,0x01,0x80,0x06,0x00,0x04,0x00},/*"y",89*/
|
||||||
|
{0x00,0x00,0x04,0x40,0x05,0xC0,0x06,0x40,0x04,0x40,0x00,0x00},/*"z",90*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x04,0x00,0x7B,0xE0,0x40,0x20,0x00,0x00},/*"{",91*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00},/*"|",92*/
|
||||||
|
{0x00,0x00,0x40,0x20,0x7B,0xE0,0x04,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
|
||||||
|
{0x40,0x00,0x80,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x40,0x00},/*"~",94*/
|
||||||
|
};
|
||||||
|
//16*16 ASCII字符集点阵
|
||||||
|
const unsigned char asc2_1608[95][16]={
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCC,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
|
||||||
|
{0x00,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x00,0x00},/*""",2*/
|
||||||
|
{0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x00,0x00},/*"#",3*/
|
||||||
|
{0x00,0x00,0x0E,0x18,0x11,0x04,0x3F,0xFF,0x10,0x84,0x0C,0x78,0x00,0x00,0x00,0x00},/*"$",4*/
|
||||||
|
{0x0F,0x00,0x10,0x84,0x0F,0x38,0x00,0xC0,0x07,0x78,0x18,0x84,0x00,0x78,0x00,0x00},/*"%",5*/
|
||||||
|
{0x00,0x78,0x0F,0x84,0x10,0xC4,0x11,0x24,0x0E,0x98,0x00,0xE4,0x00,0x84,0x00,0x08},/*"&",6*/
|
||||||
|
{0x08,0x00,0x68,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x18,0x18,0x20,0x04,0x40,0x02,0x00,0x00},/*"(",8*/
|
||||||
|
{0x00,0x00,0x40,0x02,0x20,0x04,0x18,0x18,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
|
||||||
|
{0x02,0x40,0x02,0x40,0x01,0x80,0x0F,0xF0,0x01,0x80,0x02,0x40,0x02,0x40,0x00,0x00},/*"*",10*/
|
||||||
|
{0x00,0x80,0x00,0x80,0x00,0x80,0x0F,0xF8,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00},/*"+",11*/
|
||||||
|
{0x00,0x01,0x00,0x0D,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
|
||||||
|
{0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80},/*"-",13*/
|
||||||
|
{0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
|
||||||
|
{0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00},/*"/",15*/
|
||||||
|
{0x00,0x00,0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"0",16*/
|
||||||
|
{0x00,0x00,0x08,0x04,0x08,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"1",17*/
|
||||||
|
{0x00,0x00,0x0E,0x0C,0x10,0x14,0x10,0x24,0x10,0x44,0x11,0x84,0x0E,0x0C,0x00,0x00},/*"2",18*/
|
||||||
|
{0x00,0x00,0x0C,0x18,0x10,0x04,0x11,0x04,0x11,0x04,0x12,0x88,0x0C,0x70,0x00,0x00},/*"3",19*/
|
||||||
|
{0x00,0x00,0x00,0xE0,0x03,0x20,0x04,0x24,0x08,0x24,0x1F,0xFC,0x00,0x24,0x00,0x00},/*"4",20*/
|
||||||
|
{0x00,0x00,0x1F,0x98,0x10,0x84,0x11,0x04,0x11,0x04,0x10,0x88,0x10,0x70,0x00,0x00},/*"5",21*/
|
||||||
|
{0x00,0x00,0x07,0xF0,0x08,0x88,0x11,0x04,0x11,0x04,0x18,0x88,0x00,0x70,0x00,0x00},/*"6",22*/
|
||||||
|
{0x00,0x00,0x1C,0x00,0x10,0x00,0x10,0xFC,0x13,0x00,0x1C,0x00,0x10,0x00,0x00,0x00},/*"7",23*/
|
||||||
|
{0x00,0x00,0x0E,0x38,0x11,0x44,0x10,0x84,0x10,0x84,0x11,0x44,0x0E,0x38,0x00,0x00},/*"8",24*/
|
||||||
|
{0x00,0x00,0x07,0x00,0x08,0x8C,0x10,0x44,0x10,0x44,0x08,0x88,0x07,0xF0,0x00,0x00},/*"9",25*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x03,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
|
||||||
|
{0x00,0x00,0x00,0x80,0x01,0x40,0x02,0x20,0x04,0x10,0x08,0x08,0x10,0x04,0x00,0x00},/*"<",28*/
|
||||||
|
{0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x00,0x00},/*"=",29*/
|
||||||
|
{0x00,0x00,0x10,0x04,0x08,0x08,0x04,0x10,0x02,0x20,0x01,0x40,0x00,0x80,0x00,0x00},/*">",30*/
|
||||||
|
{0x00,0x00,0x0E,0x00,0x12,0x00,0x10,0x0C,0x10,0x6C,0x10,0x80,0x0F,0x00,0x00,0x00},/*"?",31*/
|
||||||
|
{0x03,0xE0,0x0C,0x18,0x13,0xE4,0x14,0x24,0x17,0xC4,0x08,0x28,0x07,0xD0,0x00,0x00},/*"@",32*/
|
||||||
|
{0x00,0x04,0x00,0x3C,0x03,0xC4,0x1C,0x40,0x07,0x40,0x00,0xE4,0x00,0x1C,0x00,0x04},/*"A",33*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x11,0x04,0x0E,0x88,0x00,0x70,0x00,0x00},/*"B",34*/
|
||||||
|
{0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x08,0x1C,0x10,0x00,0x00},/*"C",35*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"D",36*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x17,0xC4,0x10,0x04,0x08,0x18,0x00,0x00},/*"E",37*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x17,0xC0,0x10,0x00,0x08,0x00,0x00,0x00},/*"F",38*/
|
||||||
|
{0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x44,0x1C,0x78,0x00,0x40,0x00,0x00},/*"G",39*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x10,0x84,0x00,0x80,0x00,0x80,0x10,0x84,0x1F,0xFC,0x10,0x04},/*"H",40*/
|
||||||
|
{0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x00,0x00,0x00,0x00},/*"I",41*/
|
||||||
|
{0x00,0x03,0x00,0x01,0x10,0x01,0x10,0x01,0x1F,0xFE,0x10,0x00,0x10,0x00,0x00,0x00},/*"J",42*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x03,0x80,0x14,0x64,0x18,0x1C,0x10,0x04,0x00,0x00},/*"K",43*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x10,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x0C,0x00,0x00},/*"L",44*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x1F,0x00,0x00,0xFC,0x1F,0x00,0x1F,0xFC,0x10,0x04,0x00,0x00},/*"M",45*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x0C,0x04,0x03,0x00,0x00,0xE0,0x10,0x18,0x1F,0xFC,0x10,0x00},/*"N",46*/
|
||||||
|
{0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"O",47*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x10,0x84,0x10,0x80,0x10,0x80,0x10,0x80,0x0F,0x00,0x00,0x00},/*"P",48*/
|
||||||
|
{0x07,0xF0,0x08,0x18,0x10,0x24,0x10,0x24,0x10,0x1C,0x08,0x0A,0x07,0xF2,0x00,0x00},/*"Q",49*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x11,0xC0,0x11,0x30,0x0E,0x0C,0x00,0x04},/*"R",50*/
|
||||||
|
{0x00,0x00,0x0E,0x1C,0x11,0x04,0x10,0x84,0x10,0x84,0x10,0x44,0x1C,0x38,0x00,0x00},/*"S",51*/
|
||||||
|
{0x18,0x00,0x10,0x00,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x00,0x18,0x00,0x00,0x00},/*"T",52*/
|
||||||
|
{0x10,0x00,0x1F,0xF8,0x10,0x04,0x00,0x04,0x00,0x04,0x10,0x04,0x1F,0xF8,0x10,0x00},/*"U",53*/
|
||||||
|
{0x10,0x00,0x1E,0x00,0x11,0xE0,0x00,0x1C,0x00,0x70,0x13,0x80,0x1C,0x00,0x10,0x00},/*"V",54*/
|
||||||
|
{0x1F,0xC0,0x10,0x3C,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x10,0x3C,0x1F,0xC0,0x00,0x00},/*"W",55*/
|
||||||
|
{0x10,0x04,0x18,0x0C,0x16,0x34,0x01,0xC0,0x01,0xC0,0x16,0x34,0x18,0x0C,0x10,0x04},/*"X",56*/
|
||||||
|
{0x10,0x00,0x1C,0x00,0x13,0x04,0x00,0xFC,0x13,0x04,0x1C,0x00,0x10,0x00,0x00,0x00},/*"Y",57*/
|
||||||
|
{0x08,0x04,0x10,0x1C,0x10,0x64,0x10,0x84,0x13,0x04,0x1C,0x04,0x10,0x18,0x00,0x00},/*"Z",58*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x40,0x02,0x40,0x02,0x40,0x02,0x00,0x00},/*"[",59*/
|
||||||
|
{0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x80,0x00,0x60,0x00,0x1C,0x00,0x03,0x00,0x00},/*"\",60*/
|
||||||
|
{0x00,0x00,0x40,0x02,0x40,0x02,0x40,0x02,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00},/*"^",62*/
|
||||||
|
{0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01},/*"_",63*/
|
||||||
|
{0x00,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
|
||||||
|
{0x00,0x00,0x00,0x98,0x01,0x24,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xFC,0x00,0x04},/*"a",65*/
|
||||||
|
{0x10,0x00,0x1F,0xFC,0x00,0x88,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00},/*"b",66*/
|
||||||
|
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x00},/*"c",67*/
|
||||||
|
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x11,0x08,0x1F,0xFC,0x00,0x04},/*"d",68*/
|
||||||
|
{0x00,0x00,0x00,0xF8,0x01,0x44,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xC8,0x00,0x00},/*"e",69*/
|
||||||
|
{0x00,0x00,0x01,0x04,0x01,0x04,0x0F,0xFC,0x11,0x04,0x11,0x04,0x11,0x00,0x18,0x00},/*"f",70*/
|
||||||
|
{0x00,0x00,0x00,0xD6,0x01,0x29,0x01,0x29,0x01,0x29,0x01,0xC9,0x01,0x06,0x00,0x00},/*"g",71*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04},/*"h",72*/
|
||||||
|
{0x00,0x00,0x01,0x04,0x19,0x04,0x19,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"i",73*/
|
||||||
|
{0x00,0x00,0x00,0x03,0x00,0x01,0x01,0x01,0x19,0x01,0x19,0xFE,0x00,0x00,0x00,0x00},/*"j",74*/
|
||||||
|
{0x10,0x04,0x1F,0xFC,0x00,0x24,0x00,0x40,0x01,0xB4,0x01,0x0C,0x01,0x04,0x00,0x00},/*"k",75*/
|
||||||
|
{0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"l",76*/
|
||||||
|
{0x01,0x04,0x01,0xFC,0x01,0x04,0x01,0x00,0x01,0xFC,0x01,0x04,0x01,0x00,0x00,0xFC},/*"m",77*/
|
||||||
|
{0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04},/*"n",78*/
|
||||||
|
{0x00,0x00,0x00,0xF8,0x01,0x04,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0xF8,0x00,0x00},/*"o",79*/
|
||||||
|
{0x01,0x01,0x01,0xFF,0x00,0x85,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00},/*"p",80*/
|
||||||
|
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x05,0x01,0xFF,0x00,0x01},/*"q",81*/
|
||||||
|
{0x01,0x04,0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x04,0x01,0x00,0x01,0x80,0x00,0x00},/*"r",82*/
|
||||||
|
{0x00,0x00,0x00,0xCC,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x98,0x00,0x00},/*"s",83*/
|
||||||
|
{0x00,0x00,0x01,0x00,0x01,0x00,0x07,0xF8,0x01,0x04,0x01,0x04,0x00,0x00,0x00,0x00},/*"t",84*/
|
||||||
|
{0x01,0x00,0x01,0xF8,0x00,0x04,0x00,0x04,0x00,0x04,0x01,0x08,0x01,0xFC,0x00,0x04},/*"u",85*/
|
||||||
|
{0x01,0x00,0x01,0x80,0x01,0x70,0x00,0x0C,0x00,0x10,0x01,0x60,0x01,0x80,0x01,0x00},/*"v",86*/
|
||||||
|
{0x01,0xF0,0x01,0x0C,0x00,0x30,0x01,0xC0,0x00,0x30,0x01,0x0C,0x01,0xF0,0x01,0x00},/*"w",87*/
|
||||||
|
{0x00,0x00,0x01,0x04,0x01,0x8C,0x00,0x74,0x01,0x70,0x01,0x8C,0x01,0x04,0x00,0x00},/*"x",88*/
|
||||||
|
{0x01,0x01,0x01,0x81,0x01,0x71,0x00,0x0E,0x00,0x18,0x01,0x60,0x01,0x80,0x01,0x00},/*"y",89*/
|
||||||
|
{0x00,0x00,0x01,0x84,0x01,0x0C,0x01,0x34,0x01,0x44,0x01,0x84,0x01,0x0C,0x00,0x00},/*"z",90*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x3E,0xFC,0x40,0x02,0x40,0x02},/*"{",91*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
|
||||||
|
{0x00,0x00,0x40,0x02,0x40,0x02,0x3E,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
|
||||||
|
{0x00,0x00,0x60,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x20,0x00},/*"~",94*/
|
||||||
|
};
|
||||||
|
//24*24 ASICII字符集点阵
|
||||||
|
const unsigned char asc2_2412[95][36]={
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0x0F,0xFE,0x38,0x0F,0x80,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x38,0x00,0x00,0x31,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x38,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00},/*""",2*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x61,0x80,0x00,0x67,0xF8,0x07,0xF9,0x80,0x00,0x61,0x80,0x00,0x61,0x80,0x00,0x61,0x80,0x00,0x61,0x80,0x00,0x67,0xF8,0x07,0xF9,0x80,0x00,0x61,0x80,0x00,0x00,0x00},/*"#",3*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0xE0,0x03,0xE0,0xF0,0x06,0x30,0x08,0x04,0x18,0x08,0x1F,0xFF,0xFE,0x04,0x0E,0x08,0x07,0x87,0xF0,0x03,0x81,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*"$",4*/
|
||||||
|
{0x01,0xF0,0x00,0x06,0x0C,0x00,0x04,0x04,0x08,0x06,0x0C,0x70,0x01,0xF9,0xC0,0x00,0x0E,0x00,0x00,0x3B,0xE0,0x00,0xEC,0x18,0x07,0x08,0x08,0x04,0x0C,0x18,0x00,0x03,0xE0,0x00,0x00,0x00},/*"%",5*/
|
||||||
|
{0x00,0x01,0xE0,0x00,0x07,0xF0,0x03,0xF8,0x18,0x04,0x1C,0x08,0x04,0x17,0x08,0x07,0xE1,0xD0,0x03,0xC0,0xE0,0x00,0x23,0xB0,0x00,0x3C,0x08,0x00,0x20,0x08,0x00,0x00,0x10,0x00,0x00,0x00},/*"&",6*/
|
||||||
|
{0x00,0x00,0x00,0x01,0x00,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0xFF,0xC0,0x07,0x80,0xF0,0x0C,0x00,0x18,0x10,0x00,0x04,0x20,0x00,0x02,0x00,0x00,0x00},/*"(",8*/
|
||||||
|
{0x00,0x00,0x00,0x20,0x00,0x02,0x10,0x00,0x04,0x0C,0x00,0x18,0x07,0x80,0xF0,0x01,0xFF,0xC0,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x66,0x00,0x00,0x66,0x00,0x00,0x3C,0x00,0x00,0x18,0x00,0x03,0xFF,0xC0,0x00,0x18,0x00,0x00,0x3C,0x00,0x00,0x66,0x00,0x00,0x66,0x00,0x00,0x42,0x00},/*"*",10*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x01,0xFF,0xC0,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00},/*"+",11*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00},/*"-",13*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x38,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x1C,0x00,0x00,0x70,0x00,0x01,0x80,0x00,0x0E,0x00,0x00,0x38,0x00,0x00,0xC0,0x00,0x07,0x00,0x00,0x1C,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00},/*"/",15*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x18,0x04,0x00,0x08,0x04,0x00,0x08,0x06,0x00,0x18,0x03,0x80,0x70,0x01,0xFF,0xE0,0x00,0x7F,0x80,0x00,0x00,0x00},/*"0",16*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x01,0x00,0x08,0x01,0x00,0x08,0x03,0xFF,0xF8,0x07,0xFF,0xF8,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"1",17*/
|
||||||
|
{0x00,0x00,0x00,0x01,0xC0,0x38,0x02,0xC0,0x58,0x04,0x00,0x98,0x04,0x01,0x18,0x04,0x02,0x18,0x04,0x04,0x18,0x06,0x1C,0x18,0x03,0xF8,0x18,0x01,0xE0,0xF8,0x00,0x00,0x00,0x00,0x00,0x00},/*"2",18*/
|
||||||
|
{0x00,0x00,0x00,0x01,0xC0,0xE0,0x03,0xC0,0xF0,0x04,0x00,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x06,0x18,0x08,0x03,0xF4,0x18,0x01,0xE7,0xF0,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*"3",19*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x0D,0x00,0x00,0x11,0x00,0x00,0x61,0x00,0x00,0x81,0x08,0x03,0x01,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x00,0x00},/*"4",20*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0xE0,0x07,0xFC,0xD0,0x06,0x08,0x08,0x06,0x10,0x08,0x06,0x10,0x08,0x06,0x10,0x08,0x06,0x18,0x38,0x06,0x0F,0xF0,0x06,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00},/*"5",21*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x3F,0x80,0x01,0xFF,0xE0,0x03,0x84,0x30,0x02,0x08,0x18,0x04,0x10,0x08,0x04,0x10,0x08,0x04,0x10,0x08,0x07,0x18,0x10,0x03,0x0F,0xF0,0x00,0x07,0xC0,0x00,0x00,0x00},/*"6",22*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x07,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0xF8,0x06,0x07,0xF8,0x06,0x18,0x00,0x06,0xE0,0x00,0x07,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00},/*"7",23*/
|
||||||
|
{0x00,0x00,0x00,0x01,0xE1,0xE0,0x03,0xF7,0xF0,0x06,0x34,0x10,0x04,0x18,0x08,0x04,0x18,0x08,0x04,0x0C,0x08,0x04,0x0C,0x08,0x06,0x16,0x18,0x03,0xF3,0xF0,0x01,0xC1,0xE0,0x00,0x00,0x00},/*"8",24*/
|
||||||
|
{0x00,0x00,0x00,0x00,0xF8,0x00,0x03,0xFC,0x30,0x03,0x06,0x38,0x04,0x02,0x08,0x04,0x02,0x08,0x04,0x02,0x08,0x04,0x04,0x10,0x03,0x08,0xF0,0x01,0xFF,0xC0,0x00,0x7F,0x00,0x00,0x00,0x00},/*"9",25*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x00,0x70,0x38,0x00,0x70,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x1A,0x00,0x30,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x14,0x00,0x00,0x22,0x00,0x00,0x41,0x00,0x00,0x80,0x80,0x01,0x00,0x40,0x02,0x00,0x20,0x04,0x00,0x10,0x08,0x00,0x08,0x00,0x00,0x00},/*"<",28*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x00,0x00},/*"=",29*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x04,0x00,0x10,0x02,0x00,0x20,0x01,0x00,0x40,0x00,0x80,0x80,0x00,0x41,0x00,0x00,0x22,0x00,0x00,0x14,0x00,0x00,0x08,0x00,0x00,0x00,0x00},/*">",30*/
|
||||||
|
{0x00,0x00,0x00,0x03,0xC0,0x00,0x04,0xC0,0x00,0x04,0x00,0x00,0x08,0x00,0x38,0x08,0x0F,0x38,0x08,0x08,0x38,0x08,0x10,0x00,0x0C,0x30,0x00,0x07,0xE0,0x00,0x03,0xC0,0x00,0x00,0x00,0x00},/*"?",31*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0xFF,0xE0,0x03,0x80,0x70,0x02,0x0F,0x10,0x06,0x70,0x88,0x04,0xC0,0x88,0x04,0x83,0x08,0x04,0x7F,0x88,0x02,0xC0,0x90,0x03,0x01,0x20,0x00,0xFE,0x40},/*"@",32*/
|
||||||
|
{0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x01,0xF8,0x00,0x3E,0x08,0x01,0xC2,0x00,0x07,0x02,0x00,0x07,0xE2,0x00,0x00,0xFE,0x00,0x00,0x1F,0xC8,0x00,0x01,0xF8,0x00,0x00,0x38,0x00,0x00,0x08},/*"A",33*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x06,0x18,0x08,0x03,0xF4,0x18,0x01,0xE7,0xF0,0x00,0x01,0xE0,0x00,0x00,0x00},/*"B",34*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x3F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x02,0x00,0x18,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x10,0x06,0x00,0x20,0x07,0x80,0xC0,0x00,0x00,0x00},/*"C",35*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x18,0x02,0x00,0x10,0x03,0x80,0x70,0x01,0xFF,0xE0,0x00,0x7F,0x80,0x00,0x00,0x00},/*"D",36*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x3E,0x08,0x04,0x00,0x08,0x06,0x00,0x18,0x01,0x00,0x60,0x00,0x00,0x00},/*"E",37*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x00,0x04,0x08,0x00,0x04,0x08,0x00,0x04,0x3E,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00},/*"F",38*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x3F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x18,0x04,0x00,0x08,0x04,0x02,0x08,0x04,0x02,0x08,0x02,0x03,0xF0,0x07,0x83,0xF0,0x00,0x02,0x00,0x00,0x02,0x00},/*"G",39*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x04,0x08,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08},/*"H",40*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"I",41*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x07,0x00,0x00,0x01,0x04,0x00,0x01,0x04,0x00,0x01,0x04,0x00,0x03,0x07,0xFF,0xFE,0x07,0xFF,0xFC,0x04,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00},/*"J",42*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x0C,0x08,0x00,0x18,0x00,0x00,0x3E,0x00,0x04,0xC7,0x80,0x05,0x03,0xC8,0x06,0x00,0xF8,0x04,0x00,0x38,0x04,0x00,0x18,0x00,0x00,0x08},/*"K",43*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x00,0x60,0x00,0x00,0x00},/*"L",44*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0x80,0x08,0x07,0xFC,0x00,0x00,0x7F,0xC0,0x00,0x03,0xF8,0x00,0x07,0xC0,0x00,0x78,0x00,0x07,0x80,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08},/*"M",45*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0x00,0x08,0x03,0xC0,0x00,0x00,0xE0,0x00,0x00,0x38,0x00,0x00,0x1E,0x00,0x00,0x07,0x00,0x00,0x01,0xC0,0x04,0x00,0xF0,0x07,0xFF,0xF8,0x04,0x00,0x00},/*"N",46*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x18,0x04,0x00,0x08,0x04,0x00,0x08,0x06,0x00,0x18,0x03,0x00,0x30,0x01,0xFF,0xE0,0x00,0x7F,0x80,0x00,0x00,0x00},/*"O",47*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x04,0x08,0x04,0x04,0x00,0x04,0x04,0x00,0x04,0x04,0x00,0x04,0x04,0x00,0x06,0x0C,0x00,0x03,0xF8,0x00,0x01,0xF0,0x00,0x00,0x00,0x00},/*"P",48*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x88,0x04,0x00,0x88,0x04,0x00,0xC8,0x06,0x00,0x3C,0x03,0x00,0x3E,0x01,0xFF,0xE6,0x00,0x7F,0x84,0x00,0x00,0x00},/*"Q",49*/
|
||||||
|
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x00,0x04,0x0C,0x00,0x04,0x0F,0x00,0x04,0x0B,0xC0,0x06,0x10,0xF0,0x03,0xF0,0x38,0x01,0xE0,0x08,0x00,0x00,0x08},/*"R",50*/
|
||||||
|
{0x00,0x00,0x00,0x01,0xE0,0xF8,0x03,0xF0,0x30,0x06,0x30,0x10,0x04,0x18,0x08,0x04,0x18,0x08,0x04,0x0C,0x08,0x04,0x0C,0x08,0x02,0x06,0x18,0x02,0x07,0xF0,0x07,0x81,0xE0,0x00,0x00,0x00},/*"S",51*/
|
||||||
|
{0x01,0x80,0x00,0x06,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x04,0x00,0x00,0x04,0x00,0x00,0x06,0x00,0x00,0x01,0x80,0x00},/*"T",52*/
|
||||||
|
{0x04,0x00,0x00,0x07,0xFF,0xE0,0x07,0xFF,0xF0,0x04,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x04,0x00,0x10,0x07,0xFF,0xE0,0x04,0x00,0x00},/*"U",53*/
|
||||||
|
{0x04,0x00,0x00,0x06,0x00,0x00,0x07,0xE0,0x00,0x07,0xFE,0x00,0x04,0x1F,0xE0,0x00,0x01,0xF8,0x00,0x00,0x38,0x00,0x01,0xE0,0x04,0x3E,0x00,0x07,0xC0,0x00,0x06,0x00,0x00,0x04,0x00,0x00},/*"V",54*/
|
||||||
|
{0x04,0x00,0x00,0x07,0xE0,0x00,0x07,0xFF,0xC0,0x04,0x1F,0xF8,0x00,0x07,0xC0,0x07,0xF8,0x00,0x07,0xFF,0x80,0x04,0x3F,0xF8,0x00,0x07,0xC0,0x04,0xF8,0x00,0x07,0x00,0x00,0x04,0x00,0x00},/*"W",55*/
|
||||||
|
{0x00,0x00,0x00,0x04,0x00,0x08,0x06,0x00,0x18,0x07,0xC0,0x78,0x05,0xF1,0xC8,0x00,0x3E,0x00,0x00,0x1F,0x80,0x04,0x63,0xE8,0x07,0x80,0xF8,0x06,0x00,0x18,0x04,0x00,0x08,0x00,0x00,0x00},/*"X",56*/
|
||||||
|
{0x04,0x00,0x00,0x06,0x00,0x00,0x07,0x80,0x00,0x07,0xE0,0x08,0x04,0x7C,0x08,0x00,0x1F,0xF8,0x00,0x07,0xF8,0x00,0x18,0x08,0x04,0xE0,0x08,0x07,0x00,0x00,0x06,0x00,0x00,0x04,0x00,0x00},/*"Y",57*/
|
||||||
|
{0x00,0x00,0x00,0x01,0x00,0x08,0x06,0x00,0x38,0x04,0x00,0xF8,0x04,0x03,0xE8,0x04,0x0F,0x08,0x04,0x7C,0x08,0x05,0xF0,0x08,0x07,0xC0,0x08,0x07,0x00,0x18,0x04,0x00,0x60,0x00,0x00,0x00},/*"Z",58*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFE,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x00,0x00,0x00},/*"[",59*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x07,0x00,0x00,0x00,0xC0,0x00,0x00,0x38,0x00,0x00,0x06,0x00,0x00,0x01,0xC0,0x00,0x00,0x30,0x00,0x00,0x0E,0x00,0x00,0x01,0x00,0x00,0x00},/*"\",60*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x3F,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x10,0x00,0x00,0x30,0x00,0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
|
||||||
|
{0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01},/*"_",63*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x19,0xF8,0x00,0x1B,0x18,0x00,0x22,0x08,0x00,0x26,0x08,0x00,0x24,0x08,0x00,0x24,0x10,0x00,0x3F,0xF8,0x00,0x1F,0xF8,0x00,0x00,0x08,0x00,0x00,0x18},/*"a",65*/
|
||||||
|
{0x00,0x00,0x00,0x04,0x00,0x00,0x07,0xFF,0xF8,0x0F,0xFF,0xF0,0x00,0x18,0x18,0x00,0x10,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x30,0x18,0x00,0x1F,0xF0,0x00,0x0F,0xC0,0x00,0x00,0x00},/*"b",66*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x18,0x30,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x3C,0x08,0x00,0x1C,0x10,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00},/*"c",67*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x38,0x18,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x04,0x10,0x10,0x07,0xFF,0xF8,0x0F,0xFF,0xF0,0x00,0x00,0x10,0x00,0x00,0x00},/*"d",68*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x12,0x30,0x00,0x22,0x18,0x00,0x22,0x08,0x00,0x22,0x08,0x00,0x32,0x08,0x00,0x1E,0x10,0x00,0x0E,0x20,0x00,0x00,0x00},/*"e",69*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x08,0x00,0x20,0x08,0x01,0xFF,0xF8,0x03,0xFF,0xF8,0x06,0x20,0x08,0x04,0x20,0x08,0x04,0x20,0x08,0x07,0x20,0x00,0x03,0x00,0x00,0x00,0x00,0x00},/*"f",70*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x0E,0x6E,0x00,0x1F,0xF3,0x00,0x31,0xB1,0x00,0x20,0xB1,0x00,0x20,0xB1,0x00,0x31,0x91,0x00,0x1F,0x13,0x00,0x2E,0x1E,0x00,0x20,0x0E,0x00,0x30,0x00},/*"g",71*/
|
||||||
|
{0x00,0x00,0x00,0x04,0x00,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x10,0x08,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x1F,0xF8,0x00,0x00,0x08,0x00,0x00,0x00},/*"h",72*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x06,0x3F,0xF8,0x06,0x3F,0xF8,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"i",73*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x20,0x01,0x00,0x20,0x01,0x00,0x20,0x03,0x06,0x3F,0xFE,0x06,0x3F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"j",74*/
|
||||||
|
{0x00,0x00,0x00,0x04,0x00,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x01,0x88,0x00,0x03,0x00,0x00,0x2F,0xC0,0x00,0x38,0xF8,0x00,0x20,0x38,0x00,0x20,0x08,0x00,0x00,0x08,0x00,0x00,0x00},/*"k",75*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"l",76*/
|
||||||
|
{0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x10,0x08,0x00,0x20,0x00,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x10,0x08,0x00,0x20,0x00,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x00,0x08},/*"m",77*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x10,0x08,0x00,0x10,0x00,0x00,0x20,0x00,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x1F,0xF8,0x00,0x00,0x08,0x00,0x00,0x00},/*"n",78*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x0F,0xF0,0x00,0x18,0x30,0x00,0x30,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x30,0x08,0x00,0x18,0x30,0x00,0x0F,0xF0,0x00,0x07,0xC0,0x00,0x00,0x00},/*"o",79*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x01,0x00,0x3F,0xFF,0x00,0x3F,0xFF,0x00,0x10,0x11,0x00,0x20,0x09,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x30,0x38,0x00,0x1F,0xF0,0x00,0x0F,0xC0,0x00,0x00,0x00},/*"p",80*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x38,0x18,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x09,0x00,0x10,0x11,0x00,0x1F,0xFF,0x00,0x3F,0xFF,0x00,0x00,0x01,0x00,0x00,0x00},/*"q",81*/
|
||||||
|
{0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x08,0x08,0x00,0x10,0x08,0x00,0x20,0x08,0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00},/*"r",82*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x78,0x00,0x1E,0x18,0x00,0x33,0x08,0x00,0x23,0x08,0x00,0x21,0x08,0x00,0x21,0x88,0x00,0x21,0x98,0x00,0x30,0xF0,0x00,0x38,0x60,0x00,0x00,0x00},/*"s",83*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0xFF,0xF0,0x03,0xFF,0xF8,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00},/*"t",84*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x3F,0xF0,0x00,0x7F,0xF8,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x20,0x10,0x00,0x3F,0xF8,0x00,0x7F,0xF0,0x00,0x00,0x10,0x00,0x00,0x00},/*"u",85*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x3C,0x00,0x00,0x3F,0x80,0x00,0x23,0xF0,0x00,0x00,0x78,0x00,0x00,0x70,0x00,0x23,0x80,0x00,0x3C,0x00,0x00,0x30,0x00,0x00,0x20,0x00},/*"v",86*/
|
||||||
|
{0x00,0x20,0x00,0x00,0x3C,0x00,0x00,0x3F,0xE0,0x00,0x23,0xF8,0x00,0x00,0xE0,0x00,0x27,0x00,0x00,0x3E,0x00,0x00,0x3F,0xE0,0x00,0x21,0xF8,0x00,0x01,0xE0,0x00,0x3E,0x00,0x00,0x20,0x00},/*"w",87*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x38,0x38,0x00,0x3E,0x68,0x00,0x27,0x80,0x00,0x03,0xC8,0x00,0x2C,0xF8,0x00,0x38,0x38,0x00,0x20,0x18,0x00,0x20,0x08,0x00,0x00,0x00},/*"x",88*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x30,0x03,0x00,0x3C,0x01,0x00,0x3F,0x83,0x00,0x23,0xEC,0x00,0x00,0x70,0x00,0x23,0x80,0x00,0x3C,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"y",89*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x08,0x00,0x20,0x38,0x00,0x20,0xF8,0x00,0x23,0xE8,0x00,0x2F,0x88,0x00,0x3E,0x08,0x00,0x38,0x08,0x00,0x20,0x18,0x00,0x00,0x70,0x00,0x00,0x00},/*"z",90*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x14,0x00,0x1F,0xF7,0xFC,0x30,0x00,0x06,0x20,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00},/*"{",91*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x02,0x30,0x00,0x06,0x1F,0xF7,0xFC,0x00,0x14,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
|
||||||
|
{0x00,0x00,0x00,0x18,0x00,0x00,0x60,0x00,0x00,0x40,0x00,0x00,0x40,0x00,0x00,0x20,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x0C,0x00,0x00,0x10,0x00,0x00},/*"~",94*/
|
||||||
|
};
|
||||||
|
|
||||||
|
//32*32 ASCII字符集点阵
|
||||||
|
const unsigned char asc2_3216[95][128]={
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x00,0xC0,0x07,0xFF,0xE1,0xE0,0x07,0xF0,0x01,0xE0,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x01,0xC0,0x00,0x00,0x07,0x80,0x00,0x00,0x1F,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x1C,0x20,0x00,0x00,0x01,0xC0,0x00,0x00,0x07,0x80,0x00,0x00,0x1F,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0x00,0x00,0x18,0x0C,0x00,0x00,0x18,0x0F,0xE0,0x00,0x1F,0xFC,0x00,0x03,0xF8,0x0C,0x00,0x00,0x18,0x0C,0x00,0x00,0x18,0x0C,0x00,0x00,0x18,0x0C,0x00,0x00,0x18,0x0C,0x00,0x00,0x18,0x0F,0xE0,0x00,0x1F,0xFC,0x00,0x03,0xF8,0x0C,0x00,0x00,0x18,0x0C,0x00,0x00,0x18,0x0C,0x00,0x00,0x00,0x00,0x00},/*"#",3*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x78,0x07,0xC0,0x00,0xFC,0x06,0x40,0x01,0x0E,0x00,0x20,0x03,0x07,0x00,0x20,0x02,0x03,0x80,0x20,0x0F,0xFF,0xFF,0xFC,0x02,0x01,0xC0,0x20,0x02,0x00,0xE0,0x60,0x01,0x30,0x70,0x40,0x01,0xF0,0x3F,0x80,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"$",4*/
|
||||||
|
{0x00,0xFE,0x00,0x00,0x01,0xFF,0x00,0x00,0x03,0x01,0x80,0x00,0x02,0x00,0x80,0x60,0x03,0x01,0x81,0xC0,0x01,0xFF,0x07,0x00,0x00,0xFE,0x18,0x00,0x00,0x00,0xE0,0x00,0x00,0x03,0xBF,0x00,0x00,0x0C,0xFF,0xC0,0x00,0x71,0x80,0x60,0x01,0xC1,0x00,0x20,0x03,0x01,0x80,0x60,0x00,0x00,0xFF,0xC0,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00},/*"%",5*/
|
||||||
|
{0x00,0x00,0x1F,0x00,0x00,0x00,0x7F,0xC0,0x00,0xFC,0xC0,0xC0,0x01,0xFF,0x80,0x60,0x03,0x03,0xE0,0x20,0x02,0x02,0x78,0x20,0x02,0x06,0x1E,0x20,0x03,0xFC,0x07,0x40,0x01,0xF0,0x03,0x80,0x00,0x01,0x03,0xC0,0x00,0x01,0x1C,0x60,0x00,0x01,0xE0,0x20,0x00,0x01,0x00,0x20,0x00,0x01,0x00,0x40,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00},/*"&",6*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x1C,0x60,0x00,0x00,0x1C,0x40,0x00,0x00,0x1F,0x80,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,0x3F,0xFF,0x00,0x00,0x78,0x07,0xC0,0x01,0xC0,0x00,0xE0,0x03,0x00,0x00,0x30,0x04,0x00,0x00,0x08,0x08,0x00,0x00,0x04,0x10,0x00,0x00,0x02,0x00,0x00,0x00,0x00},/*"(",8*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x02,0x08,0x00,0x00,0x04,0x04,0x00,0x00,0x08,0x03,0x00,0x00,0x30,0x01,0xC0,0x00,0xE0,0x00,0x78,0x07,0xC0,0x00,0x3F,0xFF,0x00,0x00,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x00,0x00,0x0E,0x38,0x00,0x00,0x0E,0x38,0x00,0x00,0x06,0x30,0x00,0x00,0x03,0x60,0x00,0x00,0x61,0x43,0x80,0x00,0xFF,0xFF,0x80,0x00,0x61,0x43,0x00,0x00,0x03,0x60,0x00,0x00,0x06,0x30,0x00,0x00,0x0E,0x38,0x00,0x00,0x0E,0x38,0x00,0x00,0x0C,0x18,0x00,0x00,0x00,0x00,0x00},/*"*",10*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x7F,0xFF,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00},/*"+",11*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xE3,0x00,0x00,0x00,0xE2,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x00,0x03,0x80,0x00,0x00,0x0E,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x00,0x03,0x80,0x00,0x00,0x0E,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x00,0x03,0x80,0x00,0x00,0x0E,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"/",15*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x7F,0xFF,0x00,0x00,0xF0,0x07,0x80,0x01,0x80,0x00,0xC0,0x03,0x00,0x00,0x60,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0x00,0x00,0x60,0x01,0x80,0x00,0xC0,0x00,0xE0,0x03,0x80,0x00,0x7F,0xFF,0x00,0x00,0x0F,0xF8,0x00,0x00,0x00,0x00,0x00},/*"0",16*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x20,0x00,0x80,0x00,0x20,0x00,0x80,0x00,0x20,0x00,0x80,0x00,0x60,0x01,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"1",17*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0xE0,0x00,0x98,0x01,0x60,0x01,0x00,0x02,0x60,0x02,0x00,0x04,0x60,0x02,0x00,0x08,0x60,0x02,0x00,0x10,0x60,0x02,0x00,0x20,0x60,0x02,0x00,0x40,0x60,0x03,0x00,0x80,0x60,0x01,0x83,0x00,0x60,0x01,0xFE,0x00,0xE0,0x00,0x7C,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"2",18*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x07,0x80,0x01,0xF0,0x07,0xC0,0x01,0x00,0x00,0x40,0x02,0x00,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x03,0x03,0x80,0x20,0x01,0x86,0x80,0x40,0x01,0xFC,0xC0,0xC0,0x00,0x78,0x7F,0x80,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"3",19*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x48,0x00,0x00,0x01,0x88,0x00,0x00,0x06,0x08,0x00,0x00,0x0C,0x08,0x10,0x00,0x30,0x08,0x10,0x00,0x40,0x08,0x10,0x01,0xFF,0xFF,0xF0,0x03,0xFF,0xFF,0xF0,0x03,0xFF,0xFF,0xF0,0x00,0x00,0x08,0x10,0x00,0x00,0x08,0x10,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00},/*"4",20*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x1F,0x86,0x40,0x03,0xE1,0x00,0x20,0x03,0x02,0x00,0x20,0x03,0x04,0x00,0x20,0x03,0x04,0x00,0x20,0x03,0x04,0x00,0x20,0x03,0x04,0x00,0x20,0x03,0x06,0x00,0x40,0x03,0x03,0x01,0xC0,0x03,0x01,0xFF,0x80,0x03,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"5",21*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFC,0x00,0x00,0x3F,0xFF,0x00,0x00,0x70,0xC3,0x80,0x00,0x81,0x80,0xC0,0x01,0x01,0x00,0x60,0x03,0x02,0x00,0x20,0x02,0x02,0x00,0x20,0x02,0x02,0x00,0x20,0x02,0x02,0x00,0x20,0x02,0x03,0x00,0x40,0x01,0xC1,0x80,0xC0,0x00,0xC0,0xFF,0x80,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00},/*"6",22*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0x80,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x07,0xE0,0x03,0x00,0x3F,0xE0,0x03,0x01,0xC0,0x00,0x03,0x06,0x00,0x00,0x03,0x18,0x00,0x00,0x03,0x60,0x00,0x00,0x03,0x80,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"7",23*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x78,0x3F,0x80,0x00,0xFC,0x60,0xC0,0x01,0x8E,0xC0,0x40,0x03,0x07,0x80,0x20,0x02,0x03,0x00,0x20,0x02,0x01,0x80,0x20,0x02,0x01,0x80,0x20,0x02,0x01,0xC0,0x20,0x03,0x01,0xE0,0x40,0x01,0x86,0x70,0xC0,0x00,0xFC,0x3F,0x80,0x00,0x78,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"8",24*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0xFF,0x81,0xC0,0x01,0xC0,0xC1,0xC0,0x01,0x00,0x60,0x20,0x02,0x00,0x20,0x20,0x02,0x00,0x20,0x20,0x02,0x00,0x20,0x20,0x02,0x00,0x20,0x60,0x02,0x00,0x40,0xC0,0x01,0x00,0xC1,0x80,0x00,0xC1,0x8F,0x00,0x00,0x7F,0xFE,0x00,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"9",25*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x07,0x81,0xE0,0x00,0x07,0x81,0xE0,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x66,0x00,0x06,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x01,0xC0,0x00,0x00,0x03,0x60,0x00,0x00,0x06,0x30,0x00,0x00,0x0C,0x18,0x00,0x00,0x18,0x0C,0x00,0x00,0x30,0x06,0x00,0x00,0x60,0x03,0x00,0x00,0xC0,0x01,0x80,0x01,0x00,0x00,0x40,0x02,0x00,0x00,0x20,0x04,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"<",28*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x00,0x00,0x00},/*"=",29*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x10,0x02,0x00,0x00,0x20,0x01,0x00,0x00,0x40,0x00,0xC0,0x01,0x80,0x00,0x60,0x03,0x00,0x00,0x30,0x06,0x00,0x00,0x18,0x0C,0x00,0x00,0x0C,0x18,0x00,0x00,0x06,0x30,0x00,0x00,0x03,0x60,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*">",30*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x02,0x38,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0xC0,0x04,0x00,0x79,0xE0,0x04,0x00,0x81,0xE0,0x04,0x01,0x00,0xC0,0x04,0x03,0x00,0x00,0x02,0x02,0x00,0x00,0x03,0x06,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00},/*"?",31*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x3F,0xFE,0x00,0x00,0x70,0x07,0x80,0x00,0xC0,0x00,0xC0,0x01,0x01,0xF8,0x40,0x03,0x07,0xFC,0x20,0x02,0x1E,0x04,0x20,0x02,0x30,0x08,0x20,0x02,0x20,0x30,0x20,0x02,0x3F,0xFC,0x20,0x01,0x3F,0x04,0x40,0x01,0x80,0x0C,0xC0,0x00,0xE0,0x31,0x80,0x00,0x1F,0xC2,0x00,0x00,0x00,0x00,0x00},/*"@",32*/
|
||||||
|
{0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x60,0x00,0x00,0x03,0xE0,0x00,0x00,0x3E,0x20,0x00,0x03,0xE0,0x20,0x00,0x3E,0x20,0x00,0x03,0xE0,0x20,0x00,0x03,0x80,0x20,0x00,0x07,0xFC,0x20,0x00,0x00,0x3F,0xE0,0x00,0x00,0x03,0xFE,0x20,0x00,0x00,0x3F,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"A",33*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x03,0x03,0x00,0x20,0x01,0x86,0x80,0x60,0x01,0xFC,0xC0,0xC0,0x00,0xF8,0x7F,0x80,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00},/*"B",34*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,0x3F,0xFF,0x00,0x00,0x70,0x07,0x80,0x00,0xC0,0x00,0xC0,0x01,0x00,0x00,0x40,0x03,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x01,0x00,0x00,0x40,0x01,0x80,0x00,0xC0,0x03,0xC0,0x01,0x80,0x00,0x30,0x06,0x00,0x00,0x00,0x00,0x00},/*"C",35*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0x00,0x00,0x60,0x01,0x00,0x00,0x40,0x01,0x80,0x00,0xC0,0x00,0xF0,0x07,0x80,0x00,0x7F,0xFE,0x00,0x00,0x0F,0xF8,0x00,0x00,0x00,0x00,0x00},/*"D",36*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x03,0x80,0x20,0x02,0x0F,0xE0,0x20,0x03,0x00,0x00,0x60,0x03,0xC0,0x00,0xE0,0x00,0x60,0x03,0x00,0x00,0x00,0x00,0x00},/*"E",37*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x02,0x03,0x80,0x00,0x03,0x0F,0xE0,0x00,0x03,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x60,0x00,0x00},/*"F",38*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,0x3F,0xFE,0x00,0x00,0x70,0x07,0x80,0x01,0xC0,0x01,0xC0,0x01,0x00,0x00,0x40,0x03,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x01,0x00,0x20,0x20,0x01,0x00,0x20,0x40,0x03,0xC0,0x3F,0x80,0x00,0x30,0x3F,0x80,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00},/*"G",39*/
|
||||||
|
{0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x80,0x20,0x02,0x00,0x80,0x20,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x02,0x00,0x80,0x20,0x02,0x00,0x80,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"H",40*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"I",41*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x01,0x02,0x00,0x00,0x01,0x02,0x00,0x00,0x03,0x02,0x00,0x00,0x06,0x03,0xFF,0xFF,0xFC,0x03,0xFF,0xFF,0xF8,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"J",42*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0xC0,0x20,0x02,0x01,0x00,0x20,0x00,0x07,0x80,0x00,0x00,0x0F,0xE0,0x00,0x00,0x30,0xF8,0x00,0x02,0x60,0x3E,0x20,0x03,0x80,0x0F,0x20,0x03,0x00,0x03,0xE0,0x02,0x00,0x00,0xE0,0x02,0x00,0x00,0x20,0x00,0x00,0x00,0x20},/*"K",43*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0xE0,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00},/*"L",44*/
|
||||||
|
{0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xE0,0x00,0x20,0x03,0xFF,0x00,0x20,0x00,0x1F,0xF0,0x00,0x00,0x01,0xFF,0x80,0x00,0x00,0x0F,0xE0,0x00,0x00,0x1E,0x00,0x00,0x03,0xE0,0x00,0x00,0x3E,0x00,0x20,0x03,0xE0,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20},/*"M",45*/
|
||||||
|
{0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0x80,0x00,0x20,0x03,0xF0,0x00,0x20,0x00,0xFC,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x07,0xC0,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0x7C,0x00,0x02,0x00,0x1F,0x80,0x02,0x00,0x07,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"N",46*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x3F,0xFE,0x00,0x00,0xF0,0x07,0x80,0x01,0x80,0x00,0xC0,0x01,0x00,0x00,0x40,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x01,0x00,0x00,0x40,0x01,0x80,0x00,0xC0,0x00,0xF0,0x03,0x80,0x00,0x3F,0xFE,0x00,0x00,0x0F,0xF8,0x00,0x00,0x00,0x00,0x00},/*"O",47*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x80,0x20,0x02,0x00,0x80,0x20,0x02,0x00,0x80,0x00,0x02,0x00,0x80,0x00,0x02,0x00,0x80,0x00,0x02,0x00,0x80,0x00,0x03,0x01,0x80,0x00,0x01,0x83,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00},/*"P",48*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x7F,0xFF,0x00,0x00,0xF0,0x03,0x80,0x01,0x80,0x01,0xC0,0x01,0x00,0x06,0x40,0x02,0x00,0x04,0x20,0x02,0x00,0x04,0x20,0x02,0x00,0x06,0x20,0x02,0x00,0x03,0xE0,0x01,0x00,0x00,0xF8,0x01,0x80,0x00,0x5C,0x00,0xE0,0x03,0x8C,0x00,0x3F,0xFF,0x0C,0x00,0x0F,0xFC,0x18,0x00,0x00,0x00,0x00},/*"Q",49*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x01,0x00,0x20,0x02,0x01,0x00,0x20,0x02,0x01,0x80,0x00,0x02,0x01,0xE0,0x00,0x02,0x01,0xFC,0x00,0x03,0x03,0x3F,0x80,0x01,0x86,0x07,0xE0,0x01,0xFC,0x00,0xE0,0x00,0xF8,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"R",50*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x06,0x00,0x00,0xFE,0x01,0xE0,0x01,0x86,0x00,0xC0,0x03,0x03,0x00,0x40,0x02,0x03,0x00,0x20,0x02,0x01,0x80,0x20,0x02,0x01,0x80,0x20,0x02,0x01,0xC0,0x20,0x02,0x00,0xC0,0x20,0x01,0x00,0xE0,0x60,0x01,0x80,0x70,0xC0,0x03,0xE0,0x3F,0x80,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00},/*"S",51*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x03,0x80,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*"T",52*/
|
||||||
|
{0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0xC0,0x02,0x00,0x00,0x40,0x02,0x00,0x00,0x60,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x02,0x00,0x00,0x40,0x02,0x00,0x00,0x80,0x03,0xFF,0xFF,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"U",53*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xFC,0x00,0x00,0x02,0x3F,0xC0,0x00,0x00,0x03,0xF8,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x07,0xE0,0x00,0x00,0x07,0x80,0x00,0x00,0x78,0x00,0x02,0x03,0xC0,0x00,0x02,0x3C,0x00,0x00,0x03,0xC0,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00},/*"V",54*/
|
||||||
|
{0x02,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xFF,0x80,0x00,0x02,0x3F,0xFE,0x00,0x02,0x00,0x7F,0xE0,0x00,0x00,0x0F,0x00,0x02,0x00,0xF0,0x00,0x03,0xEF,0x00,0x00,0x03,0xFF,0x80,0x00,0x02,0x0F,0xFE,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x1F,0x00,0x02,0x07,0xE0,0x00,0x03,0xF8,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00},/*"W",55*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0x80,0x00,0xE0,0x03,0xF0,0x03,0x20,0x02,0xFC,0x0C,0x20,0x02,0x1F,0x30,0x00,0x00,0x07,0xC0,0x00,0x00,0x07,0xF0,0x00,0x02,0x18,0x7C,0x00,0x02,0x60,0x1F,0x20,0x03,0x80,0x03,0xE0,0x02,0x00,0x00,0xE0,0x02,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"X",56*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xF8,0x00,0x00,0x02,0x3E,0x00,0x20,0x02,0x0F,0xC0,0x20,0x00,0x01,0xFF,0xE0,0x00,0x00,0x7F,0xE0,0x00,0x03,0x80,0x20,0x02,0x1C,0x00,0x20,0x02,0x70,0x00,0x00,0x03,0x80,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"Y",57*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x60,0x00,0xE0,0x03,0x80,0x03,0xE0,0x03,0x00,0x0F,0xA0,0x02,0x00,0x3E,0x20,0x02,0x00,0xF8,0x20,0x02,0x03,0xE0,0x20,0x02,0x0F,0x80,0x20,0x02,0x3E,0x00,0x20,0x02,0x78,0x00,0x20,0x03,0xE0,0x00,0x60,0x03,0x80,0x00,0xE0,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"Z",58*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFC,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"[",59*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"\",60*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x10,0x00,0x00,0x04,0x1F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
|
||||||
|
{0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01},/*"_",63*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x01,0x8F,0xC0,0x00,0x03,0x8C,0x60,0x00,0x06,0x18,0x20,0x00,0x04,0x10,0x20,0x00,0x04,0x10,0x20,0x00,0x04,0x20,0x20,0x00,0x04,0x20,0x40,0x00,0x06,0x20,0x40,0x00,0x03,0xFF,0xC0,0x00,0x01,0xFF,0xE0,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00},/*"a",65*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x00,0x01,0x80,0xC0,0x00,0x02,0x00,0x60,0x00,0x02,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x06,0x00,0x40,0x00,0x03,0x00,0xC0,0x00,0x01,0xFF,0x80,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00},/*"b",66*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x01,0xFF,0x80,0x00,0x03,0x81,0xC0,0x00,0x02,0x00,0x40,0x00,0x06,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x06,0x00,0x20,0x00,0x03,0xC0,0x40,0x00,0x01,0xC0,0x80,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"c",67*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x01,0xFF,0x80,0x00,0x03,0x80,0xC0,0x00,0x06,0x00,0x60,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x02,0x04,0x00,0x40,0x02,0x02,0x00,0x80,0x03,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00},/*"d",68*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x01,0xFF,0x80,0x00,0x03,0x11,0xC0,0x00,0x02,0x10,0x40,0x00,0x04,0x10,0x60,0x00,0x04,0x10,0x20,0x00,0x04,0x10,0x20,0x00,0x04,0x10,0x20,0x00,0x06,0x10,0x20,0x00,0x03,0x10,0x40,0x00,0x01,0xF0,0xC0,0x00,0x00,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"e",69*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x7F,0xFF,0xE0,0x01,0xFF,0xFF,0xE0,0x01,0x04,0x00,0x20,0x03,0x04,0x00,0x20,0x02,0x04,0x00,0x20,0x02,0x04,0x00,0x20,0x02,0x04,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x01,0xC0,0x00,0x00},/*"f",70*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0xE3,0x3E,0x00,0x03,0xFF,0xC2,0x00,0x02,0x0C,0xC3,0x00,0x04,0x04,0xC1,0x00,0x04,0x04,0xC1,0x00,0x04,0x04,0xC1,0x00,0x04,0x04,0xC1,0x00,0x06,0x0C,0xC1,0x00,0x03,0xF8,0xC3,0x00,0x05,0xF0,0x62,0x00,0x06,0x00,0x7E,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00},/*"g",71*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xE0,0x00,0x01,0x00,0x20,0x00,0x02,0x00,0x20,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x06,0x00,0x20,0x00,0x03,0xFF,0xE0,0x00,0x01,0xFF,0xE0,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20},/*"h",72*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x03,0x87,0xFF,0xE0,0x03,0x8F,0xFF,0xE0,0x03,0x80,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"i",73*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x01,0x00,0x04,0x00,0x01,0x00,0x04,0x00,0x03,0x00,0x04,0x00,0x06,0x03,0x87,0xFF,0xFC,0x03,0x8F,0xFF,0xF8,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"j",74*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xE0,0x00,0x00,0x08,0x20,0x00,0x00,0x10,0x20,0x00,0x00,0x30,0x00,0x00,0x00,0xFC,0x00,0x00,0x05,0x8E,0x00,0x00,0x07,0x07,0xA0,0x00,0x06,0x01,0xE0,0x00,0x04,0x00,0xE0,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"k",75*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,0x03,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"l",76*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x07,0xFF,0xE0,0x00,0x0F,0xFF,0xE0,0x00,0x02,0x00,0x20,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x07,0xFF,0xE0,0x00,0x03,0xFF,0xE0,0x00,0x02,0x00,0x20,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x07,0xFF,0xE0,0x00,0x03,0xFF,0xE0,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"m",77*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x07,0xFF,0xE0,0x00,0x0F,0xFF,0xE0,0x00,0x01,0x00,0x20,0x00,0x02,0x00,0x20,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x06,0x00,0x20,0x00,0x03,0xFF,0xE0,0x00,0x01,0xFF,0xE0,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20},/*"n",78*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0xFF,0x80,0x00,0x03,0x81,0xC0,0x00,0x02,0x00,0x40,0x00,0x06,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x06,0x00,0x20,0x00,0x02,0x00,0x40,0x00,0x03,0x81,0xC0,0x00,0x01,0xFF,0x80,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00},/*"o",79*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x01,0x00,0x04,0x00,0x01,0x00,0x07,0xFF,0xFF,0x00,0x0F,0xFF,0xFF,0x00,0x01,0x00,0xC1,0x00,0x02,0x00,0x41,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x06,0x00,0x40,0x00,0x03,0x01,0xC0,0x00,0x01,0xFF,0x80,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00},/*"p",80*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x01,0xFF,0x80,0x00,0x03,0x80,0xC0,0x00,0x02,0x00,0x60,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x02,0x00,0x41,0x00,0x03,0x00,0xC1,0x00,0x03,0xFF,0xFF,0x00,0x07,0xFF,0xFF,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01},/*"q",81*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x0F,0xFF,0xE0,0x00,0x0F,0xFF,0xE0,0x00,0x00,0xC0,0x20,0x00,0x01,0x00,0x20,0x00,0x02,0x00,0x20,0x00,0x06,0x00,0x20,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00},/*"r",82*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xE0,0x00,0x01,0xC0,0xE0,0x00,0x03,0xE0,0x40,0x00,0x06,0x30,0x20,0x00,0x04,0x30,0x20,0x00,0x04,0x18,0x20,0x00,0x04,0x18,0x20,0x00,0x04,0x18,0x20,0x00,0x04,0x0C,0x20,0x00,0x02,0x0C,0x60,0x00,0x03,0x07,0xC0,0x00,0x07,0x83,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"s",83*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x1F,0xFF,0x80,0x00,0xFF,0xFF,0xC0,0x00,0x04,0x00,0x60,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x40,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"t",84*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0xFF,0x80,0x00,0x0F,0xFF,0xC0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x40,0x00,0x04,0x00,0x80,0x00,0x07,0xFF,0xE0,0x00,0x0F,0xFF,0xC0,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40},/*"u",85*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0xF0,0x00,0x00,0x04,0xFE,0x00,0x00,0x04,0x1F,0xC0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x00,0x04,0x60,0x00,0x00,0x07,0x80,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"v",86*/
|
||||||
|
{0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0xC0,0x00,0x00,0x07,0xFC,0x00,0x00,0x04,0x3F,0x80,0x00,0x00,0x03,0xE0,0x00,0x04,0x0F,0x80,0x00,0x06,0xF0,0x00,0x00,0x07,0xF0,0x00,0x00,0x07,0xFF,0x80,0x00,0x04,0x0F,0xE0,0x00,0x00,0x03,0x80,0x00,0x04,0x3C,0x00,0x00,0x07,0xC0,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00},/*"w",87*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x20,0x00,0x04,0x00,0x60,0x00,0x07,0x00,0xE0,0x00,0x07,0x83,0x20,0x00,0x07,0xE6,0x00,0x00,0x04,0xF8,0x00,0x00,0x00,0x3C,0x00,0x00,0x04,0x5E,0x20,0x00,0x05,0x87,0xA0,0x00,0x06,0x01,0xE0,0x00,0x04,0x00,0x60,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"x",88*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x03,0x00,0x07,0x00,0x03,0x00,0x07,0xE0,0x01,0x00,0x04,0xF8,0x01,0x00,0x04,0x1F,0x02,0x00,0x00,0x07,0xFC,0x00,0x00,0x00,0xE0,0x00,0x00,0x07,0x00,0x00,0x04,0x38,0x00,0x00,0x07,0xC0,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00},/*"y",89*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x60,0x00,0x06,0x00,0xE0,0x00,0x04,0x03,0xE0,0x00,0x04,0x07,0xA0,0x00,0x04,0x0E,0x20,0x00,0x04,0x3C,0x20,0x00,0x04,0x70,0x20,0x00,0x05,0xE0,0x20,0x00,0x07,0x80,0x20,0x00,0x07,0x00,0x60,0x00,0x04,0x00,0xE0,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"z",90*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x01,0x40,0x00,0x07,0xFE,0x3F,0xF8,0x08,0x00,0x00,0x04,0x10,0x00,0x00,0x02,0x10,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"{",91*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x02,0x10,0x00,0x00,0x02,0x08,0x00,0x00,0x04,0x07,0xFE,0x3F,0xF8,0x00,0x01,0x40,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
|
||||||
|
{0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
|
||||||
|
};
|
||||||
|
#endif
|
||||||
163
FW/Core/my_src/font_text.c
Normal file
163
FW/Core/my_src/font_text.c
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
#include "w25qxx.h"
|
||||||
|
#include "ltdc_drv.h"
|
||||||
|
#include "font_text.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "lcd_base_display.h"
|
||||||
|
#include "file_cache.h"
|
||||||
|
#include "internal_flash.h"
|
||||||
|
|
||||||
|
#define F24addr FLASH_FONT_START_ADDR
|
||||||
|
|
||||||
|
void set_font_color(unsigned int point_color, unsigned int back_color)
|
||||||
|
{
|
||||||
|
POINT_COLOR = point_color;
|
||||||
|
BACK_COLOR = back_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
//code 字符指针开始
|
||||||
|
//从字库中查找出字模
|
||||||
|
//code 字符串的开始地址,GBK码
|
||||||
|
//mat 数据存放地址 (size/8+((size%8)?1:0))*(size) bytes大小
|
||||||
|
//size:字体大小
|
||||||
|
void Get_HzMat(unsigned char *code,unsigned char *mat,unsigned char size)
|
||||||
|
{
|
||||||
|
static unsigned char kkk[256];
|
||||||
|
unsigned char qh,ql;
|
||||||
|
unsigned char i;
|
||||||
|
unsigned long foffset;
|
||||||
|
unsigned char csize=(size/8+((size%8)?1:0))*(size);//得到字体一个字符对应点阵集所占的字节数
|
||||||
|
qh=*code;
|
||||||
|
ql=*(++code);
|
||||||
|
/*
|
||||||
|
if(qh<0x81||ql<0x40||ql==0xff||qh==0xff)//非常用汉字
|
||||||
|
{
|
||||||
|
for(i=0;i<csize;i++)*mat++=0x00;//填充满格
|
||||||
|
return; //结束访问
|
||||||
|
}
|
||||||
|
if(ql<0x7f)ql-=0x40;//注意!
|
||||||
|
else ql-=0x41;
|
||||||
|
qh-=0x81;
|
||||||
|
foffset=((unsigned long)190*qh+ql)*csize;//得到字库中的字节偏移量
|
||||||
|
*/
|
||||||
|
foffset = 72UL*((qh-15-0xa1)*94 + (ql-0xa1));
|
||||||
|
|
||||||
|
if(24 == size){
|
||||||
|
//W25QXX_Read(mat,foffset+0,csize);
|
||||||
|
//memcpy(mat, (unsigned char *)(FLASH_USER_FONT_24X24 + foffset), csize);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case 12:
|
||||||
|
W25QXX_Read(mat,foffset+ftinfo.f12addr,csize);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
W25QXX_Read(mat,foffset+ftinfo.f16addr,csize);
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
W25QXX_Read(mat,foffset+ftinfo.f24addr,csize);
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
W25QXX_Read(mat,foffset+ftinfo.f32addr,csize);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
//显示一个指定大小的汉字
|
||||||
|
//x,y :汉字的坐标
|
||||||
|
//font:汉字GBK码
|
||||||
|
//size:字体大小
|
||||||
|
//mode:0,正常显示,1,叠加显示
|
||||||
|
void Show_Font(unsigned short x,unsigned short y,unsigned char *font,unsigned char size,unsigned char mode)
|
||||||
|
{
|
||||||
|
unsigned char temp,t,t1;
|
||||||
|
unsigned short y0=y;
|
||||||
|
unsigned char dzk[128];
|
||||||
|
unsigned char csize=(size/8+((size%8)?1:0))*(size); //得到字体一个字符对应点阵集所占的字节数
|
||||||
|
if(size!=12&&size!=16&&size!=24&&size!=32)return; //不支持的size
|
||||||
|
Get_HzMat(font,dzk,size); //得到相应大小的点阵数据
|
||||||
|
for(t=0;t<csize;t++)
|
||||||
|
{
|
||||||
|
temp=dzk[t]; //得到点阵数据
|
||||||
|
for(t1=0;t1<8;t1++)
|
||||||
|
{
|
||||||
|
if(temp&0x80)LTDC_Draw_Point(x,y,POINT_COLOR);
|
||||||
|
else if(mode==0)LTDC_Draw_Point(x,y,BACK_COLOR);
|
||||||
|
temp<<=1;
|
||||||
|
y++;
|
||||||
|
if((y-y0)==size)
|
||||||
|
{
|
||||||
|
y=y0;
|
||||||
|
x++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//在指定位置开始显示一个字符串
|
||||||
|
//支持自动换行
|
||||||
|
//(x,y):起始坐标
|
||||||
|
//width,height:区域
|
||||||
|
//str :字符串
|
||||||
|
//size :字体大小
|
||||||
|
//mode:0,非叠加方式;1,叠加方式
|
||||||
|
void Show_Str(unsigned short x,unsigned short y,unsigned short width,unsigned short height,unsigned char*str,unsigned char size,unsigned char mode)
|
||||||
|
{
|
||||||
|
unsigned short x0=x;
|
||||||
|
unsigned short y0=y;
|
||||||
|
unsigned char bHz=0; //字符或者中文
|
||||||
|
while(*str!=0)//数据未结束
|
||||||
|
{
|
||||||
|
if(!bHz)
|
||||||
|
{
|
||||||
|
if(*str>0x80)bHz=1;//中文
|
||||||
|
else //字符
|
||||||
|
{
|
||||||
|
if(x>(x0+width-size/2))//换行
|
||||||
|
{
|
||||||
|
y+=size;
|
||||||
|
x=x0;
|
||||||
|
}
|
||||||
|
if(y>(y0+height-size))break;//越界返回
|
||||||
|
if(*str==13)//换行符号
|
||||||
|
{
|
||||||
|
y+=size;
|
||||||
|
x=x0;
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
else LCD_ShowChar(x,y,*str,size,mode);//有效部分写入
|
||||||
|
str++;
|
||||||
|
x+=size/2; //字符,为全字的一半
|
||||||
|
}
|
||||||
|
}else//中文
|
||||||
|
{
|
||||||
|
bHz=0;//有汉字库
|
||||||
|
if(x>(x0+width-size))//换行
|
||||||
|
{
|
||||||
|
y+=size;
|
||||||
|
x=x0;
|
||||||
|
}
|
||||||
|
if(y>(y0+height-size))break;//越界返回
|
||||||
|
Show_Font(x,y,str,size,mode); //显示这个汉字,空心显示
|
||||||
|
str+=2;
|
||||||
|
x+=size;//下一个汉字偏移
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//在指定宽度的中间显示字符串
|
||||||
|
//如果字符长度超过了len,则用Show_Str显示
|
||||||
|
//len:指定要显示的宽度
|
||||||
|
void Show_Str_Mid(unsigned short x,unsigned short y,unsigned char*str,unsigned char size,unsigned char len)
|
||||||
|
{
|
||||||
|
unsigned short strlenth=0;
|
||||||
|
strlenth=strlen((const char*)str);
|
||||||
|
strlenth*=size/2;
|
||||||
|
/*
|
||||||
|
if(strlenth>len)Show_Str(x,y,lcddev.width,lcddev.height,str,size,1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strlenth=(len-strlenth)/2;
|
||||||
|
Show_Str(strlenth+x,y,lcddev.width,lcddev.height,str,size,1);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
20
FW/Core/my_src/font_text.h
Normal file
20
FW/Core/my_src/font_text.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef __TEXT_H__
|
||||||
|
#define __TEXT_H__
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||||
|
//ALIENTEK STM32开发板
|
||||||
|
//汉字显示 驱动代码
|
||||||
|
//正点原子@ALIENTEK
|
||||||
|
//技术论坛:www.openedv.com
|
||||||
|
//创建日期:2016/1/7
|
||||||
|
//版本:V1.0
|
||||||
|
//版权所有,盗版必究。
|
||||||
|
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||||
|
//All rights reserved
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void Get_HzMat(unsigned char *code,unsigned char *mat,unsigned char size); //得到汉字的点阵码
|
||||||
|
void Show_Font(unsigned short x,unsigned short y,unsigned char *font,unsigned char size,unsigned char mode); //在指定位置显示一个汉字
|
||||||
|
void Show_Str(unsigned short x,unsigned short y,unsigned short width,unsigned short height,unsigned char*str,unsigned char size,unsigned char mode); //在指定位置显示一个字符串
|
||||||
|
void Show_Str_Mid(unsigned short x,unsigned short y,unsigned char*str,unsigned char size,unsigned char len);
|
||||||
|
#endif
|
||||||
232
FW/Core/my_src/internal_flash.c
Normal file
232
FW/Core/my_src/internal_flash.c
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "internal_flash.h"
|
||||||
|
|
||||||
|
T_Factory_Prm factory_prm;
|
||||||
|
|
||||||
|
static FLASH_EraseInitTypeDef EraseInitStruct;
|
||||||
|
|
||||||
|
unsigned int FirstSector = 0, BankNum = FLASH_BANK_1, NbOfSectors = 0;
|
||||||
|
unsigned int Address = 0, SECTORError = 0, Index = 0;
|
||||||
|
__IO unsigned int MemoryProgramStatus = 0;
|
||||||
|
__IO uint64_t data64 = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the sector of a given address
|
||||||
|
* @param Address Address of the FLASH Memory
|
||||||
|
* @retval The sector of a given address
|
||||||
|
*/
|
||||||
|
unsigned int GetSector(unsigned int Address)
|
||||||
|
{
|
||||||
|
unsigned int sector = 0;
|
||||||
|
|
||||||
|
if(((Address < ADDR_FLASH_SECTOR_1_BANK1) && (Address >= ADDR_FLASH_SECTOR_0_BANK1)) || \
|
||||||
|
((Address < ADDR_FLASH_SECTOR_1_BANK2) && (Address >= ADDR_FLASH_SECTOR_0_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_0;
|
||||||
|
}
|
||||||
|
else if(((Address < ADDR_FLASH_SECTOR_2_BANK1) && (Address >= ADDR_FLASH_SECTOR_1_BANK1)) || \
|
||||||
|
((Address < ADDR_FLASH_SECTOR_2_BANK2) && (Address >= ADDR_FLASH_SECTOR_1_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_1;
|
||||||
|
}
|
||||||
|
else if(((Address < ADDR_FLASH_SECTOR_3_BANK1) && (Address >= ADDR_FLASH_SECTOR_2_BANK1)) || \
|
||||||
|
((Address < ADDR_FLASH_SECTOR_3_BANK2) && (Address >= ADDR_FLASH_SECTOR_2_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_2;
|
||||||
|
}
|
||||||
|
else if(((Address < ADDR_FLASH_SECTOR_4_BANK1) && (Address >= ADDR_FLASH_SECTOR_3_BANK1)) || \
|
||||||
|
((Address < ADDR_FLASH_SECTOR_4_BANK2) && (Address >= ADDR_FLASH_SECTOR_3_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_3;
|
||||||
|
}
|
||||||
|
else if(((Address < ADDR_FLASH_SECTOR_5_BANK1) && (Address >= ADDR_FLASH_SECTOR_4_BANK1)) || \
|
||||||
|
((Address < ADDR_FLASH_SECTOR_5_BANK2) && (Address >= ADDR_FLASH_SECTOR_4_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_4;
|
||||||
|
}
|
||||||
|
else if(((Address < ADDR_FLASH_SECTOR_6_BANK1) && (Address >= ADDR_FLASH_SECTOR_5_BANK1)) || \
|
||||||
|
((Address < ADDR_FLASH_SECTOR_6_BANK2) && (Address >= ADDR_FLASH_SECTOR_5_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_5;
|
||||||
|
}
|
||||||
|
else if(((Address < ADDR_FLASH_SECTOR_7_BANK1) && (Address >= ADDR_FLASH_SECTOR_6_BANK1)) || \
|
||||||
|
((Address < ADDR_FLASH_SECTOR_7_BANK2) && (Address >= ADDR_FLASH_SECTOR_6_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_6;
|
||||||
|
}
|
||||||
|
else if(((Address < ADDR_FLASH_SECTOR_0_BANK2) && (Address >= ADDR_FLASH_SECTOR_7_BANK1)) || \
|
||||||
|
((Address < FLASH_END_ADDR) && (Address >= ADDR_FLASH_SECTOR_7_BANK2)))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_7;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_7;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sector;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int GetBank(unsigned int Address)
|
||||||
|
{
|
||||||
|
unsigned int bank = 0;
|
||||||
|
|
||||||
|
if(IS_FLASH_PROGRAM_ADDRESS_BANK1(Address))
|
||||||
|
{
|
||||||
|
bank = FLASH_BANK_1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bank = FLASH_BANK_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void erase_internal_one_sector(unsigned int Address)
|
||||||
|
{
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
|
||||||
|
/* -3- Erase the user Flash area
|
||||||
|
(area defined by FLASH_USER_START_ADDR and FLASH_USER_END_ADDR) ***********/
|
||||||
|
|
||||||
|
/* Get the 1st sector to erase */
|
||||||
|
FirstSector = GetSector(Address);
|
||||||
|
/* Get the number of sector to erase from 1st sector*/
|
||||||
|
NbOfSectors = 1;
|
||||||
|
|
||||||
|
BankNum = GetBank(Address);
|
||||||
|
|
||||||
|
/* Fill EraseInit structure*/
|
||||||
|
EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS;
|
||||||
|
EraseInitStruct.VoltageRange = FLASH_VOLTAGE_RANGE_3;
|
||||||
|
EraseInitStruct.Banks = BankNum;
|
||||||
|
EraseInitStruct.Sector = FirstSector;
|
||||||
|
EraseInitStruct.NbSectors = NbOfSectors;
|
||||||
|
|
||||||
|
if (HAL_FLASHEx_Erase(&EraseInitStruct, &SECTORError) != HAL_OK)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Error occurred while sector erase.
|
||||||
|
User can add here some code to deal with this error.
|
||||||
|
SECTORError will contain the faulty sector and then to know the code error on this sector,
|
||||||
|
user can call function 'HAL_FLASH_GetError()'
|
||||||
|
*/
|
||||||
|
/* Infinite loop */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_internal_flash(unsigned int Address, unsigned int val_addr)//Address 32uint, write 32byte
|
||||||
|
{
|
||||||
|
uint64_t val_check;
|
||||||
|
|
||||||
|
//HAL_FLASH_Unlock();
|
||||||
|
|
||||||
|
if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, Address, (uint64_t)val_addr) == HAL_OK)
|
||||||
|
{
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Error occurred while writing data in Flash memory.
|
||||||
|
User can add here some code to deal with this error */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void read_internal_flash(unsigned int start_address, unsigned int * val_addr, unsigned int num)//num 8byte multiple
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int * p_val_addr;
|
||||||
|
p_val_addr = val_addr;
|
||||||
|
|
||||||
|
for(i=0;i<num;i++)
|
||||||
|
{
|
||||||
|
*(uint64_t*)p_val_addr = *(uint64_t*)start_address;
|
||||||
|
__DSB();
|
||||||
|
p_val_addr +=8;
|
||||||
|
start_address +=8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_factory_prm(void)
|
||||||
|
{
|
||||||
|
unsigned int load_falsh_addr;
|
||||||
|
load_falsh_addr = FLASH_USER_FACTORY_PRM;
|
||||||
|
|
||||||
|
erase_internal_one_sector(load_falsh_addr);
|
||||||
|
|
||||||
|
factory_prm.open_password_isenable = 1;
|
||||||
|
factory_prm.auth_function_isenable = 0;
|
||||||
|
|
||||||
|
write_factory_prm();
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_factory_prm(void)
|
||||||
|
{
|
||||||
|
unsigned int load_falsh_addr;
|
||||||
|
load_falsh_addr = FLASH_USER_FACTORY_PRM;
|
||||||
|
|
||||||
|
erase_internal_one_sector(load_falsh_addr);
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
write_internal_flash(load_falsh_addr, &factory_prm);
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void read_factory_prm(void)
|
||||||
|
{
|
||||||
|
unsigned int falsh_addr;
|
||||||
|
unsigned int pid_temp;
|
||||||
|
|
||||||
|
falsh_addr = FLASH_USER_FACTORY_PRM;
|
||||||
|
|
||||||
|
factory_prm.open_password_isenable = *(__IO uint32_t *)falsh_addr;
|
||||||
|
factory_prm.rsv1 = *(__IO uint32_t *)(falsh_addr+4);
|
||||||
|
factory_prm.auth_function_isenable = *(__IO uint32_t *)(falsh_addr+8);
|
||||||
|
|
||||||
|
if(((0 == (*(__IO uint32_t *)(falsh_addr + 12)))&&(0 == (*(__IO uint32_t *)(falsh_addr + 16)))) ||\
|
||||||
|
((0xFFFFFFFF == (*(__IO uint32_t *)(falsh_addr + 12)))&&(0xFFFFFFFF == (*(__IO uint32_t *)(falsh_addr + 16))))){
|
||||||
|
factory_prm.pid[0] = 1;
|
||||||
|
factory_prm.pid[1] = 2;
|
||||||
|
factory_prm.pid[2] = 3;
|
||||||
|
factory_prm.pid[3] = 4;
|
||||||
|
factory_prm.pid[4] = 5;
|
||||||
|
factory_prm.pid[5] = 6;
|
||||||
|
factory_prm.pid[6] = 7;
|
||||||
|
factory_prm.pid[7] = 8;
|
||||||
|
}else{
|
||||||
|
pid_temp = *(__IO uint32_t *)(falsh_addr + 12);
|
||||||
|
factory_prm.pid[0] = pid_temp & 0xFF;
|
||||||
|
factory_prm.pid[1] = (pid_temp>>8) & 0xFF;
|
||||||
|
factory_prm.pid[2] = (pid_temp>>16) & 0xFF;
|
||||||
|
factory_prm.pid[3] = (pid_temp>>24) & 0xFF;
|
||||||
|
|
||||||
|
pid_temp = *(__IO uint32_t *)(falsh_addr + 16);
|
||||||
|
factory_prm.pid[4] = pid_temp & 0xFF;
|
||||||
|
factory_prm.pid[5] = (pid_temp>>8) & 0xFF;
|
||||||
|
factory_prm.pid[6] = (pid_temp>>16) & 0xFF;
|
||||||
|
factory_prm.pid[7] = (pid_temp>>24) & 0xFF;
|
||||||
|
|
||||||
|
pid_temp = *(__IO uint32_t *)(falsh_addr + 20);
|
||||||
|
factory_prm.pid[8] = pid_temp & 0xFF;
|
||||||
|
factory_prm.pid[9] = (pid_temp>>8) & 0xFF;
|
||||||
|
factory_prm.pid[10] = (pid_temp>>16) & 0xFF;
|
||||||
|
factory_prm.pid[11] = (pid_temp>>24) & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory_prm.ctl_type = (*(__IO uint32_t *)(falsh_addr + 24))&0xFF;
|
||||||
|
if((0 == factory_prm.ctl_type)||(0xFF == factory_prm.ctl_type))factory_prm.ctl_type = 1;
|
||||||
|
|
||||||
|
if(factory_prm.open_password_isenable > 1)factory_prm.open_password_isenable = 1;
|
||||||
|
if(factory_prm.auth_function_isenable > 1)factory_prm.auth_function_isenable = 0;
|
||||||
|
factory_prm.open_password_isenable = 0;
|
||||||
|
}
|
||||||
52
FW/Core/my_src/internal_flash.h
Normal file
52
FW/Core/my_src/internal_flash.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#ifndef INTERNAL_FALSH_H
|
||||||
|
#define INTERNAL_FALSH_H
|
||||||
|
|
||||||
|
#define FLASH_USER_FONT_24X24 ADDR_FLASH_SECTOR_2_BANK2 //
|
||||||
|
#define FLASH_USER_FONT_24X24_SECTOR_NUM 4
|
||||||
|
|
||||||
|
#define FLASH_USER_FACTORY_PRM ADDR_FLASH_SECTOR_6_BANK2 //
|
||||||
|
#define FLASH_USER_FACTORY_PRM_SECTOR_NUM 1
|
||||||
|
|
||||||
|
#define FLASH_USER_PIC ADDR_FLASH_SECTOR_7_BANK2
|
||||||
|
|
||||||
|
#define FLASH_USER_PIC_16X16 FLASH_USER_PIC //one sector 128 pic, use half
|
||||||
|
#define FLASH_USER_PIC_16X16_UINT 1024//16*16*4 byte
|
||||||
|
#define FLASH_USER_PIC_16X16_COUNT_MAX 32
|
||||||
|
//#define FLASH_USER_PIC_16X16_SECTOR_NUM 1
|
||||||
|
|
||||||
|
#define FLASH_USER_PIC_24X24 FLASH_USER_PIC_16X16 + (FLASH_USER_PIC_16X16_UINT * FLASH_USER_PIC_16X16_COUNT_MAX) //one sector 56 pic
|
||||||
|
#define FLASH_USER_PIC_24X24_UINT 2304//24*24*4 byte
|
||||||
|
#define FLASH_USER_PIC_24X24_COUNT_MAX 24
|
||||||
|
//#define FLASH_USER_PIC_24X24_SECTOR_NUM 2
|
||||||
|
|
||||||
|
#define FLASH_USER_PIC_32X32 FLASH_USER_PIC_24X24 + (FLASH_USER_PIC_24X24_UINT * FLASH_USER_PIC_24X24_COUNT_MAX) //one sector 32 pic
|
||||||
|
#define FLASH_USER_PIC_32X32_UINT 4096//32*32*4 byte
|
||||||
|
#define FLASH_USER_PIC_32X32_COUNT_MAX 4
|
||||||
|
//#define FLASH_USER_PIC_32X32_SECTOR_NUM 1
|
||||||
|
|
||||||
|
#define FLASH_USER_PIC_LOGO FLASH_USER_PIC_32X32 + (FLASH_USER_PIC_32X32_UINT * FLASH_USER_PIC_32X32_COUNT_MAX)
|
||||||
|
#define FLASH_USER_PIC_LOGO24_UINT 8640//24*90*4 byte
|
||||||
|
#define FLASH_USER_PIC_LOGO32_UINT 15616//32*122*4 byte
|
||||||
|
#define FLASH_USER_PIC_LOGO24 FLASH_USER_PIC_LOGO
|
||||||
|
#define FLASH_USER_PIC_LOGO32 (FLASH_USER_PIC_LOGO + FLASH_USER_PIC_LOGO24_UINT)
|
||||||
|
|
||||||
|
typedef struct{//32byte
|
||||||
|
unsigned int open_password_isenable;
|
||||||
|
unsigned int rsv1;
|
||||||
|
unsigned int auth_function_isenable;
|
||||||
|
unsigned char pid[12];
|
||||||
|
unsigned int ctl_type;
|
||||||
|
unsigned int pwr;
|
||||||
|
}T_Factory_Prm;
|
||||||
|
|
||||||
|
extern T_Factory_Prm factory_prm;
|
||||||
|
|
||||||
|
extern void reset_factory_prm(void);
|
||||||
|
extern void write_factory_prm(void);
|
||||||
|
extern void read_factory_prm(void);
|
||||||
|
|
||||||
|
extern void erase_internal_one_sector(unsigned int Address);
|
||||||
|
extern void write_internal_flash(unsigned int Address, unsigned int val_addr);
|
||||||
|
extern void read_internal_flash(unsigned int start_address, unsigned int * val_addr, unsigned int num);
|
||||||
|
|
||||||
|
#endif
|
||||||
311
FW/Core/my_src/lcd_base_display.c
Normal file
311
FW/Core/my_src/lcd_base_display.c
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
#include "lcd_base_display.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "font.h"
|
||||||
|
//#include "delay.h"
|
||||||
|
#include "ltdc_drv.h"
|
||||||
|
|
||||||
|
//LCD的画笔颜色和背景色
|
||||||
|
unsigned int POINT_COLOR=0xFFFF00FF; //画笔颜色
|
||||||
|
unsigned int BACK_COLOR =0xFF00FF00; //背景色
|
||||||
|
|
||||||
|
//管理LCD重要参数
|
||||||
|
//默认为竖屏
|
||||||
|
_lcd_dev lcddev;
|
||||||
|
|
||||||
|
unsigned short LCD_BGR2RGB(unsigned short c)
|
||||||
|
{
|
||||||
|
unsigned short r,g,b,rgb;
|
||||||
|
b=(c>>0)&0x1f;
|
||||||
|
g=(c>>5)&0x3f;
|
||||||
|
r=(c>>11)&0x1f;
|
||||||
|
rgb=(b<<11)+(g<<5)+(r<<0);
|
||||||
|
return(rgb);
|
||||||
|
}
|
||||||
|
//当mdk -O1时间优化时需要设置
|
||||||
|
//延时i
|
||||||
|
void opt_delay(unsigned char i)
|
||||||
|
{
|
||||||
|
while(i--);
|
||||||
|
}
|
||||||
|
|
||||||
|
//LCD开启显示
|
||||||
|
void LCD_DisplayOn(void)
|
||||||
|
{
|
||||||
|
LTDC_Switch(1);//开启LCD
|
||||||
|
}
|
||||||
|
//LCD关闭显示
|
||||||
|
void LCD_DisplayOff(void)
|
||||||
|
{
|
||||||
|
LTDC_Switch(0);//关闭LCD
|
||||||
|
}
|
||||||
|
//画点
|
||||||
|
//x,y:坐标
|
||||||
|
//POINT_COLOR:此点的颜色
|
||||||
|
void LCD_DrawPoint(unsigned short x,unsigned short y)
|
||||||
|
{
|
||||||
|
LTDC_Draw_Point(x,y,POINT_COLOR);
|
||||||
|
}
|
||||||
|
//快速画点
|
||||||
|
//x,y:坐标
|
||||||
|
//color:颜色
|
||||||
|
void LCD_Fast_DrawPoint(unsigned short x,unsigned short y,unsigned int color)
|
||||||
|
{
|
||||||
|
LTDC_Draw_Point(x,y,color);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置LCD显示方向
|
||||||
|
//dir:0,竖屏;1,横屏
|
||||||
|
void LCD_Display_Dir(unsigned char dir)
|
||||||
|
{
|
||||||
|
lcddev.dir=dir; //横屏/竖屏
|
||||||
|
if(lcdltdc.pwidth!=0) //如果是RGB屏
|
||||||
|
{
|
||||||
|
LTDC_Display_Dir(dir);
|
||||||
|
lcddev.width=lcdltdc.width;
|
||||||
|
lcddev.height=lcdltdc.height;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//清屏函数
|
||||||
|
//color:要清屏的填充色
|
||||||
|
void LCD_Clear(unsigned int color)
|
||||||
|
{
|
||||||
|
LTDC_Clear(color);
|
||||||
|
}
|
||||||
|
//在指定区域内填充单个颜色
|
||||||
|
//(sx,sy),(ex,ey):填充矩形对角坐标,区域大小为:(ex-sx+1)*(ey-sy+1)
|
||||||
|
//color:要填充的颜色
|
||||||
|
void LCD_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned int color)
|
||||||
|
{
|
||||||
|
LTDC_Fill(sx,sy,ex,ey,color);
|
||||||
|
}
|
||||||
|
//在指定区域内填充指定颜色块
|
||||||
|
//(sx,sy),(ex,ey):填充矩形对角坐标,区域大小为:(ex-sx+1)*(ey-sy+1)
|
||||||
|
//color:要填充的颜色
|
||||||
|
void LCD_Color_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned short *color)
|
||||||
|
{
|
||||||
|
LTDC_Color_Fill(sx,sy,ex,ey,color);
|
||||||
|
}
|
||||||
|
//画线
|
||||||
|
//x1,y1:起点坐标
|
||||||
|
//x2,y2:终点坐标
|
||||||
|
void LCD_DrawLine(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2)
|
||||||
|
{
|
||||||
|
unsigned short t;
|
||||||
|
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||||
|
int incx,incy,uRow,uCol;
|
||||||
|
delta_x=x2-x1; //计算坐标增量
|
||||||
|
delta_y=y2-y1;
|
||||||
|
uRow=x1;
|
||||||
|
uCol=y1;
|
||||||
|
if(delta_x>0)incx=1; //设置单步方向
|
||||||
|
else if(delta_x==0)incx=0;//垂直线
|
||||||
|
else {incx=-1;delta_x=-delta_x;}
|
||||||
|
if(delta_y>0)incy=1;
|
||||||
|
else if(delta_y==0)incy=0;//水平线
|
||||||
|
else{incy=-1;delta_y=-delta_y;}
|
||||||
|
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||||
|
else distance=delta_y;
|
||||||
|
for(t=0;t<=distance+1;t++ )//画线输出
|
||||||
|
{
|
||||||
|
LCD_DrawPoint(uRow,uCol);//画点
|
||||||
|
xerr+=delta_x ;
|
||||||
|
yerr+=delta_y ;
|
||||||
|
if(xerr>distance)
|
||||||
|
{
|
||||||
|
xerr-=distance;
|
||||||
|
uRow+=incx;
|
||||||
|
}
|
||||||
|
if(yerr>distance)
|
||||||
|
{
|
||||||
|
yerr-=distance;
|
||||||
|
uCol+=incy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//画矩形
|
||||||
|
//(x1,y1),(x2,y2):矩形的对角坐标
|
||||||
|
void LCD_DrawRectangle(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2)
|
||||||
|
{
|
||||||
|
LCD_DrawLine(x1,y1,x2,y1);
|
||||||
|
LCD_DrawLine(x1,y1,x1,y2);
|
||||||
|
LCD_DrawLine(x1,y2,x2,y2);
|
||||||
|
LCD_DrawLine(x2,y1,x2,y2);
|
||||||
|
}
|
||||||
|
//在指定位置画一个指定大小的圆
|
||||||
|
//(x,y):中心点
|
||||||
|
//r :半径
|
||||||
|
void LCD_Draw_Circle(unsigned short x0,unsigned short y0,unsigned char r)
|
||||||
|
{
|
||||||
|
int a,b;
|
||||||
|
int di;
|
||||||
|
a=0;b=r;
|
||||||
|
di=3-(r<<1); //判断下个点位置的标志
|
||||||
|
while(a<=b)
|
||||||
|
{
|
||||||
|
LCD_DrawPoint(x0+a,y0-b); //5
|
||||||
|
LCD_DrawPoint(x0+b,y0-a); //0
|
||||||
|
LCD_DrawPoint(x0+b,y0+a); //4
|
||||||
|
LCD_DrawPoint(x0+a,y0+b); //6
|
||||||
|
LCD_DrawPoint(x0-a,y0+b); //1
|
||||||
|
LCD_DrawPoint(x0-b,y0+a);
|
||||||
|
LCD_DrawPoint(x0-a,y0-b); //2
|
||||||
|
LCD_DrawPoint(x0-b,y0-a); //7
|
||||||
|
a++;
|
||||||
|
//使用Bresenham算法画圆
|
||||||
|
if(di<0)di +=4*a+6;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
di+=10+4*(a-b);
|
||||||
|
b--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//在指定位置显示一个字符
|
||||||
|
//x,y:起始坐标
|
||||||
|
//num:要显示的字符:" "--->"~"
|
||||||
|
//size:字体大小 12/16/24/32
|
||||||
|
//mode:叠加方式(1)还是非叠加方式(0)
|
||||||
|
void LCD_ShowChar(unsigned short x,unsigned short y,unsigned char num,unsigned char size,unsigned char mode)
|
||||||
|
{
|
||||||
|
unsigned char temp,t1,t;
|
||||||
|
unsigned short y0=y;
|
||||||
|
unsigned char csize=(size/8+((size%8)?1:0))*(size/2); //得到字体一个字符对应点阵集所占的字节数
|
||||||
|
num=num-' ';//得到偏移后的值(ASCII字库是从空格开始取模,所以-' '就是对应字符的字库)
|
||||||
|
for(t=0;t<csize;t++)
|
||||||
|
{
|
||||||
|
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
|
||||||
|
else if(size==16)temp=asc2_1608[num][t]; //调用1608字体
|
||||||
|
else if(size==24)temp=asc2_2412[num][t]; //调用2412字体
|
||||||
|
else if(size==32)temp=asc2_3216[num][t]; //调用3216字体
|
||||||
|
else return; //没有的字库
|
||||||
|
for(t1=0;t1<8;t1++)
|
||||||
|
{
|
||||||
|
if(temp&0x80)LCD_Fast_DrawPoint(x,y,POINT_COLOR);
|
||||||
|
else if(mode==0)LCD_Fast_DrawPoint(x,y,BACK_COLOR);
|
||||||
|
temp<<=1;
|
||||||
|
y++;
|
||||||
|
if(y>=lcddev.height)return; //超区域了
|
||||||
|
if((y-y0)==size)
|
||||||
|
{
|
||||||
|
y=y0;
|
||||||
|
x++;
|
||||||
|
if(x>=lcddev.width)return; //超区域了
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//m^n函数
|
||||||
|
//返回值:m^n次方.
|
||||||
|
unsigned int LCD_Pow(unsigned char m,unsigned char n)
|
||||||
|
{
|
||||||
|
unsigned int result=1;
|
||||||
|
while(n--)result*=m;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
//显示数字,高位为0,则不显示
|
||||||
|
//x,y :起点坐标
|
||||||
|
//len :数字的位数
|
||||||
|
//size:字体大小
|
||||||
|
//color:颜色
|
||||||
|
//num:数值(0~4294967295);
|
||||||
|
void LCD_ShowNum(unsigned short x,unsigned short y,unsigned int num,unsigned char len,unsigned char size)
|
||||||
|
{
|
||||||
|
unsigned char t,temp;
|
||||||
|
unsigned char enshow=0;
|
||||||
|
for(t=0;t<len;t++)
|
||||||
|
{
|
||||||
|
temp=(num/LCD_Pow(10,len-t-1))%10;
|
||||||
|
if(enshow==0&&t<(len-1))
|
||||||
|
{
|
||||||
|
if(temp==0)
|
||||||
|
{
|
||||||
|
LCD_ShowChar(x+(size/2)*t,y,' ',size,0);
|
||||||
|
continue;
|
||||||
|
}else enshow=1;
|
||||||
|
|
||||||
|
}
|
||||||
|
LCD_ShowChar(x+(size/2)*t,y,temp+'0',size,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//显示数字,高位为0,还是显示
|
||||||
|
//x,y:起点坐标
|
||||||
|
//num:数值(0~999999999);
|
||||||
|
//len:长度(即要显示的位数)
|
||||||
|
//size:字体大小
|
||||||
|
//mode:
|
||||||
|
//[7]:0,不填充;1,填充0.
|
||||||
|
//[6:1]:保留
|
||||||
|
//[0]:0,非叠加显示;1,叠加显示.
|
||||||
|
void LCD_ShowxNum(unsigned short x,unsigned short y,unsigned int num,unsigned char len,unsigned char size,unsigned char mode)
|
||||||
|
{
|
||||||
|
unsigned char t,temp;
|
||||||
|
unsigned char enshow=0;
|
||||||
|
for(t=0;t<len;t++)
|
||||||
|
{
|
||||||
|
temp=(num/LCD_Pow(10,len-t-1))%10;
|
||||||
|
if(enshow==0&&t<(len-1))
|
||||||
|
{
|
||||||
|
if(temp==0)
|
||||||
|
{
|
||||||
|
if(mode&0X80)LCD_ShowChar(x+(size/2)*t,y,'0',size,mode&0X01);
|
||||||
|
else LCD_ShowChar(x+(size/2)*t,y,' ',size,mode&0X01);
|
||||||
|
continue;
|
||||||
|
}else enshow=1;
|
||||||
|
|
||||||
|
}
|
||||||
|
LCD_ShowChar(x+(size/2)*t,y,temp+'0',size,mode&0X01);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//显示字符串
|
||||||
|
//x,y:起点坐标
|
||||||
|
//width,height:区域大小
|
||||||
|
//size:字体大小
|
||||||
|
//*p:字符串起始地址
|
||||||
|
void LCD_ShowString(unsigned short x,unsigned short y,unsigned short width,unsigned short height,unsigned char size,unsigned char *p)
|
||||||
|
{
|
||||||
|
unsigned char x0=x;
|
||||||
|
width+=x;
|
||||||
|
height+=y;
|
||||||
|
while((*p<='~')&&(*p>=' '))//判断是不是非法字符!
|
||||||
|
{
|
||||||
|
if(x>=width){x=x0;y+=size;}
|
||||||
|
if(y>=height)break;//退出
|
||||||
|
LCD_ShowChar(x,y,*p,size,0);
|
||||||
|
x+=size/2;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
143
FW/Core/my_src/lcd_base_display.h
Normal file
143
FW/Core/my_src/lcd_base_display.h
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
#ifndef __LCD_H
|
||||||
|
#define __LCD_H
|
||||||
|
#include "stdlib.h"
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||||
|
//ALIENTEK STM32开发板
|
||||||
|
//2.8寸/3.5寸/4.3寸/7寸 TFT液晶驱动
|
||||||
|
//支持驱动IC型号包括:ILI9341/NT35310/NT35510/SSD1963等
|
||||||
|
//正点原子@ALIENTEK
|
||||||
|
//技术论坛:www.openedv.com
|
||||||
|
//创建日期:2015/12/10
|
||||||
|
//版本:V1.0
|
||||||
|
//版权所有,盗版必究。
|
||||||
|
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||||
|
//All rights reserved
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//LCD重要参数集
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned short width; //LCD 宽度
|
||||||
|
unsigned short height; //LCD 高度
|
||||||
|
unsigned short id; //LCD ID
|
||||||
|
unsigned char dir; //横屏还是竖屏控制:0,竖屏;1,横屏。
|
||||||
|
unsigned short wramcmd; //开始写gram指令
|
||||||
|
unsigned short setxcmd; //设置x坐标指令
|
||||||
|
unsigned short setycmd; //设置y坐标指令
|
||||||
|
}_lcd_dev;
|
||||||
|
|
||||||
|
//LCD参数
|
||||||
|
extern _lcd_dev lcddev; //管理LCD重要参数
|
||||||
|
//LCD的画笔颜色和背景色
|
||||||
|
extern unsigned int POINT_COLOR;//默认红色
|
||||||
|
extern unsigned int BACK_COLOR; //背景颜色.默认为白色
|
||||||
|
|
||||||
|
//LCD MPU保护参数
|
||||||
|
#define LCD_REGION_NUMBER MPU_REGION_NUMBER0 //LCD使用region0
|
||||||
|
#define LCD_ADDRESS_START (0X60000000) //LCD区的首地址
|
||||||
|
#define LCD_REGION_SIZE MPU_REGION_SIZE_256MB //LCD区大小
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//-----------------MCU屏 LCD端口定义----------------
|
||||||
|
//LCD背光 PB5
|
||||||
|
#define LCD_LED(n) (n?HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_SET):HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_RESET))
|
||||||
|
//LCD地址结构体
|
||||||
|
|
||||||
|
//使用NOR/SRAM的 Bank1.sector4,地址位HADDR[27,26]=11 A18作为数据命令区分线
|
||||||
|
//注意设置时STM32内部会右移一位对其!
|
||||||
|
#define LCD_BASE ((unsigned int)(0x60000000 | 0x0007FFFE))
|
||||||
|
#define LCD ((LCD_TypeDef *) LCD_BASE)
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//扫描方向定义
|
||||||
|
#define L2R_U2D 0 //从左到右,从上到下
|
||||||
|
#define L2R_D2U 1 //从左到右,从下到上
|
||||||
|
#define R2L_U2D 2 //从右到左,从上到下
|
||||||
|
#define R2L_D2U 3 //从右到左,从下到上
|
||||||
|
|
||||||
|
#define U2D_L2R 4 //从上到下,从左到右
|
||||||
|
#define U2D_R2L 5 //从上到下,从右到左
|
||||||
|
#define D2U_L2R 6 //从下到上,从左到右
|
||||||
|
#define D2U_R2L 7 //从下到上,从右到左
|
||||||
|
|
||||||
|
#define DFT_SCAN_DIR L2R_U2D //默认的扫描方向
|
||||||
|
|
||||||
|
//画笔颜色
|
||||||
|
#define WHITE 0xFFFF
|
||||||
|
#define BLACK 0x0000
|
||||||
|
#define BLUE 0x001F
|
||||||
|
#define BRED 0XF81F
|
||||||
|
#define GRED 0XFFE0
|
||||||
|
#define GBLUE 0X07FF
|
||||||
|
#define RED 0xF800
|
||||||
|
#define MAGENTA 0xF81F
|
||||||
|
#define GREEN 0x07E0
|
||||||
|
#define CYAN 0x7FFF
|
||||||
|
#define YELLOW 0xFFE0
|
||||||
|
#define BROWN 0XBC40 //棕色
|
||||||
|
#define BRRED 0XFC07 //棕红色
|
||||||
|
#define GRAY 0X8430 //灰色
|
||||||
|
//GUI颜色
|
||||||
|
|
||||||
|
#define DARKBLUE 0X01CF //深蓝色
|
||||||
|
#define LIGHTBLUE 0X7D7C //浅蓝色
|
||||||
|
#define GRAYBLUE 0X5458 //灰蓝色
|
||||||
|
//以上三色为PANEL的颜色
|
||||||
|
|
||||||
|
#define LIGHTGREEN 0X841F //浅绿色
|
||||||
|
//#define LIGHTGRAY 0XEF5B //浅灰色(PANNEL)
|
||||||
|
#define LGRAY 0XC618 //浅灰色(PANNEL),窗体背景色
|
||||||
|
|
||||||
|
#define LGRAYBLUE 0XA651 //浅灰蓝色(中间层颜色)
|
||||||
|
#define LBBLUE 0X2B12 //浅棕蓝色(选择条目的反色)
|
||||||
|
|
||||||
|
void LCD_Init(void); //初始化
|
||||||
|
void LCD_DisplayOn(void); //开显示
|
||||||
|
void LCD_DisplayOff(void); //关显示
|
||||||
|
void LCD_Clear(unsigned int Color); //清屏
|
||||||
|
void LCD_SetCursor(unsigned short Xpos, unsigned short Ypos); //设置光标
|
||||||
|
void LCD_DrawPoint(unsigned short x,unsigned short y); //画点
|
||||||
|
void LCD_Fast_DrawPoint(unsigned short x,unsigned short y,unsigned int color); //快速画点
|
||||||
|
unsigned int LCD_ReadPoint(unsigned short x,unsigned short y); //读点
|
||||||
|
void LCD_Draw_Circle(unsigned short x0,unsigned short y0,unsigned char r); //画圆
|
||||||
|
void LCD_DrawLine(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2); //画线
|
||||||
|
void LCD_DrawRectangle(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2); //画矩形
|
||||||
|
void LCD_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned int color); //填充单色
|
||||||
|
void LCD_Color_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned short *color); //填充指定颜色
|
||||||
|
void LCD_ShowChar(unsigned short x,unsigned short y,unsigned char num,unsigned char size,unsigned char mode); //显示一个字符
|
||||||
|
void LCD_ShowNum(unsigned short x,unsigned short y,unsigned int num,unsigned char len,unsigned char size); //显示一个数字
|
||||||
|
void LCD_ShowxNum(unsigned short x,unsigned short y,unsigned int num,unsigned char len,unsigned char size,unsigned char mode); //显示 数字
|
||||||
|
void LCD_ShowString(unsigned short x,unsigned short y,unsigned short width,unsigned short height,unsigned char size,unsigned char *p); //显示一个字符串,12/16字体
|
||||||
|
|
||||||
|
void LCD_WriteReg(unsigned short LCD_Reg, unsigned short LCD_RegValue);
|
||||||
|
unsigned short LCD_ReadReg(unsigned short LCD_Reg);
|
||||||
|
void LCD_WriteRAM_Prepare(void);
|
||||||
|
void LCD_WriteRAM(unsigned short RGB_Code);
|
||||||
|
void LCD_SSD_BackLightSet(unsigned char pwm); //SSD1963 背光控制
|
||||||
|
void LCD_Scan_Dir(unsigned char dir); //设置屏扫描方向
|
||||||
|
void LCD_Display_Dir(unsigned char dir); //设置屏幕显示方向
|
||||||
|
void LCD_Set_Window(unsigned short sx,unsigned short sy,unsigned short width,unsigned short height); //设置窗口
|
||||||
|
//LCD分辨率设置
|
||||||
|
#define SSD_HOR_RESOLUTION 800 //LCD水平分辨率
|
||||||
|
#define SSD_VER_RESOLUTION 480 //LCD垂直分辨率
|
||||||
|
//LCD驱动参数设置
|
||||||
|
#define SSD_HOR_PULSE_WIDTH 1 //水平脉宽
|
||||||
|
#define SSD_HOR_BACK_PORCH 46 //水平前廊
|
||||||
|
#define SSD_HOR_FRONT_PORCH 210 //水平后廊
|
||||||
|
|
||||||
|
#define SSD_VER_PULSE_WIDTH 1 //垂直脉宽
|
||||||
|
#define SSD_VER_BACK_PORCH 23 //垂直前廊
|
||||||
|
#define SSD_VER_FRONT_PORCH 22 //垂直前廊
|
||||||
|
//如下几个参数,自动计算
|
||||||
|
#define SSD_HT (SSD_HOR_RESOLUTION+SSD_HOR_BACK_PORCH+SSD_HOR_FRONT_PORCH)
|
||||||
|
#define SSD_HPS (SSD_HOR_BACK_PORCH)
|
||||||
|
#define SSD_VT (SSD_VER_RESOLUTION+SSD_VER_BACK_PORCH+SSD_VER_FRONT_PORCH)
|
||||||
|
#define SSD_VPS (SSD_VER_BACK_PORCH)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
457
FW/Core/my_src/lcd_text.c
Normal file
457
FW/Core/my_src/lcd_text.c
Normal file
@@ -0,0 +1,457 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "internal_flash.h"
|
||||||
|
#include "lcd_base_display.h"
|
||||||
|
#include "my_font.h"
|
||||||
|
|
||||||
|
#define BIT8(n) ((unsigned char)((unsigned char)1<<n) ) //n(0~7)
|
||||||
|
#define isBit8(dat, n) ((dat & BIT8(n)) ? 1: 0) //0~7
|
||||||
|
|
||||||
|
#define Hzk_16_data (const unsigned char *)((unsigned int)0x80000000)//no use
|
||||||
|
#define Hzk_24_data (const unsigned char *)(FLASH_USER_FONT_24X24)
|
||||||
|
|
||||||
|
const unsigned char *text_buf;
|
||||||
|
|
||||||
|
extern const unsigned char asc2_1608[95][16];
|
||||||
|
extern const unsigned char asc2_2412[95][36];
|
||||||
|
|
||||||
|
void gui_put_pixel(unsigned short x, unsigned short y, unsigned int offset, unsigned int color)
|
||||||
|
{
|
||||||
|
LCD_Fast_DrawPoint(x,y,color);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_chinese_offset_16(const unsigned char *p)
|
||||||
|
{
|
||||||
|
unsigned int d;
|
||||||
|
|
||||||
|
d=32UL*( ((*p)-0xa1)*94 + ((*(p+1))-0xa1) );
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_CN16(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor, const unsigned char *p)
|
||||||
|
{
|
||||||
|
const unsigned char* pbuf;
|
||||||
|
unsigned short ix, iy;
|
||||||
|
unsigned int address;
|
||||||
|
unsigned int offset = 0;
|
||||||
|
|
||||||
|
offset = get_chinese_offset_16( p);
|
||||||
|
|
||||||
|
text_buf = Hzk_16_data;
|
||||||
|
pbuf = &text_buf[offset]; //______________________________fill location
|
||||||
|
|
||||||
|
for(iy=0; iy<16; iy++)
|
||||||
|
{
|
||||||
|
for(ix=0; ix<8; ix++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-ix))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix, y, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix, y, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
for(ix=0; ix<8; ix++)//?1????8?
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-ix))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix+8, y, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix+8, y, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_EN1608(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor,unsigned char num)
|
||||||
|
{
|
||||||
|
const unsigned char* pbuf;
|
||||||
|
unsigned short ix, iy;
|
||||||
|
unsigned int offset = 0;
|
||||||
|
|
||||||
|
//num=num-' ';//得到偏移后的值(ASCII字库是从空格开始取模,所以-' '就是对应字符的字库)
|
||||||
|
offset = (num-' ');
|
||||||
|
//text_buf = &asc2_1608[0][0];
|
||||||
|
pbuf = &asc2_1608[offset][0];
|
||||||
|
|
||||||
|
for(ix=0; ix<8; ix++)
|
||||||
|
{
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+8+iy, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+8+iy, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_hex16(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor, unsigned char hex)
|
||||||
|
{
|
||||||
|
if(((hex&0xF0)>>4)>9)
|
||||||
|
gui_write_EN1608(x,y,CharColor,BackColor,(((hex&0xF0)>>4) - 0x0A +'A'));
|
||||||
|
else
|
||||||
|
gui_write_EN1608(x,y,CharColor,BackColor,(((hex&0xF0)>>4)+'0'));
|
||||||
|
|
||||||
|
if((hex&0x0F)>9)
|
||||||
|
gui_write_EN1608((x+8),y,CharColor,BackColor,((hex&0x0F) - 0x0A +'A'));
|
||||||
|
else
|
||||||
|
gui_write_EN1608((x+8),y,CharColor,BackColor,((hex&0x0F)+'0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_num16(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor, unsigned char num)
|
||||||
|
{
|
||||||
|
gui_write_EN1608(x,y,CharColor,BackColor,(num+'0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_num(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor, unsigned short num, unsigned char bit)
|
||||||
|
{
|
||||||
|
if((bit > 4)||(0==bit))return;
|
||||||
|
LCD_Fill(x,y,(x+(bit<<3)-1),(y+8-1),BackColor);
|
||||||
|
if(4 == bit)
|
||||||
|
{
|
||||||
|
gui_write_num16(x,y,CharColor,BackColor,(num/1000%10));
|
||||||
|
gui_write_num16((x+8),y,CharColor,BackColor,(num/100%10));
|
||||||
|
gui_write_num16((x+16),y,CharColor,BackColor,(num/10%10));
|
||||||
|
gui_write_num16((x+24),y,CharColor,BackColor,(num%10));
|
||||||
|
}
|
||||||
|
else if(3 == bit)
|
||||||
|
{
|
||||||
|
gui_write_num16((x),y,CharColor,BackColor,(num/100%10));
|
||||||
|
gui_write_num16((x+8),y,CharColor,BackColor,(num/10%10));
|
||||||
|
gui_write_num16((x+16),y,CharColor,BackColor,(num%10));
|
||||||
|
}
|
||||||
|
else if(2 == bit)
|
||||||
|
{
|
||||||
|
gui_write_num16(x,y,CharColor,BackColor,(num/10%10));
|
||||||
|
gui_write_num16((x+8),y,CharColor,BackColor,(num%10));
|
||||||
|
}
|
||||||
|
else if(1 == bit)
|
||||||
|
{
|
||||||
|
gui_write_num16(x,y,CharColor,BackColor,(num%10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_string16(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor, const unsigned char* p)
|
||||||
|
{
|
||||||
|
unsigned char dat;
|
||||||
|
|
||||||
|
for(; *p!=0; p++)
|
||||||
|
{
|
||||||
|
if(( (unsigned char)*p&0x80)==0)//??
|
||||||
|
{
|
||||||
|
if(*p=='\r')//??
|
||||||
|
{
|
||||||
|
//x=START_X;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(*p=='\n')//??
|
||||||
|
{
|
||||||
|
//y+=24;
|
||||||
|
//if(y > RECT_YMAX-24)
|
||||||
|
// y=START_Y;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(*p=='\1') //?????.?
|
||||||
|
dat='~'-' '+1;
|
||||||
|
else if(*p=='\2') //?????.?
|
||||||
|
dat='~'-' '+2;
|
||||||
|
else if(*p=='\3') //?????.?
|
||||||
|
dat='~'-' '+3;
|
||||||
|
else if(*p=='\4') //?????.?
|
||||||
|
dat='~'-' '+4;
|
||||||
|
// else if(*p=='\\') //?????
|
||||||
|
// {
|
||||||
|
// p++;
|
||||||
|
// if(*p=='U') //?????.?
|
||||||
|
// dat='~'-' '+1;
|
||||||
|
// else if(*p=='D') //?????.?
|
||||||
|
// dat='~'-' '+2;
|
||||||
|
// else if(*p=='L') //?????.?
|
||||||
|
// dat='~'-' '+3;
|
||||||
|
// else// if(*p=='R') //?????.?
|
||||||
|
// dat='~'-' '+4;
|
||||||
|
// }
|
||||||
|
else //??????
|
||||||
|
dat=*p-0x20;
|
||||||
|
|
||||||
|
dat=*p;
|
||||||
|
gui_write_EN1608(x, y, CharColor, BackColor, dat);
|
||||||
|
x+=8;
|
||||||
|
}
|
||||||
|
else//??
|
||||||
|
{
|
||||||
|
gui_write_CN16(x, y, CharColor, BackColor, (unsigned char*)p);
|
||||||
|
x+=16;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_chinese_offset_24(const unsigned char *p)
|
||||||
|
{
|
||||||
|
unsigned int d;
|
||||||
|
|
||||||
|
d=72UL*( ((*p)-15-0xa1)*94 + ((*(p+1))-0xa1) );
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_CN24(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor, const unsigned char *p)
|
||||||
|
{
|
||||||
|
const unsigned char* pbuf;
|
||||||
|
unsigned short ix, iy;
|
||||||
|
unsigned int address;
|
||||||
|
unsigned int offset = 0;
|
||||||
|
|
||||||
|
offset = get_chinese_offset_24( p);
|
||||||
|
|
||||||
|
text_buf = Hzk_24_data;
|
||||||
|
pbuf = &text_buf[offset]; //______________________________fill location
|
||||||
|
|
||||||
|
for(ix=0; ix<24; ix++)
|
||||||
|
{
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy+8, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy+8, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy+16, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy+16, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_EN2412(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor,unsigned char num)
|
||||||
|
{
|
||||||
|
const unsigned char* pbuf;
|
||||||
|
unsigned short ix, iy;
|
||||||
|
unsigned int offset = 0;
|
||||||
|
|
||||||
|
//num=num-' ';//得到偏移后的值(ASCII字库是从空格开始取模,所以-' '就是对应字符的字库)
|
||||||
|
offset = (num-' ');
|
||||||
|
pbuf = &asc2_2412[offset][0];
|
||||||
|
|
||||||
|
for(ix=0; ix<12; ix++)
|
||||||
|
{
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+iy, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+8+iy, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+8+iy, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
|
||||||
|
for(iy=0; iy<8; iy++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-iy))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+16+iy, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x, y+16+iy, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_EN2417(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor,unsigned char num)
|
||||||
|
{
|
||||||
|
const unsigned char* pbuf;
|
||||||
|
unsigned short ix, iy;
|
||||||
|
unsigned int offset = 0;
|
||||||
|
|
||||||
|
//num=num-' ';//得到偏移后的值(ASCII字库是从空格开始取模,所以-' '就是对应字符的字库)
|
||||||
|
offset = (num-' ')*72;
|
||||||
|
text_buf = ascii_17x24_table;
|
||||||
|
pbuf = &text_buf[offset];
|
||||||
|
|
||||||
|
for(iy=0; iy<24; iy++)
|
||||||
|
{
|
||||||
|
for(ix=0; ix<8; ix++)
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-ix))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix, y, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix, y, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
for(ix=0; ix<8; ix++)//?1????8?
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-ix))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix+8, y, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix+8, y, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
for(ix=0; ix<8; ix++)//?1????8?
|
||||||
|
{
|
||||||
|
if( isBit8(*pbuf, (7-ix))==0 )
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix+16, y, 0, BackColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_put_pixel(x+ix+16, y, 0, CharColor); //______________________________put pixel here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pbuf++;
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_write_string24(unsigned short x, unsigned short y, unsigned int CharColor, unsigned int BackColor, const unsigned char* p)
|
||||||
|
{
|
||||||
|
unsigned char dat;
|
||||||
|
|
||||||
|
for(; *p!=0; p++)
|
||||||
|
{
|
||||||
|
if(( (unsigned char)*p&0x80)==0)//??
|
||||||
|
{
|
||||||
|
if(*p=='\r')//??
|
||||||
|
{
|
||||||
|
//x=START_X;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(*p=='\n')//??
|
||||||
|
{
|
||||||
|
//y+=24;
|
||||||
|
//if(y > RECT_YMAX-24)
|
||||||
|
// y=START_Y;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(*p=='\1') //?????.?
|
||||||
|
dat='~'-' '+1;
|
||||||
|
else if(*p=='\2') //?????.?
|
||||||
|
dat='~'-' '+2;
|
||||||
|
else if(*p=='\3') //?????.?
|
||||||
|
dat='~'-' '+3;
|
||||||
|
else if(*p=='\4') //?????.?
|
||||||
|
dat='~'-' '+4;
|
||||||
|
// else if(*p=='\\') //?????
|
||||||
|
// {
|
||||||
|
// p++;
|
||||||
|
// if(*p=='U') //?????.?
|
||||||
|
// dat='~'-' '+1;
|
||||||
|
// else if(*p=='D') //?????.?
|
||||||
|
// dat='~'-' '+2;
|
||||||
|
// else if(*p=='L') //?????.?
|
||||||
|
// dat='~'-' '+3;
|
||||||
|
// else// if(*p=='R') //?????.?
|
||||||
|
// dat='~'-' '+4;
|
||||||
|
// }
|
||||||
|
else //??????
|
||||||
|
dat=*p-0x20;
|
||||||
|
|
||||||
|
dat=*p;
|
||||||
|
gui_write_EN2412(x, y, CharColor, BackColor, dat);
|
||||||
|
x+=12;
|
||||||
|
//gui_write_EN2417(x, y, CharColor, BackColor, dat);
|
||||||
|
//x+=17;
|
||||||
|
}
|
||||||
|
|
||||||
|
else//??
|
||||||
|
{
|
||||||
|
gui_write_CN24(x, y, CharColor, BackColor, (unsigned char*)p);
|
||||||
|
x+=24;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
FW/Core/my_src/lcd_text.h
Normal file
7
FW/Core/my_src/lcd_text.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
extern void gui_write_EN1608(unsigned short x, unsigned short y, unsigned short CharColor, unsigned short BackColor,unsigned char num);
|
||||||
|
extern void gui_write_string16(unsigned short x, unsigned short y, unsigned short CharColor, unsigned short BackColor, const unsigned char* p);
|
||||||
|
extern void gui_write_hex16(unsigned short x, unsigned short y, unsigned short CharColor, unsigned short BackColor, unsigned char hex);
|
||||||
|
extern void gui_write_num16(unsigned short x, unsigned short y, unsigned short CharColor, unsigned short BackColor, unsigned char num);
|
||||||
|
extern void gui_write_num(unsigned short x, unsigned short y, unsigned short CharColor, unsigned short BackColor, unsigned short num, unsigned char bit);
|
||||||
|
extern void gui_write_star(unsigned short x, unsigned short y, unsigned short CharColor, unsigned short BackColor);
|
||||||
517
FW/Core/my_src/load_gui_lib.c
Normal file
517
FW/Core/my_src/load_gui_lib.c
Normal file
@@ -0,0 +1,517 @@
|
|||||||
|
#include "HW_config.h"
|
||||||
|
#include "fatfs.h"
|
||||||
|
#include "ff.h"
|
||||||
|
#include "internal_flash.h"
|
||||||
|
#include "sdram_addr_map.h"
|
||||||
|
#include "file_cache.h"
|
||||||
|
#include "w25qxx.h"
|
||||||
|
#include "usb_host.h"
|
||||||
|
#include "usb_device.h"
|
||||||
|
|
||||||
|
//#define FLASH_SECTOR_SIZE 0x00020000
|
||||||
|
|
||||||
|
#define FONT_24X24_PATH "HZK/HZK24S"
|
||||||
|
|
||||||
|
#define PIC_16X16_BMP_NUM 32
|
||||||
|
#define PIC_24X24_BMP_NUM 24
|
||||||
|
#define PIC_32X32_BMP_NUM 4
|
||||||
|
|
||||||
|
#define LCD_TOTAL_WIDTH 800
|
||||||
|
#define LCD_LAYER1_ADDR 0xC0000000
|
||||||
|
|
||||||
|
Bmp_Parameter_TypeDef pic_16x16_bmp_prm[PIC_16X16_BMP_NUM];
|
||||||
|
Bmp_Parameter_TypeDef pic_24x24_bmp_prm[PIC_24X24_BMP_NUM];
|
||||||
|
Bmp_Parameter_TypeDef pic_32x32_bmp_prm[PIC_32X32_BMP_NUM];
|
||||||
|
Bmp_Parameter_TypeDef pic_logo24_bmp_prm;
|
||||||
|
Bmp_Parameter_TypeDef pic_logo32_bmp_prm;
|
||||||
|
|
||||||
|
extern ApplicationTypeDef Appli_state;
|
||||||
|
//volatile BYTE ReadBuffer[256]={0}; /* 读缓冲区 */
|
||||||
|
|
||||||
|
void load_pic_logo_bmp_to_flash(void);
|
||||||
|
|
||||||
|
void pic_prm_init(void)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
for(i=0;i<PIC_16X16_BMP_NUM;i++){
|
||||||
|
pic_16x16_bmp_prm[i].flash_address = FLASH_USER_PIC_16X16 + (FLASH_USER_PIC_16X16_UINT * i);
|
||||||
|
pic_16x16_bmp_prm[i].pic_width = 16;
|
||||||
|
pic_16x16_bmp_prm[i].pic_height = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<PIC_24X24_BMP_NUM;i++){
|
||||||
|
pic_24x24_bmp_prm[i].flash_address = FLASH_USER_PIC_24X24 + (FLASH_USER_PIC_24X24_UINT * i);
|
||||||
|
pic_24x24_bmp_prm[i].pic_width = 24;
|
||||||
|
pic_24x24_bmp_prm[i].pic_height = 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<PIC_32X32_BMP_NUM;i++){
|
||||||
|
pic_32x32_bmp_prm[i].flash_address = FLASH_USER_PIC_32X32 + (FLASH_USER_PIC_32X32_UINT * i);
|
||||||
|
pic_32x32_bmp_prm[i].pic_width = 32;
|
||||||
|
pic_32x32_bmp_prm[i].pic_height = 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_logo24_bmp_prm.flash_address = FLASH_USER_PIC_LOGO24;
|
||||||
|
pic_logo24_bmp_prm.pic_width = 90;
|
||||||
|
pic_logo24_bmp_prm.pic_height = 24;
|
||||||
|
|
||||||
|
pic_logo32_bmp_prm.flash_address = FLASH_USER_PIC_LOGO32;
|
||||||
|
pic_logo32_bmp_prm.pic_width = 122;
|
||||||
|
pic_logo32_bmp_prm.pic_height = 32;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
void erase_pic_16x16_lib_sector(void)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
for(i=0;i<FLASH_USER_PIC_16X16_SECTOR_NUM;i++)
|
||||||
|
erase_internal_one_sector(FLASH_USER_PIC_16X16 + (FLASH_SECTOR_SIZE * i));
|
||||||
|
}
|
||||||
|
|
||||||
|
void erase_pic_24x24_lib_sector(void)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0;i<FLASH_USER_PIC_24X24_SECTOR_NUM;i++)
|
||||||
|
erase_internal_one_sector(FLASH_USER_PIC_24X24 + (FLASH_SECTOR_SIZE * i));
|
||||||
|
}
|
||||||
|
|
||||||
|
void erase_pic_32x32_lib_sector(void)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0;i<FLASH_USER_PIC_32X32_SECTOR_NUM;i++)
|
||||||
|
erase_internal_one_sector(FLASH_USER_PIC_32X32 + (FLASH_SECTOR_SIZE * i));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
void erase_pic_lib_sector(void)
|
||||||
|
{
|
||||||
|
erase_internal_one_sector(FLASH_USER_PIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void erase_font_24x24_lib_sector(void)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0;i<FLASH_USER_FONT_24X24_SECTOR_NUM;i++)
|
||||||
|
erase_internal_one_sector(FLASH_USER_FONT_24X24 + (FLASH_SECTOR_SIZE * i));
|
||||||
|
}
|
||||||
|
|
||||||
|
void mount_usb_file_sys(void)
|
||||||
|
{
|
||||||
|
FRESULT f_res; /* 文件操做结果 */
|
||||||
|
BYTE work[512];
|
||||||
|
|
||||||
|
//在SD卡挂载文件系统,文件系统挂载时会对SD卡初始化
|
||||||
|
f_res = f_mount(&USBHFatFS,(TCHAR const*)USBHPath,1);
|
||||||
|
/*----------------------- 格式化测试 ---------------------------*/
|
||||||
|
/* 若是没有文件系统就格式化建立建立文件系统 */
|
||||||
|
if(f_res == FR_NO_FILESYSTEM)
|
||||||
|
{
|
||||||
|
/* 格式化 */
|
||||||
|
f_res=f_mkfs((TCHAR const*)USBHPath,FM_ANY,0,work,512); //
|
||||||
|
|
||||||
|
if(f_res == FR_OK)
|
||||||
|
{
|
||||||
|
/* 格式化后,先取消挂载 */
|
||||||
|
f_res = f_mount(NULL,(TCHAR const*)USBHPath,1);
|
||||||
|
/* 从新挂载 */
|
||||||
|
f_res = f_mount(&USBHFatFS,(TCHAR const*)USBHPath,1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// printf("《《格式化失败。》》\n");
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(f_res!=FR_OK)
|
||||||
|
{
|
||||||
|
// printf("!!SD卡挂载文件系统失败。(%d)\n",f_res);
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//printf("》文件系统挂载成功,能够进行读写测试\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_hzk_load_to_flash(void)
|
||||||
|
{
|
||||||
|
unsigned int load_falsh_addr = 0;
|
||||||
|
unsigned int load_sdram_addr = 0;
|
||||||
|
int tSta = -3;
|
||||||
|
|
||||||
|
uint32_t size;
|
||||||
|
FIL file; /* 文件对象 */
|
||||||
|
|
||||||
|
//-------------------load flash---------------------------------------------------
|
||||||
|
load_file_to_sdramcache(FONT_24X24_PATH,SDRAM_BUF_CACHE_ADDRESS, &tSta);
|
||||||
|
f_open(&file, FONT_24X24_PATH, FA_OPEN_EXISTING | FA_READ);//get file.obj.objsize
|
||||||
|
|
||||||
|
erase_font_24x24_lib_sector();
|
||||||
|
load_falsh_addr = FLASH_USER_FONT_24X24;
|
||||||
|
load_sdram_addr = SDRAM_BUF_CACHE_ADDRESS;
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
for(size = 0;size < file.obj.objsize;(size+=32))
|
||||||
|
{
|
||||||
|
write_internal_flash(load_falsh_addr, load_sdram_addr);
|
||||||
|
//W25QXX_Write(((unsigned char*)load_sdram_addr),load_falsh_addr,4096);
|
||||||
|
load_falsh_addr+=32;
|
||||||
|
load_sdram_addr+=32;
|
||||||
|
}
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
|
||||||
|
/* 再也不读写,关闭文件 */
|
||||||
|
f_close(&file);
|
||||||
|
HAL_Delay(5);
|
||||||
|
return tSta;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_16x16_bmp(void)
|
||||||
|
{
|
||||||
|
unsigned int x,y;
|
||||||
|
|
||||||
|
char str_name[20] = "Bmp16/A000.bmp";
|
||||||
|
|
||||||
|
for(x=0;x<PIC_16X16_BMP_NUM;x++)
|
||||||
|
{
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
for(y=0;y<14;y++)
|
||||||
|
{
|
||||||
|
pic_16x16_bmp_prm[x].name_str[y] = str_name[y];
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_16x16_bmp_prm[x].start_address = SDRAM_PIC_16X16_ADDR_START + (x * SDRAM_PIC_16X16_MEM_UNIT);
|
||||||
|
|
||||||
|
load_bmpfile_to_sdram(&pic_16x16_bmp_prm[x]);//load bmp file
|
||||||
|
|
||||||
|
str_name[9] +=1;
|
||||||
|
if(str_name[9] > '9')
|
||||||
|
{
|
||||||
|
str_name[9] = '0';
|
||||||
|
str_name[8] +=1;
|
||||||
|
if(str_name[8] > '9')
|
||||||
|
{
|
||||||
|
str_name[8] = '0';
|
||||||
|
str_name[7] +=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_16x16_bmp_to_flash(void)
|
||||||
|
{
|
||||||
|
unsigned int i = 0, size = 0;
|
||||||
|
unsigned int load_falsh_addr = 0;
|
||||||
|
unsigned int load_sdram_addr = 0;
|
||||||
|
|
||||||
|
for(i=0;i<PIC_16X16_BMP_NUM;i++){
|
||||||
|
pic_16x16_bmp_prm[i].flash_address = FLASH_USER_PIC_16X16 + (FLASH_USER_PIC_16X16_UINT * i);
|
||||||
|
}
|
||||||
|
|
||||||
|
//erase_pic_16x16_lib_sector();
|
||||||
|
//HAL_FLASH_Unlock();
|
||||||
|
for(i=0;i<PIC_16X16_BMP_NUM;i++){
|
||||||
|
load_falsh_addr = pic_16x16_bmp_prm[i].flash_address;
|
||||||
|
load_sdram_addr = pic_16x16_bmp_prm[i].start_address;
|
||||||
|
|
||||||
|
for(size = 0;size < FLASH_USER_PIC_16X16_UINT;(size+=32))
|
||||||
|
{
|
||||||
|
write_internal_flash(load_falsh_addr, load_sdram_addr);
|
||||||
|
//W25QXX_Write(((unsigned char*)load_sdram_addr),load_falsh_addr,4096);
|
||||||
|
load_falsh_addr+=32;
|
||||||
|
load_sdram_addr+=32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//load_pic_logo_bmp_to_flash();
|
||||||
|
//HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_24x24_bmp(void)
|
||||||
|
{
|
||||||
|
unsigned int x,y;
|
||||||
|
|
||||||
|
char str_name[20] = "Bmp24/B000.bmp";
|
||||||
|
|
||||||
|
for(x=0;x<PIC_24X24_BMP_NUM;x++)
|
||||||
|
{
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
for(y=0;y<14;y++)
|
||||||
|
{
|
||||||
|
pic_24x24_bmp_prm[x].name_str[y] = str_name[y];
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_24x24_bmp_prm[x].start_address = SDRAM_PIC_24X24_ADDR_START + (x * SDRAM_PIC_24X24_MEM_UNIT);
|
||||||
|
|
||||||
|
load_bmpfile_to_sdram(&pic_24x24_bmp_prm[x]);//load bmp file
|
||||||
|
|
||||||
|
str_name[9] +=1;
|
||||||
|
if(str_name[9] > '9')
|
||||||
|
{
|
||||||
|
str_name[9] = '0';
|
||||||
|
str_name[8] +=1;
|
||||||
|
if(str_name[8] > '9')
|
||||||
|
{
|
||||||
|
str_name[8] = '0';
|
||||||
|
str_name[7] +=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_24x24_bmp_to_flash(void)
|
||||||
|
{
|
||||||
|
unsigned int i = 0, size = 0;
|
||||||
|
unsigned int load_falsh_addr = 0;
|
||||||
|
unsigned int load_sdram_addr = 0;
|
||||||
|
|
||||||
|
for(i=0;i<PIC_24X24_BMP_NUM;i++){
|
||||||
|
pic_24x24_bmp_prm[i].flash_address = FLASH_USER_PIC_24X24 + (FLASH_USER_PIC_24X24_UINT * i);
|
||||||
|
}
|
||||||
|
|
||||||
|
//erase_pic_24x24_lib_sector();
|
||||||
|
//HAL_FLASH_Unlock();
|
||||||
|
for(i=0;i<PIC_24X24_BMP_NUM;i++){
|
||||||
|
load_falsh_addr = pic_24x24_bmp_prm[i].flash_address;
|
||||||
|
load_sdram_addr = pic_24x24_bmp_prm[i].start_address;
|
||||||
|
|
||||||
|
for(size = 0;size < FLASH_USER_PIC_24X24_UINT;(size+=32))
|
||||||
|
{
|
||||||
|
write_internal_flash(load_falsh_addr, load_sdram_addr);
|
||||||
|
//W25QXX_Write(((unsigned char*)load_sdram_addr),load_falsh_addr,4096);
|
||||||
|
load_falsh_addr+=32;
|
||||||
|
load_sdram_addr+=32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_32x32_bmp(void)
|
||||||
|
{
|
||||||
|
unsigned int x,y;
|
||||||
|
|
||||||
|
char str_name[20] = "Bmp32/C000.bmp";
|
||||||
|
|
||||||
|
for(x=0;x<PIC_32X32_BMP_NUM;x++)
|
||||||
|
{
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
for(y=0;y<14;y++)
|
||||||
|
{
|
||||||
|
pic_32x32_bmp_prm[x].name_str[y] = str_name[y];
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_32x32_bmp_prm[x].start_address = SDRAM_PIC_32X32_ADDR_START + (x * SDRAM_PIC_32X32_MEM_UNIT);
|
||||||
|
|
||||||
|
load_bmpfile_to_sdram(&pic_32x32_bmp_prm[x]);//load bmp file
|
||||||
|
|
||||||
|
str_name[9] +=1;
|
||||||
|
if(str_name[9] > '9')
|
||||||
|
{
|
||||||
|
str_name[9] = '0';
|
||||||
|
str_name[8] +=1;
|
||||||
|
if(str_name[8] > '9')
|
||||||
|
{
|
||||||
|
str_name[8] = '0';
|
||||||
|
str_name[7] +=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_32x32_bmp_to_flash(void)
|
||||||
|
{
|
||||||
|
unsigned int i = 0, size = 0;
|
||||||
|
unsigned int load_falsh_addr = 0;
|
||||||
|
unsigned int load_sdram_addr = 0;
|
||||||
|
|
||||||
|
for(i=0;i<PIC_32X32_BMP_NUM;i++){
|
||||||
|
pic_32x32_bmp_prm[i].flash_address = FLASH_USER_PIC_32X32 + (FLASH_USER_PIC_32X32_UINT * i);
|
||||||
|
}
|
||||||
|
|
||||||
|
//erase_pic_32x32_lib_sector();
|
||||||
|
//HAL_FLASH_Unlock();
|
||||||
|
for(i=0;i<PIC_32X32_BMP_NUM;i++){
|
||||||
|
load_falsh_addr = pic_32x32_bmp_prm[i].flash_address;
|
||||||
|
load_sdram_addr = pic_32x32_bmp_prm[i].start_address;
|
||||||
|
|
||||||
|
for(size = 0;size < FLASH_USER_PIC_32X32_UINT;(size+=32))
|
||||||
|
{
|
||||||
|
write_internal_flash(load_falsh_addr, load_sdram_addr);
|
||||||
|
//W25QXX_Write(((unsigned char*)load_sdram_addr),load_falsh_addr,4096);
|
||||||
|
load_falsh_addr+=32;
|
||||||
|
load_sdram_addr+=32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_logo_bmp(void)
|
||||||
|
{
|
||||||
|
unsigned int y;
|
||||||
|
|
||||||
|
char str_name[20] = "logo/logo24.bmp";
|
||||||
|
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
for(y=0;y<15;y++)
|
||||||
|
{
|
||||||
|
pic_logo24_bmp_prm.name_str[y] = str_name[y];
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_logo24_bmp_prm.start_address = SDRAM_PIC_LOGO24_ADDR_START;
|
||||||
|
|
||||||
|
load_bmpfile_to_sdram(&pic_logo24_bmp_prm);//load bmp file
|
||||||
|
|
||||||
|
str_name[9] = '0'+3;
|
||||||
|
str_name[10]= '0'+2;
|
||||||
|
|
||||||
|
for(y=0;y<15;y++)
|
||||||
|
{
|
||||||
|
pic_logo32_bmp_prm.name_str[y] = str_name[y];
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_logo32_bmp_prm.start_address = SDRAM_PIC_LOGO32_ADDR_START;
|
||||||
|
|
||||||
|
load_bmpfile_to_sdram(&pic_logo32_bmp_prm);//load bmp file
|
||||||
|
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_logo_bmp_to_flash(void)
|
||||||
|
{
|
||||||
|
unsigned int i = 0, size = 0;
|
||||||
|
unsigned int load_falsh_addr = 0;
|
||||||
|
unsigned int load_sdram_addr = 0;
|
||||||
|
|
||||||
|
//erase_pic_32x32_lib_sector();
|
||||||
|
//HAL_FLASH_Unlock();
|
||||||
|
load_falsh_addr = pic_logo24_bmp_prm.flash_address;
|
||||||
|
load_sdram_addr = pic_logo24_bmp_prm.start_address;
|
||||||
|
|
||||||
|
for(size = 0;size < FLASH_USER_PIC_LOGO24_UINT;(size+=32))
|
||||||
|
{
|
||||||
|
write_internal_flash(load_falsh_addr, load_sdram_addr);
|
||||||
|
//W25QXX_Write(((unsigned char*)load_sdram_addr),load_falsh_addr,4096);
|
||||||
|
load_falsh_addr+=32;
|
||||||
|
load_sdram_addr+=32;
|
||||||
|
}
|
||||||
|
|
||||||
|
load_falsh_addr = pic_logo32_bmp_prm.flash_address;
|
||||||
|
load_sdram_addr = pic_logo32_bmp_prm.start_address;
|
||||||
|
|
||||||
|
for(size = 0;size < FLASH_USER_PIC_LOGO32_UINT;(size+=32))
|
||||||
|
{
|
||||||
|
write_internal_flash(load_falsh_addr, load_sdram_addr);
|
||||||
|
//W25QXX_Write(((unsigned char*)load_sdram_addr),load_falsh_addr,4096);
|
||||||
|
load_falsh_addr+=32;
|
||||||
|
load_sdram_addr+=32;
|
||||||
|
}
|
||||||
|
//HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_bmp_to_flash()
|
||||||
|
{
|
||||||
|
erase_pic_lib_sector();
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
load_pic_24x24_bmp_to_flash();
|
||||||
|
load_pic_24x24_bmp_to_flash();
|
||||||
|
load_pic_32x32_bmp_to_flash();
|
||||||
|
load_pic_logo_bmp_to_flash();
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_zone_on_full_screen(uint32_t pic_start_adress,uint32_t start_x,uint32_t start_y,Bmp_Parameter_TypeDef* zone_pic)
|
||||||
|
//IIB on full pic
|
||||||
|
{
|
||||||
|
uint32_t index_width = 0;
|
||||||
|
uint32_t index_height= 0;
|
||||||
|
|
||||||
|
uint32_t area_width = zone_pic->pic_width;
|
||||||
|
uint32_t area_height = zone_pic->pic_height;
|
||||||
|
|
||||||
|
uint32_t back_start_adress = pic_start_adress;
|
||||||
|
//uint32_t surface_start_adress = zone_pic->start_address;
|
||||||
|
uint32_t surface_start_adress = zone_pic->flash_address;
|
||||||
|
|
||||||
|
back_start_adress = back_start_adress + (LCD_TOTAL_WIDTH * start_y * 4) + (start_x * 4);
|
||||||
|
|
||||||
|
for(index_height = 0; index_height < area_height; index_height++)
|
||||||
|
{
|
||||||
|
for (index_width = 0; index_width < area_width; index_width++)
|
||||||
|
{
|
||||||
|
*(__IO uint32_t*) (back_start_adress) = *(__IO uint32_t *)surface_start_adress;
|
||||||
|
|
||||||
|
back_start_adress+=4;
|
||||||
|
surface_start_adress+=4;
|
||||||
|
}
|
||||||
|
back_start_adress = back_start_adress + ((LCD_TOTAL_WIDTH - area_width) * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_16x16_to_dispaly_layer(uint32_t start_x,uint32_t start_y,uint8_t pic_ord)
|
||||||
|
{
|
||||||
|
if(pic_ord >= PIC_16X16_BMP_NUM)return;
|
||||||
|
load_pic_zone_on_full_screen(LCD_LAYER1_ADDR,start_x,start_y,&pic_16x16_bmp_prm[pic_ord]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_24x24_to_dispaly_layer(uint32_t start_x,uint32_t start_y,uint8_t pic_ord)
|
||||||
|
{
|
||||||
|
if(pic_ord >= PIC_24X24_BMP_NUM)return;
|
||||||
|
load_pic_zone_on_full_screen(LCD_LAYER1_ADDR,start_x,start_y,&pic_24x24_bmp_prm[pic_ord]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_32x32_to_dispaly_layer(uint32_t start_x,uint32_t start_y,uint8_t pic_ord)
|
||||||
|
{
|
||||||
|
if(pic_ord >= PIC_32X32_BMP_NUM)return;
|
||||||
|
load_pic_zone_on_full_screen(LCD_LAYER1_ADDR,start_x,start_y,&pic_32x32_bmp_prm[pic_ord]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_logo24_to_dispaly_layer(uint32_t start_x,uint32_t start_y)
|
||||||
|
{
|
||||||
|
load_pic_zone_on_full_screen(LCD_LAYER1_ADDR,start_x,start_y,&pic_logo24_bmp_prm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_pic_logo32_to_dispaly_layer(uint32_t start_x,uint32_t start_y)
|
||||||
|
{
|
||||||
|
load_pic_zone_on_full_screen(LCD_LAYER1_ADDR,start_x,start_y,&pic_logo32_bmp_prm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void read_bmp_load_to_flash(void)
|
||||||
|
{
|
||||||
|
load_pic_16x16_bmp();
|
||||||
|
load_pic_24x24_bmp();
|
||||||
|
load_pic_32x32_bmp();
|
||||||
|
load_pic_logo_bmp();
|
||||||
|
|
||||||
|
load_pic_bmp_to_flash();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_hzk_pic_task(void)//100ms
|
||||||
|
{
|
||||||
|
static unsigned int time_count = 80;
|
||||||
|
static unsigned int once_init = 1;
|
||||||
|
|
||||||
|
if(time_count){
|
||||||
|
time_count--;
|
||||||
|
|
||||||
|
if(APPLICATION_READY == Appli_state){
|
||||||
|
if(!(GPIOH->IDR & 0x0008)){//KEY
|
||||||
|
gui_write_string24(20,0,0xff000000,0xffff0000,"LOADING_HZK_PIC");
|
||||||
|
//mount_usb_file_sys();
|
||||||
|
//read_hzk_load_to_flash();
|
||||||
|
read_bmp_load_to_flash();
|
||||||
|
gui_write_string24(20,0,0xff000000,0xffff0000,"LOAD_COMPLETE ");
|
||||||
|
time_count = 0;
|
||||||
|
}else{
|
||||||
|
pic_prm_init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(once_init){
|
||||||
|
once_init = 0;
|
||||||
|
|
||||||
|
usb_host_to_device();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
FW/Core/my_src/load_gui_lib.h
Normal file
18
FW/Core/my_src/load_gui_lib.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#define FONT_NOR_FLASH_START_ADDR 0
|
||||||
|
|
||||||
|
typedef struct Bmp_Parameter_struct
|
||||||
|
{
|
||||||
|
char name_str[32];
|
||||||
|
unsigned int start_address;
|
||||||
|
unsigned int pic_width;
|
||||||
|
unsigned int pic_height;
|
||||||
|
unsigned int flash_address;
|
||||||
|
}Bmp_Parameter_TypeDef;
|
||||||
|
|
||||||
|
extern void pic_prm_init(void);
|
||||||
|
|
||||||
|
extern void mount_usb_file_sys(void);
|
||||||
|
extern int read_hzk_load_to_flash(void);
|
||||||
|
extern void read_bmp_load_to_flash(void);
|
||||||
|
|
||||||
|
extern void load_hzk_pic_task(void);
|
||||||
373
FW/Core/my_src/ltdc_drv.c
Normal file
373
FW/Core/my_src/ltdc_drv.c
Normal file
@@ -0,0 +1,373 @@
|
|||||||
|
#include "lcd_base_display.h"
|
||||||
|
#include "ltdc_drv.h"
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||||
|
//ALIENTEK 阿波罗STM32H7开发板
|
||||||
|
//LTDC驱动代码
|
||||||
|
//正点原子@ALIENTEK
|
||||||
|
//技术论坛:www.openedv.com
|
||||||
|
//创建日期:2017/8/12
|
||||||
|
//版本:V1.0
|
||||||
|
//版权所有,盗版必究。
|
||||||
|
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||||
|
//All rights reserved
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
LTDC_HandleTypeDef LTDC_Handler; //LTDC句柄
|
||||||
|
|
||||||
|
//根据不同的颜色格式,定义帧缓存数组
|
||||||
|
#if LCD_PIXFORMAT==LCD_PIXFORMAT_ARGB8888||LCD_PIXFORMAT==LCD_PIXFORMAT_RGB888
|
||||||
|
//unsigned int ltdc_lcd_framebuf[800][480] __attribute__((at(LCD_FRAME_BUF_ADDR))); //定义最大屏分辨率时,LCD所需的帧缓存数组大小
|
||||||
|
static unsigned int * const my_address = (unsigned int *) (LCD_FRAME_BUF_ADDR);
|
||||||
|
#define ltdc_lcd_framebuf (*my_address)
|
||||||
|
|
||||||
|
static unsigned int * const my_address_2 = (unsigned int *) (LCD_FRAME_BUF_2_ADDR);
|
||||||
|
#define ltdc_lcd_framebuf_2 (*my_address_2)
|
||||||
|
#else
|
||||||
|
unsigned short ltdc_lcd_framebuf[1280][800] __attribute__((at(LCD_FRAME_BUF_ADDR))); //定义最大屏分辨率时,LCD所需的帧缓存数组大小
|
||||||
|
#endif
|
||||||
|
|
||||||
|
unsigned int *ltdc_framebuf[2]; //LTDC LCD帧缓存数组指针,必须指向对应大小的内存区域
|
||||||
|
_ltdc_dev lcdltdc; //管理LCD LTDC的重要参数
|
||||||
|
|
||||||
|
//打开LCD开关
|
||||||
|
//lcd_switch:1 打开,0,关闭
|
||||||
|
void LTDC_Switch(unsigned char sw)
|
||||||
|
{
|
||||||
|
if(sw==1) __HAL_LTDC_ENABLE(<DC_Handler);
|
||||||
|
else if(sw==0)__HAL_LTDC_DISABLE(<DC_Handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
//开关指定层
|
||||||
|
//layerx:层号,0,第一层; 1,第二层
|
||||||
|
//sw:1 打开;0关闭
|
||||||
|
void LTDC_Layer_Switch(unsigned char layerx,unsigned char sw)
|
||||||
|
{
|
||||||
|
if(sw==1) __HAL_LTDC_LAYER_ENABLE(<DC_Handler,layerx);
|
||||||
|
else if(sw==0) __HAL_LTDC_LAYER_DISABLE(<DC_Handler,layerx);
|
||||||
|
__HAL_LTDC_RELOAD_CONFIG(<DC_Handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
//选择层
|
||||||
|
//layerx:层号;0,第一层;1,第二层;
|
||||||
|
void LTDC_Select_Layer(unsigned char layerx)
|
||||||
|
{
|
||||||
|
lcdltdc.activelayer=layerx;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置LCD显示方向
|
||||||
|
//dir:0,竖屏;1,横屏
|
||||||
|
void LTDC_Display_Dir(unsigned char dir)
|
||||||
|
{
|
||||||
|
lcdltdc.dir=dir; //显示方向
|
||||||
|
if(dir==0) //竖屏
|
||||||
|
{
|
||||||
|
lcdltdc.width=lcdltdc.pheight;
|
||||||
|
lcdltdc.height=lcdltdc.pwidth;
|
||||||
|
}else if(dir==1) //横屏
|
||||||
|
{
|
||||||
|
lcdltdc.width=lcdltdc.pwidth;
|
||||||
|
lcdltdc.height=lcdltdc.pheight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//画点函数
|
||||||
|
//x,y:坐标
|
||||||
|
//color:颜色值
|
||||||
|
void LTDC_Draw_Point(unsigned short x,unsigned short y,unsigned int color)
|
||||||
|
{
|
||||||
|
#if LCD_PIXFORMAT==LCD_PIXFORMAT_ARGB8888||LCD_PIXFORMAT==LCD_PIXFORMAT_RGB888
|
||||||
|
if(lcdltdc.dir) //横屏
|
||||||
|
{
|
||||||
|
*(unsigned int*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*y+x))=color;
|
||||||
|
}else //竖屏
|
||||||
|
{
|
||||||
|
*(unsigned int*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*(lcdltdc.pheight-x-1)+y))=color;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(lcdltdc.dir) //横屏
|
||||||
|
{
|
||||||
|
*(unsigned short*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*y+x))=color;
|
||||||
|
}else //竖屏
|
||||||
|
{
|
||||||
|
*(unsigned short*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*(lcdltdc.pheight-x-1)+y))=color;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//读点函数
|
||||||
|
//返回值:颜色值
|
||||||
|
unsigned int LTDC_Read_Point(unsigned short x,unsigned short y)
|
||||||
|
{
|
||||||
|
#if LCD_PIXFORMAT==LCD_PIXFORMAT_ARGB8888||LCD_PIXFORMAT==LCD_PIXFORMAT_RGB888
|
||||||
|
if(lcdltdc.dir) //横屏
|
||||||
|
{
|
||||||
|
return *(unsigned int*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*y+x));
|
||||||
|
}else //竖屏
|
||||||
|
{
|
||||||
|
return *(unsigned int*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*(lcdltdc.pheight-x-1)+y));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(lcdltdc.dir) //横屏
|
||||||
|
{
|
||||||
|
return *(unsigned short*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*y+x));
|
||||||
|
}else //竖屏
|
||||||
|
{
|
||||||
|
return *(unsigned short*)((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*(lcdltdc.pheight-x-1)+y));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//LTDC填充矩形,DMA2D填充
|
||||||
|
//(sx,sy),(ex,ey):填充矩形对角坐标,区域大小为:(ex-sx+1)*(ey-sy+1)
|
||||||
|
//注意:sx,ex,不能大于lcddev.width-1;sy,ey,不能大于lcddev.height-1!!!
|
||||||
|
//color:要填充的颜色
|
||||||
|
void LTDC_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned int color)
|
||||||
|
{
|
||||||
|
unsigned int psx,psy,pex,pey; //以LCD面板为基准的坐标系,不随横竖屏变化而变化
|
||||||
|
unsigned int timeout=0;
|
||||||
|
unsigned short offline;
|
||||||
|
unsigned int addr;
|
||||||
|
//坐标系转换
|
||||||
|
if(lcdltdc.dir) //横屏
|
||||||
|
{
|
||||||
|
psx=sx;psy=sy;
|
||||||
|
pex=ex;pey=ey;
|
||||||
|
}else //竖屏
|
||||||
|
{
|
||||||
|
psx=sy;psy=lcdltdc.pheight-ex-1;
|
||||||
|
pex=ey;pey=lcdltdc.pheight-sx-1;
|
||||||
|
}
|
||||||
|
offline=lcdltdc.pwidth-(pex-psx+1);
|
||||||
|
addr=((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*psy+psx));
|
||||||
|
RCC->AHB1ENR|=1<<23; //使能DM2D时钟
|
||||||
|
DMA2D->CR=3<<16; //寄存器到存储器模式
|
||||||
|
DMA2D->OPFCCR=LCD_PIXFORMAT; //设置颜色格式
|
||||||
|
DMA2D->OOR=offline; //设置行偏移
|
||||||
|
DMA2D->CR&=~(1<<0); //先停止DMA2D
|
||||||
|
DMA2D->OMAR=addr; //输出存储器地址
|
||||||
|
DMA2D->NLR=(pey-psy+1)|((pex-psx+1)<<16); //设定行数寄存器
|
||||||
|
DMA2D->OCOLR=color; //设定输出颜色寄存器
|
||||||
|
DMA2D->CR|=1<<0; //启动DMA2D
|
||||||
|
while((DMA2D->ISR&(1<<1))==0) //等待传输完成
|
||||||
|
{
|
||||||
|
timeout++;
|
||||||
|
if(timeout>0X1FFFFF)break; //超时退出
|
||||||
|
}
|
||||||
|
DMA2D->IFCR|=1<<1; //清除传输完成标志
|
||||||
|
}
|
||||||
|
//在指定区域内填充单个颜色
|
||||||
|
//(sx,sy),(ex,ey):填充矩形对角坐标,区域大小为:(ex-sx+1)*(ey-sy+1)
|
||||||
|
//color:要填充的颜色
|
||||||
|
//void LTDC_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned int color)
|
||||||
|
//{
|
||||||
|
// unsigned int psx,psy,pex,pey; //以LCD面板为基准的坐标系,不随横竖屏变化而变化
|
||||||
|
// unsigned int timeout=0;
|
||||||
|
// unsigned short offline;
|
||||||
|
// unsigned int addr;
|
||||||
|
// if(ex>=lcdltdc.width)ex=lcdltdc.width-1;
|
||||||
|
// if(ey>=lcdltdc.height)ey=lcdltdc.height-1;
|
||||||
|
// //坐标系转换
|
||||||
|
// if(lcdltdc.dir) //横屏
|
||||||
|
// {
|
||||||
|
// psx=sx;psy=sy;
|
||||||
|
// pex=ex;pey=ey;
|
||||||
|
// }else //竖屏
|
||||||
|
// {
|
||||||
|
// psx=sy;psy=lcdltdc.pheight-ex-1;
|
||||||
|
// pex=ey;pey=lcdltdc.pheight-sx-1;
|
||||||
|
// }
|
||||||
|
// offline=lcdltdc.pwidth-(pex-psx+1);
|
||||||
|
// addr=((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*psy+psx));
|
||||||
|
// if(LCD_PIXFORMAT==LCD_PIXEL_FORMAT_RGB565) //如果是RGB565格式的话需要进行颜色转换,将16bit转换为32bit的
|
||||||
|
// {
|
||||||
|
// color=((color&0X0000F800)<<8)|((color&0X000007E0)<<5)|((color&0X0000001F)<<3);
|
||||||
|
// }
|
||||||
|
// //配置DMA2D的模式
|
||||||
|
// DMA2D_Handler.Instance=DMA2D;
|
||||||
|
// DMA2D_Handler.Init.Mode=DMA2D_R2M; //内存到存储器模式
|
||||||
|
// DMA2D_Handler.Init.ColorMode=LCD_PIXFORMAT; //设置颜色格式
|
||||||
|
// DMA2D_Handler.Init.OutputOffset=offline; //输出偏移
|
||||||
|
// HAL_DMA2D_Init(&DMA2D_Handler); //初始化DMA2D
|
||||||
|
// HAL_DMA2D_ConfigLayer(&DMA2D_Handler,lcdltdc.activelayer); //层配置
|
||||||
|
// HAL_DMA2D_Start(&DMA2D_Handler,color,(unsigned int)addr,pex-psx+1,pey-psy+1);//开启传输
|
||||||
|
// HAL_DMA2D_PollForTransfer(&DMA2D_Handler,1000);//传输数据
|
||||||
|
// while((__HAL_DMA2D_GET_FLAG(&DMA2D_Handler,DMA2D_FLAG_TC)==0)&&(timeout<0X5000))//等待DMA2D完成
|
||||||
|
// {
|
||||||
|
// timeout++;
|
||||||
|
// }
|
||||||
|
// __HAL_DMA2D_CLEAR_FLAG(&DMA2D_Handler,DMA2D_FLAG_TC); //清除传输完成标志
|
||||||
|
//}
|
||||||
|
|
||||||
|
//在指定区域内填充指定颜色块,DMA2D填充
|
||||||
|
//此函数仅支持unsigned short,RGB565格式的颜色数组填充.
|
||||||
|
//(sx,sy),(ex,ey):填充矩形对角坐标,区域大小为:(ex-sx+1)*(ey-sy+1)
|
||||||
|
//注意:sx,ex,不能大于lcddev.width-1;sy,ey,不能大于lcddev.height-1!!!
|
||||||
|
//color:要填充的颜色数组首地址
|
||||||
|
void LTDC_Color_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned short *color)
|
||||||
|
{
|
||||||
|
unsigned int psx,psy,pex,pey; //以LCD面板为基准的坐标系,不随横竖屏变化而变化
|
||||||
|
unsigned int timeout=0;
|
||||||
|
unsigned short offline;
|
||||||
|
unsigned int addr;
|
||||||
|
//坐标系转换
|
||||||
|
if(lcdltdc.dir) //横屏
|
||||||
|
{
|
||||||
|
psx=sx;psy=sy;
|
||||||
|
pex=ex;pey=ey;
|
||||||
|
}else //竖屏
|
||||||
|
{
|
||||||
|
psx=sy;psy=lcdltdc.pheight-ex-1;
|
||||||
|
pex=ey;pey=lcdltdc.pheight-sx-1;
|
||||||
|
}
|
||||||
|
offline=lcdltdc.pwidth-(pex-psx+1);
|
||||||
|
addr=((unsigned int)ltdc_framebuf[lcdltdc.activelayer]+lcdltdc.pixsize*(lcdltdc.pwidth*psy+psx));
|
||||||
|
RCC->AHB1ENR|=1<<23; //使能DM2D时钟
|
||||||
|
DMA2D->CR=0<<16; //存储器到存储器模式
|
||||||
|
DMA2D->FGPFCCR=LCD_PIXFORMAT; //设置颜色格式
|
||||||
|
DMA2D->FGOR=0; //前景层行偏移为0
|
||||||
|
DMA2D->OOR=offline; //设置行偏移
|
||||||
|
DMA2D->CR&=~(1<<0); //先停止DMA2D
|
||||||
|
DMA2D->FGMAR=(unsigned int)color; //源地址
|
||||||
|
DMA2D->OMAR=addr; //输出存储器地址
|
||||||
|
DMA2D->NLR=(pey-psy+1)|((pex-psx+1)<<16); //设定行数寄存器
|
||||||
|
DMA2D->CR|=1<<0; //启动DMA2D
|
||||||
|
while((DMA2D->ISR&(1<<1))==0) //等待传输完成
|
||||||
|
{
|
||||||
|
timeout++;
|
||||||
|
if(timeout>0X1FFFFF)break; //超时退出
|
||||||
|
}
|
||||||
|
DMA2D->IFCR|=1<<1; //清除传输完成标志
|
||||||
|
}
|
||||||
|
|
||||||
|
//LCD清屏
|
||||||
|
//color:颜色值
|
||||||
|
void LTDC_Clear(unsigned int color)
|
||||||
|
{
|
||||||
|
LTDC_Fill(0,0,lcdltdc.width-1,lcdltdc.height-1,color);
|
||||||
|
}
|
||||||
|
|
||||||
|
//LTDC时钟(Fdclk)设置函数
|
||||||
|
//PLL3_VCO Input=HSE_VALUE/PLL3M
|
||||||
|
//PLL3_VCO Output=PLL3_VCO Input * PLL3N
|
||||||
|
//PLLLCDCLK = PLL3_VCO Output/PLL3R
|
||||||
|
//假如HSE_VALUE=25MHz,PLL3M=5,PLL3N=160,PLL3R=88
|
||||||
|
//LTDCLK=PLLLCDCLK=25/5*160/88=9MHz
|
||||||
|
//返回值:0,成功;1,失败。
|
||||||
|
unsigned char LTDC_Clk_Set(unsigned int pll3m,unsigned int pll3n,unsigned int pll3r)
|
||||||
|
{
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkIniture;
|
||||||
|
PeriphClkIniture.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
|
||||||
|
PeriphClkIniture.PLL3.PLL3M = pll3m;
|
||||||
|
PeriphClkIniture.PLL3.PLL3N = pll3n;
|
||||||
|
PeriphClkIniture.PLL3.PLL3P = 2;
|
||||||
|
PeriphClkIniture.PLL3.PLL3Q = 2;
|
||||||
|
PeriphClkIniture.PLL3.PLL3R = pll3r;
|
||||||
|
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkIniture)==HAL_OK) //配置像素时钟,这里配置为时钟为18.75MHZ
|
||||||
|
{
|
||||||
|
return 0; //成功
|
||||||
|
}
|
||||||
|
else return 1; //失败
|
||||||
|
}
|
||||||
|
|
||||||
|
//LTDC,层颜窗口设置,窗口以LCD面板坐标系为基准
|
||||||
|
//注意:此函数必须在LTDC_Layer_Parameter_Config之后再设置.
|
||||||
|
//layerx:层值,0/1.
|
||||||
|
//sx,sy:起始坐标
|
||||||
|
//width,height:宽度和高度
|
||||||
|
void LTDC_Layer_Window_Config(unsigned char layerx,unsigned short sx,unsigned short sy,unsigned short width,unsigned short height)
|
||||||
|
{
|
||||||
|
HAL_LTDC_SetWindowPosition(<DC_Handler,sx,sy,layerx); //设置窗口的位置
|
||||||
|
HAL_LTDC_SetWindowSize(<DC_Handler,width,height,layerx);//设置窗口大小
|
||||||
|
}
|
||||||
|
|
||||||
|
//LTDC,基本参数设置.
|
||||||
|
//注意:此函数,必须在LTDC_Layer_Window_Config之前设置.
|
||||||
|
//layerx:层值,0/1.
|
||||||
|
//bufaddr:层颜色帧缓存起始地址
|
||||||
|
//pixformat:颜色格式.0,ARGB8888;1,RGB888;2,RGB565;3,ARGB1555;4,ARGB4444;5,L8;6;AL44;7;AL88
|
||||||
|
//alpha:层颜色Alpha值,0,全透明;255,不透明
|
||||||
|
//alpha0:默认颜色Alpha值,0,全透明;255,不透明
|
||||||
|
//bfac1:混合系数1,4(100),恒定的Alpha;6(101),像素Alpha*恒定Alpha
|
||||||
|
//bfac2:混合系数2,5(101),恒定的Alpha;7(111),像素Alpha*恒定Alpha
|
||||||
|
//bkcolor:层默认颜色,32位,低24位有效,RGB888格式
|
||||||
|
//返回值:无
|
||||||
|
void LTDC_Layer_Parameter_Config(unsigned char layerx,unsigned int bufaddr,unsigned char pixformat,unsigned char alpha,unsigned char alpha0,unsigned char bfac1,unsigned char bfac2,unsigned int bkcolor)
|
||||||
|
{
|
||||||
|
LTDC_LayerCfgTypeDef pLayerCfg;
|
||||||
|
|
||||||
|
pLayerCfg.WindowX0=0; //窗口起始X坐标
|
||||||
|
pLayerCfg.WindowY0=0; //窗口起始Y坐标
|
||||||
|
pLayerCfg.WindowX1=lcdltdc.pwidth; //窗口终止X坐标
|
||||||
|
pLayerCfg.WindowY1=lcdltdc.pheight; //窗口终止Y坐标
|
||||||
|
pLayerCfg.PixelFormat=pixformat; //像素格式
|
||||||
|
pLayerCfg.Alpha=alpha; //Alpha值设置,0~255,255为完全不透明
|
||||||
|
pLayerCfg.Alpha0=alpha0; //默认Alpha值
|
||||||
|
pLayerCfg.BlendingFactor1=(unsigned int)bfac1<<8; //设置层混合系数
|
||||||
|
pLayerCfg.BlendingFactor2=(unsigned int)bfac2<<8; //设置层混合系数
|
||||||
|
pLayerCfg.FBStartAdress=bufaddr; //设置层颜色帧缓存起始地址
|
||||||
|
pLayerCfg.ImageWidth=lcdltdc.pwidth; //设置颜色帧缓冲区的宽度
|
||||||
|
pLayerCfg.ImageHeight=lcdltdc.pheight; //设置颜色帧缓冲区的高度
|
||||||
|
pLayerCfg.Backcolor.Red=(unsigned char)(bkcolor&0X00FF0000)>>16; //背景颜色红色部分
|
||||||
|
pLayerCfg.Backcolor.Green=(unsigned char)(bkcolor&0X0000FF00)>>8; //背景颜色绿色部分
|
||||||
|
pLayerCfg.Backcolor.Blue=(unsigned char)bkcolor&0X000000FF; //背景颜色蓝色部分
|
||||||
|
HAL_LTDC_ConfigLayer(<DC_Handler,&pLayerCfg,layerx); //设置所选中的层
|
||||||
|
}
|
||||||
|
|
||||||
|
//LCD初始化函数
|
||||||
|
void LTDC_Init(void)
|
||||||
|
{
|
||||||
|
unsigned short lcdid=0;
|
||||||
|
|
||||||
|
lcdltdc.pwidth=800; //面板宽度,单位:像素
|
||||||
|
lcdltdc.pheight=480; //面板高度,单位:像素
|
||||||
|
lcdltdc.hsw=1; //水平同步宽度
|
||||||
|
lcdltdc.hbp=46; //水平后廊
|
||||||
|
lcdltdc.hfp=210; //水平前廊
|
||||||
|
lcdltdc.vsw=1; //垂直同步宽度
|
||||||
|
lcdltdc.vbp=23; //垂直后廊
|
||||||
|
lcdltdc.vfp=22; //垂直前廊
|
||||||
|
//LTDC_Clk_Set(5,160,47);//设置像素时钟 17Mhz
|
||||||
|
|
||||||
|
lcddev.width=lcdltdc.pwidth;
|
||||||
|
lcddev.height=lcdltdc.pheight;
|
||||||
|
|
||||||
|
#if LCD_PIXFORMAT==LCD_PIXFORMAT_ARGB8888||LCD_PIXFORMAT==LCD_PIXFORMAT_RGB888
|
||||||
|
ltdc_framebuf[0]=(unsigned int*)<dc_lcd_framebuf;
|
||||||
|
ltdc_framebuf[1]=(unsigned int*)<dc_lcd_framebuf_2;
|
||||||
|
lcdltdc.pixsize=4; //每个像素占4个字节
|
||||||
|
#else
|
||||||
|
lcdltdc.pixsize=2; //每个像素占2个字节
|
||||||
|
ltdc_framebuf[0]=(unsigned int*)<dc_lcd_framebuf;
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
//LTDC配置
|
||||||
|
LTDC_Handler.Instance=LTDC;
|
||||||
|
LTDC_Handler.Init.HSPolarity=LTDC_HSPOLARITY_AL; //水平同步极性
|
||||||
|
LTDC_Handler.Init.VSPolarity=LTDC_VSPOLARITY_AL; //垂直同步极性
|
||||||
|
LTDC_Handler.Init.DEPolarity=LTDC_DEPOLARITY_AL; //数据使能极性
|
||||||
|
LTDC_Handler.Init.PCPolarity=LTDC_PCPOLARITY_IPC; //像素时钟极性
|
||||||
|
//if(lcdid==0X1018)LTDC_Handler.Init.PCPolarity=LTDC_PCPOLARITY_IIPC; //像素时钟极性相反
|
||||||
|
LTDC_Handler.Init.HorizontalSync=lcdltdc.hsw-1; //水平同步宽度
|
||||||
|
LTDC_Handler.Init.VerticalSync=lcdltdc.vsw-1; //垂直同步宽度
|
||||||
|
LTDC_Handler.Init.AccumulatedHBP=lcdltdc.hsw+lcdltdc.hbp-1; //水平同步后沿宽度
|
||||||
|
LTDC_Handler.Init.AccumulatedVBP=lcdltdc.vsw+lcdltdc.vbp-1; //垂直同步后沿高度
|
||||||
|
LTDC_Handler.Init.AccumulatedActiveW=lcdltdc.hsw+lcdltdc.hbp+lcdltdc.pwidth-1;//有效宽度
|
||||||
|
LTDC_Handler.Init.AccumulatedActiveH=lcdltdc.vsw+lcdltdc.vbp+lcdltdc.pheight-1;//有效高度
|
||||||
|
LTDC_Handler.Init.TotalWidth=lcdltdc.hsw+lcdltdc.hbp+lcdltdc.pwidth+lcdltdc.hfp-1; //总宽度
|
||||||
|
LTDC_Handler.Init.TotalHeigh=lcdltdc.vsw+lcdltdc.vbp+lcdltdc.pheight+lcdltdc.vfp-1; //总高度
|
||||||
|
LTDC_Handler.Init.Backcolor.Red=0; //屏幕背景层红色部分
|
||||||
|
LTDC_Handler.Init.Backcolor.Green=0; //屏幕背景层绿色部分
|
||||||
|
LTDC_Handler.Init.Backcolor.Blue=0; //屏幕背景色蓝色部分
|
||||||
|
HAL_LTDC_Init(<DC_Handler);
|
||||||
|
|
||||||
|
//层配置
|
||||||
|
//LTDC_Layer_Parameter_Config(0,(unsigned int)ltdc_framebuf[0],LCD_PIXFORMAT,255,0,6,7,0X000000);//层参数配置
|
||||||
|
//LTDC_Layer_Window_Config(0,0,0,lcdltdc.pwidth,lcdltdc.pheight); //层窗口配置,以LCD面板坐标系为基准,不要随便修改!
|
||||||
|
*/
|
||||||
|
|
||||||
|
LTDC_Display_Dir(1); //默认横屏
|
||||||
|
LTDC_Select_Layer(1); //选择第2层
|
||||||
|
LTDC_Clear(0); //清屏
|
||||||
|
LTDC_Select_Layer(0); //选择第1层
|
||||||
|
LTDC_Clear(0XFF000000); //清屏
|
||||||
|
}
|
||||||
76
FW/Core/my_src/ltdc_drv.h
Normal file
76
FW/Core/my_src/ltdc_drv.h
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#ifndef _LCD_H
|
||||||
|
#define _LCD_H
|
||||||
|
//#include "sys.h"
|
||||||
|
#include "main.h"
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||||
|
//ALIENTEK STM32H7开发板
|
||||||
|
//LCD驱动代码
|
||||||
|
//正点原子@ALIENTEK
|
||||||
|
//技术论坛:www.openedv.com
|
||||||
|
//创建日期:2017/8/12
|
||||||
|
//版本:V1.0
|
||||||
|
//版权所有,盗版必究。
|
||||||
|
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||||
|
//All rights reserved
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#define LCD_LED(n) (n?HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_SET):HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_RESET)) //LCD背光PD13 //LCD背光PD13
|
||||||
|
|
||||||
|
//LCD LTDC重要参数集
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned int pwidth; //LCD面板的宽度,固定参数,不随显示方向改变,如果为0,说明没有任何RGB屏接入
|
||||||
|
unsigned int pheight; //LCD面板的高度,固定参数,不随显示方向改变
|
||||||
|
unsigned short hsw; //水平同步宽度
|
||||||
|
unsigned short vsw; //垂直同步宽度
|
||||||
|
unsigned short hbp; //水平后廊
|
||||||
|
unsigned short vbp; //垂直后廊
|
||||||
|
unsigned short hfp; //水平前廊
|
||||||
|
unsigned short vfp; //垂直前廊
|
||||||
|
unsigned char activelayer; //当前层编号:0/1
|
||||||
|
unsigned char dir; //0,竖屏;1,横屏;
|
||||||
|
unsigned short width; //LCD宽度
|
||||||
|
unsigned short height; //LCD高度
|
||||||
|
unsigned int pixsize; //每个像素所占字节数
|
||||||
|
}_ltdc_dev;
|
||||||
|
|
||||||
|
extern _ltdc_dev lcdltdc; //管理LCD LTDC参数
|
||||||
|
extern LTDC_HandleTypeDef LTDC_Handler; //LTDC句柄
|
||||||
|
extern unsigned int *ltdc_framebuf[2]; //LTDC LCD帧缓存数组指针,必须指向对应大小的内存区域
|
||||||
|
|
||||||
|
#define LCD_PIXEL_FORMAT_ARGB8888 0X00
|
||||||
|
#define LCD_PIXEL_FORMAT_RGB888 0X01
|
||||||
|
#define LCD_PIXEL_FORMAT_RGB565 0X02
|
||||||
|
#define LCD_PIXEL_FORMAT_ARGB1555 0X03
|
||||||
|
#define LCD_PIXEL_FORMAT_ARGB4444 0X04
|
||||||
|
#define LCD_PIXEL_FORMAT_L8 0X05
|
||||||
|
#define LCD_PIXEL_FORMAT_AL44 0X06
|
||||||
|
#define LCD_PIXEL_FORMAT_AL88 0X07
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
//用户修改配置部分:
|
||||||
|
|
||||||
|
//定义颜色像素格式,一般用RGB565
|
||||||
|
#define LCD_PIXFORMAT LCD_PIXEL_FORMAT_ARGB8888
|
||||||
|
//定义默认背景层颜色
|
||||||
|
#define LTDC_BACKLAYERCOLOR 0X00000000
|
||||||
|
//LCD帧缓冲区首地址,这里定义在SDRAM里面.
|
||||||
|
#define LCD_FRAME_BUF_ADDR 0XC0000000
|
||||||
|
#define LCD_FRAME_BUF_2_ADDR 0XC0177000
|
||||||
|
|
||||||
|
void LTDC_Switch(unsigned char sw); //LTDC开关
|
||||||
|
void LTDC_Layer_Switch(unsigned char layerx,unsigned char sw); //层开关
|
||||||
|
void LTDC_Select_Layer(unsigned char layerx); //层选择
|
||||||
|
void LTDC_Display_Dir(unsigned char dir); //显示方向控制
|
||||||
|
void LTDC_Draw_Point(unsigned short x,unsigned short y,unsigned int color);//画点函数
|
||||||
|
unsigned int LTDC_Read_Point(unsigned short x,unsigned short y); //读点函数
|
||||||
|
void LTDC_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned int color); //矩形单色填充函数
|
||||||
|
void LTDC_Color_Fill(unsigned short sx,unsigned short sy,unsigned short ex,unsigned short ey,unsigned short *color); //矩形彩色填充函数
|
||||||
|
void LTDC_Clear(unsigned int color); //清屏函数
|
||||||
|
unsigned char LTDC_Clk_Set(unsigned int pll3m,unsigned int pll3n,unsigned int pll3r);//LTDC时钟配置
|
||||||
|
//unsigned char LTDC_Clk_Set(unsigned int pllsain,unsigned int pllsair,unsigned int pllsaidivr);//LTDC时钟配置
|
||||||
|
void LTDC_Layer_Window_Config(unsigned char layerx,unsigned short sx,unsigned short sy,unsigned short width,unsigned short height);//LTDC层窗口设置
|
||||||
|
void LTDC_Layer_Parameter_Config(unsigned char layerx,unsigned int bufaddr,unsigned char pixformat,unsigned char alpha,unsigned char alpha0,unsigned char bfac1,unsigned char bfac2,unsigned int bkcolor);//LTDC基本参数设置
|
||||||
|
unsigned short LTDC_PanelID_Read(void); //LCD ID读取函数
|
||||||
|
void LTDC_Init(void); //LTDC初始化函数
|
||||||
|
#endif
|
||||||
66
FW/Core/my_src/relay_task.c
Normal file
66
FW/Core/my_src/relay_task.c
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "relay_task.h"
|
||||||
|
|
||||||
|
#define RELAY1_ON() LL_TIM_OC_SetCompareCH1(TIM2,255)
|
||||||
|
#define RELAY1_OFF() LL_TIM_OC_SetCompareCH1(TIM2,0)
|
||||||
|
#define RELAY1_HOLD() LL_TIM_OC_SetCompareCH1(TIM2,200)
|
||||||
|
|
||||||
|
#define RELAY2_ON() LL_TIM_OC_SetCompareCH1(TIM12,255)
|
||||||
|
#define RELAY2_OFF() LL_TIM_OC_SetCompareCH1(TIM12,0)
|
||||||
|
#define RELAY2_HOLD() LL_TIM_OC_SetCompareCH1(TIM12,200)
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned char fault;
|
||||||
|
unsigned char alarm;
|
||||||
|
unsigned char dump0;
|
||||||
|
unsigned char dump1;
|
||||||
|
}TSys_Relay_State_Struct;
|
||||||
|
|
||||||
|
TSys_Relay_State_Struct relay_state = {0,0};
|
||||||
|
|
||||||
|
void set_Relay_alarm_state(unsigned char aSta)
|
||||||
|
{
|
||||||
|
relay_state.alarm = aSta;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_Relay_fault_state(unsigned char aSta)
|
||||||
|
{
|
||||||
|
relay_state.fault = aSta;
|
||||||
|
}
|
||||||
|
|
||||||
|
void alarm_relay_output_handle(void)
|
||||||
|
{
|
||||||
|
static unsigned int relay_tick = 0;
|
||||||
|
|
||||||
|
if(relay_state.alarm){
|
||||||
|
if(relay_tick < 200)relay_tick++;
|
||||||
|
}else{
|
||||||
|
relay_tick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(0 == relay_tick)RELAY1_OFF();
|
||||||
|
else if(relay_tick < 100)RELAY1_ON();
|
||||||
|
else RELAY1_HOLD();
|
||||||
|
}
|
||||||
|
|
||||||
|
void fault_relay_output_handle(void)
|
||||||
|
{
|
||||||
|
static unsigned int relay_tick = 0;
|
||||||
|
|
||||||
|
if(relay_state.fault){
|
||||||
|
if(relay_tick < 200)relay_tick++;
|
||||||
|
}else{
|
||||||
|
relay_tick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(0 == relay_tick)RELAY2_OFF();
|
||||||
|
else if(relay_tick < 100)RELAY2_ON();
|
||||||
|
else RELAY2_HOLD();
|
||||||
|
}
|
||||||
|
|
||||||
|
void relay_output_handle(void)//100ms
|
||||||
|
{
|
||||||
|
alarm_relay_output_handle();
|
||||||
|
fault_relay_output_handle();
|
||||||
|
}
|
||||||
8
FW/Core/my_src/relay_task.h
Normal file
8
FW/Core/my_src/relay_task.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef RELAY_TASK_H_
|
||||||
|
#define RELAY_TASK_H_
|
||||||
|
|
||||||
|
extern void relay_output_handle(void);
|
||||||
|
extern void set_Relay_alarm_state(unsigned char aSta);
|
||||||
|
extern void set_Relay_fault_state(unsigned char aSta);
|
||||||
|
|
||||||
|
#endif
|
||||||
24
FW/Core/my_src/sdram_addr_map.h
Normal file
24
FW/Core/my_src/sdram_addr_map.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef __SDRAM_ADDR_MAP_H
|
||||||
|
#define __SDRAM_ADDR_MAP_H
|
||||||
|
|
||||||
|
//#define SDRAM_BUF_RECORD_ADDRESS ((uint32_t)0xC2000000)
|
||||||
|
//#define SDRAM_BUF_RECORD_SIZE ((uint32_t)0x00020000)//128kbyte
|
||||||
|
|
||||||
|
#define SDRAM_PIC_16X16_ADDR_START ((uint32_t)0xC3E00000) //num128(16*16) 24bit
|
||||||
|
#define SDRAM_PIC_16X16_MEM_UNIT ((uint32_t)0x400)
|
||||||
|
|
||||||
|
#define SDRAM_PIC_24X24_ADDR_START ((uint32_t)0xC3E20000)//num128(24*24) 24bit
|
||||||
|
#define SDRAM_PIC_24X24_MEM_UNIT ((uint32_t)0x900)
|
||||||
|
|
||||||
|
#define SDRAM_PIC_32X32_ADDR_START ((uint32_t)0xC3E60000)//num32(32*32) 24bit
|
||||||
|
#define SDRAM_PIC_32X32_MEM_UNIT ((uint32_t)0x1000)
|
||||||
|
|
||||||
|
#define SDRAM_PIC_LOGO24_ADDR_START ((uint32_t)0xC3E80000)//num1(24*90) 24bit
|
||||||
|
#define SDRAM_PIC_LOGO24_MEM_UNIT ((uint32_t)0x2800)
|
||||||
|
|
||||||
|
#define SDRAM_PIC_LOGO32_ADDR_START ((uint32_t)0xC3E90000)//num1(122*32) 24bit
|
||||||
|
#define SDRAM_PIC_LOGO32_MEM_UNIT ((uint32_t)0x4000)
|
||||||
|
|
||||||
|
#define SDRAM_BUF_CACHE_ADDRESS ((uint32_t)0xC3F00000)
|
||||||
|
|
||||||
|
#endif
|
||||||
179
FW/Core/my_src/task.c
Normal file
179
FW/Core/my_src/task.c
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "rtc.h"
|
||||||
|
#include "HW_config.h"
|
||||||
|
#include "w25qxx.h"
|
||||||
|
#include "load_gui_lib.h"
|
||||||
|
#include "fdcan_task.h"
|
||||||
|
#include "uart_printer_drv.h"
|
||||||
|
#include "uart_fecbus_drv.h"
|
||||||
|
#include "uart_fec_std_drv.h"
|
||||||
|
#include "uart_lp_test_drv.h"
|
||||||
|
#include "uart_task.h"
|
||||||
|
#include "relay_task.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
unsigned int sys_tick_1ms_rdy = 0;
|
||||||
|
unsigned int sys_tick_10ms_rdy = 0;
|
||||||
|
unsigned int sys_tick_100ms_rdy = 0;
|
||||||
|
unsigned int sys_tick_200ms_rdy = 0;
|
||||||
|
unsigned int sys_tick_1s_rdy = 0;
|
||||||
|
unsigned int sys_tick_600S_rdy = 0;
|
||||||
|
|
||||||
|
volatile unsigned int sys_oldtime = 0;
|
||||||
|
volatile unsigned int sys_free_run_ms = 0;
|
||||||
|
volatile unsigned int sys_test_sp_time = 0;
|
||||||
|
|
||||||
|
unsigned int UserRequestReset = 0;
|
||||||
|
unsigned int SysLoopTick = 0;
|
||||||
|
|
||||||
|
unsigned char datatemp[128];
|
||||||
|
unsigned char tx_test_data[16] = {0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,\
|
||||||
|
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55};
|
||||||
|
|
||||||
|
void my_sys_tick(void)
|
||||||
|
{
|
||||||
|
static unsigned int sys_tick_10ms_tick = 0;
|
||||||
|
static unsigned int sys_tick_100ms_tick = 0;
|
||||||
|
static unsigned int sys_tick_200ms_tick = 0;
|
||||||
|
static unsigned int sys_tick_1s_tick = 0;
|
||||||
|
static unsigned int sys_tick_600S_tick = 0;
|
||||||
|
|
||||||
|
static unsigned int norflash_err_tick[2] = {0,0};
|
||||||
|
|
||||||
|
sys_tick_1ms_rdy = 1;
|
||||||
|
sys_free_run_ms++;
|
||||||
|
|
||||||
|
fecbus_rx_timeout_tick();
|
||||||
|
fec_std_rx_timeout_tick();
|
||||||
|
test_rx_timeout_tick();
|
||||||
|
|
||||||
|
Cpp_1Ms_Task();
|
||||||
|
|
||||||
|
uart_tx_complete_delay();
|
||||||
|
can_tx_complete_delay();
|
||||||
|
|
||||||
|
if(norflash_get_busy_flag[0]){
|
||||||
|
norflash_err_tick[0]++;
|
||||||
|
if(norflash_err_tick[0] > 201000){
|
||||||
|
norflash_err_tick[0] = 0;
|
||||||
|
norflash_err_flag[0] = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
norflash_err_tick[0] = 0;
|
||||||
|
norflash_err_flag[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(norflash_get_busy_flag[1]){
|
||||||
|
norflash_err_tick[1]++;
|
||||||
|
if(norflash_err_tick[1] > 201000){
|
||||||
|
norflash_err_tick[1] = 0;
|
||||||
|
norflash_err_flag[1] = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
norflash_err_tick[1] = 0;
|
||||||
|
norflash_err_flag[1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sys_tick_10ms_tick++;
|
||||||
|
if(sys_tick_10ms_tick > 9){
|
||||||
|
sys_tick_10ms_tick = 0;
|
||||||
|
sys_tick_10ms_rdy = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sys_tick_100ms_tick++;
|
||||||
|
if(sys_tick_100ms_tick > 99){
|
||||||
|
sys_tick_100ms_tick = 0;
|
||||||
|
sys_tick_100ms_rdy = 1;
|
||||||
|
|
||||||
|
if(UserRequestReset != 0x12345678){
|
||||||
|
SysLoopTick++;
|
||||||
|
if(SysLoopTick < 100)
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1);
|
||||||
|
}
|
||||||
|
|
||||||
|
can_send_time_handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
sys_tick_200ms_tick++;
|
||||||
|
if(sys_tick_200ms_tick > 199){
|
||||||
|
sys_tick_200ms_tick = 0;
|
||||||
|
sys_tick_200ms_rdy = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sys_tick_1s_tick++;
|
||||||
|
if(sys_tick_1s_tick > 999){
|
||||||
|
sys_tick_1s_tick = 0;
|
||||||
|
sys_tick_1s_rdy = 1;
|
||||||
|
|
||||||
|
sys_tick_600S_tick++;
|
||||||
|
if(sys_tick_600S_tick > 599){
|
||||||
|
sys_tick_600S_tick = 0;
|
||||||
|
sys_tick_600S_rdy = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_error_led_task(void)
|
||||||
|
{
|
||||||
|
if(!GetSystemErrorState()){
|
||||||
|
//GPIOE->ODR ^=0x04;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoUpdataRtc()
|
||||||
|
{
|
||||||
|
RTC_TimeShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void operation_finction(void)
|
||||||
|
{
|
||||||
|
static unsigned int color_tick = 0;
|
||||||
|
|
||||||
|
static unsigned int addr = 0;
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
CppFreRun();
|
||||||
|
|
||||||
|
if(sys_tick_1ms_rdy){
|
||||||
|
sys_tick_1ms_rdy = 0;
|
||||||
|
|
||||||
|
uart_interval_send();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sys_tick_10ms_rdy){
|
||||||
|
sys_tick_10ms_rdy = 0;
|
||||||
|
sys_error_led_task();
|
||||||
|
Cpp_10Ms_Task();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sys_tick_100ms_rdy){
|
||||||
|
sys_tick_100ms_rdy = 0;
|
||||||
|
|
||||||
|
GPIOC->ODR ^=0x0020;
|
||||||
|
|
||||||
|
Cpp_100Ms_Task();
|
||||||
|
load_hzk_pic_task();
|
||||||
|
|
||||||
|
relay_output_handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sys_tick_1s_rdy){
|
||||||
|
sys_tick_1s_rdy = 0;
|
||||||
|
Sys_1s_Load_Rdy();
|
||||||
|
|
||||||
|
printer_task();
|
||||||
|
DoUpdataRtc();
|
||||||
|
|
||||||
|
sys_oldtime = sys_free_run_ms;
|
||||||
|
CppIn();
|
||||||
|
sys_test_sp_time = sys_free_run_ms - sys_oldtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
uart_task();
|
||||||
|
can_task();
|
||||||
|
|
||||||
|
if(sys_tick_600S_rdy){
|
||||||
|
sys_tick_600S_rdy = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
0
FW/Core/my_src/uart_can_drv.c
Normal file
0
FW/Core/my_src/uart_can_drv.c
Normal file
0
FW/Core/my_src/uart_can_drv.h
Normal file
0
FW/Core/my_src/uart_can_drv.h
Normal file
146
FW/Core/my_src/uart_fec_std_drv.c
Normal file
146
FW/Core/my_src/uart_fec_std_drv.c
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
#include "HW_Config.h"
|
||||||
|
#include "uart_fec_std_drv.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
#define FEC_STD_UART 4
|
||||||
|
|
||||||
|
#define FEC_STD_RX_TIMEOUT 25//12:19200 25:9600 //9600 19byte:20ms
|
||||||
|
|
||||||
|
T_FEC_STD_RX_Prm fec_std_rx_prm;
|
||||||
|
|
||||||
|
unsigned char fec_std_uart_tx[32];
|
||||||
|
|
||||||
|
static unsigned int set_crc_error_flag = 0;
|
||||||
|
|
||||||
|
unsigned int fec_std_tx_is_busy(void)//1:is busy 0:no busy
|
||||||
|
{
|
||||||
|
if(!get_uart_tx_complete_delay_flag(FEC_STD_UART))return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_fec_std_tx_data(unsigned char * pdata)//fec¸ñʽ£¬¼ÓÉϺóÃæcrc 2byte Óëend
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int len = 0;
|
||||||
|
|
||||||
|
len = pdata[7];
|
||||||
|
if(len > 8)return;
|
||||||
|
len += 8;
|
||||||
|
for(i=0;i<len;i++){
|
||||||
|
fec_std_uart_tx[i] = pdata[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
fec_std_uart_tx[len] = pdata[16];
|
||||||
|
fec_std_uart_tx[len+1] = pdata[17];
|
||||||
|
fec_std_uart_tx[len+2] = pdata[18];
|
||||||
|
|
||||||
|
len+=3;
|
||||||
|
|
||||||
|
uart_tx_over(FEC_STD_UART, fec_std_uart_tx, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fec_std_rx_timeout_tick(void)//1ms in irq
|
||||||
|
{
|
||||||
|
if(fec_std_rx_prm.starttime_flag){
|
||||||
|
fec_std_rx_prm.timecount++;
|
||||||
|
if(fec_std_rx_prm.timecount > 30){//9600 19byte:20ms
|
||||||
|
fec_std_rx_prm.state = 0;
|
||||||
|
fec_std_rx_prm.starttime_flag = 0;
|
||||||
|
fec_std_rx_prm.timecount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fec_std_rx_irq(void)
|
||||||
|
{
|
||||||
|
unsigned short cc;
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(UART4))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(UART4);
|
||||||
|
|
||||||
|
switch(fec_std_rx_prm.state){
|
||||||
|
case 0 :
|
||||||
|
if(FEC_STD_UART_HEAD == cc){
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_index = 0;
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_buf[uart_info_8bit[FEC_STD_UART].rx_index] = cc;
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_len = 25;//>19
|
||||||
|
fec_std_rx_prm.starttime_flag = 1;
|
||||||
|
fec_std_rx_prm.state++;
|
||||||
|
set_crc_error_flag = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_index++;
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_buf[uart_info_8bit[FEC_STD_UART].rx_index] = cc;
|
||||||
|
if(7 == uart_info_8bit[FEC_STD_UART].rx_index){
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_len = 11 + cc;
|
||||||
|
if(uart_info_8bit[FEC_STD_UART].rx_len > 19){
|
||||||
|
fec_std_rx_prm.state = 0;
|
||||||
|
fec_std_rx_prm.starttime_flag = 0;
|
||||||
|
fec_std_rx_prm.timecount = 0;
|
||||||
|
}else{
|
||||||
|
fec_std_rx_prm.state++;
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(uart_info_8bit[FEC_STD_UART].rx_index > 7){
|
||||||
|
fec_std_rx_prm.state = 0;
|
||||||
|
fec_std_rx_prm.starttime_flag = 0;
|
||||||
|
fec_std_rx_prm.timecount = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_index++;
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_buf[uart_info_8bit[FEC_STD_UART].rx_index] = cc;
|
||||||
|
if(((uart_info_8bit[FEC_STD_UART].rx_len - 1) == uart_info_8bit[FEC_STD_UART].rx_index)&&(fec_std_rx_prm.timecount < FEC_STD_RX_TIMEOUT)&&(cc == FEC_STD_UART_END)){
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_complete = 1;
|
||||||
|
fec_std_rx_prm.state = 0;
|
||||||
|
fec_std_rx_prm.starttime_flag = 0;
|
||||||
|
fec_std_rx_prm.timecount = 0;
|
||||||
|
}else
|
||||||
|
if(uart_info_8bit[FEC_STD_UART].rx_index > 19){
|
||||||
|
fec_std_rx_prm.state = 0;
|
||||||
|
fec_std_rx_prm.starttime_flag = 0;
|
||||||
|
fec_std_rx_prm.timecount = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fec_std_rx_prm.state = 0;
|
||||||
|
fec_std_rx_prm.starttime_flag = 0;
|
||||||
|
fec_std_rx_prm.timecount = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart4_rx_task(void)
|
||||||
|
{
|
||||||
|
if(uart_info_8bit[FEC_STD_UART].rx_complete){
|
||||||
|
uart_info_8bit[FEC_STD_UART].rx_complete = 0;
|
||||||
|
if(!check_crc(uart_info_8bit[FEC_STD_UART].rx_buf,(uart_info_8bit[FEC_STD_UART].rx_len-1))){
|
||||||
|
LoadStdViaFECBus(uart_info_8bit[FEC_STD_UART].rx_buf);
|
||||||
|
}else{
|
||||||
|
if((FEC_STD_UART_HEAD == uart_info_8bit[FEC_STD_UART].rx_buf[0])&&\
|
||||||
|
(FEC_STD_UART_END == uart_info_8bit[FEC_STD_UART].rx_buf[uart_info_8bit[FEC_STD_UART].rx_len-1])&&\
|
||||||
|
(0 == uart_info_8bit[FEC_STD_UART].rx_buf[1])){
|
||||||
|
|
||||||
|
set_crc_error_flag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((set_crc_error_flag)&&(0 == uart_info_8bit[FEC_STD_UART].rx_buf[6])){
|
||||||
|
set_crc_error_flag = 0;
|
||||||
|
SetRpyFECStdCRCError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_fec_std_task(void)
|
||||||
|
{
|
||||||
|
uart4_rx_task();
|
||||||
|
}
|
||||||
|
|
||||||
23
FW/Core/my_src/uart_fec_std_drv.h
Normal file
23
FW/Core/my_src/uart_fec_std_drv.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef UART_FEC_STD_DRV_H_
|
||||||
|
#define UART_FEC_STD_DRV_H_
|
||||||
|
|
||||||
|
#define FEC_STD_UART_HEAD 0x7E
|
||||||
|
#define FEC_STD_UART_END 0x7E
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
unsigned int state;
|
||||||
|
unsigned int starttime_flag;
|
||||||
|
unsigned int timecount;
|
||||||
|
}T_FEC_STD_RX_Prm;
|
||||||
|
|
||||||
|
extern T_FEC_STD_RX_Prm fec_std_rx_prm;
|
||||||
|
|
||||||
|
extern unsigned int fec_std_tx_is_busy(void);
|
||||||
|
extern void set_fec_std_tx_data(unsigned char * pdata);
|
||||||
|
|
||||||
|
extern void fec_std_rx_timeout_tick(void);
|
||||||
|
extern void fec_std_rx_irq(void);
|
||||||
|
extern void uart_fec_std_task(void);
|
||||||
|
extern void fec_std_rx_timeout_tick(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
147
FW/Core/my_src/uart_fecbus_drv.c
Normal file
147
FW/Core/my_src/uart_fecbus_drv.c
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
#include "HW_Config.h"
|
||||||
|
#include "uart_fecbus_drv.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
#define FECBUS_UART 2
|
||||||
|
|
||||||
|
#define FECBUS_RX_TIMEOUT 25//12:19200 25:9600 //9600 19byte:20ms
|
||||||
|
|
||||||
|
#define FECBUS_UART_HEAD 0x7E
|
||||||
|
#define FECBUS_UART_END 0x7E
|
||||||
|
|
||||||
|
T_FECBus_RX_Prm fecbus_rx_prm;
|
||||||
|
|
||||||
|
unsigned char fecbus_uart_tx[32];
|
||||||
|
|
||||||
|
unsigned int fecbus_tx_is_busy(void)//1:is busy 0:no busy
|
||||||
|
{
|
||||||
|
if(!get_uart_tx_complete_delay_flag(FECBUS_UART))return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_fecbus_tx_data(unsigned char * pdata)//fec??¨º?¡ê??¨®¨¦?o¨®??crc 2byte ¨®?end
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int len = 0;
|
||||||
|
|
||||||
|
len = pdata[7];
|
||||||
|
if(len > 8)return;
|
||||||
|
len += 8;
|
||||||
|
for(i=0;i<len;i++){
|
||||||
|
fecbus_uart_tx[i] = pdata[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
fecbus_uart_tx[len] = pdata[16];
|
||||||
|
fecbus_uart_tx[len+1] = pdata[17];
|
||||||
|
fecbus_uart_tx[len+2] = pdata[18];
|
||||||
|
|
||||||
|
len+=3;
|
||||||
|
|
||||||
|
uart_tx_over(FECBUS_UART, fecbus_uart_tx, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fecbus_rx_timeout_tick(void)//1ms in irq
|
||||||
|
{
|
||||||
|
if(fecbus_rx_prm.starttime_flag){
|
||||||
|
fecbus_rx_prm.timecount++;
|
||||||
|
if(fecbus_rx_prm.timecount > 30){//9600 19byte:20ms
|
||||||
|
fecbus_rx_prm.state = 0;
|
||||||
|
fecbus_rx_prm.starttime_flag = 0;
|
||||||
|
fecbus_rx_prm.timecount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fecbus_rx_irq(void)
|
||||||
|
{
|
||||||
|
unsigned short cc;
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(USART2))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(USART2);
|
||||||
|
|
||||||
|
switch(fecbus_rx_prm.state){
|
||||||
|
case 0 :
|
||||||
|
if(0x7E == cc){
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_index = 0;
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_buf[uart_info_8bit[FECBUS_UART].rx_index] = cc;
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_len = 25;//>19
|
||||||
|
fecbus_rx_prm.starttime_flag = 1;
|
||||||
|
fecbus_rx_prm.state++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_index++;
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_buf[uart_info_8bit[FECBUS_UART].rx_index] = cc;
|
||||||
|
if(7 == uart_info_8bit[FECBUS_UART].rx_index){
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_len = 11 + cc;
|
||||||
|
if(uart_info_8bit[FECBUS_UART].rx_len > 19){
|
||||||
|
fecbus_rx_prm.state = 0;
|
||||||
|
fecbus_rx_prm.starttime_flag = 0;
|
||||||
|
fecbus_rx_prm.timecount = 0;
|
||||||
|
}else{
|
||||||
|
fecbus_rx_prm.state++;
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(uart_info_8bit[FECBUS_UART].rx_index > 7){
|
||||||
|
fecbus_rx_prm.state = 0;
|
||||||
|
fecbus_rx_prm.starttime_flag = 0;
|
||||||
|
fecbus_rx_prm.timecount = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_index++;
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_buf[uart_info_8bit[FECBUS_UART].rx_index] = cc;
|
||||||
|
if(((uart_info_8bit[FECBUS_UART].rx_len - 1) == uart_info_8bit[FECBUS_UART].rx_index)&&(fecbus_rx_prm.timecount < FECBUS_RX_TIMEOUT)&&(cc == 0x7E)){
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_complete = 1;
|
||||||
|
fecbus_rx_prm.state = 0;
|
||||||
|
fecbus_rx_prm.starttime_flag = 0;
|
||||||
|
fecbus_rx_prm.timecount = 0;
|
||||||
|
}else
|
||||||
|
if(uart_info_8bit[FECBUS_UART].rx_index > 19){
|
||||||
|
fecbus_rx_prm.state = 0;
|
||||||
|
fecbus_rx_prm.starttime_flag = 0;
|
||||||
|
fecbus_rx_prm.timecount = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fecbus_rx_prm.state = 0;
|
||||||
|
fecbus_rx_prm.starttime_flag = 0;
|
||||||
|
fecbus_rx_prm.timecount = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart2_rx_task(void)
|
||||||
|
{
|
||||||
|
static unsigned int set_crc_error_flag = 0;
|
||||||
|
|
||||||
|
if(uart_info_8bit[FECBUS_UART].rx_complete){
|
||||||
|
uart_info_8bit[FECBUS_UART].rx_complete = 0;
|
||||||
|
if(!check_crc(uart_info_8bit[FECBUS_UART].rx_buf,(uart_info_8bit[FECBUS_UART].rx_len-1))){
|
||||||
|
LoadCRTViaFECBbus(uart_info_8bit[FECBUS_UART].rx_buf);
|
||||||
|
}else{
|
||||||
|
if((0x7E == uart_info_8bit[FECBUS_UART].rx_buf[0])&&\
|
||||||
|
(0x7E == uart_info_8bit[FECBUS_UART].rx_buf[uart_info_8bit[FECBUS_UART].rx_len-1])&&\
|
||||||
|
(0 == uart_info_8bit[FECBUS_UART].rx_buf[1])){
|
||||||
|
|
||||||
|
set_crc_error_flag = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((set_crc_error_flag)&&(0 == uart_info_8bit[FECBUS_UART].rx_buf[6])){
|
||||||
|
set_crc_error_flag = 0;
|
||||||
|
//SetRpyFECBusCRCError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void uart_fecbus_task(void)
|
||||||
|
{
|
||||||
|
uart2_rx_task();
|
||||||
|
}
|
||||||
|
|
||||||
19
FW/Core/my_src/uart_fecbus_drv.h
Normal file
19
FW/Core/my_src/uart_fecbus_drv.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef UART_FECBUS_DRV_H_
|
||||||
|
#define UART_FECBUS_DRV_H_
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
unsigned int state;
|
||||||
|
unsigned int starttime_flag;
|
||||||
|
unsigned int timecount;
|
||||||
|
}T_FECBus_RX_Prm;
|
||||||
|
|
||||||
|
extern T_FECBus_RX_Prm fecbus_rx_prm;
|
||||||
|
|
||||||
|
extern unsigned int fecbus_tx_is_busy(void);
|
||||||
|
extern void set_fecbus_tx_data(unsigned char * pdata);
|
||||||
|
|
||||||
|
extern void fecbus_rx_tick(void);
|
||||||
|
extern void fecbus_rx_irq(void);
|
||||||
|
extern void uart_fecbus_task(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
388
FW/Core/my_src/uart_key_drv.c
Normal file
388
FW/Core/my_src/uart_key_drv.c
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
#include "HW_config.h"
|
||||||
|
#include "uart_key_drv.h"
|
||||||
|
#include "relay_task.h"
|
||||||
|
#include "uart_task.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
#define KEY_UART 7
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
SEND_CMD_40H_SET_STATE = 0x001,
|
||||||
|
SEND_CMD_41H_SELF_CHECK = 0x002,
|
||||||
|
SEND_CMD_42H_RESET = 0x004,
|
||||||
|
SEND_CMD_42H_RESET_DUMP = 0x008,
|
||||||
|
SEND_CMD_43H_SET_POWER_COUNT = 0x010,
|
||||||
|
SEND_CMD_44H_GET_POWER0_VER = 0x020,
|
||||||
|
SEND_CMD_44H_GET_POWER1_VER = 0x040,
|
||||||
|
SEND_CMD_44H_GET_POWER2_VER = 0x080,
|
||||||
|
SEND_CMD_45H_GET_BRD_VER = 0x100,
|
||||||
|
SEND_CMD_46H_GET_BRD_DESCP = 0x200,
|
||||||
|
SEND_CMD_47H_SCAN_POWER = 0x400,
|
||||||
|
SEND_CMD_60H_ASK_POWER_CNT = 0x800,
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int send_cmd_flag = 0;
|
||||||
|
Sys_State_Struct p_d2u_data;
|
||||||
|
|
||||||
|
unsigned char set_power_count = 0;
|
||||||
|
|
||||||
|
//key brd
|
||||||
|
void uart7_rx_task(void)
|
||||||
|
{
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[7];
|
||||||
|
unsigned int aLen;
|
||||||
|
unsigned int cmd;
|
||||||
|
|
||||||
|
if(p_uart_info->rx_complete){
|
||||||
|
p_uart_info->rx_complete = 0;
|
||||||
|
if((p_uart_info->rx_len <= UART_RX_BUF_MAX)&&(p_uart_info->rx_len > 3)){
|
||||||
|
if(((p_uart_info->rx_len - 4) == p_uart_info->rx_buf[1]) &&
|
||||||
|
(KEY_UART_HEAD == p_uart_info->rx_buf[0]) &&
|
||||||
|
(KEY_UART_END == p_uart_info->rx_buf[p_uart_info->rx_len-1]) &&
|
||||||
|
(!check_sum8(p_uart_info->rx_buf,(p_uart_info->rx_len - 2))))
|
||||||
|
{
|
||||||
|
aLen = p_uart_info->rx_buf[1];
|
||||||
|
cmd = p_uart_info->rx_buf[2];
|
||||||
|
if(aLen == 4){
|
||||||
|
if(1 == p_uart_info->rx_buf[3]){
|
||||||
|
KeyRdy = 1;
|
||||||
|
KeyValue = p_uart_info->rx_buf[4];
|
||||||
|
}
|
||||||
|
LoadBatStateViaKeyPad(p_uart_info->rx_buf[5]);
|
||||||
|
KeyPadSilenceTickClear();
|
||||||
|
}else
|
||||||
|
if(aLen == 1){
|
||||||
|
if(0x43 == cmd){
|
||||||
|
KeyPadAskPowerCount();
|
||||||
|
KeyPadSilenceTickClear();
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(aLen == 14){
|
||||||
|
if(p_uart_info->rx_buf[2] == 0){
|
||||||
|
LoadPsBatStateViaKeyPad(&p_uart_info->rx_buf[4]);
|
||||||
|
KeyPadSilenceTickClear();
|
||||||
|
}else if(p_uart_info->rx_buf[2] == 1){
|
||||||
|
LoadPsBatStateViaKeyPadSub1(&p_uart_info->rx_buf[3]);
|
||||||
|
KeyPadSilenceTickClear();
|
||||||
|
}else if(p_uart_info->rx_buf[2] == 2){
|
||||||
|
LoadPsBatStateViaKeyPadSub2(&p_uart_info->rx_buf[3]);
|
||||||
|
KeyPadSilenceTickClear();
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(aLen == 9){
|
||||||
|
if(0x44 == cmd){
|
||||||
|
GetHwInfo(p_uart_info->rx_buf[3],1,&p_uart_info->rx_buf[3]);
|
||||||
|
}else
|
||||||
|
if(0x45 == cmd){
|
||||||
|
GetHwInfo(p_uart_info->rx_buf[3],1,&p_uart_info->rx_buf[3]);
|
||||||
|
}else
|
||||||
|
if(0x46 == cmd){
|
||||||
|
GetHwInfo(p_uart_info->rx_buf[3],0,&p_uart_info->rx_buf[3]);
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(aLen == 5){
|
||||||
|
if(0x60 == cmd){
|
||||||
|
GetPowerCount(p_uart_info->rx_buf[3], p_uart_info->rx_buf[4], p_uart_info->rx_buf[5], 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_key_task(void)
|
||||||
|
{
|
||||||
|
uart7_rx_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_display_led_state(unsigned int aState)
|
||||||
|
{
|
||||||
|
p_d2u_data.D32 = aState;
|
||||||
|
send_cmd_flag |= SEND_CMD_40H_SET_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_set_key_self_detect_state(unsigned char self_det_state)
|
||||||
|
{
|
||||||
|
send_cmd_flag |= SEND_CMD_41H_SELF_CHECK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_set_key_reset_dump_state(void)
|
||||||
|
{
|
||||||
|
send_cmd_flag |= SEND_CMD_42H_RESET_DUMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_set_key_reset_state(void)
|
||||||
|
{
|
||||||
|
send_cmd_flag |= SEND_CMD_42H_RESET;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_set_power_suply_count(unsigned char aCnt)
|
||||||
|
{
|
||||||
|
if(aCnt > 3)return;
|
||||||
|
|
||||||
|
set_power_count = aCnt;
|
||||||
|
send_cmd_flag |= SEND_CMD_43H_SET_POWER_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_get_power_ver(unsigned char power_ord)
|
||||||
|
{
|
||||||
|
if(power_ord > 2)return;
|
||||||
|
|
||||||
|
if(0 == power_ord){
|
||||||
|
send_cmd_flag |= SEND_CMD_44H_GET_POWER0_VER;
|
||||||
|
}else
|
||||||
|
if(1 == power_ord){
|
||||||
|
send_cmd_flag |= SEND_CMD_44H_GET_POWER1_VER;
|
||||||
|
}else
|
||||||
|
if(2 == power_ord){
|
||||||
|
send_cmd_flag |= SEND_CMD_44H_GET_POWER2_VER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_get_sw_brd_ver(void)
|
||||||
|
{
|
||||||
|
send_cmd_flag |= SEND_CMD_45H_GET_BRD_VER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_get_sw_brd_descp(void)
|
||||||
|
{
|
||||||
|
send_cmd_flag |= SEND_CMD_46H_GET_BRD_DESCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_set_scan_power(void)
|
||||||
|
{
|
||||||
|
send_cmd_flag |= SEND_CMD_47H_SCAN_POWER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_get_power_Count(void)
|
||||||
|
{
|
||||||
|
send_cmd_flag |= SEND_CMD_60H_ASK_POWER_CNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sys_key_uart_tx_task(void)//1ms
|
||||||
|
{
|
||||||
|
static unsigned int send_tick = 0;
|
||||||
|
unsigned char check_sum = 0;
|
||||||
|
|
||||||
|
send_tick++;
|
||||||
|
if(send_tick > 8){
|
||||||
|
send_tick = 0;
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_40H_SET_STATE){
|
||||||
|
send_cmd_flag &=~SEND_CMD_40H_SET_STATE;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x40;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = p_d2u_data.state_val[0];
|
||||||
|
UART7->TDR = p_d2u_data.state_val[1];
|
||||||
|
UART7->TDR = p_d2u_data.state_val[2];
|
||||||
|
UART7->TDR = p_d2u_data.state_val[3];
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x40+0x04+p_d2u_data.state_val[0]+p_d2u_data.state_val[1]+p_d2u_data.state_val[2]+p_d2u_data.state_val[3];
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_41H_SELF_CHECK){
|
||||||
|
send_cmd_flag &=~SEND_CMD_41H_SELF_CHECK;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x41;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x41+0x04;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_42H_RESET){
|
||||||
|
send_cmd_flag &=~SEND_CMD_42H_RESET;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x42;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x42+0x04;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_42H_RESET_DUMP){
|
||||||
|
send_cmd_flag &=~SEND_CMD_42H_RESET_DUMP;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x42;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0xAA;
|
||||||
|
UART7->TDR = 0x55;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x42+0x04+0xAA+0x55;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_43H_SET_POWER_COUNT){
|
||||||
|
send_cmd_flag &=~SEND_CMD_43H_SET_POWER_COUNT;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x43;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = set_power_count;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x43+0x04+set_power_count;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_44H_GET_POWER0_VER){
|
||||||
|
send_cmd_flag &=~SEND_CMD_44H_GET_POWER0_VER;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x44;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x44+0x04+0x00;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_44H_GET_POWER1_VER){
|
||||||
|
send_cmd_flag &=~SEND_CMD_44H_GET_POWER1_VER;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x44;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x01;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x44+0x04+0x01;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_44H_GET_POWER2_VER){
|
||||||
|
send_cmd_flag &=~SEND_CMD_44H_GET_POWER2_VER;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x44;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x02;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x44+0x04+0x02;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_45H_GET_BRD_VER){
|
||||||
|
send_cmd_flag &=~SEND_CMD_45H_GET_BRD_VER;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x45;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x45+0x04+0;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_46H_GET_BRD_DESCP){
|
||||||
|
send_cmd_flag &=~SEND_CMD_46H_GET_BRD_DESCP;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x46;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x46+0x04+0;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_47H_SCAN_POWER){
|
||||||
|
send_cmd_flag &=~SEND_CMD_47H_SCAN_POWER;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x47;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x47+0x04+0;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}else
|
||||||
|
|
||||||
|
if(send_cmd_flag & SEND_CMD_60H_ASK_POWER_CNT){
|
||||||
|
send_cmd_flag &=~SEND_CMD_60H_ASK_POWER_CNT;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_HEAD;
|
||||||
|
UART7->TDR = 0x60;
|
||||||
|
UART7->TDR = 0x04;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
UART7->TDR = 0x00;
|
||||||
|
|
||||||
|
check_sum = KEY_UART_HEAD+0x60+0x04+0;
|
||||||
|
UART7->TDR = check_sum;
|
||||||
|
|
||||||
|
UART7->TDR = KEY_UART_END;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_bl_on(void)
|
||||||
|
{
|
||||||
|
LL_TIM_OC_SetCompareCH2(TIM3,255);//bl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_bl_off(void)
|
||||||
|
{
|
||||||
|
LL_TIM_OC_SetCompareCH2(TIM3,0);//bl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
28
FW/Core/my_src/uart_key_drv.h
Normal file
28
FW/Core/my_src/uart_key_drv.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef UART_KEY_DRV_H_
|
||||||
|
#define UART_KEY_DRV_H_
|
||||||
|
|
||||||
|
//UART7 key use
|
||||||
|
#define KEY_UART_HEAD 0xFF
|
||||||
|
#define KEY_UART_END 0xFE
|
||||||
|
|
||||||
|
extern void sys_display_led_state(unsigned int aState);
|
||||||
|
extern void sys_set_key_self_detect_state(unsigned char self_det_state);
|
||||||
|
extern void sys_set_key_reset_state(void);
|
||||||
|
extern void sys_set_key_reset_dump_state(void);
|
||||||
|
extern void sys_set_power_suply_count(unsigned char aCnt);
|
||||||
|
extern void sys_get_power_ver(unsigned char power_ord);
|
||||||
|
extern void sys_get_sw_brd_ver(void);
|
||||||
|
extern void sys_get_sw_brd_descp(void);
|
||||||
|
extern void sys_set_scan_power(void);
|
||||||
|
extern void sys_get_power_Count(void);
|
||||||
|
|
||||||
|
extern void sys_error_led_task(void);
|
||||||
|
|
||||||
|
extern void sys_key_uart_tx_task(void);
|
||||||
|
|
||||||
|
extern void lcd_bl_on(void);
|
||||||
|
extern void lcd_bl_off(void);
|
||||||
|
|
||||||
|
extern void uart_key_task(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
144
FW/Core/my_src/uart_linkage_drv.c
Normal file
144
FW/Core/my_src/uart_linkage_drv.c
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
#include "HW_Config.h"
|
||||||
|
#include "uart_linkage_drv.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
#define LINKAGE_UART 3
|
||||||
|
|
||||||
|
typedef union{
|
||||||
|
unsigned int D32;
|
||||||
|
unsigned char D8[4];
|
||||||
|
struct{
|
||||||
|
unsigned char Cmd;
|
||||||
|
unsigned char Order;
|
||||||
|
unsigned char CarryByte;
|
||||||
|
unsigned char PriRoutingIdf;
|
||||||
|
}Id;
|
||||||
|
}TC2CIdBody;
|
||||||
|
|
||||||
|
static unsigned int uart_tx_error_flag = 0;
|
||||||
|
|
||||||
|
unsigned int get_uart_tx_error_flag(void)
|
||||||
|
{
|
||||||
|
return uart_tx_error_flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart3_rx_task(void)
|
||||||
|
{
|
||||||
|
unsigned int Cmd;
|
||||||
|
|
||||||
|
if(uart_info_8bit[LINKAGE_UART].rx_complete){
|
||||||
|
uart_info_8bit[LINKAGE_UART].rx_complete = 0;
|
||||||
|
if((uart_info_8bit[LINKAGE_UART].rx_len <= 13)&&(uart_info_8bit[LINKAGE_UART].rx_len >= 5)){
|
||||||
|
if((uart_info_8bit[LINKAGE_UART].rx_len - 5) == uart_info_8bit[LINKAGE_UART].rx_buf[4]){
|
||||||
|
Cmd = uart_info_8bit[LINKAGE_UART].rx_buf[3];
|
||||||
|
Cmd<<=8;
|
||||||
|
Cmd |= uart_info_8bit[LINKAGE_UART].rx_buf[2];
|
||||||
|
Cmd<<=8;
|
||||||
|
Cmd |= uart_info_8bit[LINKAGE_UART].rx_buf[1];
|
||||||
|
Cmd<<=8;
|
||||||
|
Cmd |= uart_info_8bit[LINKAGE_UART].rx_buf[0];
|
||||||
|
LoadOuterCanRxMsg(Cmd, (&uart_info_8bit[LINKAGE_UART].rx_buf[5]), uart_info_8bit[LINKAGE_UART].rx_buf[4]);
|
||||||
|
}else
|
||||||
|
if(5 == uart_info_8bit[LINKAGE_UART].rx_len){
|
||||||
|
if(14 == uart_info_8bit[LINKAGE_UART].rx_buf[4]){//ALL_FULL_FLAG
|
||||||
|
uart_tx_error_flag = 3;
|
||||||
|
}else
|
||||||
|
if(12 == uart_info_8bit[LINKAGE_UART].rx_buf[4]){//CLOSE_FULL_FLAG
|
||||||
|
uart_tx_error_flag = 2;
|
||||||
|
}else
|
||||||
|
if(16 == uart_info_8bit[LINKAGE_UART].rx_buf[4]){//ERR_HANDLE_FLAG can send fail
|
||||||
|
uart_tx_error_flag = 1;
|
||||||
|
}else
|
||||||
|
if(20 == uart_info_8bit[LINKAGE_UART].rx_buf[4]){//recover from error
|
||||||
|
uart_tx_error_flag = 0;
|
||||||
|
}
|
||||||
|
SetOuterCanTxMsgState(uart_tx_error_flag);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if((0x5A == uart_info_8bit[LINKAGE_UART].rx_buf[uart_info_8bit[LINKAGE_UART].rx_len-1]) && \
|
||||||
|
(0xA5 == uart_info_8bit[LINKAGE_UART].rx_buf[0]) && \
|
||||||
|
((uart_info_8bit[LINKAGE_UART].rx_buf[2] + 4) == uart_info_8bit[LINKAGE_UART].rx_len)){
|
||||||
|
GetHwInfo(uart_info_8bit[LINKAGE_UART].rx_buf[3],1,&uart_info_8bit[LINKAGE_UART].rx_buf[3]);
|
||||||
|
GetHwInfo(uart_info_8bit[LINKAGE_UART].rx_buf[11],0,&uart_info_8bit[LINKAGE_UART].rx_buf[11]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_linkage_task(void)
|
||||||
|
{
|
||||||
|
uart3_rx_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_excan_linkage_tx_complete(void)
|
||||||
|
{
|
||||||
|
return get_uart_tx_complete_delay_flag(LINKAGE_UART);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_linkage_tx_data(unsigned char * pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
uart_tx_over(LINKAGE_UART, pdata, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int outer_can_send_data(volatile unsigned int head, volatile unsigned char * pdata, volatile unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
static TC2CIdBody exId;
|
||||||
|
|
||||||
|
if(len > 8)return 1;
|
||||||
|
if(!get_excan_linkage_tx_complete())return 1;
|
||||||
|
|
||||||
|
exId.D32 = head;
|
||||||
|
|
||||||
|
USART3->TDR = exId.Id.Cmd;
|
||||||
|
USART3->TDR = exId.Id.Order;
|
||||||
|
USART3->TDR = exId.Id.CarryByte;
|
||||||
|
USART3->TDR = exId.Id.PriRoutingIdf & 0b00011111;
|
||||||
|
USART3->TDR = len;
|
||||||
|
for(i=0;i<len;i++){
|
||||||
|
USART3->TDR = pdata[i];
|
||||||
|
}
|
||||||
|
uart_info_8bit[LINKAGE_UART].tx_complete = 1;
|
||||||
|
uart_info_8bit[LINKAGE_UART].tx_complete_delay_flag = 0;
|
||||||
|
uart_info_8bit[LINKAGE_UART].tx_complete_delay_tick= 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_commbrd_ver_modle(void)
|
||||||
|
{
|
||||||
|
while(0 == get_excan_linkage_tx_complete());
|
||||||
|
USART3->TDR = 0xA5;
|
||||||
|
USART3->TDR = 0x50;
|
||||||
|
USART3->TDR = 0;
|
||||||
|
USART3->TDR = 0x5A;
|
||||||
|
uart_info_8bit[LINKAGE_UART].tx_complete = 1;
|
||||||
|
uart_info_8bit[LINKAGE_UART].tx_complete_delay_flag = 0;
|
||||||
|
uart_info_8bit[LINKAGE_UART].tx_complete_delay_tick= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int outer_can_send_data_(unsigned int head, unsigned char * pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned char data[16] = {0};
|
||||||
|
|
||||||
|
TC2CIdBody exId;
|
||||||
|
|
||||||
|
if(len > 8)return 1;
|
||||||
|
if(!get_excan_linkage_tx_complete())return 1;
|
||||||
|
|
||||||
|
exId.D32 = head;
|
||||||
|
|
||||||
|
data[0] = exId.Id.Cmd;
|
||||||
|
data[1] = 0;
|
||||||
|
data[2] = 0;
|
||||||
|
data[3] = (exId.Id.PriRoutingIdf) & (0b00011111);
|
||||||
|
data[4] = len;
|
||||||
|
for(i=0;i<len;i++){
|
||||||
|
data[5+i] = pdata[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
uart_linkage_tx_data(data, (len+5));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
FW/Core/my_src/uart_linkage_drv.h
Normal file
8
FW/Core/my_src/uart_linkage_drv.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef UART_LINKAGE_DRV_H_
|
||||||
|
#define UART_LINKAGE_DRV_H_
|
||||||
|
|
||||||
|
extern unsigned int get_excan_linkage_tx_complete(void);
|
||||||
|
extern void get_commbrd_ver_modle(void);
|
||||||
|
extern unsigned int outer_can_send_data(volatile unsigned int head, volatile unsigned char * pdata, volatile unsigned int len);
|
||||||
|
|
||||||
|
#endif
|
||||||
471
FW/Core/my_src/uart_lp_test_drv.c
Normal file
471
FW/Core/my_src/uart_lp_test_drv.c
Normal file
@@ -0,0 +1,471 @@
|
|||||||
|
#include "HW_Config.h"
|
||||||
|
#include "uart_lp_test_drv.h"
|
||||||
|
#include "user_norflash.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
#include "HW_test_task.h"
|
||||||
|
#include "internal_flash.h"
|
||||||
|
|
||||||
|
#define TEST_RX_TIMEOUT 50
|
||||||
|
|
||||||
|
#define NORFLASH_GBK_ADDR 0x009C0000
|
||||||
|
#define SDRAM_GBK_ADDR 0xC0600000
|
||||||
|
|
||||||
|
#define SIZE_OF_BYTE_GBK_LIB (23940*24*3)
|
||||||
|
#define SIZE_OF_PAGE_GBK_LIB 6734
|
||||||
|
#define SIZE_OF_64K_GBK_LIB 27
|
||||||
|
|
||||||
|
#define dFlashGBKChipX (0)
|
||||||
|
|
||||||
|
TdataType load_data;
|
||||||
|
|
||||||
|
typedef union{
|
||||||
|
unsigned char D8[264];
|
||||||
|
unsigned int D32[66];
|
||||||
|
struct{
|
||||||
|
unsigned char head;
|
||||||
|
unsigned char cmd;
|
||||||
|
unsigned short len;
|
||||||
|
unsigned char data[260];
|
||||||
|
}prm;
|
||||||
|
}Tcom_gbk_pkg_gbk;
|
||||||
|
|
||||||
|
Tcom_gbk_pkg_gbk * gbk_rx_pkg;
|
||||||
|
Tcom_gbk_pkg_gbk * gbk_tx_pkg;
|
||||||
|
|
||||||
|
unsigned char test_uart_tx[64];
|
||||||
|
unsigned char test_uart_rx[272];
|
||||||
|
|
||||||
|
unsigned int rx_state = 0;
|
||||||
|
unsigned int rx_starttime_flag = 0;
|
||||||
|
unsigned int rx_timecount = 0;
|
||||||
|
|
||||||
|
static unsigned int rpy_usb_state = 0;
|
||||||
|
static unsigned int rpy_usb_state_tick = 0;
|
||||||
|
|
||||||
|
void config_app_handle(void);
|
||||||
|
void gbk_download_handle(void);
|
||||||
|
|
||||||
|
unsigned int test_tx_is_busy(void)//1:is busy 0:no busy
|
||||||
|
{
|
||||||
|
if(!get_uart_tx_complete_delay_flag(TEST_UART))return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_test_tx_data(unsigned char * pdata, unsigned int len)//fec格式,加上后面crc 2byte 与end
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned short crc_value = 0;
|
||||||
|
|
||||||
|
uart_load_txbuf(TEST_UART, pdata, len);
|
||||||
|
|
||||||
|
crc_value = crc16_data(uart_info_8bit[TEST_UART].tx_buf, len);
|
||||||
|
uart_info_8bit[TEST_UART].tx_buf[len] = (crc_value&0xFF);
|
||||||
|
uart_info_8bit[TEST_UART].tx_buf[len+1] = ((crc_value&0xFF00)>>8);
|
||||||
|
|
||||||
|
uart_info_8bit[TEST_UART].tx_buf[len+2] = TEST_UART_END;
|
||||||
|
uart_info_8bit[TEST_UART].tx_len = len+3;
|
||||||
|
|
||||||
|
uart_tx_trigger(TEST_UART);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_rx_timeout_tick(void)//1ms in irq
|
||||||
|
{
|
||||||
|
if(rx_starttime_flag){
|
||||||
|
rx_timecount++;
|
||||||
|
if(rx_timecount > 55){//57600 272byte:48ms
|
||||||
|
rx_state = 0;
|
||||||
|
rx_starttime_flag = 0;
|
||||||
|
rx_timecount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rpy_usb_state){
|
||||||
|
if(rpy_usb_state_tick > 3000){
|
||||||
|
rpy_usb_state_tick = 0;
|
||||||
|
rpy_usb_state = 0;
|
||||||
|
|
||||||
|
if(UsbConfigGetState()){
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = 0xA0;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = 0x22;
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else{
|
||||||
|
rpy_usb_state_tick++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
rpy_usb_state_tick = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_rx_irq(void)
|
||||||
|
{
|
||||||
|
unsigned short cc;
|
||||||
|
|
||||||
|
if(LL_USART_IsActiveFlag_RXNE(LPUART1))
|
||||||
|
{
|
||||||
|
cc = LL_USART_ReceiveData8(LPUART1);
|
||||||
|
switch(rx_state){
|
||||||
|
case 0 :
|
||||||
|
if(TEST_UART_HEAD == cc){
|
||||||
|
uart_info_8bit[TEST_UART].rx_index = 0;
|
||||||
|
uart_info_8bit[TEST_UART].rx_buf[uart_info_8bit[TEST_UART].rx_index] = cc;
|
||||||
|
uart_info_8bit[TEST_UART].rx_len = UART_RX_BUF_MAX;
|
||||||
|
rx_starttime_flag = 1;
|
||||||
|
rx_state++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
uart_info_8bit[TEST_UART].rx_index++;
|
||||||
|
uart_info_8bit[TEST_UART].rx_buf[uart_info_8bit[TEST_UART].rx_index] = cc;
|
||||||
|
if(3 == uart_info_8bit[TEST_UART].rx_index){
|
||||||
|
if(uart_info_8bit[TEST_UART].rx_buf[1] > 0x80){
|
||||||
|
uart_info_8bit[TEST_UART].rx_len = uart_info_8bit[TEST_UART].rx_buf[3];
|
||||||
|
uart_info_8bit[TEST_UART].rx_len<<=8;
|
||||||
|
uart_info_8bit[TEST_UART].rx_len |= uart_info_8bit[TEST_UART].rx_buf[2];
|
||||||
|
uart_info_8bit[TEST_UART].rx_len +=7;
|
||||||
|
if(uart_info_8bit[TEST_UART].rx_len > (260+8)){
|
||||||
|
rx_state = 0;
|
||||||
|
rx_starttime_flag = 0;
|
||||||
|
rx_timecount = 0;
|
||||||
|
}else{
|
||||||
|
rx_state++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
uart_info_8bit[TEST_UART].rx_len = 7 + cc;
|
||||||
|
if(uart_info_8bit[TEST_UART].rx_len > 128){
|
||||||
|
rx_state = 0;
|
||||||
|
rx_starttime_flag = 0;
|
||||||
|
rx_timecount = 0;
|
||||||
|
}else{
|
||||||
|
rx_state++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(uart_info_8bit[TEST_UART].rx_index > 3){
|
||||||
|
rx_state = 0;
|
||||||
|
rx_starttime_flag = 0;
|
||||||
|
rx_timecount = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
uart_info_8bit[TEST_UART].rx_index++;
|
||||||
|
uart_info_8bit[TEST_UART].rx_buf[uart_info_8bit[TEST_UART].rx_index] = cc;
|
||||||
|
if(((uart_info_8bit[TEST_UART].rx_len - 1) == uart_info_8bit[TEST_UART].rx_index)&&(rx_timecount < TEST_RX_TIMEOUT)&&(cc == TEST_UART_END)){
|
||||||
|
uart_info_8bit[TEST_UART].rx_complete = 1;
|
||||||
|
rx_state = 0;
|
||||||
|
rx_starttime_flag = 0;
|
||||||
|
rx_timecount = 0;
|
||||||
|
}else
|
||||||
|
if(uart_info_8bit[TEST_UART].rx_index > uart_info_8bit[TEST_UART].rx_len){
|
||||||
|
rx_state = 0;
|
||||||
|
rx_starttime_flag = 0;
|
||||||
|
rx_timecount = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
rx_state = 0;
|
||||||
|
rx_starttime_flag = 0;
|
||||||
|
rx_timecount = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void lpuart_rx_task(void)
|
||||||
|
{
|
||||||
|
if(uart_info_8bit[TEST_UART].rx_complete){
|
||||||
|
uart_info_8bit[TEST_UART].rx_complete = 0;
|
||||||
|
|
||||||
|
//LoadDebugViaFECTest(uart_info_8bit[TEST_UART].rx_buf);
|
||||||
|
if(!check_crc(uart_info_8bit[TEST_UART].rx_buf,(uart_info_8bit[TEST_UART].rx_len-1))){
|
||||||
|
if(uart_info_8bit[TEST_UART].rx_buf[1] < 0x80){
|
||||||
|
//-----------------config app handle------------------
|
||||||
|
config_app_handle();
|
||||||
|
}else{
|
||||||
|
//-----------------gbk download handle----------------
|
||||||
|
gbk_download_handle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_test_task(void)
|
||||||
|
{
|
||||||
|
lpuart_rx_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gbk_nor_load_to_sdram(void)
|
||||||
|
{
|
||||||
|
unsigned int x,y;
|
||||||
|
for(y = 0;y < SIZE_OF_PAGE_GBK_LIB;y++){
|
||||||
|
nor_read_page(0, (NORFLASH_GBK_ADDR + (y * 256)), load_data.D8);
|
||||||
|
for(x = 0;x < 64;x++){
|
||||||
|
*(volatile unsigned int *)(SDRAM_GBK_ADDR + (y * 256) + (x * 4)) = load_data.D32[x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gbk_download_handle(void)
|
||||||
|
{
|
||||||
|
unsigned int i,aFlashState;
|
||||||
|
|
||||||
|
gbk_tx_pkg = (Tcom_gbk_pkg_gbk *)test_uart_tx;
|
||||||
|
gbk_rx_pkg = (Tcom_gbk_pkg_gbk *)uart_info_8bit[TEST_UART].rx_buf;
|
||||||
|
|
||||||
|
if(0x88 == gbk_rx_pkg->prm.cmd){
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 0;
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x90 == gbk_rx_pkg->prm.cmd){
|
||||||
|
for(i=0;i<SIZE_OF_64K_GBK_LIB;i++){
|
||||||
|
nor_erase_sector_64k(dFlashGBKChipX, (NORFLASH_GBK_ADDR+(i*64*1024)));
|
||||||
|
do{
|
||||||
|
HAL_Delay(2);
|
||||||
|
aFlashState = nor_get_busy_state(dFlashGBKChipX);
|
||||||
|
}while(aFlashState);
|
||||||
|
}
|
||||||
|
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 4;
|
||||||
|
gbk_tx_pkg->prm.data[0] = 0xAA;
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[2] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[3] = 0;
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x91 == gbk_rx_pkg->prm.cmd){
|
||||||
|
nor_write_page(dFlashGBKChipX,(NORFLASH_GBK_ADDR + (gbk_rx_pkg->D32[1] * 256)),&gbk_rx_pkg->prm.data[4]);
|
||||||
|
do{
|
||||||
|
HAL_Delay(2);
|
||||||
|
aFlashState = nor_get_busy_state(dFlashGBKChipX);
|
||||||
|
}while(aFlashState);
|
||||||
|
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 4;
|
||||||
|
gbk_tx_pkg->prm.data[0] = 0xAA;
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[2] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[3] = 0;
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
//-------------------------------------------------test(测试板子)--------------------------------------------------
|
||||||
|
if(0xA0 == gbk_rx_pkg->prm.cmd){
|
||||||
|
if(0x20 == gbk_rx_pkg->prm.data[0]){//测试uart1-7
|
||||||
|
hw_test_mode = 1;
|
||||||
|
hw_test_init();
|
||||||
|
|
||||||
|
gbk_tx_pkg->prm.data[1] = (unsigned char)hw_uart_test_all() + 1;
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x21 == gbk_rx_pkg->prm.data[0]){//退出测试
|
||||||
|
hw_test_mode = 0;
|
||||||
|
hw_test_deinit();
|
||||||
|
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x22 == gbk_rx_pkg->prm.data[0]){//检测U盘
|
||||||
|
if(hw_test_mode){
|
||||||
|
if(usb_is_host){
|
||||||
|
if(UsbConfigGetState()){
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else{
|
||||||
|
usb_device_to_host();
|
||||||
|
rpy_usb_state = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
usb_host_to_device();
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0x55;
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(0x24 == gbk_rx_pkg->prm.data[0]){//测试显示屏
|
||||||
|
if(hw_test_mode){
|
||||||
|
hw_lcd_test();
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
gbk_tx_pkg->prm.data[1] = hw_test_mode;
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x25 == gbk_rx_pkg->prm.data[0]){//测试nor flash读写
|
||||||
|
if(hw_test_mode){
|
||||||
|
if(hw_nor_flash_test()){
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0x55;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x26 == gbk_rx_pkg->prm.data[0]){//测试eeprom读写
|
||||||
|
if(hw_test_mode){
|
||||||
|
if(hw_eeprom_test()){
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0x55;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x27 == gbk_rx_pkg->prm.data[0]){//测试sdram读写
|
||||||
|
if(hw_test_mode){
|
||||||
|
if(hw_sdram_test()){
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0x55;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x28 == gbk_rx_pkg->prm.data[0]){//测试print
|
||||||
|
if(hw_test_mode){
|
||||||
|
hw_print_test();
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0x55;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x29 == gbk_rx_pkg->prm.data[0]){//测试继电器
|
||||||
|
if(hw_test_mode){
|
||||||
|
hw_relay_test();
|
||||||
|
gbk_tx_pkg->prm.data[1] = 1;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0x55;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0x2A == gbk_rx_pkg->prm.data[0]){//测试uart1-7 除uart6
|
||||||
|
hw_test_mode = 1;
|
||||||
|
hw_test_init();
|
||||||
|
|
||||||
|
gbk_tx_pkg->prm.data[1] = (unsigned char)hw_uart_test() + 1;
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 2;
|
||||||
|
gbk_tx_pkg->prm.data[0] = gbk_rx_pkg->prm.data[0];
|
||||||
|
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
//-------------------------------------------------读写编码--------------------------------------------------
|
||||||
|
if(0xB0 == gbk_rx_pkg->prm.cmd){
|
||||||
|
if((gbk_rx_pkg->prm.data[0] > 0)&&(gbk_rx_pkg->prm.data[0] < 255)){
|
||||||
|
factory_prm.ctl_type = gbk_rx_pkg->prm.data[0];
|
||||||
|
for(i=0;i<7;i++)factory_prm.pid[i] = gbk_rx_pkg->prm.data[i+4];
|
||||||
|
factory_prm.pid[7] = 0;
|
||||||
|
|
||||||
|
write_factory_prm();
|
||||||
|
|
||||||
|
gbk_tx_pkg->prm.data[0] = 1;
|
||||||
|
}else{
|
||||||
|
gbk_tx_pkg->prm.data[0] = 0;
|
||||||
|
}
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 1;
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}else
|
||||||
|
if(0xB1 == gbk_rx_pkg->prm.cmd){
|
||||||
|
gbk_tx_pkg->prm.head = TEST_UART_HEAD;
|
||||||
|
gbk_tx_pkg->prm.cmd = gbk_rx_pkg->prm.cmd;
|
||||||
|
gbk_tx_pkg->prm.len = 16;
|
||||||
|
gbk_tx_pkg->prm.data[0] = factory_prm.ctl_type & 0xFF;
|
||||||
|
gbk_tx_pkg->prm.data[1] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[2] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[3] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[4] = factory_prm.pid[0];
|
||||||
|
gbk_tx_pkg->prm.data[5] = factory_prm.pid[1];
|
||||||
|
gbk_tx_pkg->prm.data[6] = factory_prm.pid[2];
|
||||||
|
gbk_tx_pkg->prm.data[7] = factory_prm.pid[3];
|
||||||
|
gbk_tx_pkg->prm.data[8] = factory_prm.pid[4];
|
||||||
|
gbk_tx_pkg->prm.data[9] = factory_prm.pid[5];
|
||||||
|
gbk_tx_pkg->prm.data[10] = factory_prm.pid[6];
|
||||||
|
gbk_tx_pkg->prm.data[11] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[12] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[13] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[14] = 0;
|
||||||
|
gbk_tx_pkg->prm.data[15] = 0;
|
||||||
|
set_test_tx_data(gbk_tx_pkg->D8, (gbk_tx_pkg->prm.len + 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void config_app_handle(void)
|
||||||
|
{
|
||||||
|
GetCfgViaUartRx();
|
||||||
|
}
|
||||||
108
FW/Core/my_src/uart_lp_test_drv.h
Normal file
108
FW/Core/my_src/uart_lp_test_drv.h
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
#ifndef UART_LP_TEST_DRV_H_
|
||||||
|
#define UART_LP_TEST_DRV_H_
|
||||||
|
|
||||||
|
#define TEST_UART_HEAD 0xD7
|
||||||
|
#define TEST_UART_END 0xEE
|
||||||
|
|
||||||
|
#define TEST_UART 0
|
||||||
|
|
||||||
|
typedef union{
|
||||||
|
unsigned char D8[64];
|
||||||
|
unsigned int D32[16];
|
||||||
|
struct{
|
||||||
|
unsigned char Head;
|
||||||
|
unsigned char Cmd;
|
||||||
|
unsigned char count;
|
||||||
|
unsigned char Len;
|
||||||
|
union{
|
||||||
|
unsigned char Data8[60];
|
||||||
|
unsigned int Data32[15];
|
||||||
|
struct{
|
||||||
|
unsigned char loopCount;
|
||||||
|
unsigned char busPanelCount;
|
||||||
|
unsigned char dirPanelCount;
|
||||||
|
unsigned char areaCount;
|
||||||
|
char desc[32];
|
||||||
|
unsigned char rsv[24];
|
||||||
|
}CmdCtl;
|
||||||
|
struct{
|
||||||
|
unsigned char id;
|
||||||
|
unsigned char devId;//dev for device
|
||||||
|
unsigned char devType;
|
||||||
|
unsigned char assignType;
|
||||||
|
unsigned char devProperty;
|
||||||
|
unsigned char areaId;
|
||||||
|
unsigned short delayTime;
|
||||||
|
unsigned int devNum;
|
||||||
|
char desc[32];
|
||||||
|
unsigned char rsv[16];
|
||||||
|
}CmdLoop;
|
||||||
|
struct{
|
||||||
|
unsigned char id;
|
||||||
|
unsigned char keyId;
|
||||||
|
unsigned short rsv;
|
||||||
|
union{
|
||||||
|
unsigned char d8[4];
|
||||||
|
unsigned int d32;
|
||||||
|
struct{
|
||||||
|
unsigned char val;
|
||||||
|
unsigned char loopId;
|
||||||
|
unsigned char startAddr;
|
||||||
|
unsigned char endAddr;
|
||||||
|
}methodAddr;
|
||||||
|
struct{
|
||||||
|
unsigned char val;
|
||||||
|
unsigned char loopId;
|
||||||
|
unsigned char devType;
|
||||||
|
unsigned char rsv;
|
||||||
|
}methodType;
|
||||||
|
struct{
|
||||||
|
unsigned char val;
|
||||||
|
unsigned char loopId;
|
||||||
|
unsigned char areaId;
|
||||||
|
unsigned char rsv;
|
||||||
|
}methodArea;
|
||||||
|
}prm;
|
||||||
|
unsigned int Num;
|
||||||
|
char desc[32];
|
||||||
|
unsigned char rsv2[16];
|
||||||
|
}CmdBus;
|
||||||
|
struct{
|
||||||
|
unsigned char Id;
|
||||||
|
unsigned char keyId;
|
||||||
|
unsigned char outProp;
|
||||||
|
unsigned char ctlDevType;
|
||||||
|
unsigned char errDetFlag;
|
||||||
|
unsigned char areaId;
|
||||||
|
unsigned short rsv;
|
||||||
|
unsigned int Num;
|
||||||
|
char desc[32];
|
||||||
|
unsigned char rsv2[16];
|
||||||
|
}CmdDir;
|
||||||
|
struct{
|
||||||
|
unsigned char id;
|
||||||
|
unsigned char rsv;
|
||||||
|
unsigned short rsv2;
|
||||||
|
unsigned int Num;
|
||||||
|
char desc[32];
|
||||||
|
unsigned char rsv3[20];
|
||||||
|
}CmdArea;
|
||||||
|
}Frm;
|
||||||
|
}Cfg;
|
||||||
|
}TConfigUartData;
|
||||||
|
|
||||||
|
extern unsigned int deviceCfgCount;
|
||||||
|
extern unsigned int BusPanelKeyCfgCount;
|
||||||
|
extern unsigned int DirPanelKeyCfgCount;
|
||||||
|
extern unsigned int AreaCfgCount;
|
||||||
|
|
||||||
|
extern unsigned int test_tx_is_busy(void);
|
||||||
|
extern void set_test_tx_data(unsigned char * pdata, unsigned int len);
|
||||||
|
|
||||||
|
extern void test_rx_timeout_tick(void);
|
||||||
|
extern void test_rx_irq(void);
|
||||||
|
extern void uart_test_task(void);
|
||||||
|
|
||||||
|
extern void gbk_nor_load_to_sdram(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
60
FW/Core/my_src/uart_memory_drv.c
Normal file
60
FW/Core/my_src/uart_memory_drv.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#include "HW_Config.h"
|
||||||
|
#include "uart_memory_drv.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
#define MEMORY_UART 5
|
||||||
|
|
||||||
|
unsigned char memory_uart_tx[32];
|
||||||
|
|
||||||
|
unsigned int memory_is_busy(void)//1:is busy 0:no busy
|
||||||
|
{
|
||||||
|
if(!get_uart_tx_complete_delay_flag(MEMORY_UART))return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_memory_tx_data(unsigned char cmd, unsigned char * pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
if(len > 32)return;
|
||||||
|
|
||||||
|
memory_uart_tx[0] = MEMORY_UART_HEAD;
|
||||||
|
memory_uart_tx[1] = 0x55;
|
||||||
|
memory_uart_tx[2] = cmd;
|
||||||
|
memory_uart_tx[3] = len;
|
||||||
|
for(i=0;i<len;i++){
|
||||||
|
memory_uart_tx[4+i] = (*pdata);
|
||||||
|
pdata++;
|
||||||
|
}
|
||||||
|
memory_uart_tx[len + 4] = sum8_data(memory_uart_tx, (len + 4));
|
||||||
|
memory_uart_tx[len + 5] = MEMORY_UART_END;
|
||||||
|
|
||||||
|
uart_tx_over(MEMORY_UART, memory_uart_tx, (len + 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
//memory brd
|
||||||
|
void uart5_rx_task(void)
|
||||||
|
{
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[MEMORY_UART];
|
||||||
|
|
||||||
|
if(p_uart_info->rx_complete){
|
||||||
|
p_uart_info->rx_complete = 0;
|
||||||
|
if((p_uart_info->rx_len <= UART_RX_BUF_MAX)&&(p_uart_info->rx_len >= 6)){
|
||||||
|
if(((p_uart_info->rx_len - 6) == p_uart_info->rx_buf[3])&&(0xAA == p_uart_info->rx_buf[1])&&\
|
||||||
|
(MEMORY_UART_HEAD == p_uart_info->rx_buf[0])&&(MEMORY_UART_END == p_uart_info->rx_buf[p_uart_info->rx_len-1])){
|
||||||
|
if(0 == (check_sum8(p_uart_info->rx_buf, (p_uart_info->rx_len-2)))){
|
||||||
|
LoadExRecordViaMemory(&(p_uart_info->rx_buf[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_memory_task(void)
|
||||||
|
{
|
||||||
|
uart5_rx_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
12
FW/Core/my_src/uart_memory_drv.h
Normal file
12
FW/Core/my_src/uart_memory_drv.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef UART_MEMORY_DRV_H_
|
||||||
|
#define UART_MEMORY_DRV_H_
|
||||||
|
|
||||||
|
//UART5 memory use
|
||||||
|
#define MEMORY_UART_HEAD 0x48
|
||||||
|
#define MEMORY_UART_END 0x41
|
||||||
|
|
||||||
|
extern void uart_memory_task(void);
|
||||||
|
extern unsigned int memory_is_busy(void);
|
||||||
|
extern void set_memory_tx_data(unsigned char cmd, unsigned char * pdata, unsigned int len);
|
||||||
|
|
||||||
|
#endif
|
||||||
233
FW/Core/my_src/uart_printer_drv.c
Normal file
233
FW/Core/my_src/uart_printer_drv.c
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
#include "HW_Config.h"
|
||||||
|
#include "uart_printer_drv.h"
|
||||||
|
|
||||||
|
#define PRINT_UART 6
|
||||||
|
|
||||||
|
#define GET_PRINTER_PAPER_FLAG 0x01
|
||||||
|
|
||||||
|
unsigned char print_init_data[16];
|
||||||
|
unsigned int print_init_data_len = 0;
|
||||||
|
|
||||||
|
unsigned int get_printer_status_falg = 0;
|
||||||
|
|
||||||
|
unsigned int printer_flag_no_paper = 0;
|
||||||
|
unsigned int printer_flag_err = 0;
|
||||||
|
unsigned int printer_Rpy = 0;
|
||||||
|
unsigned int printer_offline = 0;
|
||||||
|
unsigned int PrinterDivTick =0;
|
||||||
|
|
||||||
|
void uart6_rx_task(void)
|
||||||
|
{
|
||||||
|
uart_info_8bit_struct * p_uart_info;
|
||||||
|
p_uart_info = &uart_info_8bit[PRINT_UART];
|
||||||
|
|
||||||
|
if(p_uart_info->rx_complete){
|
||||||
|
p_uart_info->rx_complete = 0;
|
||||||
|
|
||||||
|
if(get_printer_status_falg & GET_PRINTER_PAPER_FLAG){
|
||||||
|
get_printer_status_falg &=~GET_PRINTER_PAPER_FLAG;
|
||||||
|
if(0x04 == p_uart_info->rx_buf[0]){
|
||||||
|
printer_flag_no_paper = 0;
|
||||||
|
printer_Rpy = 1;
|
||||||
|
}else
|
||||||
|
if(0x00 == p_uart_info->rx_buf[0]){
|
||||||
|
printer_flag_no_paper = 1;
|
||||||
|
printer_Rpy = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int printer_is_busy(void)//1:is busy 0:no busy
|
||||||
|
{
|
||||||
|
if((!get_uart_tx_complete_delay_flag(PRINT_UART))||(GET_PRINTER_STATUS()))return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printer_reset_int(void)
|
||||||
|
{
|
||||||
|
//系统复位
|
||||||
|
print_init_data[0] = 0x10;
|
||||||
|
print_init_data[1] = 0x04;
|
||||||
|
print_init_data[2] = 0x03;
|
||||||
|
|
||||||
|
print_init_data_len = 3;
|
||||||
|
|
||||||
|
uart_tx_over(PRINT_UART, print_init_data, print_init_data_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void printer_set_int(void)
|
||||||
|
{
|
||||||
|
//初始化指令
|
||||||
|
print_init_data[0] = 0x1B;
|
||||||
|
print_init_data[1] = 0x40;
|
||||||
|
//方向指令
|
||||||
|
print_init_data[2] = 0x1B;
|
||||||
|
print_init_data[3] = 0x63;
|
||||||
|
print_init_data[4] = 0x01;
|
||||||
|
//字间距0
|
||||||
|
print_init_data[5] = 0x1B;
|
||||||
|
print_init_data[6] = 0x70;
|
||||||
|
print_init_data[7] = 0x00;
|
||||||
|
//设置左限0
|
||||||
|
print_init_data[8] = 0x1B;
|
||||||
|
print_init_data[9] = 0x6C;
|
||||||
|
print_init_data[10]= 0x00;
|
||||||
|
//设置右限0
|
||||||
|
print_init_data[11]= 0x1B;
|
||||||
|
print_init_data[12]= 0x51;
|
||||||
|
print_init_data[13]= 0x00;
|
||||||
|
|
||||||
|
print_init_data_len = 14;
|
||||||
|
|
||||||
|
uart_tx_over(PRINT_UART, print_init_data, print_init_data_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_printer_paper_status(void)
|
||||||
|
{
|
||||||
|
//实时查询有无纸
|
||||||
|
print_init_data[0] = 0x10;
|
||||||
|
print_init_data[1] = 0x04;
|
||||||
|
print_init_data[2] = 0x02;
|
||||||
|
|
||||||
|
print_init_data_len = 3;
|
||||||
|
|
||||||
|
//非实时查询有无纸
|
||||||
|
print_init_data[0] = 0x1C;
|
||||||
|
print_init_data[1] = 0x76;
|
||||||
|
|
||||||
|
print_init_data_len = 2;
|
||||||
|
|
||||||
|
uart_tx_over(PRINT_UART, print_init_data, print_init_data_len);
|
||||||
|
|
||||||
|
get_printer_status_falg |= GET_PRINTER_PAPER_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int set_print_text(char * p_data, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
if(printer_is_busy())return 1;
|
||||||
|
if((!len)||(len > 16))return 1;
|
||||||
|
|
||||||
|
for(i = 0;i<len;i++){
|
||||||
|
USART6->TDR = *p_data;
|
||||||
|
p_data++;
|
||||||
|
}
|
||||||
|
uart_info_8bit[PRINT_UART].tx_complete = 1;
|
||||||
|
uart_info_8bit[PRINT_UART].tx_complete_delay_flag = 0;
|
||||||
|
uart_info_8bit[PRINT_UART].tx_complete_delay_tick= 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int print_text(char * p_data)
|
||||||
|
{
|
||||||
|
volatile char * pdata;
|
||||||
|
|
||||||
|
pdata = p_data;
|
||||||
|
|
||||||
|
print_init_data_len = 0;
|
||||||
|
while(*pdata){
|
||||||
|
pdata++;
|
||||||
|
print_init_data_len++;
|
||||||
|
if(print_init_data_len > (UART_TX_BUF_MAX-1))break;
|
||||||
|
}
|
||||||
|
print_init_data_len+=1;
|
||||||
|
|
||||||
|
if(printer_is_busy())return 1;
|
||||||
|
|
||||||
|
if(print_init_data_len <= UART_TX_BUF_MAX){
|
||||||
|
uart_tx_over(PRINT_UART, p_data, print_init_data_len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printer_init(void)
|
||||||
|
{
|
||||||
|
PRINTER_DRV_ENABLE();
|
||||||
|
HAL_Delay(10);
|
||||||
|
printer_reset_int();
|
||||||
|
HAL_Delay(500);
|
||||||
|
printer_set_int();
|
||||||
|
HAL_Delay(20);
|
||||||
|
print_text("\r\n\r\n\r\n");
|
||||||
|
HAL_Delay(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void printer_task(void)//1S
|
||||||
|
{
|
||||||
|
static unsigned int clear_tick = 0;
|
||||||
|
static unsigned int err_tick = 0;
|
||||||
|
static unsigned int no_rpy_times = 0;
|
||||||
|
static unsigned int HasStartCheck = 0;
|
||||||
|
|
||||||
|
PrinterDivTick++;
|
||||||
|
if(PrinterDivTick>9){
|
||||||
|
PrinterDivTick = 0;
|
||||||
|
if(HasStartCheck){
|
||||||
|
HasStartCheck = 0;
|
||||||
|
if(printer_Rpy == 0){
|
||||||
|
no_rpy_times++;
|
||||||
|
if(no_rpy_times >1){
|
||||||
|
no_rpy_times = 2;
|
||||||
|
printer_offline = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
no_rpy_times = 0;
|
||||||
|
printer_offline = 0;
|
||||||
|
}
|
||||||
|
PrcDevPrinterState(printer_offline , printer_flag_no_paper);
|
||||||
|
}
|
||||||
|
if(!printer_is_busy()){
|
||||||
|
//if(0 == get_printer_status_falg){
|
||||||
|
if(1){
|
||||||
|
get_printer_paper_status();
|
||||||
|
printer_Rpy = 0;
|
||||||
|
HasStartCheck =1;
|
||||||
|
}else{
|
||||||
|
//clear_tick++;
|
||||||
|
//if(clear_tick > 9){
|
||||||
|
// clear_tick = 0;
|
||||||
|
get_printer_status_falg = 0;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
err_tick = 0;
|
||||||
|
printer_flag_err = 0;
|
||||||
|
}else{
|
||||||
|
err_tick++;
|
||||||
|
if(err_tick > 2 ){
|
||||||
|
err_tick = 0;
|
||||||
|
printer_flag_err = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printer_reset_callback(void)
|
||||||
|
{
|
||||||
|
PrinterDivTick =0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_printer_task(void)
|
||||||
|
{
|
||||||
|
uart6_rx_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int get_printer_flag_no_paper(void)//1:no paper or err
|
||||||
|
{
|
||||||
|
if(printer_flag_no_paper + printer_flag_err)return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_enable_printer(void)
|
||||||
|
{
|
||||||
|
PRINTER_DRV_ENABLE();
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_disable_printer(void)
|
||||||
|
{
|
||||||
|
PRINTER_DRV_DISABLE();
|
||||||
|
}
|
||||||
23
FW/Core/my_src/uart_printer_drv.h
Normal file
23
FW/Core/my_src/uart_printer_drv.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef _PRINTER_UART_DRV_H
|
||||||
|
#define _PRINTER_UART_DRV_H
|
||||||
|
//#include "sys.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#define PRINTER_DRV_ENABLE() LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_7)
|
||||||
|
#define PRINTER_DRV_DISABLE() LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_7)
|
||||||
|
|
||||||
|
#define GET_PRINTER_STATUS() LL_GPIO_IsInputPinSet(GPIOC, LL_GPIO_PIN_4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern void printer_init(void);
|
||||||
|
extern void printer_task(void);//1S
|
||||||
|
extern void uart_printer_task(void);
|
||||||
|
|
||||||
|
extern unsigned int printer_is_busy(void);
|
||||||
|
extern unsigned int print_text(char * p_data);
|
||||||
|
extern unsigned int set_print_text(char * p_data, unsigned int len);
|
||||||
|
|
||||||
|
extern void printer_reset_callback(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
49
FW/Core/my_src/uart_task.c
Normal file
49
FW/Core/my_src/uart_task.c
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#include "HW_config.h"
|
||||||
|
#include "uart_key_drv.h"
|
||||||
|
#include "uart_linkage_drv.h"
|
||||||
|
#include "uart_memory_drv.h"
|
||||||
|
#include "uart_printer_drv.h"
|
||||||
|
#include "uart_fecbus_drv.h"
|
||||||
|
#include "uart_fec_std_drv.h"
|
||||||
|
#include "uart_lp_test_drv.h"
|
||||||
|
#include "usb_cdc_task.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
void uart_task(void)
|
||||||
|
{
|
||||||
|
uart_printer_task();
|
||||||
|
uart_key_task();
|
||||||
|
uart_linkage_task();
|
||||||
|
uart_memory_task();
|
||||||
|
uart_fecbus_task();
|
||||||
|
uart_fec_std_task();
|
||||||
|
uart_test_task();
|
||||||
|
|
||||||
|
usb_cdc_rx_handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_interval_send(void)//1ms
|
||||||
|
{
|
||||||
|
sys_key_uart_tx_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
27
FW/Core/my_src/uart_task.h
Normal file
27
FW/Core/my_src/uart_task.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
typedef union
|
||||||
|
{
|
||||||
|
unsigned int D32;
|
||||||
|
volatile unsigned char state_val[4];
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
volatile unsigned int take_charge : 2; /* [0] */
|
||||||
|
volatile unsigned int feedback : 2; /* [1] */
|
||||||
|
volatile unsigned int start_delay : 2; /* [2] */
|
||||||
|
volatile unsigned int start : 2; /* [3] */
|
||||||
|
volatile unsigned int mute : 2; /* [4] */
|
||||||
|
volatile unsigned int fault : 2; /* [5] */
|
||||||
|
volatile unsigned int alarm : 2; /* [6] */
|
||||||
|
volatile unsigned int rsv1 : 2; /* [7] */
|
||||||
|
volatile unsigned int linkage : 2; /* [8] */
|
||||||
|
volatile unsigned int rx : 2; /* [9] */
|
||||||
|
volatile unsigned int tx : 2; /* [10] */
|
||||||
|
volatile unsigned int self_check : 2; /* [11] */
|
||||||
|
volatile unsigned int alarm_fault : 2; /* [12] */
|
||||||
|
volatile unsigned int alarm_start : 2; /* [13] */
|
||||||
|
volatile unsigned int shield : 2; /* [14] */
|
||||||
|
volatile unsigned int rsv2 : 2; /* [15] */
|
||||||
|
}state;
|
||||||
|
}Sys_State_Struct;
|
||||||
|
|
||||||
|
extern void uart_task(void);
|
||||||
|
extern void uart_interval_send(void);
|
||||||
39
FW/Core/my_src/uart_wifi_drv.c
Normal file
39
FW/Core/my_src/uart_wifi_drv.c
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include "HW_config.h"
|
||||||
|
#include "uart_wifi_drv.h"
|
||||||
|
#include "uart_task.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
unsigned int wifi_tx_is_busy(void)//1:is busy 0:no busy
|
||||||
|
{
|
||||||
|
if(!get_uart_tx_complete_delay_flag(WIFI_UART))return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_wifi_tx_data(unsigned char * pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
if(len > UART_TX_BUF_MAX)return;
|
||||||
|
|
||||||
|
uart_tx_over(WIFI_UART, pdata, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifi_app_handle(void)
|
||||||
|
{
|
||||||
|
GetWifiViaUartRx();
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart1_rx_task(void)
|
||||||
|
{
|
||||||
|
if(uart_info_8bit[WIFI_UART].rx_complete){
|
||||||
|
uart_info_8bit[WIFI_UART].rx_complete = 0;
|
||||||
|
|
||||||
|
wifi_app_handle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_wifi_task(void)
|
||||||
|
{
|
||||||
|
uart1_rx_task();
|
||||||
|
}
|
||||||
11
FW/Core/my_src/uart_wifi_drv.h
Normal file
11
FW/Core/my_src/uart_wifi_drv.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef __UART_WIFI_DRV
|
||||||
|
#define __UART_WIFI_DRV
|
||||||
|
|
||||||
|
#define WIFI_UART 1
|
||||||
|
|
||||||
|
extern unsigned int wifi_tx_is_busy(void);
|
||||||
|
extern void set_wifi_tx_data(unsigned char * pdata, unsigned int len);
|
||||||
|
|
||||||
|
extern void uart_wifi_task(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
76
FW/Core/my_src/usb_cdc_task.c
Normal file
76
FW/Core/my_src/usb_cdc_task.c
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#include "HW_Config.h"
|
||||||
|
#include "usbd_cdc_if.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "CnCpp.h"
|
||||||
|
|
||||||
|
#define USB_CDC_HEAD 0xD7
|
||||||
|
#define USB_CDC_END 0xEE
|
||||||
|
|
||||||
|
T_usb_cdc_data_struct usb_cdc_data;
|
||||||
|
|
||||||
|
void usccdc_config_app_handle(void);
|
||||||
|
|
||||||
|
void usb_cdc_rx_data(unsigned char *buf, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if((len < 7)||(len > USB_CDC_BUF_MAX))return;
|
||||||
|
|
||||||
|
usb_cdc_data.rx_len = len;
|
||||||
|
for(i=0;i<len;i++){
|
||||||
|
usb_cdc_data.rx_buf[i] = buf[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if((USB_CDC_HEAD == usb_cdc_data.rx_buf[0]) && (USB_CDC_END == usb_cdc_data.rx_buf[len-1])){
|
||||||
|
if(!check_crc(usb_cdc_data.rx_buf,(len-1))){
|
||||||
|
usb_cdc_data.rx_complete = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_cdc_rx_handle(void)
|
||||||
|
{
|
||||||
|
unsigned int len = 0;
|
||||||
|
|
||||||
|
if(usb_cdc_data.rx_complete){
|
||||||
|
usb_cdc_data.rx_complete = 0;
|
||||||
|
|
||||||
|
if(usb_cdc_data.rx_buf[1] > 0x80){
|
||||||
|
len = usb_cdc_data.rx_buf[3];
|
||||||
|
len<<=8;
|
||||||
|
len |= usb_cdc_data.rx_buf[2];
|
||||||
|
len +=7;
|
||||||
|
if(len == usb_cdc_data.rx_len){
|
||||||
|
;//gbk
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if((usb_cdc_data.rx_buf[3] + 7) == usb_cdc_data.rx_len){
|
||||||
|
usccdc_config_app_handle();//cfg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_cdc_tx(unsigned char * pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned short crc_value = 0;
|
||||||
|
|
||||||
|
for(i=0;i<len;i++){
|
||||||
|
usb_cdc_data.tx_buf[i] = pdata[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
crc_value = crc16_data(usb_cdc_data.tx_buf, len);
|
||||||
|
usb_cdc_data.tx_buf[len] = (crc_value&0xFF);
|
||||||
|
usb_cdc_data.tx_buf[len+1] = ((crc_value&0xFF00)>>8);
|
||||||
|
|
||||||
|
usb_cdc_data.tx_buf[len+2] = USB_CDC_END;
|
||||||
|
usb_cdc_data.tx_len = len+3;
|
||||||
|
|
||||||
|
CDC_Transmit_FS(usb_cdc_data.tx_buf, usb_cdc_data.tx_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void usccdc_config_app_handle(void)
|
||||||
|
{
|
||||||
|
GetCfgViaUsbCdcRx();
|
||||||
|
}
|
||||||
9
FW/Core/my_src/usb_cdc_task.h
Normal file
9
FW/Core/my_src/usb_cdc_task.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef USB_CDC_TASK_H_
|
||||||
|
#define USB_CDC_TASK_H_
|
||||||
|
|
||||||
|
extern void usb_cdc_rx_data(unsigned char *buf, unsigned int len);
|
||||||
|
extern void usb_cdc_rx_handle(void);
|
||||||
|
|
||||||
|
extern void usb_cdc_tx(unsigned char * pdata, unsigned int len);
|
||||||
|
|
||||||
|
#endif
|
||||||
27
FW/Core/my_src/user_eeprom.c
Normal file
27
FW/Core/my_src/user_eeprom.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "I2C_eeprom.h"
|
||||||
|
#include "user_eeprom.h"
|
||||||
|
|
||||||
|
//Chip_CS: 0 = 512KBits, 1 = 1MBits
|
||||||
|
|
||||||
|
unsigned int eeprom_write_byte_via_page(unsigned int chip_cs, unsigned int addr, unsigned char *pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
return I2C_byte_write_via_page(chip_cs, addr, pdata, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int eeprom_write_page(unsigned int chip_cs, unsigned int addr, unsigned char *pdata)
|
||||||
|
{
|
||||||
|
return I2C_page_write(chip_cs, addr, pdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int eeprom_read_byte(unsigned int chip_cs, unsigned int addr, unsigned char *pdata, unsigned int len)
|
||||||
|
{
|
||||||
|
return I2C_page_read(chip_cs, addr, pdata, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
9
FW/Core/my_src/user_eeprom.h
Normal file
9
FW/Core/my_src/user_eeprom.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef USER_EEPROM_H_
|
||||||
|
#define USER_EEPROM_H_
|
||||||
|
|
||||||
|
extern unsigned int eeprom_write_byte_via_page(unsigned int chip_cs, unsigned int addr, unsigned char *pdata, unsigned int len);
|
||||||
|
extern unsigned int eeprom_write_page(unsigned int chip_cs, unsigned int addr, unsigned char *pdata);
|
||||||
|
extern unsigned int eeprom_read_byte(unsigned int chip_cs, unsigned int addr, unsigned char *pdata, unsigned int len);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
133
FW/Core/my_src/user_norflash.c
Normal file
133
FW/Core/my_src/user_norflash.c
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
#include "W25Qxx.h"
|
||||||
|
#include "user_norflash.h"
|
||||||
|
|
||||||
|
#define CHIP_SELECT_0() LL_GPIO_ResetOutputPin(GPIOC,LL_GPIO_PIN_1)
|
||||||
|
#define CHIP_SELECT_1() LL_GPIO_SetOutputPin(GPIOC,LL_GPIO_PIN_1)
|
||||||
|
|
||||||
|
static void wait(void)
|
||||||
|
{
|
||||||
|
__nop();__nop();
|
||||||
|
__nop();__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wait_50ns(void)
|
||||||
|
{
|
||||||
|
__nop();__nop();__nop();__nop();__nop();
|
||||||
|
__nop();__nop();__nop();__nop();__nop();
|
||||||
|
__nop();__nop();__nop();__nop();__nop();
|
||||||
|
__nop();__nop();__nop();__nop();__nop();
|
||||||
|
__nop();__nop();__nop();__nop();__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_flash_init(void)
|
||||||
|
{
|
||||||
|
CHIP_SELECT_0();
|
||||||
|
wait();
|
||||||
|
W25QXX_Init();
|
||||||
|
CHIP_SELECT_1();
|
||||||
|
wait();
|
||||||
|
W25QXX_Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int nor_get_busy_state(unsigned int chip_cs)
|
||||||
|
{
|
||||||
|
unsigned int state;
|
||||||
|
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
|
||||||
|
state = W25QXX_ReadSR(1)&0x01;
|
||||||
|
|
||||||
|
if(state)norflash_get_busy_flag[chip_cs] = 1;
|
||||||
|
else norflash_get_busy_flag[chip_cs] = 0;
|
||||||
|
|
||||||
|
if(norflash_err_flag[chip_cs])return 0;
|
||||||
|
|
||||||
|
return (state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_erase_full_chip(unsigned int chip_cs)
|
||||||
|
{
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Erase_Chip_no_wait();
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_erase_sector_4k(unsigned int chip_cs,unsigned int addr)
|
||||||
|
{
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Erase_Sector_4k_no_wait(addr&0x00FFFFFF);
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_erase_sector_32k(unsigned int chip_cs,unsigned int addr)
|
||||||
|
{
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Erase_Sector_32k_no_wait(addr&0x00FFFFFF);
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_erase_sector_64k(unsigned int chip_cs,unsigned int addr)
|
||||||
|
{
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Erase_Sector_64k_no_wait(addr&0x00FFFFFF);
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_read_byte(unsigned int chip_cs,unsigned int addr,unsigned char * p_read_data,unsigned int len)
|
||||||
|
{
|
||||||
|
if((addr+len) > NOR_FLASH_SIZE)return;
|
||||||
|
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Read(p_read_data,addr,len);
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_read_page(unsigned int chip_cs,unsigned int addr,unsigned char * p_read_data)
|
||||||
|
{
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Read(p_read_data,(addr&0x00FFFF00),256);
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_write_byte_via_page(unsigned int chip_cs,unsigned int addr,unsigned char * p_write_data,unsigned int len)
|
||||||
|
{
|
||||||
|
if(((addr&0xFF) + len) > 0x100)return;
|
||||||
|
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Write_Byte_no_wait(p_write_data,addr,len);
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nor_write_page(unsigned int chip_cs,unsigned int addr,unsigned char * p_write_data)
|
||||||
|
{
|
||||||
|
if(chip_cs)CHIP_SELECT_1();
|
||||||
|
else CHIP_SELECT_0();
|
||||||
|
|
||||||
|
wait();
|
||||||
|
W25QXX_Write_Byte_no_wait(p_write_data,(addr&0x00FFFF00),256);
|
||||||
|
wait_50ns();
|
||||||
|
}
|
||||||
16
FW/Core/my_src/user_norflash.h
Normal file
16
FW/Core/my_src/user_norflash.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef USER_NORFLASH_H_
|
||||||
|
#define USER_NORFLASH_H_
|
||||||
|
|
||||||
|
extern void nor_flash_init(void);
|
||||||
|
extern unsigned int nor_get_busy_state(unsigned int chip_cs);
|
||||||
|
extern void nor_erase_full_chip(unsigned int chip_cs);
|
||||||
|
extern void nor_erase_sector_4k(unsigned int chip_cs,unsigned int addr);
|
||||||
|
extern void nor_erase_sector_32k(unsigned int chip_cs,unsigned int addr);
|
||||||
|
extern void nor_erase_sector_64k(unsigned int chip_cs,unsigned int addr);
|
||||||
|
extern void nor_read_byte(unsigned int chip_cs,unsigned int addr,unsigned char * p_read_data,unsigned int len);
|
||||||
|
extern void nor_read_page(unsigned int chip_cs,unsigned int addr,unsigned char * p_read_data);
|
||||||
|
extern void nor_write_byte_via_page(unsigned int chip_cs,unsigned int addr,unsigned char * p_write_data,unsigned int len);
|
||||||
|
extern void nor_write_page(unsigned int chip_cs,unsigned int addr,unsigned char * p_write_data);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
351
FW/Core/my_src/w25qxx.c
Normal file
351
FW/Core/my_src/w25qxx.c
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
#include "w25qxx.h"
|
||||||
|
|
||||||
|
#define GET_CHIP_SELECT() LL_GPIO_IsOutputPinSet(GPIOC,LL_GPIO_PIN_1)
|
||||||
|
|
||||||
|
unsigned short W25QXX_TYPE = 1;
|
||||||
|
|
||||||
|
unsigned short norflash_get_busy_flag[2] = {0,0};
|
||||||
|
unsigned short norflash_err_flag[2] = {0,0};
|
||||||
|
|
||||||
|
//4Kbytes为一个Sector
|
||||||
|
//16个扇区为1个Block
|
||||||
|
//W25Q128
|
||||||
|
//容量为16M字节,共有256个Block,4096个Sector
|
||||||
|
|
||||||
|
static void wait(void)
|
||||||
|
{
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化SPI FLASH的IO口
|
||||||
|
void W25QXX_Init(void)
|
||||||
|
{
|
||||||
|
W25QXX_Write_Enable();
|
||||||
|
W25QXX_Reset();
|
||||||
|
HAL_Delay(10);
|
||||||
|
|
||||||
|
W25QXX_Write_Enable();
|
||||||
|
W25QXX_Qspi_Enable(); //使能QSPI模式
|
||||||
|
W25QXX_TYPE = W25QXX_ReadID(); //读取FLASH ID.
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
HAL_Delay(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Qspi_Enable(void)
|
||||||
|
{
|
||||||
|
unsigned char stareg2;
|
||||||
|
stareg2=W25QXX_ReadSR(2);
|
||||||
|
|
||||||
|
do{
|
||||||
|
W25QXX_Write_Enable();
|
||||||
|
stareg2 |= 0x02;
|
||||||
|
W25QXX_Write_SR(2,stareg2);
|
||||||
|
HAL_Delay(1);
|
||||||
|
stareg2 = W25QXX_ReadSR(2);
|
||||||
|
}while(!(stareg2 & 0x02));
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Qspi_Disable(void)
|
||||||
|
{
|
||||||
|
unsigned char stareg2;
|
||||||
|
stareg2=W25QXX_ReadSR(2);
|
||||||
|
|
||||||
|
do{
|
||||||
|
W25QXX_Write_Enable();
|
||||||
|
stareg2 &=~0x02;
|
||||||
|
W25QXX_Write_SR(2,stareg2);
|
||||||
|
HAL_Delay(1);
|
||||||
|
stareg2 = W25QXX_ReadSR(2);
|
||||||
|
}while(stareg2 & 0x02);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char W25QXX_ReadSR(unsigned char regno)
|
||||||
|
{
|
||||||
|
unsigned char byte=0,command=0;
|
||||||
|
|
||||||
|
switch(regno){
|
||||||
|
case 1:
|
||||||
|
command = W25Qx_CMD_ReadStatusReg1; //读状态寄存器1指令
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
command = W25Qx_CMD_ReadStatusReg2; //读状态寄存器2指令
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
command = W25Qx_CMD_ReadStatusReg3; //读状态寄存器3指令
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
command = W25Qx_CMD_ReadStatusReg1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
wait();
|
||||||
|
QSPI_Send_CMD(command,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_1_LINE);
|
||||||
|
QSPI_Receive(&byte,1);
|
||||||
|
return byte;
|
||||||
|
}
|
||||||
|
|
||||||
|
//写W25QXX状态寄存器
|
||||||
|
void W25QXX_Write_SR(unsigned char regno,unsigned char sr)
|
||||||
|
{
|
||||||
|
unsigned char command=0;
|
||||||
|
|
||||||
|
switch(regno){
|
||||||
|
case 1:
|
||||||
|
command = W25Qx_CMD_WriteStatusReg1; //写状态寄存器1指令
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
command = W25Qx_CMD_WriteStatusReg2; //写状态寄存器2指令
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
command = W25Qx_CMD_WriteStatusReg3; //写状态寄存器3指令
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
command = W25Qx_CMD_WriteStatusReg1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
QSPI_Send_CMD(command,0,0, QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_1_LINE);
|
||||||
|
QSPI_Transmit(&sr,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Write_Enable(void)
|
||||||
|
{
|
||||||
|
unsigned char stareg1;
|
||||||
|
stareg1=W25QXX_ReadSR(1); //先读出状态寄存器1的原始值
|
||||||
|
do{
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_WriteEnable,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
wait();
|
||||||
|
stareg1 = W25QXX_ReadSR(1);
|
||||||
|
}while(!(stareg1 & 0x02)); //WE位未使能
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Write_Disable(void)
|
||||||
|
{
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_WriteDisable,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回值如下:
|
||||||
|
//0XEF13,表示芯片型号为W25Q80
|
||||||
|
//0XEF14,表示芯片型号为W25Q16
|
||||||
|
//0XEF15,表示芯片型号为W25Q32
|
||||||
|
//0XEF16,表示芯片型号为W25Q64
|
||||||
|
//0XEF17,表示芯片型号为W25Q128
|
||||||
|
//0XEF18,表示芯片型号为W25Q256
|
||||||
|
unsigned short W25QXX_ReadID(void)
|
||||||
|
{
|
||||||
|
unsigned char temp[2];
|
||||||
|
unsigned short deviceid;
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_ManufactDeviceID,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_1_LINE);
|
||||||
|
QSPI_Receive(temp,2);
|
||||||
|
deviceid=(temp[0]<<8)|temp[1];
|
||||||
|
return deviceid;
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取SPI FLASH,仅支持QPI模式
|
||||||
|
//在指定地址开始读取指定长度的数据
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//ReadAddr:开始读取的地址(最大32bit)
|
||||||
|
//NumByteToRead:要读取的字节数(最大65535)
|
||||||
|
void W25QXX_Read(unsigned char* pBuffer,unsigned int ReadAddr,unsigned short NumByteToRead)
|
||||||
|
{
|
||||||
|
if((ReadAddr + NumByteToRead) > NOR_FLASH_SIZE)return;
|
||||||
|
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_Quad_Read,ReadAddr,8,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_4_LINES);
|
||||||
|
QSPI_Receive(pBuffer,NumByteToRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
//SPI在一页(0~65535)内写入少于256个字节的数据
|
||||||
|
//在指定地址开始写入最大256字节的数据
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//WriteAddr:开始写入的地址(最大32bit)
|
||||||
|
//NumByteToWrite:要写入的字节数(最大256),该数不应该超过该页的剩余字节数!!!
|
||||||
|
void W25QXX_Write_Page(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite)
|
||||||
|
{
|
||||||
|
if((WriteAddr + NumByteToWrite) > NOR_FLASH_SIZE)return;
|
||||||
|
|
||||||
|
W25QXX_Write_Enable();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_Quad_PageProgram,WriteAddr,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_4_LINES);
|
||||||
|
QSPI_Transmit(pBuffer,NumByteToWrite);
|
||||||
|
wait();
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Write_Byte_no_wait(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite)
|
||||||
|
{
|
||||||
|
if(((WriteAddr&0xFF) + NumByteToWrite) > NOR_PAGE_SIZE)return;
|
||||||
|
|
||||||
|
W25QXX_Write_Enable();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_Quad_PageProgram,WriteAddr,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_4_LINES);
|
||||||
|
QSPI_Transmit(pBuffer,NumByteToWrite);
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
//无检验写SPI FLASH
|
||||||
|
//必须确保所写的地址范围内的数据全部为0XFF,否则在非0XFF处写入的数据将失败!
|
||||||
|
//具有自动换页功能
|
||||||
|
//在指定地址开始写入指定长度的数据,但是要确保地址不越界!
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//WriteAddr:开始写入的地址(最大32bit)
|
||||||
|
//NumByteToWrite:要写入的字节数(最大65535)
|
||||||
|
//CHECK OK
|
||||||
|
void W25QXX_Write_NoCheck(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite)
|
||||||
|
{
|
||||||
|
unsigned short pageremain;
|
||||||
|
|
||||||
|
if((WriteAddr + NumByteToWrite) > NOR_FLASH_SIZE)return;
|
||||||
|
|
||||||
|
pageremain=256-WriteAddr%256; //单页剩余的字节数
|
||||||
|
if(NumByteToWrite<=pageremain)pageremain=NumByteToWrite;//不大于256个字节
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
W25QXX_Write_Page(pBuffer,WriteAddr,pageremain);
|
||||||
|
|
||||||
|
if(NumByteToWrite==pageremain)break;//写入结束了
|
||||||
|
else //NumByteToWrite>pageremain
|
||||||
|
{
|
||||||
|
pBuffer+=pageremain;
|
||||||
|
WriteAddr+=pageremain;
|
||||||
|
|
||||||
|
NumByteToWrite-=pageremain; //减去已经写入了的字节数
|
||||||
|
if(NumByteToWrite>256)pageremain=256; //一次可以写入256个字节
|
||||||
|
else pageremain=NumByteToWrite; //不够256个字节了
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//写SPI FLASH
|
||||||
|
//在指定地址开始写入指定长度的数据
|
||||||
|
//该函数带擦除操作!
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//WriteAddr:开始写入的地址(最大32bit)
|
||||||
|
//NumByteToWrite:要写入的字节数(最大65535)
|
||||||
|
unsigned char W25QXX_BUFFER[4096];
|
||||||
|
void W25QXX_Write(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite)
|
||||||
|
{
|
||||||
|
unsigned int secpos;
|
||||||
|
unsigned short secoff;
|
||||||
|
unsigned short secremain;
|
||||||
|
unsigned short i;
|
||||||
|
unsigned char * W25QXX_BUF;
|
||||||
|
|
||||||
|
if((WriteAddr + NumByteToWrite) > NOR_FLASH_SIZE)return;
|
||||||
|
|
||||||
|
W25QXX_BUF=W25QXX_BUFFER;
|
||||||
|
secpos=WriteAddr/4096;//扇区地址
|
||||||
|
secoff=WriteAddr%4096;//在扇区内的偏移
|
||||||
|
secremain=4096-secoff;//扇区剩余空间大小
|
||||||
|
//printf("ad:%X,nb:%X\r\n",WriteAddr,NumByteToWrite);//测试用
|
||||||
|
if(NumByteToWrite<=secremain)secremain=NumByteToWrite;//不大于4096个字节
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
W25QXX_Read(W25QXX_BUF,secpos*4096,4096);//读出整个扇区的内容
|
||||||
|
for(i=0;i<secremain;i++){//校验数据
|
||||||
|
if(W25QXX_BUF[secoff+i]!=0XFF)break;//需要擦除
|
||||||
|
}
|
||||||
|
if(i<secremain){//需要擦除
|
||||||
|
W25QXX_Erase_Sector(secpos*4096);//擦除这个扇区
|
||||||
|
for(i=0;i<secremain;i++){ //复制
|
||||||
|
W25QXX_BUF[i+secoff]=pBuffer[i];
|
||||||
|
}
|
||||||
|
W25QXX_Write_NoCheck(W25QXX_BUF,secpos*4096,4096);//写入整个扇区
|
||||||
|
}else W25QXX_Write_NoCheck(pBuffer,WriteAddr,secremain);//写已经擦除了的,直接写入扇区剩余区间.
|
||||||
|
|
||||||
|
if(NumByteToWrite==secremain)break;//写入结束了
|
||||||
|
else{//写入未结束
|
||||||
|
secpos++;//扇区地址增1
|
||||||
|
secoff=0;//偏移位置为0
|
||||||
|
|
||||||
|
pBuffer+=secremain; //指针偏移
|
||||||
|
WriteAddr+=secremain;//写地址偏移
|
||||||
|
NumByteToWrite-=secremain; //字节数递减
|
||||||
|
if(NumByteToWrite>4096)secremain=4096; //下一个扇区还是写不完
|
||||||
|
else secremain=NumByteToWrite; //下一个扇区可以写完了
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//擦除整个芯片
|
||||||
|
//等待时间超长...
|
||||||
|
void W25QXX_Erase_Chip(void)
|
||||||
|
{
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_ChipErase,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
HAL_Delay(100);
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Erase_Chip_no_wait(void)
|
||||||
|
{
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_ChipErase,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
//擦除一个扇区
|
||||||
|
//Dst_Addr:扇区地址 根据实际容量设置
|
||||||
|
//擦除一个扇区的最少时间:150ms
|
||||||
|
void W25QXX_Erase_Sector(unsigned int addr)
|
||||||
|
{
|
||||||
|
unsigned int addr_sector = addr & 0x00FFF000;
|
||||||
|
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_SectorErase_4K,addr_sector,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_NONE);
|
||||||
|
HAL_Delay(5);
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Erase_Sector_4k_no_wait(unsigned int addr)
|
||||||
|
{
|
||||||
|
unsigned int addr_sector = addr & 0x00FFF000;
|
||||||
|
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_SectorErase_4K,addr_sector,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_NONE);
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Erase_Sector_32k_no_wait(unsigned int addr)
|
||||||
|
{
|
||||||
|
unsigned int addr_sector = addr & 0x00FF8000;
|
||||||
|
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_SectorErase_32K,addr_sector,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_NONE);
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Erase_Sector_64k_no_wait(unsigned int addr)
|
||||||
|
{
|
||||||
|
unsigned int addr_sector = addr & 0x00FF0000;
|
||||||
|
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_SectorErase_64K,addr_sector,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_NONE);
|
||||||
|
__nop();
|
||||||
|
}
|
||||||
|
|
||||||
|
//等待空闲
|
||||||
|
void W25QXX_Wait_Busy(void)
|
||||||
|
{
|
||||||
|
while((W25QXX_ReadSR(1)&0x01)==0x01){
|
||||||
|
LL_IWDG_ReloadCounter(IWDG1); // 等待BUSY位清空
|
||||||
|
|
||||||
|
norflash_get_busy_flag[GET_CHIP_SELECT()] = 1;
|
||||||
|
if(norflash_err_flag[GET_CHIP_SELECT()])return;
|
||||||
|
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
norflash_get_busy_flag[GET_CHIP_SELECT()] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void W25QXX_Reset(void)
|
||||||
|
{
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_Reset_Enble,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
QSPI_Send_CMD(W25Qx_CMD_Reset_Memory,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
}
|
||||||
100
FW/Core/my_src/w25qxx.h
Normal file
100
FW/Core/my_src/w25qxx.h
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#ifndef __W25QXX_H
|
||||||
|
#define __W25QXX_H
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
//W25X系列/Q系列芯片列表 ID码
|
||||||
|
#define W25Q80 0xEF13
|
||||||
|
#define W25Q16 0xEF14
|
||||||
|
#define W25Q32 0xEF15
|
||||||
|
#define W25Q64 0xEF16
|
||||||
|
#define W25Q128 0xEF17
|
||||||
|
#define W25Q256 0xEF18
|
||||||
|
|
||||||
|
#define W25Q128_FLASH_SIZE 0x01000000
|
||||||
|
#define W25Q128_ADDR_BIT_NUM 24
|
||||||
|
|
||||||
|
#define NOR_FLASH_SIZE W25Q128_FLASH_SIZE
|
||||||
|
#define NOR_PAGE_SIZE 0x100
|
||||||
|
|
||||||
|
extern unsigned short W25QXX_TYPE; //定义W25QXX芯片型号
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//指令表
|
||||||
|
#define W25Qx_CMD_Reset_Enble 0x66
|
||||||
|
#define W25Qx_CMD_Reset_Memory 0x99
|
||||||
|
|
||||||
|
#define W25Qx_CMD_ManufactDeviceID 0x90
|
||||||
|
|
||||||
|
#define W25Qx_CMD_ReadStatusReg1 0x05
|
||||||
|
#define W25Qx_CMD_ReadStatusReg2 0x35
|
||||||
|
#define W25Qx_CMD_ReadStatusReg3 0x15
|
||||||
|
#define W25Qx_CMD_WriteStatusReg1 0x01
|
||||||
|
#define W25Qx_CMD_WriteStatusReg2 0x31
|
||||||
|
#define W25Qx_CMD_WriteStatusReg3 0x11
|
||||||
|
|
||||||
|
#define W25Qx_CMD_WriteEnable 0x06
|
||||||
|
#define W25Qx_CMD_WriteDisable 0x04
|
||||||
|
|
||||||
|
#define W25Qx_CMD_ChipErase 0x60
|
||||||
|
#define W25Qx_CMD_SectorErase_4K 0x20
|
||||||
|
#define W25Qx_CMD_SectorErase_32K 0x52
|
||||||
|
#define W25Qx_CMD_SectorErase_64K 0xD8
|
||||||
|
#define W25Qx_CMD_Quad_PageProgram 0x32
|
||||||
|
#define W25Qx_CMD_Quad_Read 0x6B
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define W25X_WriteEnable 0x06
|
||||||
|
#define W25X_WriteDisable 0x04
|
||||||
|
|
||||||
|
#define W25X_ReadStatusReg1 0x05
|
||||||
|
#define W25X_ReadStatusReg2 0x35
|
||||||
|
#define W25X_ReadStatusReg3 0x15
|
||||||
|
#define W25X_WriteStatusReg1 0x01
|
||||||
|
#define W25X_WriteStatusReg2 0x31
|
||||||
|
#define W25X_WriteStatusReg3 0x11
|
||||||
|
|
||||||
|
#define W25X_ReadData 0x03
|
||||||
|
#define W25X_FastReadData 0x0B
|
||||||
|
#define W25X_FastReadDual 0x3B
|
||||||
|
#define W25X_FastReadQuad 0x6B
|
||||||
|
#define W25X_PageProgram 0x32
|
||||||
|
#define W25X_BlockErase 0xD8
|
||||||
|
#define W25X_SectorErase 0x20
|
||||||
|
#define W25X_ChipErase 0x60
|
||||||
|
#define W25X_PowerDown 0xB9
|
||||||
|
#define W25X_ReleasePowerDown 0xAB
|
||||||
|
#define W25X_DeviceID 0xAB
|
||||||
|
#define W25X_ManufactDeviceID 0x90
|
||||||
|
#define W25X_JedecDeviceID 0x9F
|
||||||
|
#define W25X_Enable4ByteAddr 0xB7
|
||||||
|
#define W25X_Exit4ByteAddr 0xE9
|
||||||
|
#define W25X_EnterQPIMode 0x38
|
||||||
|
#define W25X_ExitQPIMode 0xFF
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern unsigned short norflash_get_busy_flag[2];
|
||||||
|
extern unsigned short norflash_err_flag[2];
|
||||||
|
|
||||||
|
extern void W25QXX_Init(void);
|
||||||
|
extern void W25QXX_Qspi_Enable(void);
|
||||||
|
extern void W25QXX_Qspi_Disable(void);
|
||||||
|
extern unsigned short W25QXX_ReadID(void);
|
||||||
|
extern unsigned char W25QXX_ReadSR(unsigned char regno);
|
||||||
|
extern void W25QXX_Write_SR(unsigned char regno,unsigned char sr);
|
||||||
|
extern void W25QXX_Write_Enable(void);
|
||||||
|
extern void W25QXX_Write_Disable(void);
|
||||||
|
extern void W25QXX_Write_NoCheck(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite);//写flash,不校验
|
||||||
|
extern void W25QXX_Read(unsigned char* pBuffer,unsigned int ReadAddr,unsigned short NumByteToRead);
|
||||||
|
extern void W25QXX_Write(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite);
|
||||||
|
extern void W25QXX_Write_Byte_no_wait(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite);
|
||||||
|
extern void W25QXX_Erase_Chip(void);
|
||||||
|
extern void W25QXX_Erase_Chip_no_wait(void);
|
||||||
|
extern void W25QXX_Erase_Sector(unsigned int addr);
|
||||||
|
extern void W25QXX_Erase_Sector_4k_no_wait(unsigned int addr);
|
||||||
|
extern void W25QXX_Erase_Sector_32k_no_wait(unsigned int addr);
|
||||||
|
extern void W25QXX_Erase_Sector_64k_no_wait(unsigned int addr);
|
||||||
|
extern void W25QXX_Wait_Busy(void);
|
||||||
|
extern void W25QXX_Reset(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
365
FW/Core/my_src/w25qxx_qspi.c
Normal file
365
FW/Core/my_src/w25qxx_qspi.c
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
#include "quadspi.h"
|
||||||
|
#include "w25qxx_qspi.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function send a Write Enable and wait it is effective.
|
||||||
|
* @param hqspi: QSPI handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void QSPI_WriteEnable(void)
|
||||||
|
{
|
||||||
|
QSPI_CommandTypeDef sCommand;
|
||||||
|
QSPI_AutoPollingTypeDef sConfig;
|
||||||
|
|
||||||
|
/* Enable write operations ------------------------------------------ */
|
||||||
|
sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;
|
||||||
|
sCommand.Instruction = WRITE_ENABLE_CMD;
|
||||||
|
sCommand.AddressMode = QSPI_ADDRESS_NONE;
|
||||||
|
sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
|
||||||
|
sCommand.DataMode = QSPI_DATA_NONE;
|
||||||
|
sCommand.DummyCycles = 0;
|
||||||
|
sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;
|
||||||
|
sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
|
||||||
|
sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
|
||||||
|
|
||||||
|
if (HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Configure automatic polling mode to wait for write enabling ---- */
|
||||||
|
sConfig.Match = 0x02;
|
||||||
|
sConfig.Mask = 0x02;
|
||||||
|
sConfig.MatchMode = QSPI_MATCH_MODE_AND;
|
||||||
|
sConfig.StatusBytesSize = 1;
|
||||||
|
sConfig.Interval = 0x10;
|
||||||
|
sConfig.AutomaticStop = QSPI_AUTOMATIC_STOP_ENABLE;
|
||||||
|
|
||||||
|
sCommand.Instruction = READ_STATUS_REG1_CMD;
|
||||||
|
sCommand.DataMode = QSPI_DATA_1_LINE;
|
||||||
|
|
||||||
|
if (HAL_QSPI_AutoPolling(&hqspi, &sCommand, &sConfig, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void QSPI_WriteDisable(void)
|
||||||
|
{
|
||||||
|
QSPI_CommandTypeDef sCommand;
|
||||||
|
QSPI_AutoPollingTypeDef sConfig;
|
||||||
|
|
||||||
|
/* Enable write operations ------------------------------------------ */
|
||||||
|
sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;
|
||||||
|
sCommand.Instruction = WRITE_DISABLE_CMD;
|
||||||
|
sCommand.AddressMode = QSPI_ADDRESS_NONE;
|
||||||
|
sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
|
||||||
|
sCommand.DataMode = QSPI_DATA_NONE;
|
||||||
|
sCommand.DummyCycles = 0;
|
||||||
|
sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;
|
||||||
|
sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
|
||||||
|
sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
|
||||||
|
|
||||||
|
if (HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Configure automatic polling mode to wait for write enabling ---- */
|
||||||
|
sConfig.Match = 0x00;
|
||||||
|
sConfig.Mask = 0x02;
|
||||||
|
sConfig.MatchMode = QSPI_MATCH_MODE_AND;
|
||||||
|
sConfig.StatusBytesSize = 1;
|
||||||
|
sConfig.Interval = 0x10;
|
||||||
|
sConfig.AutomaticStop = QSPI_AUTOMATIC_STOP_ENABLE;
|
||||||
|
|
||||||
|
sCommand.Instruction = READ_STATUS_REG1_CMD;
|
||||||
|
sCommand.DataMode = QSPI_DATA_1_LINE;
|
||||||
|
|
||||||
|
if (HAL_QSPI_AutoPolling(&hqspi, &sCommand, &sConfig, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QSPI_AutoPollingMemReady(void)//SR1 ready
|
||||||
|
{
|
||||||
|
QSPI_CommandTypeDef sCommand;
|
||||||
|
QSPI_AutoPollingTypeDef sConfig;
|
||||||
|
|
||||||
|
/* Configure automatic polling mode to wait for memory ready ------ */
|
||||||
|
sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;
|
||||||
|
sCommand.Instruction = READ_STATUS_REG1_CMD;
|
||||||
|
sCommand.AddressMode = QSPI_ADDRESS_NONE;
|
||||||
|
sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
|
||||||
|
sCommand.DataMode = QSPI_DATA_1_LINE;
|
||||||
|
sCommand.DummyCycles = 0;
|
||||||
|
sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;
|
||||||
|
sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
|
||||||
|
sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
|
||||||
|
|
||||||
|
sConfig.Match = 0x00;
|
||||||
|
sConfig.Mask = 0x01;
|
||||||
|
sConfig.MatchMode = QSPI_MATCH_MODE_AND;
|
||||||
|
sConfig.StatusBytesSize = 1;
|
||||||
|
sConfig.Interval = 0x10;
|
||||||
|
sConfig.AutomaticStop = QSPI_AUTOMATIC_STOP_ENABLE;
|
||||||
|
|
||||||
|
if (HAL_QSPI_AutoPolling_IT(&hqspi, &sCommand, &sConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char QSPI_Read_SR(unsigned char sr)
|
||||||
|
{
|
||||||
|
unsigned char cmd;
|
||||||
|
unsigned char byte = 0xF1;
|
||||||
|
|
||||||
|
if(2 == sr)cmd = READ_STATUS_REG2_CMD;
|
||||||
|
else if(3 == sr)cmd = READ_STATUS_REG3_CMD;
|
||||||
|
else cmd = READ_STATUS_REG1_CMD;
|
||||||
|
|
||||||
|
QSPI_Send_CMD(cmd,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
QSPI_Transmit(&byte,1);
|
||||||
|
return byte;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void QSPI_Write_SR(unsigned char sr, unsigned char val)
|
||||||
|
{
|
||||||
|
unsigned char cmd;
|
||||||
|
|
||||||
|
if(2 == sr)cmd = WRITE_STATUS_REG2_CMD;
|
||||||
|
else if(3 == sr)cmd = WRITE_STATUS_REG3_CMD;
|
||||||
|
else cmd = WRITE_STATUS_REG1_CMD;
|
||||||
|
|
||||||
|
QSPI_Send_CMD(cmd,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
QSPI_Transmit(&val,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25qxx_write_enable(void)
|
||||||
|
{
|
||||||
|
QSPI_WriteEnable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25qxx_write_disable(void)
|
||||||
|
{
|
||||||
|
QSPI_WriteDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25qxx_reset(void)
|
||||||
|
{
|
||||||
|
QSPI_Send_CMD(RESET_ENABLE_CMD,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
QSPI_Send_CMD(RESET_MEMORY_CMD,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25qxx_wait_ready(void)
|
||||||
|
{
|
||||||
|
QSPI_AutoPollingMemReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25qxx_qspi_enable(void)
|
||||||
|
{
|
||||||
|
unsigned char reg;
|
||||||
|
|
||||||
|
reg = QSPI_Read_SR(2);
|
||||||
|
|
||||||
|
if(!(reg & 0x02)){
|
||||||
|
QSPI_Write_SR(2, (reg | 0x02));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25qxx_qspi_disable(void)
|
||||||
|
{
|
||||||
|
unsigned char reg;
|
||||||
|
|
||||||
|
reg = QSPI_Read_SR(2);
|
||||||
|
|
||||||
|
if(reg & 0x02){
|
||||||
|
QSPI_Write_SR(2, (reg & (~0x02)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void w25qxx_qspi_setup(void)
|
||||||
|
{
|
||||||
|
unsigned char temp;
|
||||||
|
|
||||||
|
w25qxx_write_enable();
|
||||||
|
w25qxx_reset();
|
||||||
|
HAL_Delay(5);
|
||||||
|
|
||||||
|
w25qxx_write_enable();
|
||||||
|
w25qxx_wait_ready();
|
||||||
|
|
||||||
|
while(!(QSPI_Read_SR(2) & 0x02))
|
||||||
|
{
|
||||||
|
w25qxx_qspi_enable();
|
||||||
|
HAL_Delay(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short w25qxx_qspi_read_id(void)
|
||||||
|
{
|
||||||
|
unsigned char temp[2];
|
||||||
|
unsigned short deviceid;
|
||||||
|
|
||||||
|
QSPI_Send_CMD(READ_ID_CMD,0,0,QSPI_INSTRUCTION_1_LINE,QSPI_ADDRESS_1_LINE,QSPI_ADDRESS_24_BITS,QSPI_DATA_1_LINE);//QPI,读id,地址为0,4线传输数据_24位地址_4线传输地址_4线传输指令,无空周期,2个字节数据
|
||||||
|
QSPI_Receive(temp,2);
|
||||||
|
deviceid=(temp[0]<<8)|temp[1];
|
||||||
|
|
||||||
|
return deviceid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
//返回值如下:
|
||||||
|
//0XEF13,表示芯片型号为W25Q80
|
||||||
|
//0XEF14,表示芯片型号为W25Q16
|
||||||
|
//0XEF15,表示芯片型号为W25Q32
|
||||||
|
//0XEF16,表示芯片型号为W25Q64
|
||||||
|
//0XEF17,表示芯片型号为W25Q128
|
||||||
|
//0XEF18,表示芯片型号为W25Q256
|
||||||
|
unsigned short W25QXX_ReadID(void)
|
||||||
|
{
|
||||||
|
unsigned char temp[2];
|
||||||
|
unsigned short deviceid;
|
||||||
|
QSPI_Send_CMD(W25X_ManufactDeviceID,0,0,QSPI_INSTRUCTION_4_LINES,QSPI_ADDRESS_4_LINES,QSPI_ADDRESS_24_BITS,QSPI_DATA_4_LINES);//QPI,读id,地址为0,4线传输数据_24位地址_4线传输地址_4线传输指令,无空周期,2个字节数据
|
||||||
|
QSPI_Receive(temp,2);
|
||||||
|
deviceid=(temp[0]<<8)|temp[1];
|
||||||
|
return deviceid;
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取SPI FLASH,仅支持QPI模式
|
||||||
|
//在指定地址开始读取指定长度的数据
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//ReadAddr:开始读取的地址(最大32bit)
|
||||||
|
//NumByteToRead:要读取的字节数(最大65535)
|
||||||
|
void W25QXX_Read(unsigned char* pBuffer,unsigned int ReadAddr,unsigned short NumByteToRead)
|
||||||
|
{
|
||||||
|
QSPI_Send_CMD(W25X_FastReadData,ReadAddr,8,QSPI_INSTRUCTION_4_LINES,QSPI_ADDRESS_4_LINES,QSPI_ADDRESS_32_BITS,QSPI_DATA_4_LINES); //QPI,快速读数据,地址为ReadAddr,4线传输数据_32位地址_4线传输地址_4线传输指令,8空周期,NumByteToRead个数据
|
||||||
|
QSPI_Receive(pBuffer,NumByteToRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
//SPI在一页(0~65535)内写入少于256个字节的数据
|
||||||
|
//在指定地址开始写入最大256字节的数据
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//WriteAddr:开始写入的地址(最大32bit)
|
||||||
|
//NumByteToWrite:要写入的字节数(最大256),该数不应该超过该页的剩余字节数!!!
|
||||||
|
void W25QXX_Write_Page(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite)
|
||||||
|
{
|
||||||
|
W25QXX_Write_Enable(); //写使能
|
||||||
|
QSPI_Send_CMD(W25X_PageProgram,WriteAddr,0,QSPI_INSTRUCTION_4_LINES,QSPI_ADDRESS_4_LINES,QSPI_ADDRESS_32_BITS,QSPI_DATA_4_LINES); //QPI,页写指令,地址为WriteAddr,4线传输数据_32位地址_4线传输地址_4线传输指令,无空周期,NumByteToWrite个数据
|
||||||
|
QSPI_Transmit(pBuffer,NumByteToWrite);
|
||||||
|
W25QXX_Wait_Busy(); //等待写入结束
|
||||||
|
}
|
||||||
|
|
||||||
|
//无检验写SPI FLASH
|
||||||
|
//必须确保所写的地址范围内的数据全部为0XFF,否则在非0XFF处写入的数据将失败!
|
||||||
|
//具有自动换页功能
|
||||||
|
//在指定地址开始写入指定长度的数据,但是要确保地址不越界!
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//WriteAddr:开始写入的地址(最大32bit)
|
||||||
|
//NumByteToWrite:要写入的字节数(最大65535)
|
||||||
|
//CHECK OK
|
||||||
|
void W25QXX_Write_NoCheck(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite)
|
||||||
|
{
|
||||||
|
unsigned short pageremain;
|
||||||
|
pageremain=256-WriteAddr%256; //单页剩余的字节数
|
||||||
|
if(NumByteToWrite<=pageremain)pageremain=NumByteToWrite;//不大于256个字节
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
W25QXX_Write_Page(pBuffer,WriteAddr,pageremain);
|
||||||
|
if(NumByteToWrite==pageremain)break;//写入结束了
|
||||||
|
else //NumByteToWrite>pageremain
|
||||||
|
{
|
||||||
|
pBuffer+=pageremain;
|
||||||
|
WriteAddr+=pageremain;
|
||||||
|
|
||||||
|
NumByteToWrite-=pageremain; //减去已经写入了的字节数
|
||||||
|
if(NumByteToWrite>256)pageremain=256; //一次可以写入256个字节
|
||||||
|
else pageremain=NumByteToWrite; //不够256个字节了
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//写SPI FLASH
|
||||||
|
//在指定地址开始写入指定长度的数据
|
||||||
|
//该函数带擦除操作!
|
||||||
|
//pBuffer:数据存储区
|
||||||
|
//WriteAddr:开始写入的地址(最大32bit)
|
||||||
|
//NumByteToWrite:要写入的字节数(最大65535)
|
||||||
|
unsigned char W25QXX_BUFFER[4096];
|
||||||
|
void W25QXX_Write(unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite)
|
||||||
|
{
|
||||||
|
unsigned int secpos;
|
||||||
|
unsigned short secoff;
|
||||||
|
unsigned short secremain;
|
||||||
|
unsigned short i;
|
||||||
|
unsigned char * W25QXX_BUF;
|
||||||
|
W25QXX_BUF=W25QXX_BUFFER;
|
||||||
|
secpos=WriteAddr/4096;//扇区地址
|
||||||
|
secoff=WriteAddr%4096;//在扇区内的偏移
|
||||||
|
secremain=4096-secoff;//扇区剩余空间大小
|
||||||
|
//printf("ad:%X,nb:%X\r\n",WriteAddr,NumByteToWrite);//测试用
|
||||||
|
if(NumByteToWrite<=secremain)secremain=NumByteToWrite;//不大于4096个字节
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
W25QXX_Read(W25QXX_BUF,secpos*4096,4096);//读出整个扇区的内容
|
||||||
|
for(i=0;i<secremain;i++)//校验数据
|
||||||
|
{
|
||||||
|
if(W25QXX_BUF[secoff+i]!=0XFF)break;//需要擦除
|
||||||
|
}
|
||||||
|
if(i<secremain)//需要擦除
|
||||||
|
{
|
||||||
|
W25QXX_Erase_Sector(secpos);//擦除这个扇区
|
||||||
|
for(i=0;i<secremain;i++) //复制
|
||||||
|
{
|
||||||
|
W25QXX_BUF[i+secoff]=pBuffer[i];
|
||||||
|
}
|
||||||
|
W25QXX_Write_NoCheck(W25QXX_BUF,secpos*4096,4096);//写入整个扇区
|
||||||
|
|
||||||
|
}else W25QXX_Write_NoCheck(pBuffer,WriteAddr,secremain);//写已经擦除了的,直接写入扇区剩余区间.
|
||||||
|
if(NumByteToWrite==secremain)break;//写入结束了
|
||||||
|
else//写入未结束
|
||||||
|
{
|
||||||
|
secpos++;//扇区地址增1
|
||||||
|
secoff=0;//偏移位置为0
|
||||||
|
|
||||||
|
pBuffer+=secremain; //指针偏移
|
||||||
|
WriteAddr+=secremain;//写地址偏移
|
||||||
|
NumByteToWrite-=secremain; //字节数递减
|
||||||
|
if(NumByteToWrite>4096)secremain=4096; //下一个扇区还是写不完
|
||||||
|
else secremain=NumByteToWrite; //下一个扇区可以写完了
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//擦除整个芯片
|
||||||
|
//等待时间超长...
|
||||||
|
void W25QXX_Erase_Chip(void)
|
||||||
|
{
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25X_ChipErase,0,0,QSPI_INSTRUCTION_4_LINES,QSPI_ADDRESS_NONE,QSPI_ADDRESS_8_BITS,QSPI_DATA_NONE);//QPI,写全片擦除指令,地址为0,无数据_8位地址_无地址_4线传输指令,无空周期,0个字节数据
|
||||||
|
W25QXX_Wait_Busy(); //等待芯片擦除结束
|
||||||
|
}
|
||||||
|
|
||||||
|
//擦除一个扇区
|
||||||
|
//Dst_Addr:扇区地址 根据实际容量设置
|
||||||
|
//擦除一个扇区的最少时间:150ms
|
||||||
|
void W25QXX_Erase_Sector(unsigned int Dst_Addr)
|
||||||
|
{
|
||||||
|
|
||||||
|
//printf("fe:%x\r\n",Dst_Addr); //监视falsh擦除情况,测试用
|
||||||
|
Dst_Addr*=4096;
|
||||||
|
W25QXX_Write_Enable(); //SET WEL
|
||||||
|
W25QXX_Wait_Busy();
|
||||||
|
QSPI_Send_CMD(W25X_SectorErase,Dst_Addr,0,QSPI_INSTRUCTION_4_LINES,QSPI_ADDRESS_4_LINES,QSPI_ADDRESS_32_BITS,QSPI_DATA_NONE);//QPI,写扇区擦除指令,地址为0,无数据_32位地址_4线传输地址_4线传输指令,无空周期,0个字节数据
|
||||||
|
W25QXX_Wait_Busy(); //等待擦除完成
|
||||||
|
}
|
||||||
|
|
||||||
|
//等待空闲
|
||||||
|
void W25QXX_Wait_Busy(void)
|
||||||
|
{
|
||||||
|
while((W25QXX_ReadSR(1)&0x01)==0x01); // 等待BUSY位清空
|
||||||
|
}
|
||||||
|
*/
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user