Pervasive Displays Library Suite - Reference Manual 9.0.3
Library for Pervasive Displays e-paper screens, extension boards and development kits
Loading...
Searching...
No Matches
Memory Class Reference

Memory class. More...

#include <hV_Memory.h>

Public Member Functions

 Memory (uint8_t kind=1, uint8_t bus=24)
 Constructor.
 
void begin (uint8_t pin)
 Initialisation.
 
bool test (uint32_t address=0, uint8_t data=0x5a)
 Test memory and set number of dummy reads.
 
void reset ()
 Reset default mode for SRAM and FRAM.
 
void set (uint32_t address, uint8_t data)
 Write one value.
 
void writeEnableOnce ()
 Enable write for FRAM.
 
void writeEnable ()
 Enable write for FRAM.
 
void writeDisable ()
 Disable write for FRAM.
 
void write (uint32_t address, const void *buffer, uint32_t length)
 Write a buffer.
 
void setMemory (uint32_t address, uint8_t data, uint32_t length)
 Write one value on range.
 
void copyMemory (uint32_t destination, uint32_t source, uint32_t length)
 Write one value on range.
 
uint8_t get (uint32_t address)
 Read one value.
 
void read (void *buffer, uint32_t address, uint32_t length)
 Read a buffer.
 
void clearBit (uint32_t address, uint8_t bit)
 Clear bit in place.
 
void setBit (uint32_t address, uint8_t bit)
 Set bit in place.
 
uint8_t readBit (uint32_t address, uint8_t bit)
 Read bit in place.
 
void debug (STRING_TYPE text, uint32_t address, uint32_t length=512, uint8_t line=32, uint8_t mark=8)
 Debug memory.
 

Detailed Description

Memory class.

for Flash, SRAM and FRAM

Warning
Does not manage SPI

Constructor & Destructor Documentation

◆ Memory()

Memory::Memory ( uint8_t kind = 1,
uint8_t bus = 24 )

Constructor.

Parameters
kindkind, default = MEMORY_FLASH
kindbus, default = BUS_24_BITS

Member Function Documentation

◆ begin()

void Memory::begin ( uint8_t pin)

Initialisation.

Parameters
pin/CS pin, default = MEMORY_FLASH
Warning
begin() does not initialise SPI
Note
begin() does not call SPI

Expected SPI parameters

  • BitOrder: MSBFIRST
  • DataMode: SPI_MODE0
  • ClockDivider: SPI_CLOCK_DIV4 to get 4 MHz with SPI_CLOCK_MAX = 16000000

◆ clearBit()

void Memory::clearBit ( uint32_t address,
uint8_t bit )

Clear bit in place.

Parameters
address16- or 24-bit address
bitbit to clear
Note
For SRAM and FRAM only, not available for Flash

◆ copyMemory()

void Memory::copyMemory ( uint32_t destination,
uint32_t source,
uint32_t length )

Write one value on range.

Parameters
destinationdestination address starting 16- or 24-bit address
sourcesource address starting 16- or 24-bit address
lengthnumber of bytes
Note
Similar to memcpy
Not available for Flash

◆ debug()

void Memory::debug ( STRING_TYPE text,
uint32_t address,
uint32_t length = 512,
uint8_t line = 32,
uint8_t mark = 8 )

Debug memory.

Parameters
textmessage
address16- or 24-bit address
lengthdefault = 512 bytes to read
linedefault = 32 bytes per line
markdisplay : every default = 8 bytes

◆ get()

uint8_t Memory::get ( uint32_t address)

Read one value.

Parameters
address16- or 24-bit address
Returns
uint8_t value

◆ read()

void Memory::read ( void * buffer,
uint32_t address,
uint32_t length )

Read a buffer.

Parameters
[out]bufferbuffer
addressstarting 24-bit address
lengthnumber of bytes

◆ readBit()

uint8_t Memory::readBit ( uint32_t address,
uint8_t bit )

Read bit in place.

Parameters
address16- or 24-bit address
bitbit to set

◆ reset()

void Memory::reset ( )

Reset default mode for SRAM and FRAM.

Note
Just in case

◆ set()

void Memory::set ( uint32_t address,
uint8_t data )

Write one value.

Parameters
address24-bit address
datauint8_t value
Note
For SRAM and FRAM only, not available for Flash

◆ setBit()

void Memory::setBit ( uint32_t address,
uint8_t bit )

Set bit in place.

Parameters
address16- or 24-bit address
bitbit to set
Note
For SRAM and FRAM only, not available for Flash

◆ setMemory()

void Memory::setMemory ( uint32_t address,
uint8_t data,
uint32_t length )

Write one value on range.

Parameters
addressstarting 16- or 24-bit address
datauint8_t value
lengthnumber of bytes
Note
Similar to memset
For SRAM and FRAM only, not available for Flash

◆ test()

bool Memory::test ( uint32_t address = 0,
uint8_t data = 0x5a )

Test memory and set number of dummy reads.

Parameters
addressaddress to test, default = 0
datavalue to test, default = 0x5a = Z
Returns
RESULT_SUCCESS if write-read successful, RESULT_FAILURE otherwise
Note
Not available for Flash
Number of dummy reads
  • Flash: one
  • FRAM: none
  • SRAM: one, sometimes zero

◆ write()

void Memory::write ( uint32_t address,
const void * buffer,
uint32_t length )

Write a buffer.

Parameters
addressstarting 16- or 24-bit address
[in]bufferbuffer
lengthnumber of bytes
Note
For SRAM and FRAM only, not available for Flash

◆ writeEnable()

void Memory::writeEnable ( )

Enable write for FRAM.

Note
Only valid for the next write

◆ writeEnableOnce()

void Memory::writeEnableOnce ( )

Enable write for FRAM.

Note
Valid for all next writes

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