-
Notifications
You must be signed in to change notification settings - Fork 14
/
power.c
65 lines (57 loc) · 1.63 KB
/
power.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "power.h"
/** Processor Clock **/
int getClockFrequency(int no) {
if (no == 0) return scePowerGetArmClockFrequency();
else if (no == 1) return scePowerGetBusClockFrequency();
else if (no == 2) return scePowerGetGpuClockFrequency();
else if (no == 3) return scePowerGetGpuXbarClockFrequency();
else return 0;
}
void setClockFrequency(int no, int freq) {
if (no == 0) scePowerSetArmClockFrequency(freq);
else if (no == 1) scePowerSetBusClockFrequency(freq);
else if (no == 2) scePowerSetGpuClockFrequency(freq);
else if (no == 3) scePowerSetGpuXbarClockFrequency(freq);
}
/** Battery **/
const int getBatteryStatus() {
return scePowerIsBatteryCharging();
}
int getBatteryRemCapacity() {
char mAh[10];
sprintf(mAh,"%i",scePowerGetBatteryRemainCapacity());
int cap = atoi(mAh);
return cap;
}
int getBatteryCapacity() {
char mAh[10];
sprintf(mAh,"%i",scePowerGetBatteryFullCapacity());
int cap = atoi(mAh);
return cap;
}
int getBatteryLifeTime() {
char life_time[10];
sprintf(life_time,"%i",scePowerGetBatteryLifeTime());
int min = atoi(life_time);
return min;
}
char* getBatteryPercentage() {
static char percentage[5];
sprintf(percentage, "%3d%%", scePowerGetBatteryLifePercent());
return percentage;
}
char* getBatteryVoltage() {
static char voltage[8];
sprintf(voltage,"%0.2f",(float)scePowerGetBatteryVolt() / 1000.0);
return voltage;
}
char* getBatteryTempInCelsius() {
static char temp[8];
sprintf(temp,"%0.2f",(float)scePowerGetBatteryTemp() / 100.0);
return temp;
}
char* getBatteryTempInFahrenheit() {
static char temp[8];
sprintf(temp,"%0.2f",(1.8 * (float)scePowerGetBatteryTemp() / 100.0) + 32);
return temp;
}