Dependencies:   mbed

Fork of 00_eeprom_emulation_f401 by Nothing Special

Files at this revision

API Documentation at this revision

Comitter:
carlospomar
Date:
Fri Jan 12 17:16:10 2018 +0000
Parent:
1:bc0ee9ad46aa
Commit message:
asdf

Changed in this revision

main.cpp Show diff for this revision Revisions of this file
diff -r bc0ee9ad46aa -r 57d33e954f0c main.cpp
--- a/main.cpp	Tue Sep 27 20:36:44 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-
-#include "mbed.h"
-#include "eeprom.h"
-#include <ctype.h>
-
-
-
-uint16_t n = 0;
-/* Virtual address defined by the user: 0xFFFF value is prohibited */
-uint16_t VirtAddVarTab[NB_OF_VAR] = {0x5555, 0x6666, 0x7777};
-uint16_t VarDataTab[] = {0, 0, 0};
-
-
-
-int main()
-{
-
-    /* Unlock the Flash Program Erase controller */
-    HAL_FLASH_Unlock();
-
-    EE_Init();
-    
-    printf("EEPROM emulation test\n");
-
-    printf("\n\rType one of the following commands and press space or enter");
-    printf("\n\r READ - read all variables\n\r WRITE1 <n> - write first variable\n\r WRITE2 <n> - write second variable\n\r WRITE3 <n> - write third variable");
-    printf("\n\rwhere <n> is uint16_t value (0-65535)");
-    printf("\n\r");
-
-
-    char command[20];
-    char arg[10];
-            int i;
-
-    while(1) {
-        scanf("%s", command);
-    i=0;    
-    while(command[i])
-   {
-      command[i]=toupper(command[i]);
-      i++;
-   }
-       
-
-        if (strcmp("READ", command)==0) {
-            for (i=0; i<3; i++) {
-                EE_ReadVariable(VirtAddVarTab[i], &VarDataTab[i]);
-            };
-            printf("\nvar1=%6u,  var2=%6u,  var3=%6u",VarDataTab[0],VarDataTab[1],VarDataTab[2]);
-        }
-///////////////////////////////////////////////////////////////////////////////////////////////////////
-        else if (strcmp("WRITE1", command)==0) {
-            scanf("%s", arg);
-            printf("\nok");
-            n=atoi(arg);
-            EE_WriteVariable(VirtAddVarTab[0], n);
-        }
-////////////////////////////////////////////////////////////////////////////////////
-        else if (strcmp("WRITE2", command)==0) {
-            scanf("%s", arg);
-            printf("\nok");
-            n=atoi(arg);
-            EE_WriteVariable(VirtAddVarTab[1], n);
-        }
-////////////////////////////////////////////////////////////////////////////////////
-        else if (strcmp("WRITE3", command)==0) {
-            scanf("%s", arg);
-            printf("\nok");
-            n=atoi(arg);
-            EE_WriteVariable(VirtAddVarTab[2], n);
-        }
-////////////////////////////////////////////////////////////////////////////////////
-        else if (strcmp("T1", command)==0) {
-            // multiple write test. After test var1 = 1000
-            printf("\nok");
-            for (n=0;n<1001;n++)
-            {
-            EE_WriteVariable(VirtAddVarTab[0], n);
-            };
-        }
-////////////////////////////////////////////////////////////////////////////////////
-        else if (strcmp("T2", command)==0) {
-            // multiple write test. After test var2 = 1001
-            printf("\nok");
-            for (n=0;n<1002;n++)
-            {
-            EE_WriteVariable(VirtAddVarTab[1], n);
-            };
-        }
-////////////////////////////////////////////////////////////////////////////////////
-        else if (strcmp("T3", command)==0) {
-            // multiple write test. After test var3 = 1002
-            printf("\nok");
-            for (n=0;n<1003;n++)
-            {
-            EE_WriteVariable(VirtAddVarTab[2], n);
-            };
-        }
-////////////////////////////////////////////////////////////////////////////////////
-
-        else perror("\nThere is no command matching. Try again");
-
-        command[0] = arg[0] = 0;
-        printf("\n\r");
-    }
-
-
-}