整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

38
util/Temperature.cpp Normal file
View file

@ -0,0 +1,38 @@
/*
*******************************************************************************
* INCLUDE
*******************************************************************************
*/
#include "Temperature.h"
#include "Device.h"
#include "Application.h"
namespace Util
{
/*
*******************************************************************************
* CLASS DEFINE
*******************************************************************************
*/
float Temperature::read()
{
Device device("/sys/devices/virtual/mstar/msys/TEMP_R");
try
{
device.open();
char str[64];
device.read((uint8_t*)str, sizeof(str));
int temp;
sscanf(str, "Temperature %d", &temp);
device.close();
return temp;
}
catch (const std::exception& e)
{
}
return 0.0f;
}
}