Add FinishWrite method to the DataFlash class to support using an index system.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1575 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
deweibel@gmail.com 2011-01-30 01:53:04 +00:00
parent c7f162ed51
commit b3c9bf270f
2 changed files with 24 additions and 0 deletions

View File

@ -231,6 +231,29 @@ void DataFlash_Class::StartWrite(int PageAdr)
WaitReady();
}
void DataFlash_Class::FinishWrite(void)
{
df_BufferIdx=0;
BufferToPage(df_BufferNum,df_PageAdr,0); // Write Buffer to memory, NO WAIT
df_PageAdr++;
if (OVERWRITE_DATA==1)
{
if (df_PageAdr>=4096) // If we reach the end of the memory, start from the begining
df_PageAdr = 1;
}
else
{
if (df_PageAdr>=4096) // If we reach the end of the memory, stop here
df_Stop_Write=1;
}
if (df_BufferNum==1) // Change buffer to continue writing...
df_BufferNum=2;
else
df_BufferNum=1;
}
void DataFlash_Class::WriteByte(byte data)
{
if (!df_Stop_Write)

View File

@ -71,6 +71,7 @@ class DataFlash_Class
void PageErase (unsigned int PageAdr);
// Write methods
void StartWrite(int PageAdr);
void FinishWrite();
void WriteByte(unsigned char data);
void WriteInt(int data);
void WriteLong(long data);