From 6d4236bd293e752483c74bb705be15375622f2e4 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 13 Mar 2017 16:29:45 -0700 Subject: [PATCH] DS: Fix RTC not outputting on LOW --- src/ds/ds.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ds/ds.c b/src/ds/ds.c index c68a9d779..a672a1964 100644 --- a/src/ds/ds.c +++ b/src/ds/ds.c @@ -885,8 +885,12 @@ uint16_t DSWriteRTC(struct DS* ds, DSRegisterRTC value) { break; case 2: if (!DSRegisterRTCIsClock(value)) { - ds->rtc.bits &= ~(1 << ds->rtc.bitsRead); - ds->rtc.bits |= DSRegisterRTCGetData(value) << ds->rtc.bitsRead; + if (DSRegisterRTCIsDataDirection(value)) { + ds->rtc.bits &= ~(1 << ds->rtc.bitsRead); + ds->rtc.bits |= DSRegisterRTCGetData(value) << ds->rtc.bitsRead; + } else { + value = DSRegisterRTCSetData(value, GBARTCOutput(&ds->rtc)); + } } else { if (DSRegisterRTCIsSelect(value)) { // GPIO direction should always != reading