Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TempData.cpp
00001 #include "TempData.h" 00002 00003 TempData::TempData() 00004 { 00005 _count = 0; 00006 } 00007 00008 // push value 00009 void TempData::PushData(float data) 00010 { 00011 _buffer[_count] = data; // store data and increment counter 00012 _count++; 00013 } 00014 00015 // pop value. return either top value, or -999 as error code 00016 float TempData::PopData() 00017 { 00018 if(_count) // check if buffer not empty 00019 { 00020 _count--; 00021 return _buffer[_count]; // return value 00022 } 00023 return -999; 00024 } 00025 00026 // get value by index 00027 float TempData::GetData(int index) 00028 { 00029 return _buffer[index]; // return value 00030 } 00031 00032 // get number of stored measurings 00033 int TempData::GetCount() 00034 { 00035 return _count; 00036 }
Generated on Tue Jul 19 2022 04:04:00 by
1.7.2