sdmmc: add DeviceDetector, gpio: implement client api

This commit is contained in:
Michael Scire
2020-10-26 04:06:02 -07:00
parent 9a41e19004
commit 22fb4ff095
25 changed files with 950 additions and 42 deletions

View File

@@ -33,22 +33,21 @@ namespace ams::fatal::srv {
bool IsInRepairWithoutVolHeld() {
if (IsInRepair()) {
GpioPadSession vol_btn;
if (R_FAILED(gpioOpenSession(&vol_btn, GpioPadName_ButtonVolUp))) {
gpio::GpioPadSession vol_btn;
if (R_FAILED(gpio::OpenSession(std::addressof(vol_btn), gpio::DeviceCode_ButtonVolUp))) {
return true;
}
/* Ensure we close even on early return. */
ON_SCOPE_EXIT { gpioPadClose(&vol_btn); };
ON_SCOPE_EXIT { gpio::CloseSession(std::addressof(vol_btn)); };
/* Set direction input. */
gpioPadSetDirection(&vol_btn, GpioDirection_Input);
gpio::SetDirection(std::addressof(vol_btn), gpio::Direction_Input);
/* Ensure that we're holding the volume button for a full second. */
auto start = os::GetSystemTick();
do {
GpioValue val;
if (R_FAILED(gpioPadGetValue(&vol_btn, &val)) || val != GpioValue_Low) {
if (gpio::GetValue(std::addressof(vol_btn)) != gpio::GpioValue_Low) {
return true;
}