23 lines
846 B
C++

//======================================================
// THIS PAGE IS FOR GENERAL FUNCTIONS AND METHODES
//======================================================
// Floting Point Mapping
//------------------------------------------------------
double mapf(double val, double in_min, double in_max, double out_min, double out_max) {
return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
//------------------------------------------------------
// MONITOR THE CENTER BUTTON RELEASE STATE
//------------------------------------------------------
void DETECT_LONG_PRESS() {
// Resetting The Timer For Long Press
POWER_PRESS.Reset();
// Loop If the Person Didnt Release The Button
while(!BTN_CENTER.released()) {
if(POWER_PRESS.Trigger()) {
OLED_POWERING_DOWN();
}
}
}