Arduino-Storage
External Memory Storage library for Arduino
Storage Class Referenceabstract

#include <Storage.h>

Inheritance diagram for Storage:
Inheritance graph
Collaboration diagram for Storage:
Collaboration graph

Classes

class  Block
 
class  Cache
 
class  Stream
 

Public Member Functions

 Storage (uint32_t size)
 
uint32_t room ()
 
uint32_t alloc (size_t count)
 
void free (uint32_t addr)
 
virtual int read (void *dest, uint32_t src, size_t count)=0
 
virtual int write (uint32_t dest, const void *src, size_t count)=0
 

Public Attributes

const uint32_t SIZE
 

Protected Attributes

uint32_t m_addr
 

Detailed Description

External memory storage interface, data block read/write, caching and streaming class. Handles linear allocation of storage blocks on the device.

Definition at line 27 of file Storage.h.

Constructor & Destructor Documentation

Storage::Storage ( uint32_t  size)
inline

Create storage manager with given number of bytes.

Parameters
[in]sizenumber of bytes on device.

Definition at line 36 of file Storage.h.

Member Function Documentation

uint32_t Storage::alloc ( size_t  count)
inline

Allocate block with given number of bytes on storage. Returns storage address if successful otherwise UINT32_MAX.

Parameters
[in]countnumber of bytes.
Returns
address of allocated block, otherwise UINT32_MAX.

Definition at line 53 of file Storage.h.

void Storage::free ( uint32_t  addr)
inline

Reset allocation point to given address.

Parameters
[in]addraddress of allocated block.

Definition at line 65 of file Storage.h.

virtual int Storage::read ( void *  dest,
uint32_t  src,
size_t  count 
)
pure virtual

Read count number of bytes from storage address to buffer. Returns number of bytes read or negative error code.

Parameters
[in]destdestination buffer pointer.
[in]srcsource memory address on device.
[in]countnumber of bytes to read from device.
Returns
number of bytes read or negative error code.

Implemented in AT24CXX, MC23LCXXX< KBYTE, SS_PIN, FREQ >, MC23LCXXX< 64, SS_PIN, FREQ >, MC23LCXXX< 128, SS_PIN, FREQ >, and EEPROM.

uint32_t Storage::room ( )
inline

Returns number of bytes that may be allocated.

Returns
number of bytes.

Definition at line 42 of file Storage.h.

virtual int Storage::write ( uint32_t  dest,
const void *  src,
size_t  count 
)
pure virtual

Write count number of bytes to storage address from buffer. Returns number of bytes read or negative error code.

Parameters
[in]destdestination memory address on device.
[in]srcsource buffer pointer.
[in]countnumber of bytes to write to device.
Returns
number of bytes written or negative error code.

Implemented in AT24CXX, MC23LCXXX< KBYTE, SS_PIN, FREQ >, MC23LCXXX< 64, SS_PIN, FREQ >, MC23LCXXX< 128, SS_PIN, FREQ >, and EEPROM.

Member Data Documentation

uint32_t Storage::m_addr
protected

Address of the next allocation.

Definition at line 398 of file Storage.h.

const uint32_t Storage::SIZE

Number of bytes on device.

Definition at line 30 of file Storage.h.


The documentation for this class was generated from the following file: