HAL_Empty: added empty flash driver

This commit is contained in:
Andrew Tridgell 2019-03-26 11:14:05 +11:00
parent 36f7116054
commit 92e509a418
4 changed files with 19 additions and 1 deletions

View File

@ -18,4 +18,5 @@ namespace Empty {
class Storage;
class UARTDriver;
class Util;
class Flash;
}

View File

@ -16,3 +16,4 @@
#include "Storage.h"
#include "UARTDriver.h"
#include "Util.h"
#include "Flash.h"

View File

@ -0,0 +1,14 @@
#pragma once
#include "AP_HAL_Empty.h"
class Empty::Flash : public AP_HAL::Flash {
public:
uint32_t getpageaddr(uint32_t page) override { return 0; }
uint32_t getpagesize(uint32_t page) override { return 0; }
uint32_t getnumpages(void) override { return 0; }
bool erasepage(uint32_t page) override { return false; }
bool write(uint32_t addr, const void *buf, uint32_t count) override { return false; }
void keep_unlocked(bool set) override {}
bool ispageerased(uint32_t page) override { return false; }
};

View File

@ -21,6 +21,7 @@ static RCOutput rcoutDriver;
static Scheduler schedulerInstance;
static Util utilInstance;
static OpticalFlow opticalFlowDriver;
static Flash flashDriver;
HAL_Empty::HAL_Empty() :
AP_HAL::HAL(
@ -40,7 +41,8 @@ HAL_Empty::HAL_Empty() :
&rcoutDriver,
&schedulerInstance,
&utilInstance,
&opticalFlowDriver)
&opticalFlowDriver,
&flashDriver)
{}
void HAL_Empty::run(int argc, char* const argv[], Callbacks* callbacks) const