Minor cleanup

This commit is contained in:
Aurora 2016-11-29 20:11:30 +01:00
parent a45f8293d9
commit bfc8ba8447
7 changed files with 12 additions and 13 deletions

View File

@ -393,5 +393,5 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
else if(oldPinStatus) fileDelete(PIN_FILE);
while(HID_PAD & PIN_BUTTONS);
wait(false, 2ULL);
wait(2000ULL);
}

View File

@ -52,7 +52,7 @@ bool loadSplash(void)
if(!isTopSplashValid && !isBottomSplashValid) return false;
swapFramebuffers(true);
wait(false, 3ULL);
wait(3000ULL);
return true;
}

View File

@ -256,7 +256,7 @@ void payloadMenu(void)
}
while(HID_PAD & MENU_BUTTONS);
wait(false, 2ULL);
wait(2000ULL);
}
u32 firmRead(void *dest, u32 firmType)

View File

@ -148,7 +148,7 @@ void main(void)
if(pinExists && !shouldLoadConfigMenu)
{
while(HID_PAD & PIN_BUTTONS);
wait(false, 2ULL);
wait(2000ULL);
}
goto boot;

View File

@ -285,7 +285,7 @@ void initScreens(void)
//Turn on backlight
i2cWriteRegister(I2C_DEV_MCU, 0x22, 0x2A);
wait(true, 3ULL);
wait(3ULL);
}
else updateBrightness(MULTICONFIG(BRIGHTNESS));

View File

@ -42,13 +42,12 @@ static void startChrono(void)
for(u32 i = 1; i < 4; i++) REG_TIMER_CNT(i) = 0x84; //Count-up; enabled
}
static u64 chrono(bool isMilliseconds)
static u64 chrono(void)
{
u64 res;
u64 res = 0;
for(u32 i = 0; i < 4; i++) res |= REG_TIMER_VAL(i) << (16 * i);
if(isMilliseconds) res /= (TICKS_PER_SEC / 1000);
else res /= TICKS_PER_SEC;
res /= (TICKS_PER_SEC / 1000);
return res;
}
@ -77,7 +76,7 @@ u32 waitInput(bool isMenu)
continue;
}
if(key == oldKey && (!isMenu || (!(key & DPAD_BUTTONS) || chrono(true) < dPadDelay))) continue;
if(key == oldKey && (!isMenu || (!(key & DPAD_BUTTONS) || chrono() < dPadDelay))) continue;
//Make sure the key is pressed
u32 i;
@ -99,10 +98,10 @@ void mcuPowerOff(void)
while(true);
}
void wait(bool isMilliseconds, u64 amount)
void wait(u64 amount)
{
startChrono();
while(chrono(isMilliseconds) < amount);
while(chrono() < amount);
}
void error(const char *message)

View File

@ -34,5 +34,5 @@
u32 waitInput(bool isMenu);
void mcuPowerOff(void);
void wait(bool isMilliseconds, u64 amount);
void wait(u64 amount);
void error(const char *message);