DataFlash: AP_HAL port fixups

This commit is contained in:
Pat Hickey 2012-12-07 20:35:58 -08:00 committed by Andrew Tridgell
parent a14621534c
commit 7b9b088261
2 changed files with 7 additions and 3 deletions

View File

@ -4,8 +4,10 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <AP_HAL.h>
#include "DataFlash.h" #include "DataFlash.h"
extern AP_HAL::HAL& hal;
// *** DATAFLASH PUBLIC FUNCTIONS *** // *** DATAFLASH PUBLIC FUNCTIONS ***
void DataFlash_Class::StartWrite(int16_t PageAdr) void DataFlash_Class::StartWrite(int16_t PageAdr)
@ -186,11 +188,13 @@ uint16_t DataFlash_Class::GetFilePage()
return df_FilePage; return df_FilePage;
} }
void DataFlash_Class::EraseAll(void (*delay_cb)(unsigned long)) void DataFlash_Class::EraseAll()
{ {
for(uint16_t j = 1; j <= (df_NumPages+1)/8; j++) { for(uint16_t j = 1; j <= (df_NumPages+1)/8; j++) {
BlockErase(j); BlockErase(j);
delay_cb(1); if (j%6 == 0) {
hal.scheduler->delay(6);
}
} }
// write the logging format in the last page // write the logging format in the last page
StartWrite(df_NumPages+1); StartWrite(df_NumPages+1);

View File

@ -59,7 +59,7 @@ public:
int16_t GetWritePage(void); int16_t GetWritePage(void);
// erase handling // erase handling
void EraseAll(void (*delay_cb)(unsigned long)); void EraseAll();
bool NeedErase(void); bool NeedErase(void);
// Write methods // Write methods