boot: refactor for R_TRY

This commit is contained in:
Michael Scire 2019-06-20 00:57:17 -07:00
parent 491383c637
commit 7b6050a0cb
16 changed files with 223 additions and 623 deletions

View file

@ -22,10 +22,7 @@
Result RtcDriver::ReadRtcRegister(u8 *out, u8 address) {
const u8 update_addr = 0x04;
const u8 update_val = 0x10;
Result rc = Boot::WriteI2cRegister(this->i2c_session, &update_val, sizeof(update_val), &update_addr, sizeof(update_addr));
if (R_FAILED(rc)) {
return rc;
}
R_TRY(Boot::WriteI2cRegister(this->i2c_session, &update_val, sizeof(update_val), &update_addr, sizeof(update_addr)));
svcSleepThread(16'000'000ul);
return Boot::ReadI2cRegister(this->i2c_session, out, sizeof(*out), &address, sizeof(address));
}