MicrochipSRAM  v1.0.6
Arduino Library for an SNVRAM SPI chips from Microchip
MicrochipSRAM Class Reference

Access the Microchip SRAM with automated memory size detection. More...

Public Member Functions

 MicrochipSRAM (const uint8_t SSPin)
 
 ~MicrochipSRAM ()
 
void clearMemory (const uint8_t clearValue=0) const
 
template<typename T >
uint32_t & get (const uint32_t addr, T &value) const
 
template<typename T >
uint32_t & put (const uint32_t addr, const T &value) const
 
template<typename T >
uint32_t & fillMemory (uint32_t addr, T &value) const
 

Public Attributes

uint32_t SRAMBytes = 0
 Number of bytes available on chip//.
 

Detailed Description

Access the Microchip SRAM with automated memory size detection.

Constructor & Destructor Documentation

◆ MicrochipSRAM()

MicrochipSRAM::MicrochipSRAM ( const uint8_t  SSPin)

Class constructor

Define the SS Pin and the determine the attached SRAM memory. The algorithm to detect which memory is attached makes use of the fact that a write beyond the end of memory will wrap around to the beginning of memory.

Parameters
[in]SSPinSPI Slave-Select pin number

◆ ~MicrochipSRAM()

MicrochipSRAM::~MicrochipSRAM ( )

Class destructor

Currently empty and unused

Member Function Documentation

◆ clearMemory()

void MicrochipSRAM::clearMemory ( const uint8_t  clearValue = 0) const

Set all memory values to a single byte value

Parameters
[in]clearValueSingle byte to set all memory to

◆ fillMemory()

template<typename T >
uint32_t& MicrochipSRAM::fillMemory ( uint32_t  addr,
T &  value 
) const
inline

Template for filling SRAM memory with a specified value

Will fill as many copies of the given value as will fit in memory

Parameters
[in]addrMemory address to start filling at
[in]valueData Type "T" to read

◆ get()

template<typename T >
uint32_t& MicrochipSRAM::get ( const uint32_t  addr,
T &  value 
) const
inline

Template for reading from the SRAM memory

As a template it can support compile-time data type definitions

Parameters
[in]addrMemory address
[out]valueData Type "T" containing data read from memory
Returns
New current address in SRAM

◆ put()

template<typename T >
uint32_t& MicrochipSRAM::put ( const uint32_t  addr,
const T &  value 
) const
inline

Template for writing to the SRAM memory

As a template it can support compile-time data type definitions

Parameters
[in]addrMemory address
[in]valueData Type "T" to write
Returns
New current address in SRAM

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