2011-11-12 23:29:07 -04:00
|
|
|
/* ************************************************************ */
|
2012-11-10 02:02:16 -04:00
|
|
|
/* DataFlash_APM1 Log library */
|
2011-11-12 23:29:07 -04:00
|
|
|
/* ************************************************************ */
|
|
|
|
#ifndef __DATAFLASH_APM1_H__
|
|
|
|
#define __DATAFLASH_APM1_H__
|
|
|
|
|
2012-12-07 23:23:09 -04:00
|
|
|
#include <AP_HAL.h>
|
2011-11-12 23:29:07 -04:00
|
|
|
#include "DataFlash.h"
|
|
|
|
|
|
|
|
class DataFlash_APM1 : public DataFlash_Class
|
|
|
|
{
|
2012-08-17 03:21:26 -03:00
|
|
|
private:
|
|
|
|
//Methods
|
2012-12-07 23:20:17 -04:00
|
|
|
uint8_t BufferRead (uint8_t BufferNum, uint16_t IntPageAdr);
|
|
|
|
void BufferWrite (uint8_t BufferNum, uint16_t IntPageAdr, uint8_t Data);
|
|
|
|
void BufferToPage (uint8_t BufferNum, uint16_t PageAdr, uint8_t wait);
|
|
|
|
void PageToBuffer(uint8_t BufferNum, uint16_t PageAdr);
|
2012-08-17 03:21:26 -03:00
|
|
|
void WaitReady();
|
2012-12-07 23:20:17 -04:00
|
|
|
uint8_t ReadStatusReg();
|
|
|
|
uint8_t ReadStatus();
|
2012-08-17 03:21:26 -03:00
|
|
|
uint16_t PageSize();
|
|
|
|
void PageErase (uint16_t PageAdr);
|
|
|
|
void BlockErase (uint16_t BlockAdr);
|
2012-12-08 00:24:06 -04:00
|
|
|
void ChipErase();
|
2012-12-07 23:23:09 -04:00
|
|
|
|
|
|
|
AP_HAL::SPIDeviceDriver *_spi;
|
|
|
|
AP_HAL::Semaphore *_spi_sem;
|
2012-08-17 03:21:26 -03:00
|
|
|
public:
|
2011-11-12 23:29:07 -04:00
|
|
|
|
2012-12-07 23:23:09 -04:00
|
|
|
DataFlash_APM1() {}
|
2012-08-17 03:21:26 -03:00
|
|
|
void Init();
|
|
|
|
void ReadManufacturerID();
|
2012-11-10 02:02:16 -04:00
|
|
|
bool CardInserted();
|
2011-11-12 23:29:07 -04:00
|
|
|
};
|
|
|
|
|
2012-11-10 02:02:16 -04:00
|
|
|
#endif
|