This repository has been archived on 2022-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Luma3DS-3GX/source/utils.c

45 lines
670 B
C
Raw Normal View History

/*
* utils.c
*/
#include "utils.h"
#include "i2c.h"
#include "buttons.h"
2016-04-05 05:27:28 +02:00
u32 waitInput(void)
{
u32 pressedKey = 0,
key;
//Wait for no keys to be pressed
while(HID_PAD);
2016-04-14 17:10:55 +02:00
do
{
//Wait for a key to be pressed
while(!HID_PAD);
2016-04-04 18:19:00 +02:00
key = HID_PAD;
//Make sure it's pressed
for(u32 i = 0x13000; i; i--)
{
if(key != HID_PAD) break;
if(i == 1) pressedKey = 1;
}
2016-04-02 18:48:31 +02:00
}
while(!pressedKey);
return key;
}
void delay(u64 length)
{
while(length--) __asm("mov r0, r0");
}
2016-04-15 16:10:32 +02:00
void mcuReboot(void)
{
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);
while(1);
}