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.
Dependents: SEL_Device_Monitor
counterMinMax.cpp
00001 #include "counterMinMax.h" 00002 00003 counterMinMax::counterMinMax(int nominalVal, bool useMinLimit, int loVal, bool useMaxLimit, int hiVal) 00004 { 00005 nomVal = nominalVal; 00006 maxLim=useMinLimit; 00007 minLim=useMaxLimit; 00008 minLimVal = loVal; 00009 maxLimVal = hiVal; 00010 } 00011 00012 void counterMinMax::putVal(int newval) 00013 { 00014 if (maxLim) 00015 { 00016 if (newval>maxLimVal) 00017 { 00018 return; 00019 } 00020 } 00021 if (minLim) 00022 { 00023 if (newval<minLimVal) 00024 { 00025 return; 00026 } 00027 } 00028 if (maxSet==false) 00029 { 00030 maxVal=newval; 00031 maxSet=true; 00032 } 00033 else 00034 { 00035 if (newval>maxVal) 00036 { 00037 maxVal=newval; 00038 } 00039 } 00040 if (minSet==false) 00041 { 00042 minVal=newval; 00043 minSet=true; 00044 } 00045 else 00046 { 00047 if (newval<minVal) 00048 { 00049 minVal=newval; 00050 } 00051 } 00052 } 00053 00054 int counterMinMax::getMin(void) 00055 { 00056 return minVal; 00057 } 00058 00059 int counterMinMax::getMax(void) 00060 { 00061 return maxVal; 00062 } 00063 00064 void counterMinMax::resetNum(void) 00065 { 00066 maxVal=0; 00067 minVal=0; 00068 minSet=false; 00069 maxSet=false; 00070 } 00071
Generated on Sat Aug 6 2022 18:14:17 by
1.7.2