From 252e2911383a5267673f00c08419e2afeac35a31 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 13 Jul 2017 15:22:55 -0400 Subject: App now waits for confirmation to import, and reads pokedex seen&caught --- gba/source/link.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'gba/source/link.c') diff --git a/gba/source/link.c b/gba/source/link.c index acadf3b..26443c8 100644 --- a/gba/source/link.c +++ b/gba/source/link.c @@ -27,6 +27,21 @@ void waitForAck() REG_HS_CTRL |= JOY_RW; } +u32 waitForResponse() +{ + u32 val; + + REG_JOYTR = 1; + while ((REG_HS_CTRL & JOY_WRITE) == 0); + val = REG_JOYRE; + REG_HS_CTRL |= JOY_RW; + REG_JOYTR = 0; + while ((REG_HS_CTRL & JOY_WRITE) == 0); + REG_HS_CTRL |= JOY_RW; + + return val; +} + void sendS32(s32 val) { REG_JOYTR = val; @@ -36,3 +51,10 @@ void sendU32(u32 val) { REG_JOYTR = val; } + +void directSendU32(u32 val) +{ + REG_JOYTR = val; + while ((REG_HS_CTRL & JOY_READ) == 0); + REG_HS_CTRL |= JOY_RW; +} -- cgit 1.4.1