From 7b9b08826185cac388f5edde63f9e54aa326264a Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Fri, 7 Dec 2012 20:35:58 -0800 Subject: [PATCH] DataFlash: AP_HAL port fixups --- libraries/DataFlash/DataFlash.cpp | 8 ++++++-- libraries/DataFlash/DataFlash.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/DataFlash/DataFlash.cpp b/libraries/DataFlash/DataFlash.cpp index ff67a911d6..9f3395bd4b 100644 --- a/libraries/DataFlash/DataFlash.cpp +++ b/libraries/DataFlash/DataFlash.cpp @@ -4,8 +4,10 @@ */ #include +#include #include "DataFlash.h" +extern AP_HAL::HAL& hal; // *** DATAFLASH PUBLIC FUNCTIONS *** void DataFlash_Class::StartWrite(int16_t PageAdr) @@ -186,11 +188,13 @@ uint16_t DataFlash_Class::GetFilePage() 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++) { BlockErase(j); - delay_cb(1); + if (j%6 == 0) { + hal.scheduler->delay(6); + } } // write the logging format in the last page StartWrite(df_NumPages+1); diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 824a1066cb..2313682703 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -59,7 +59,7 @@ public: int16_t GetWritePage(void); // erase handling - void EraseAll(void (*delay_cb)(unsigned long)); + void EraseAll(); bool NeedErase(void); // Write methods