2011-11-12 23:29:07 -04:00
|
|
|
/* ************************************************************ */
|
|
|
|
/* Test for DataFlash Log library */
|
|
|
|
/* ************************************************************ */
|
|
|
|
#ifndef __DATAFLASH_APM1_H__
|
|
|
|
#define __DATAFLASH_APM1_H__
|
|
|
|
|
2012-10-18 05:03:50 -03:00
|
|
|
#include <AP_Semaphore.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
|
|
|
|
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();
|
|
|
|
void PageErase (uint16_t PageAdr);
|
|
|
|
void BlockErase (uint16_t BlockAdr);
|
|
|
|
void ChipErase(void (*delay_cb)(unsigned long));
|
2011-11-12 23:29:07 -04:00
|
|
|
|
2012-10-18 05:03:50 -03:00
|
|
|
unsigned char SPI_transfer(unsigned char data);
|
|
|
|
AP_Semaphore* _spi_semaphore;
|
2012-08-17 03:21:26 -03:00
|
|
|
public:
|
2011-11-12 23:29:07 -04:00
|
|
|
|
2012-10-18 05:03:50 -03:00
|
|
|
DataFlash_APM1(AP_Semaphore* spi_semaphore = NULL) : _spi_semaphore(spi_semaphore) {}
|
2012-08-17 03:21:26 -03:00
|
|
|
void Init();
|
|
|
|
void ReadManufacturerID();
|
|
|
|
bool CardInserted(void);
|
2011-11-12 23:29:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __DATAFLASH_APM1_H__
|