c++ify more stuff
This commit is contained in:
1 parent
fb07924a3d
commit
7d6f296fa0
19 files changed
+67
-77
No files matched your search
@@ -26,13 +26,13 @@
|
||||
|
||||
#include <battery.h>
|
||||
#include <hocclk.h>
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <i2c.hpp>
|
||||
#include <max17050.hpp>
|
||||
#include <notification.h>
|
||||
#include <pwm.h>
|
||||
#include <registers.h>
|
||||
#include <switch.h>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
|
||||
#include "../display/display_refresh_rate.hpp"
|
||||
#include "../file/file_utils.hpp"
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
*/
|
||||
|
||||
#include <hocclk.h>
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <i2c.hpp>
|
||||
#include <max17050.hpp>
|
||||
#include <switch.h>
|
||||
#include <t210.hpp>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
|
||||
#include "../display/display_refresh_rate.hpp"
|
||||
#include "../file/config.hpp"
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
|
||||
#pragma once
|
||||
#include <hocclk.h>
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <i2c.hpp>
|
||||
#include <max17050.hpp>
|
||||
#include <switch.h>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
|
||||
#include "../file/errors.hpp"
|
||||
#include "../hos/apm_ext.h"
|
||||
|
||||
@@ -27,14 +27,14 @@
|
||||
#include <algorithm>
|
||||
#include <battery.h>
|
||||
#include <hocclk.h>
|
||||
#include <i2c.h>
|
||||
#include <i2c.hpp>
|
||||
#include <math.h>
|
||||
#include <max17050.h>
|
||||
#include <max17050.hpp>
|
||||
#include <minIni.h>
|
||||
#include <numeric>
|
||||
#include <switch.h>
|
||||
#include <t210.hpp>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
#include <switch.hpp>
|
||||
|
||||
#include "../hos/apm_ext.h"
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
*/
|
||||
|
||||
#include <hocclk.h>
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <i2c.hpp>
|
||||
#include <max17050.hpp>
|
||||
#include <switch.h>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
|
||||
#include "../hos/apm_ext.h"
|
||||
#include "board.hpp"
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#include <battery.h>
|
||||
#include <cmath>
|
||||
#include <hocclk.h>
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <i2c.hpp>
|
||||
#include <max17050.hpp>
|
||||
#include <pwm.h>
|
||||
#include <switch.h>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
|
||||
#include "../file/config.hpp"
|
||||
#include "../hos/apm_ext.h"
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <i2c.h>
|
||||
#include <i2c.hpp>
|
||||
#include <map>
|
||||
#include <max17050.h>
|
||||
#include <max17050.hpp>
|
||||
#include <minIni.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../board/board.hpp"
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <tmp451.h>
|
||||
#include <i2c.hpp>
|
||||
#include <max17050.hpp>
|
||||
#include <tmp451.hpp>
|
||||
|
||||
#include "../hos/apm_ext.h"
|
||||
#include "file_utils.hpp"
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "i2c.h"
|
||||
#include "i2c.hpp"
|
||||
#include <switch.hpp>
|
||||
|
||||
using namespace nx;
|
||||
|
||||
#define I2C_CMD_SND 0
|
||||
#define I2C_CMD_RCV 1
|
||||
@@ -34,5 +37,5 @@ Result i2csessionExtRegReceive(I2cSession *s, u8 in, void *out, u8 out_size) {
|
||||
|
||||
I2C_CMD_RCV | (I2cTransactionOption_All << 6), out_size };
|
||||
|
||||
return i2csessionExecuteCommandList(s, out, out_size, cmdlist, sizeof(cmdlist));
|
||||
return i2csession::ExecuteCommandList(s, out, out_size, cmdlist, sizeof(cmdlist));
|
||||
}
|
||||
@@ -25,15 +25,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <switch.h>
|
||||
#include <switch.hpp>
|
||||
|
||||
Result i2csessionExtRegReceive(I2cSession *s, u8 in, void *out, u8 out_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -28,14 +28,14 @@ Result I2cSet_U8(I2cDevice dev, u8 reg, u8 val) {
|
||||
} __attribute__((packed)) cmd;
|
||||
|
||||
I2cSession _session;
|
||||
Result res = i2cOpenSession(&_session, dev);
|
||||
Result res = i2c::OpenSession(&_session, dev);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
cmd.reg = reg;
|
||||
cmd.val = val;
|
||||
res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
i2csessionClose(&_session);
|
||||
res = i2csession::SendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
i2csession::Close(&_session);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -48,19 +48,19 @@ Result I2cRead_OutU8(I2cDevice dev, u8 reg, u8 *out) {
|
||||
} __attribute__((packed)) rec;
|
||||
|
||||
I2cSession _session;
|
||||
Result res = i2cOpenSession(&_session, dev);
|
||||
Result res = i2c::OpenSession(&_session, dev);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
cmd.reg = reg;
|
||||
res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
res = i2csession::SendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
if (res) {
|
||||
i2csessionClose(&_session);
|
||||
i2csession::Close(&_session);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = i2csessionReceiveAuto(&_session, &rec, sizeof(rec), I2cTransactionOption_All);
|
||||
i2csessionClose(&_session);
|
||||
res = i2csession::ReceiveAuto(&_session, &rec, sizeof(rec), I2cTransactionOption_All);
|
||||
i2csession::Close(&_session);
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
@@ -78,19 +78,19 @@ Result I2cRead_OutU16(I2cDevice dev, u8 reg, u16 *out) {
|
||||
} __attribute__((packed)) rec;
|
||||
|
||||
I2cSession _session;
|
||||
Result res = i2cOpenSession(&_session, dev);
|
||||
Result res = i2c::OpenSession(&_session, dev);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
cmd.reg = reg;
|
||||
res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
res = i2csession::SendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
if (res) {
|
||||
i2csessionClose(&_session);
|
||||
i2csession::Close(&_session);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = i2csessionReceiveAuto(&_session, &rec, sizeof(rec), I2cTransactionOption_All);
|
||||
i2csessionClose(&_session);
|
||||
res = i2csession::ReceiveAuto(&_session, &rec, sizeof(rec), I2cTransactionOption_All);
|
||||
i2csession::Close(&_session);
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "i2c.h"
|
||||
#include "max17050.h"
|
||||
#include "i2c.hpp"
|
||||
#include "max17050.hpp"
|
||||
|
||||
#define MAX17050_WAIT_NS 1000000000UL
|
||||
|
||||
File renamed without changes.
+12
-9
@@ -17,8 +17,11 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "i2c.h"
|
||||
#include "tmp451.h"
|
||||
#include "i2c.hpp"
|
||||
#include "tmp451.hpp"
|
||||
#include <switch.hpp>
|
||||
|
||||
using namespace nx;
|
||||
|
||||
#define TMP451_WAIT_NS 1000000000UL
|
||||
|
||||
@@ -50,14 +53,14 @@ static Result _tmp451_get_temp(u8 reg, u8 dec_reg, s32 *out) {
|
||||
}
|
||||
|
||||
static void _tmp451_update() {
|
||||
u64 ticks = armGetSystemTick();
|
||||
if (armTicksToNs(ticks - g_update_ticks) <= TMP451_WAIT_NS) {
|
||||
u64 ticks = arm::GetSystemTick();
|
||||
if (arm::TicksToNs(ticks - g_update_ticks) <= TMP451_WAIT_NS) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_update_ticks = ticks;
|
||||
|
||||
if (!serviceIsActive(&g_i2c_session.s)) {
|
||||
if (!service::IsActive(&g_i2c_session.s)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,18 +69,18 @@ static void _tmp451_update() {
|
||||
}
|
||||
|
||||
Result tmp451Initialize(void) {
|
||||
Result rc = i2cInitialize();
|
||||
Result rc = i2c::Initialize();
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
rc = i2cOpenSession(&g_i2c_session, I2cDevice_Tmp451);
|
||||
rc = i2c::OpenSession(&g_i2c_session, I2cDevice_Tmp451);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void tmp451Exit(void) {
|
||||
i2csessionClose(&g_i2c_session);
|
||||
i2cExit();
|
||||
i2csession::Close(&g_i2c_session);
|
||||
i2c::Exit();
|
||||
}
|
||||
|
||||
s32 tmp451TempPcb(void) {
|
||||
+2
-10
@@ -26,17 +26,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
#include <switch.hpp>
|
||||
using namespace nx;
|
||||
Result tmp451Initialize(void);
|
||||
void tmp451Exit(void);
|
||||
s32 tmp451TempPcb(void);
|
||||
s32 tmp451TempSoc(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -25,11 +25,11 @@
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <i2c.hpp>
|
||||
#include <max17050.hpp>
|
||||
#include <switch.h>
|
||||
#include <switch.hpp>
|
||||
#include <tmp451.h>
|
||||
#include <tmp451.hpp>
|
||||
|
||||
#include "../file/config.hpp"
|
||||
#include "../file/errors.hpp"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <crc32.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <i2c.h>
|
||||
#include <i2c.hpp>
|
||||
|
||||
#include "../board/board.hpp"
|
||||
#include "../display/aula.hpp"
|
||||
|
||||
@@ -316,11 +316,11 @@ namespace mgr {
|
||||
}
|
||||
|
||||
void StartThreads() {
|
||||
threadCreate(&governorTHREAD, GovernorThread, nullptr, NULL, 0x2000, 0x3F, -2);
|
||||
threadStart(&governorTHREAD);
|
||||
thread::Create(&governorTHREAD, GovernorThread, nullptr, NULL, 0x2000, 0x3F, -2);
|
||||
thread::Start(&governorTHREAD);
|
||||
}
|
||||
|
||||
void ExitThreads() {
|
||||
threadClose(&governorTHREAD);
|
||||
thread::Close(&governorTHREAD);
|
||||
}
|
||||
} // namespace mgr
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <i2c.h>
|
||||
#include <i2c.hpp>
|
||||
|
||||
#include "../board/board.hpp"
|
||||
#include "../i2c/i2cDrv.h"
|
||||
|
||||
Reference in new issue
Block a user