#ifndef _FLASH_I2C_H_
#define _FLASH_I2C_H_
//----------------------------------------------------------------------------
///
/// \brief  Generic i2c flash
///
///         See implementation files for further information.
///
/// \date   20190919
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Includes-----------------------------------------------------------------


//---Own------------------------------

#include <biwak/i2c_slave.h>
#include <biwak/flash.h>


//---Declaration--------------------------------------------------------------


class CFlashI2c
      :public CI2cSlave
      ,public CFlash
{
   private:

   public:

      CFlashI2c( CI2c &_i2c, int address = 0x50 );
      ~CFlashI2c();

      //virtual void *acquireMemory(int size);
      /*
      virtual int erasePageSize() const override
      {
         return( 8 );
      }
      virtual int writePageSize() const override
      {
         return( 8 );
      }
      */
      constexpr int totalSize() const
      {
         return(128);
      }

      virtual int erasePage(address_t address, int count=1) override final;
      virtual int writeData(address_t address, const void *data, int size) override final;
      virtual int readData(address_t address, void *data, int size) override final;
      
      void dump();
};


//---fin----------------------------------------------------------------------
#endif // ? ! _FLASH_I2C_H_
