This is a simple example sketch showing how to use the SPI RAM allocator.
#include <Arduino.h>
#include <SPI.h>
#include <serialram.h>
const int chipSelect = 9;
const int chipSize = 1024l * 128l;
const bool largeAddressing = true;
const SerialRam::ESPISpeed spiSpeed = SerialRam::SPEED_FULL;
SPIRAMVAlloc valloc(chipSize, largeAddressing, chipSelect, spiSpeed);
void setup()
{
while (!Serial)
;
Serial.begin(115200);
valloc.start();
delay(3000);
}
void loop()
{
*vpi = 42;
Serial.print("*vpi = "); Serial.println(*vpi);
valloc.free(vpi);
delay(1000);
}