about summary refs log tree commit diff stats
path: root/gba/source/link.c
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-07-13 15:22:55 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-07-13 15:22:55 -0400
commit252e2911383a5267673f00c08419e2afeac35a31 (patch)
tree9713a54f6a17afa14999bab5b4c4e982ca40bfea /gba/source/link.c
parent2c837223756de2596931c22c8f4fa2ba4a4237a9 (diff)
downloadgen3uploader-252e2911383a5267673f00c08419e2afeac35a31.tar.gz
gen3uploader-252e2911383a5267673f00c08419e2afeac35a31.tar.bz2
gen3uploader-252e2911383a5267673f00c08419e2afeac35a31.zip
App now waits for confirmation to import, and reads pokedex seen&caught
Diffstat (limited to 'gba/source/link.c')
-rw-r--r--gba/source/link.c22
1 files changed, 22 insertions, 0 deletions
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()
27 REG_HS_CTRL |= JOY_RW; 27 REG_HS_CTRL |= JOY_RW;
28} 28}
29 29
30u32 waitForResponse()
31{
32 u32 val;
33
34 REG_JOYTR = 1;
35 while ((REG_HS_CTRL & JOY_WRITE) == 0);
36 val = REG_JOYRE;
37 REG_HS_CTRL |= JOY_RW;
38 REG_JOYTR = 0;
39 while ((REG_HS_CTRL & JOY_WRITE) == 0);
40 REG_HS_CTRL |= JOY_RW;
41
42 return val;
43}
44
30void sendS32(s32 val) 45void sendS32(s32 val)
31{ 46{
32 REG_JOYTR = val; 47 REG_JOYTR = val;
@@ -36,3 +51,10 @@ void sendU32(u32 val)
36{ 51{
37 REG_JOYTR = val; 52 REG_JOYTR = val;
38} 53}
54
55void directSendU32(u32 val)
56{
57 REG_JOYTR = val;
58 while ((REG_HS_CTRL & JOY_READ) == 0);
59 REG_HS_CTRL |= JOY_RW;
60}