mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_HAL: added hal.flash driver
needed for semaphore
This commit is contained in:
parent
9fa742e1be
commit
65d051cbc9
@ -18,6 +18,7 @@
|
||||
#include "Semaphores.h"
|
||||
#include "Util.h"
|
||||
#include "OpticalFlow.h"
|
||||
#include "Flash.h"
|
||||
|
||||
#if HAL_WITH_UAVCAN
|
||||
#include "CAN.h"
|
||||
|
@ -34,6 +34,7 @@ namespace AP_HAL {
|
||||
class CAN;
|
||||
|
||||
class Util;
|
||||
class Flash;
|
||||
|
||||
/* Utility Classes */
|
||||
class Print;
|
||||
|
18
libraries/AP_HAL/Flash.h
Normal file
18
libraries/AP_HAL/Flash.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
interface to flash read/write
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "AP_HAL_Namespace.h"
|
||||
|
||||
class AP_HAL::Flash {
|
||||
public:
|
||||
virtual uint32_t getpageaddr(uint32_t page) = 0;
|
||||
virtual uint32_t getpagesize(uint32_t page) = 0;
|
||||
virtual uint32_t getnumpages(void) = 0;
|
||||
virtual bool erasepage(uint32_t page) = 0;
|
||||
virtual bool write(uint32_t addr, const void *buf, uint32_t count) = 0;
|
||||
virtual void keep_unlocked(bool set) = 0;
|
||||
virtual bool ispageerased(uint32_t page) = 0;
|
||||
};
|
@ -38,6 +38,7 @@ public:
|
||||
AP_HAL::Scheduler* _scheduler,
|
||||
AP_HAL::Util* _util,
|
||||
AP_HAL::OpticalFlow *_opticalflow,
|
||||
AP_HAL::Flash *_flash,
|
||||
#if HAL_WITH_UAVCAN
|
||||
AP_HAL::CANManager* _can_mgr[MAX_NUMBER_OF_CAN_DRIVERS])
|
||||
#else
|
||||
@ -61,7 +62,8 @@ public:
|
||||
rcout(_rcout),
|
||||
scheduler(_scheduler),
|
||||
util(_util),
|
||||
opticalflow(_opticalflow)
|
||||
opticalflow(_opticalflow),
|
||||
flash(_flash)
|
||||
{
|
||||
#if HAL_WITH_UAVCAN
|
||||
if (_can_mgr == nullptr) {
|
||||
@ -112,6 +114,7 @@ public:
|
||||
AP_HAL::Scheduler* scheduler;
|
||||
AP_HAL::Util *util;
|
||||
AP_HAL::OpticalFlow *opticalflow;
|
||||
AP_HAL::Flash *flash;
|
||||
#if HAL_WITH_UAVCAN
|
||||
AP_HAL::CANManager* can_mgr[MAX_NUMBER_OF_CAN_DRIVERS];
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user