Skip to content

Round Memory averaging for Realtime Datasampling and processing

License

Notifications You must be signed in to change notification settings

rithviknishad/RoundMemory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ROUND MEMORY

Round Memory Averaging for Realtime Datasampling and processing

Usage

  1. Initialize memory space by:
    RoundMemory<float> sensorReadings = RoundMemory<float>(100, 0);
  1. Append new sensor readings to memory space using:
    sensorReadings.append( sensor.getReading() ); // replace argument with new reading to append.
  1. Use avg() to get the average of the samples of last 'size' readings.
    Serial.println( sensorReadings.avg() ); // returns average of readings.
  1. RoundMemory.append() function returns the change in average before appending and after appending.
    float delta = sensorReadings.append( sensor.getReading() );

    // is the same as:
    float u = sensorReadings.avg();
    sensorReadings.append( sensor.getReading() );
    float delta = u - sensorReadings.avg();

Memory usage

4 + (size * sizeof(datatype T)). increases linearly as size is higher. Higher the size, more cpu cycles will be used to perform avg();

Use conservative-branch for low memory application, and for much higher performance.

About

Round Memory averaging for Realtime Datasampling and processing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages