Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
memory.c
00001 #include "mbed.h" 00002 #include "iface.h" 00003 #include "memory.h" 00004 00005 LocalFileSystem local("local"); 00006 00007 extern int channelPointer; 00008 extern char* channelData; 00009 00010 void saveMemory() { 00011 int chan; 00012 FILE* mem = fopen("/local/memory.txt", "w"); 00013 for(chan = 0; chan < CHANNELCOUNT; chan++) 00014 if(channelData[chan]) 00015 fprintf(mem, "%03d %03hhd\r\n", chan, channelData[chan]); 00016 fclose(mem); 00017 } 00018 00019 void loadMemory() { 00020 int chan; 00021 char val; 00022 for(chan = 0; chan < CHANNELCOUNT; chan++) channelData[channelPointer] = 0; 00023 FILE* mem = fopen("/local/memory.txt", "r"); 00024 while(fscanf(mem, "%d %hhd ", &chan, &val) != EOF) channelData[chan] = val; 00025 fclose(mem); 00026 channelPointer = 0; 00027 }
Generated on Thu Jul 14 2022 01:01:12 by
1.7.2