reading internal temperature sensor of arch max and storing data

TempData.cpp

Committer:
tifo
Date:
2017-09-14
Revision:
3:e98dbcd4f4e3
Parent:
1:b5ed50f9a06b

File content as of revision 3:e98dbcd4f4e3:

#include "TempData.h"
 
TempData::TempData()
{
  _count = 0;
}
 
 // push value
void TempData::PushData(float data)
{
    _buffer[_count] = data;       // store data and increment counter
    _count++;
}
 
 // pop value. return either top value, or -999 as error code
float TempData::PopData()
{
    if(_count)          // check if buffer not empty
    {
        _count--;
        return _buffer[_count];   // return value
    }
    return -999;   
}

// get value by index
float TempData::GetData(int index)
{
    return _buffer[index];         // return value
}

// get number of stored measurings
int TempData::GetCount()
{
    return _count;         
}