⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.h

📁 ST ARM STR7系列在应用编程示例.采用串口下载.可供参考
💻 H
字号:
/******************** (C) COPYRIGHT 2004 STMicroelectronics ********************
* File Name          : common.h
* Author             : MCD Application Team
* Date First Issued  : 10/25/2004
* Description        : This file provides all the header of the common functions
********************************************************************************
* History:
*  10/25/2004 : Created
*  11/24/2004 : IAP Version 1.0
********************************************************************************
THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A 
RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR 
CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH 
SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN
IN CONNECTION WITH THEIR PRODUCTS.
********************************************************************************/
#ifndef __common_h
#define __common_h

#include "71x_lib.h"
#include "stdio.h"
#include "string.h"
#include "ymodem.h"


//common routines
#define IS_AF(c)	((c >= 'A') && (c <= 'F'))
#define IS_af(c)	((c >= 'a') && (c <= 'f'))
#define IS_09(c)	((c >= '0') && (c <= '9'))
#define ISVALIDHEX(c)	IS_AF(c) || IS_af(c) || IS_09(c)
#define ISVALIDDEC(c)	IS_09(c)
#define CONVERTDEC(c)	(c - '0')

#define CONVERTHEX_alpha(c)	(IS_AF(c) ? (c - 'A'+10) : (c - 'a'+10))	
#define CONVERTHEX(c)   (IS_09(c) ? (c - '0') : CONVERTHEX_alpha(c))

// Constants used by Serial Command Line Mode
#define CMD_STRING_SIZE     128

extern s32 gimagesize;
/*******************************************************************************
* Function Name  : Int2Str
* Description    : Convert an Integer to a srting 
* Input 1        : The string
* Input 2        : The intger to be converted  
* Return         : None                                         
*******************************************************************************/
void Int2Str(char* str,s32 intnum);
/*******************************************************************************
* Function Name  : Str2Int
* Description    : Convert a srting to an integer 
* Input 1        : The string to be converted
* Input 2        : The intger value  
* Return         : 1 -- Correct
                 : 0 -- Error                                           
*******************************************************************************/
u32 Str2Int(char *inputstr,s32 *intnum);

/*******************************************************************************
* Function Name  : GetIntegerInput
* Description    : Get an integer from the HyperTerminal 
* Input          : The inetger
* Return         : 1 -- Correct
                 : 0 -- Error                                           
*******************************************************************************/
u32 GetIntegerInput(s32 * num);

/*******************************************************************************
* Function Name  : SerialKeyPressed
* Description    : Test to see if a key has been pressed on the HyperTerminal 
* Input          : The key pressed
* Return         : 1 -- Correct
                 : 0 -- Error                                           
*******************************************************************************/
u32 SerialKeyPressed(char *key);

/*******************************************************************************
* Function Name  : GetKey
* Description    : Get a key from the HyperTerminal 
* Input          : None
* Return         : The Key Pressed                                            
*******************************************************************************/
u32 GetKey(void);

/*******************************************************************************
* Function Name  : SerialPutChar
* Description    : Print a character on the HyperTerminal 
* Input          : The character to be printed
* Return         : None                                         
*******************************************************************************/
void SerialPutChar(char c);

/*******************************************************************************
* Function Name  : SerialPutString
* Description    : Print a string on the HyperTerminal 
* Input          : The string to be printed
* Return         : None                                          
*******************************************************************************/
void SerialPutString(char *s);

/*******************************************************************************
* Function Name  : GetInputString	
* Description    : Get Input string from the HyperTerminal 
* Input          : The input string
* Return         : None                                          
*******************************************************************************/
void GetInputString (char * buffP);

/*******************************************************************************
* Function Name  : Main_Menu	
* Description    : Display the  Main Menu on to HyperTerminal
* Input          : None
* Return         : None                                          
*******************************************************************************/
void Main_Menu(void );

/*******************************************************************************
* Function Name  : SerialDownload
* Description    : Download a file via serial port 
* Input          : None 
* Return         : None                                                               
*******************************************************************************/
void SerialDownload(void);

/*******************************************************************************
* Function Name  : ProgramIntFlash
* Description    : Program internal Flash and display the status of the operation
* Input          : None
* Return         : None
*******************************************************************************/
void ProgramIntFlash(void);

#endif
/*******************(C)COPYRIGHT 2004 STMicroelectronics *****END OF FILE****/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -