From 6d0ddda980f6497ebe364dd5fea987b25d495b76 Mon Sep 17 00:00:00 2001 From: jiyunomegami Date: Sat, 4 Jul 2020 22:33:50 +0900 Subject: [PATCH] Make the retrode mode work after using the normal mode by accident --- Cart_Reader/SMS.ino | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Cart_Reader/SMS.ino b/Cart_Reader/SMS.ino index 7c093d8..10641d0 100644 --- a/Cart_Reader/SMS.ino +++ b/Cart_Reader/SMS.ino @@ -73,6 +73,11 @@ void setup_SMS() { DDRH |= (1 << 3); if (retrode_mode) { + // Revert changes from the other mode + PORTH &= ~((1 << 0) | (1 << 3) | (1 << 5)); + PORTL &= ~(1 << 1); + DDRH &= ~((1 << 0) | (1 << 5)); + DDRL &= ~((1 << 1)); // Set Control Pins to Output OE(PH6) DDRH |= (1 << 6); // WR(PL5) and RD(PL6) @@ -80,12 +85,12 @@ void setup_SMS() { // Setting OE(PH6) HIGH PORTH |= (1 << 6); - //PORTH &= ~(1 << 6); // set OE LOW // Setting WR(PL5) and RD(PL6) HIGH PORTL |= (1 << 5) | (1 << 6); - // RD(PL6) - //PORTL &= ~(1 << 6); // set RE LOW } else { + // Revert changes from the other mode + PORTL &= ~((1 << 5) | (1 << 6)); + DDRL &= ~((1 << 5) | (1 << 6)); // Set Control Pins to Output RST(PH0) WR(PH5) OE(PH6) DDRH |= (1 << 0) | (1 << 5) | (1 << 6); // CE(PL1)