feat: 全量同步 254 个常用的 Arduino 扩展库文件
This commit is contained in:
38
arduino-libs/arduino-cli/libraries/yfrobot/RtcTemperature.h
Normal file
38
arduino-libs/arduino-cli/libraries/yfrobot/RtcTemperature.h
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
#ifndef __RTCTEMPERATURE_H__
|
||||
#define __RTCTEMPERATURE_H__
|
||||
|
||||
|
||||
class RtcTemperature
|
||||
{
|
||||
public:
|
||||
RtcTemperature(int8_t degrees, uint8_t fraction) :
|
||||
integerDegrees(degrees),
|
||||
decimalFraction(fraction)
|
||||
{
|
||||
}
|
||||
|
||||
float AsFloat()
|
||||
{
|
||||
float degrees = (float)integerDegrees;
|
||||
degrees += (float)decimalFraction / ((degrees < 0) ? -100.0f : 100.0f) ;
|
||||
return degrees;
|
||||
}
|
||||
|
||||
int8_t AsWholeDegrees()
|
||||
{
|
||||
return integerDegrees;
|
||||
}
|
||||
|
||||
uint8_t GetFractional()
|
||||
{
|
||||
return decimalFraction;
|
||||
}
|
||||
|
||||
protected:
|
||||
int8_t integerDegrees;
|
||||
uint8_t decimalFraction;
|
||||
};
|
||||
|
||||
#endif // __RTCTEMPERATURE_H__
|
||||
Reference in New Issue
Block a user