Files
EJM_Display/PublicFunctions/Basic.cpp

19 lines
682 B
C++
Raw Normal View History

2025-08-20 23:06:28 +08:00
#include "Basic.h"
/**
* @brief map ,x的值,out_min到out_max的范围内
* @param x
* @param in_min x有可能的最小值
* @param in_max x有可能的最大值
* @param out_min
* @param out_max
* @return
*/
M_d64 map(M_d64 x, M_d64 in_min, M_d64 in_max, M_d64 out_min, M_d64 out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void Sleep(M_u16 msec){
QTime _Timer = QTime::currentTime().addMSecs(msec);
while( QTime::currentTime() < _Timer )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}