Mateusz Garwol / Mbed 2 deprecated 2_5

Dependencies:   LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI

string.h

Committer:
matis755
Date:
2020-05-20
Revision:
2:8788d711db7e
Child:
3:6fc7976cc5bf

File content as of revision 2:8788d711db7e:

#define NULL 0
#define TERMINATOR '\r'
#define DELIMITER_CHAR 0x20

#define HEX_bm 0x000F
#define MAX_TOKEN_NR 2
#define MAX_KEYWORD_STRING_LTH 6
#define MAX_KEYWORD_NR 2


typedef enum CompResult 
{ DIFFERENT , EQUAL } CompResult;

typedef enum Result 
{ OK, NOK } Result;

typedef enum TokenType 
{KEYWORD, NUMBER, STRING} TokenType;

typedef enum KeywordCode 
{ CLB, GT} KeywordCode;

typedef union TokenValue
{
enum KeywordCode eKeyword;
unsigned int uiNumber;
char *pcString; 
} TokenValue;

typedef struct Token
{
enum TokenType eType; 
union TokenValue uValue; 
} Token;


typedef struct Keyword
{
enum KeywordCode eCode;
char cString[MAX_KEYWORD_STRING_LTH + 1];
} Keyword;


void CopyString(char pcSource[], char pcDestination[]);
enum CompResult eCompareString(char pcStr1[], char pcStr2[]);
void AppendString (char pcSourceStr[],char pcDestinationStr[]);
void ReplaceCharactersInString(char pcString[],char cOldChar,char cNewChar);
void UIntToHexStr(unsigned int uiValue, char pcStr[]);
enum Result eHexStringToUInt(char pcStr[],unsigned int *puiValue);
void AppendUIntToString (unsigned int uiValue, char pcDestinationStr[]);
unsigned char ucFindTokensInString(char *pcString);
enum Result eStringToKeyword (char pcStr[],enum KeywordCode *peKeywordCode);
void DecodeTokens(unsigned char ucTokenCnt);
void DecodeMsg(char *pcString);