From d4eb5af332ce518baa552c886caa0bf3b2864f75 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 11 Jul 2017 19:19:49 -0400 Subject: Major reformatting, cleaning up black magic --- gba/source/link.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'gba/source/link.c') diff --git a/gba/source/link.c b/gba/source/link.c index e695622..c84e44d 100644 --- a/gba/source/link.c +++ b/gba/source/link.c @@ -1,13 +1,20 @@ +/* + * Copyright (C) 2017 hatkirby + * + * This software may be modified and distributed under the terms + * of the MIT license. See the LICENSE file for details. + */ #include "link.h" #define JOY_WRITE 2 #define JOY_READ 4 #define JOY_RW 6 -void waitForWriteAccess() +void initializeLink() { - //while ((REG_HS_CTRL & JOY_READ) == 0); - while ((REG_HS_CTRL & JOY_WRITE) == 0); + REG_HS_CTRL |= JOY_RW; + REG_JOYTR = 0; + while ((REG_HS_CTRL & JOY_WRITE) == 0); REG_HS_CTRL |= JOY_RW; } @@ -23,19 +30,9 @@ void waitForAck() void sendS32(s32 val) { REG_JOYTR = val; - //waitForWriteAccess(); } void sendU32(u32 val) { REG_JOYTR = val; - //waitForWriteAccess(); -} - -u32 recieveU32() -{ - while ((REG_HS_CTRL & JOY_WRITE) == 0); - REG_HS_CTRL |= JOY_RW; - return REG_JOYRE; } - -- cgit 1.4.1