Oddanie

Dependents:   MBED2-5

Files at this revision

API Documentation at this revision

Comitter:
lolkusus
Date:
Mon May 18 18:03:38 2020 +0000
Parent:
0:f6e7c3ad5a58
Commit message:
final;

Changed in this revision

DECODER.cpp Show annotated file Show diff for this revision Revisions of this file
DECODER.h Show annotated file Show diff for this revision Revisions of this file
--- a/DECODER.cpp	Mon May 18 17:08:10 2020 +0000
+++ b/DECODER.cpp	Mon May 18 18:03:38 2020 +0000
@@ -7,16 +7,6 @@
     {STEP, "step"}
 };
 
-enum CompResult Decoder::eCompareString(char pcStr1[], char pcStr2[])
-{
-    unsigned char ucCharCounter;
-    for(ucCharCounter=0;pcStr1[ucCharCounter] != '\0';ucCharCounter++)
-    {
-        if (pcStr1[ucCharCounter] != pcStr2[ucCharCounter]) return DIFFERENT;
-    }
-    return EQUAL;
-}
-
 void Decoder::ReplaceCharactersInString(char pcString[],char cOldChar,char cNewChar)
 {
     unsigned char ucCharCounter;
@@ -89,7 +79,7 @@
     unsigned char ucTokenCounter;
     for(ucTokenCounter=0;ucTokenCounter<MAX_KEYWORD_NR;ucTokenCounter++)
     {
-        if (eCompareString(pcStr,asKeywordList[ucTokenCounter].cString) == EQUAL)
+        if (strcmp(pcStr,asKeywordList[ucTokenCounter].cString) == 0)
         {
             *peKeywordCode = asKeywordList[ucTokenCounter].eCode;
             return OK;
--- a/DECODER.h	Mon May 18 17:08:10 2020 +0000
+++ b/DECODER.h	Mon May 18 18:03:38 2020 +0000
@@ -1,14 +1,13 @@
 #ifndef DECODER_H
 #define DECODER_H
 
+#include "mbed.h"
+
 #define HEX_bm 0x000F
 #define MAX_TOKEN_NR 2
 #define MAX_KEYWORD_STRING_LTH 6
 #define MAX_KEYWORD_NR 4
 
-typedef enum CompResult
-{ DIFFERENT , EQUAL } CompResult;
-
 typedef enum TokeType
 {KEYWORD, NUMBER, EMPTY} TokeType;
 
@@ -43,7 +42,6 @@
         enum Result DecodeMsg(char *pcString);
         struct Token asToken[MAX_TOKEN_NR];
     private:
-        enum CompResult eCompareString(char pcStr1[], char pcStr2[]);
         void ReplaceCharactersInString(char pcString[],char cOldChar,char cNewChar);
         enum Result eHexStringToUInt(char pcStr[],unsigned int *puiValue);
         unsigned char ucFindTokensInString(char *pcString);