HAL_ChibiOS: enable HAL storage erase
This commit is contained in:
parent
4eb5e5e8d4
commit
0e7a911aae
@ -380,4 +380,26 @@ bool Storage::healthy(void)
|
||||
(AP_HAL::millis() - _last_empty_ms < 2000u));
|
||||
}
|
||||
|
||||
/*
|
||||
erase all storage
|
||||
*/
|
||||
bool Storage::erase(void)
|
||||
{
|
||||
#if HAL_WITH_RAMTRON
|
||||
if (_initialisedType == StorageBackend::FRAM) {
|
||||
return AP_HAL::Storage::erase();
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_POSIX
|
||||
if (_initialisedType == StorageBackend::SDCard) {
|
||||
return AP_HAL::Storage::erase();
|
||||
}
|
||||
#endif
|
||||
#ifdef STORAGE_FLASH_PAGE
|
||||
return _flash.erase();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAL_USE_EMPTY_STORAGE
|
||||
|
@ -40,6 +40,7 @@ static_assert(CH_STORAGE_SIZE % CH_STORAGE_LINE_SIZE == 0,
|
||||
class ChibiOS::Storage : public AP_HAL::Storage {
|
||||
public:
|
||||
void init() override {}
|
||||
bool erase() override;
|
||||
void read_block(void *dst, uint16_t src, size_t n) override;
|
||||
void write_block(uint16_t dst, const void* src, size_t n) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user