Browse Source

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
master
deweibel@gmail.com 14 years ago
parent
commit
b3c9bf270f
  1. 23
      libraries/DataFlash/DataFlash.cpp
  2. 1
      libraries/DataFlash/DataFlash.h

23
libraries/DataFlash/DataFlash.cpp

@ -231,6 +231,29 @@ void DataFlash_Class::StartWrite(int PageAdr) @@ -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)

1
libraries/DataFlash/DataFlash.h

@ -71,6 +71,7 @@ class DataFlash_Class @@ -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);

Loading…
Cancel
Save