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:
parent
9d74a599b0
commit
343c6565db
@ -231,6 +231,29 @@ void DataFlash_Class::StartWrite(int PageAdr)
|
|||||||
WaitReady();
|
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)
|
void DataFlash_Class::WriteByte(byte data)
|
||||||
{
|
{
|
||||||
if (!df_Stop_Write)
|
if (!df_Stop_Write)
|
||||||
|
@ -71,6 +71,7 @@ class DataFlash_Class
|
|||||||
void PageErase (unsigned int PageAdr);
|
void PageErase (unsigned int PageAdr);
|
||||||
// Write methods
|
// Write methods
|
||||||
void StartWrite(int PageAdr);
|
void StartWrite(int PageAdr);
|
||||||
|
void FinishWrite();
|
||||||
void WriteByte(unsigned char data);
|
void WriteByte(unsigned char data);
|
||||||
void WriteInt(int data);
|
void WriteInt(int data);
|
||||||
void WriteLong(long data);
|
void WriteLong(long data);
|
||||||
|
Loading…
Reference in New Issue
Block a user