ardupilot/libraries/DataFlash/DataFlash_APM2.h
Andrew Tridgell 089470a671 DataFlash: moved high level logging logic to library
this moves out all the high level logic from ArduPlane/ArduCopter to
the library. It also adds a "config page", as the last page in the
flash. This is used to check if the flash needs erasing. We only erase
now if the DF_LOGGING_FORMAT has changed.

This patch also adds a public CardInserted() method, which is used to
disable logging on APM2 if a dataflash card is not inserted
2011-12-28 16:00:48 +11:00

36 lines
1.0 KiB
C++

/* ************************************************************ */
/* DataFlash_APM2 Log library */
/* ************************************************************ */
#ifndef __DATAFLASH_APM2_H__
#define __DATAFLASH_APM2_H__
#include "DataFlash.h"
class DataFlash_APM2 : public DataFlash_Class
{
private:
//Methods
unsigned char BufferRead (unsigned char BufferNum, uint16_t IntPageAdr);
void BufferWrite (unsigned char BufferNum, uint16_t IntPageAdr, unsigned char Data);
void BufferToPage (unsigned char BufferNum, uint16_t PageAdr, unsigned char wait);
void PageToBuffer(unsigned char BufferNum, uint16_t PageAdr);
void WaitReady();
unsigned char ReadStatusReg();
unsigned char ReadStatus();
uint16_t PageSize();
unsigned char SPI_transfer(unsigned char data);
void CS_inactive();
void CS_active();
void PageErase (uint16_t PageAdr);
void ChipErase ();
public:
DataFlash_APM2(); // Constructor
void Init();
void ReadManufacturerID();
bool CardInserted();
};
#endif