diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index f08922e..74fe26a 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -2,8 +2,8 @@ Cartridge Reader for Arduino Mega2560 Author: sanni - Date: 20-09-2019 - Version: 3.9 + Date: 27-09-2019 + Version: 4.0 SD lib: https://github.com/greiman/SdFat LCD lib: https://github.com/adafruit/Adafruit_SSD1306 @@ -43,7 +43,7 @@ **********************************************************************************/ #include -char ver[5] = "3.9"; +char ver[5] = "4.0"; /****************************************** Options @@ -373,9 +373,9 @@ static const char modeItem7[] PROGMEM = "Reset"; static const char* const modeOptions[] PROGMEM = {modeItem1, modeItem2, modeItem3, modeItem4, modeItem5, modeItem6, modeItem7}; // Add-ons submenu -static const char addonsItem1[] PROGMEM = "PC Engine/TG16"; +static const char addonsItem1[] PROGMEM = "NES/Famicom"; static const char addonsItem2[] PROGMEM = "Flashrom Programmer"; -static const char addonsItem3[] PROGMEM = "NES/Famicom"; +static const char addonsItem3[] PROGMEM = "PC Engine/TG16"; static const char addonsItem4[] PROGMEM = "Sega Master System"; static const char addonsItem5[] PROGMEM = "Reset"; static const char* const addonsOptions[] PROGMEM = {addonsItem1, addonsItem2, addonsItem3, addonsItem4, addonsItem5}; @@ -483,7 +483,7 @@ void addonsMenu() { switch (addonsMenu) { case 0: - pcsMenu(); + nesMenu(); break; case 1: @@ -491,7 +491,7 @@ void addonsMenu() { break; case 2: - nesMenu(); + pcsMenu(); break; case 3: diff --git a/Cart_Reader/GBSmart.ino b/Cart_Reader/GBSmart.ino index ad23732..bc31347 100644 --- a/Cart_Reader/GBSmart.ino +++ b/Cart_Reader/GBSmart.ino @@ -25,7 +25,7 @@ static const char gbSmartGameMenuItem4[] PROGMEM = "Switch Game"; static const char gbSmartGameMenuItem5[] PROGMEM = "Reset"; static const char* const menuOptionsGBSmartGame[] PROGMEM = {gbSmartGameMenuItem1, gbSmartGameMenuItem2, gbSmartGameMenuItem3, gbSmartGameMenuItem4, gbSmartGameMenuItem5}; -typedef struct +typedef struct { uint8_t start_bank; uint8_t rom_type; @@ -87,7 +87,7 @@ void setup_GBSmart() gameMenuStartBank = 0x02; hasMenu = true; numGames = 0; - + display_Clear(); display_Update(); } @@ -95,7 +95,7 @@ void setup_GBSmart() void gbSmartMenu() { uint8_t mainMenu; - + // Copy menuOptions out of progmem convertPgm(menuOptionsGBSmart, 3); mainMenu = question_box(F("GB Smart"), menuOptions, 3, 0); @@ -104,20 +104,20 @@ void gbSmartMenu() switch (mainMenu) { case 0: - { - gbSmartGameMenu(); - break; - } + { + gbSmartGameMenu(); + break; + } case 1: - { - mode = mode_GB_GBSmart_Flash; - break; - } + { + mode = mode_GB_GBSmart_Flash; + break; + } default: - { - asm volatile (" jmp 0"); - break; - } + { + asm volatile (" jmp 0"); + break; + } } } @@ -131,51 +131,51 @@ void gbSmartGameOptions() switch (gameSubMenu) { case 0: // Read Game - { - display_Clear(); - sd.chdir("/"); - readROM_GB(); - compare_checksum_GB(); - break; - } + { + display_Clear(); + sd.chdir("/"); + readROM_GB(); + compare_checksum_GB(); + break; + } case 1: // Read SRAM - { - display_Clear(); - sd.chdir("/"); - readSRAM_GB(); - break; - } + { + display_Clear(); + sd.chdir("/"); + readSRAM_GB(); + break; + } case 2: // Write SRAM - { - display_Clear(); - sd.chdir("/"); - writeSRAM_GB(); - uint32_t wrErrors = verifySRAM_GB(); - if (wrErrors == 0) { - println_Msg(F("Verified OK")); - display_Update(); + display_Clear(); + sd.chdir("/"); + writeSRAM_GB(); + uint32_t wrErrors = verifySRAM_GB(); + if (wrErrors == 0) + { + println_Msg(F("Verified OK")); + display_Update(); + } + else + { + print_Msg(F("Error: ")); + print_Msg(wrErrors); + println_Msg(F(" bytes")); + print_Error(F("did not verify."), false); + } + break; } - else - { - print_Msg(F("Error: ")); - print_Msg(wrErrors); - println_Msg(F(" bytes")); - print_Error(F("did not verify."), false); - } - break; - } case 3: // Switch Game - { - gameMenuStartBank = 0x02; - gbSmartGameMenu(); - break; - } + { + gameMenuStartBank = 0x02; + gbSmartGameMenu(); + break; + } default: - { - asm volatile (" jmp 0"); - break; - } + { + asm volatile (" jmp 0"); + break; + } } if (gameSubMenu != 3) @@ -193,7 +193,7 @@ void gbSmartGameMenu() gb_smart_load_more_games: if (gameMenuStartBank > 0xfe) gameMenuStartBank = 0x02; - + gbSmartGetGames(); if (hasMenu) @@ -216,11 +216,11 @@ gb_smart_load_more_games: // copy romname strcpy(romName, gbSmartGames[gameSubMenu].title); - + // select a game gbSmartRemapStartBank(gbSmartGames[gameSubMenu].start_bank, gbSmartGames[gameSubMenu].rom_size, gbSmartGames[gameSubMenu].sram_size); getCartInfo_GB(); - + mode = mode_GB_GBSmart_Game; } @@ -234,49 +234,49 @@ void gbSmartFlashMenu() switch (flashSubMenu) { case 0: - { - // read flash - display_Clear(); - sd.chdir("/"); + { + // read flash + display_Clear(); + sd.chdir("/"); - EEPROM_readAnything(10, foldern); - sprintf(fileName, "GBS%d.bin", foldern); - sd.mkdir("GB/GBS", true); - sd.chdir("GB/GBS"); - foldern = foldern + 1; - EEPROM_writeAnything(10, foldern); + EEPROM_readAnything(10, foldern); + sprintf(fileName, "GBS%d.bin", foldern); + sd.mkdir("GB/GBS", true); + sd.chdir("GB/GBS"); + foldern = foldern + 1; + EEPROM_writeAnything(10, foldern); - gbSmartReadFlash(); - break; - } + gbSmartReadFlash(); + break; + } case 1: - { - // write flash - display_Clear(); + { + // write flash + display_Clear(); - println_Msg(F("Attention")); - println_Msg(F("This will erase your")); - println_Msg(F("GB Smart Cartridge.")); - println_Msg(F("")); - println_Msg(F("Press Button")); - println_Msg(F("to continue")); - display_Update(); - wait(); + println_Msg(F("Attention")); + println_Msg(F("This will erase your")); + println_Msg(F("GB Smart Cartridge.")); + println_Msg(F("")); + println_Msg(F("Press Button")); + println_Msg(F("to continue")); + display_Update(); + wait(); - display_Clear(); - filePath[0] = '\0'; - sd.chdir("/"); - fileBrowser(F("Select 4MB file")); - - sprintf(filePath, "%s/%s", filePath, fileName); - gbSmartWriteFlash(); - break; - } + display_Clear(); + filePath[0] = '\0'; + sd.chdir("/"); + fileBrowser(F("Select 4MB file")); + + sprintf(filePath, "%s/%s", filePath, fileName); + gbSmartWriteFlash(); + break; + } default: - { - mode = mode_GB_GBSmart; - return; - } + { + mode = mode_GB_GBSmart; + return; + } } println_Msg(F("")); @@ -288,13 +288,13 @@ void gbSmartFlashMenu() void gbSmartGetGames() { static const byte menu_title[] = {0x47, 0x42, 0x31, 0x36, 0x4d}; - + // reset remap setting gbSmartRemapStartBank(0x00, gbSmartRomSizeGB, gbSmartSramSizeGB); uint16_t i; uint8_t myByte, myLength; - + // check if contain menu hasMenu = true; dataIn_GB(); @@ -306,13 +306,13 @@ void gbSmartGetGames() break; } } - + if (hasMenu) - { + { for (i = gameMenuStartBank, numGames = 0; i < gbSmartBanks && numGames < GB_SMART_GAMES_PER_PAGE; ) { myLength = 0; - + // switch bank dataOut(); writeByte_GB(0x2100, i); @@ -331,7 +331,7 @@ void gbSmartGetGames() for (uint8_t j = 0; j < 15; j++) { myByte = readByte_GB(0x4134 + j); - + if (((char(myByte) >= 0x30 && char(myByte) <= 0x39) || (char(myByte) >= 0x41 && char(myByte) <= 0x7a))) gbSmartGames[numGames].title[myLength++] = char(myByte); @@ -346,7 +346,7 @@ void gbSmartGetGames() myByte = (2 << gbSmartGames[numGames].rom_size); i += myByte; numGames++; -gb_smart_get_game_loop_end:; +gb_smart_get_game_loop_end:; } gameMenuStartBank = i; @@ -357,7 +357,7 @@ gb_smart_get_game_loop_end:; for (uint8_t j = 0; j < 15; j++) { myByte = readByte_GB(0x0134 + j); - + if (((char(myByte) >= 0x30 && char(myByte) <= 0x39) || (char(myByte) >= 0x41 && char(myByte) <= 0x7a))) gbSmartGames[0].title[myLength++] = char(myByte); @@ -380,14 +380,14 @@ void gbSmartReadFlash() print_Msg(fileName); println_Msg(F("...")); display_Update(); - + if (!myFile.open(fileName, O_RDWR | O_CREAT)) print_Error(F("Can't create file on SD"), true); // reset flash to read array state for (int i = 0x00; i < gbSmartBanks; i += gbSmartBanksPerFlashChip) gbSmartResetFlash(i); - + // remaps mmc to full access gbSmartRemapStartBank(0x00, gbSmartRomSizeGB, gbSmartSramSizeGB); @@ -414,7 +414,7 @@ void gbSmartReadFlash() sdBuffer[c] = readByte_GB(addr + c); myFile.write(sdBuffer, 512); - } + } } // back to initial state @@ -431,10 +431,10 @@ void gbSmartWriteFlash() for (int bank = 0x00; bank < gbSmartBanks; bank += gbSmartBanksPerFlashChip) { display_Clear(); - + print_Msg(F("Erasing...")); display_Update(); - + gbSmartEraseFlash(bank); gbSmartResetFlash(bank); @@ -443,7 +443,7 @@ void gbSmartWriteFlash() display_Update(); if (!gbSmartBlankCheckingFlash(bank)) - print_Error(F("Could not erase flash"), true); + print_Error(F("Could not erase flash"), true); println_Msg(F("Passed")); display_Update(); @@ -466,7 +466,7 @@ void gbSmartWriteFlash() } else { - print_Msg(F("Error: ")); + print_Msg(F("Error: ")); print_Msg(writeErrors); println_Msg(F(" bytes ")); print_Error(F("did not verify."), true); @@ -487,7 +487,7 @@ void gbSmartWriteFlash(uint32_t start_bank) print_Msg(start_bank, HEX); print_Msg(F("...")); display_Update(); - + // handle bank 0x00 on 0x0000 gbSmartWriteFlashFromMyFile(0x0000); @@ -496,7 +496,7 @@ void gbSmartWriteFlash(uint32_t start_bank) { dataOut(); writeByte_GB(0x2100, bank); - + gbSmartWriteFlashFromMyFile(0x4000); } @@ -524,10 +524,10 @@ void gbSmartWriteFlashFromMyFile(uint32_t addr) gbSmartWriteFlashByte(addr, 0x0c); gbSmartWriteFlashByte(addr, 0xff); gbSmartWriteFlashByte(addr + i, 0x00); // BCH should be 0x00 - - // waiting for finishing - dataIn_GB(); - while ((readByte_GB(addr + i) & 0x80) == 0x00); + + // waiting for finishing + dataIn_GB(); + while ((readByte_GB(addr + i) & 0x80) == 0x00); } // blink LED @@ -553,7 +553,7 @@ uint32_t gbSmartVerifyFlash() for (uint16_t addr = 0x0000; addr <= 0x3fff; addr += 512) { myFile.read(sdBuffer, 512); - + for (uint16_t c = 0; c < 512; c++) { if (readByte_GB(addr + c) != sdBuffer[c]) @@ -571,13 +571,13 @@ uint32_t gbSmartVerifyFlash() for (uint16_t addr = 0x4000; addr <= 0x7fff; addr += 512) { myFile.read(sdBuffer, 512); - + for (uint16_t c = 0; c < 512; c++) { if (readByte_GB(addr + c) != sdBuffer[c]) verified++; } - } + } } // back to initial state @@ -637,22 +637,22 @@ void gbSmartEraseFlash(uint8_t flash_start_bank) dataIn_GB(); while ((readByte_GB(0x0000) & 0x80) == 0x00); - + // blink LED - PORTB ^= (1 << 4); + PORTB ^= (1 << 4); // rest of flash block for (uint32_t ba = gbSmartBanksPerFlashBlock; ba < gbSmartBanksPerFlashChip; ba += gbSmartBanksPerFlashBlock) { dataOut(); writeByte_GB(0x2100, ba); - + gbSmartWriteFlashByte(0x4000, 0x20); gbSmartWriteFlashByte(0x4000, 0xd0); dataIn_GB(); while ((readByte_GB(0x4000) & 0x80) == 0x00); - + // blink LED PORTB ^= (1 << 4); } @@ -674,10 +674,10 @@ void gbSmartWriteFlashByte(uint32_t myAddress, uint8_t myData) __asm__("nop\n\tnop\n\tnop\n\tnop\n\t"); // Pull FLASH_WE (PH4) high - PORTH |= (1 << 4); + PORTH |= (1 << 4); // pull high for another 250ns - __asm__("nop\n\tnop\n\tnop\n\tnop\n\t"); + __asm__("nop\n\tnop\n\tnop\n\tnop\n\t"); } // rom_start_bank = 0x00 means back to original state @@ -686,7 +686,7 @@ void gbSmartRemapStartBank(uint8_t rom_start_bank, uint8_t rom_size, uint8_t sra rom_start_bank &= 0xfe; dataOut(); - + // clear base bank setting writeByte_GB(0x1000, 0xa5); writeByte_GB(0x7000, 0x00); diff --git a/Cart_Reader/N64.ino b/Cart_Reader/N64.ino index f87a0ed..7a6ed7f 100644 --- a/Cart_Reader/N64.ino +++ b/Cart_Reader/N64.ino @@ -42,12 +42,15 @@ unsigned long romBase = 0x10000000; byte flashramType = 1; boolean MN63F81MPN = false; +//ControllerTest +bool quit = 1; + /****************************************** Menu *****************************************/ // N64 start menu static const char n64MenuItem1[] PROGMEM = "Game Cartridge"; -static const char n64MenuItem2[] PROGMEM = "Controller Pak"; +static const char n64MenuItem2[] PROGMEM = "Controller"; static const char n64MenuItem3[] PROGMEM = "Flash Repro"; static const char n64MenuItem4[] PROGMEM = "Flash Gameshark"; static const char n64MenuItem5[] PROGMEM = "Reset"; @@ -155,7 +158,8 @@ void n64ControllerMenu() { case 0: display_Clear(); display_Update(); - readController(); + controllerTest(); + quit = 1; break; case 1: @@ -830,35 +834,533 @@ void get_button() } } -void readController() { - bool quit = 1; + +/****************************************** + N64 Controller Test + *****************************************/ +#define CENTER 64 + +void oledPrint(const char string[], int x, int y) { + + if (x == CENTER) + x = 64 - (strlen(string) / 2) * 6; + display.setCursor(x, y); + display.print(string); +} + +void oledPrint(int number, int x, int y) { + display.setCursor(x, y); + display.print(number); +} + +void printSTR(String st, int x, int y) +{ + char buf[st.length() + 1]; + + st.toCharArray(buf, st.length() + 1); + oledPrint(buf, x, y); +} + +void controllerTest() { + // on which screens do we start + int startscreen = 1; + int mode = 0; + int test = 1; + + //name of the current displayed result + String anastick = ""; + int prevStickX = 0; + + // Graph + int xax = 22 + 24; // midpoint x + int yax = 24; // midpoint y + int zax = 24; // size + + // variables to display test data of different sticks + int upx = 0; + int upy = 0; + int uprightx = 0; + int uprighty = 0; + int rightx = 0; + int righty = 0; + int downrightx = 0; + int downrighty = 0; + int downx = 0; + int downy = 0; + int downleftx = 0; + int downlefty = 0; + int leftx = 0; + int lefty = 0; + int upleftx = 0; + int uplefty = 0; + + // variables to save test data + int bupx = 0; + int bupy = 0; + int buprightx = 0; + int buprighty = 0; + int brightx = 0; + int brighty = 0; + int bdownrightx = 0; + int bdownrighty = 0; + int bdownx = 0; + int bdowny = 0; + int bdownleftx = 0; + int bdownlefty = 0; + int bleftx = 0; + int blefty = 0; + int bupleftx = 0; + int buplefty = 0; + int results = 0; while (quit) { - display_Clear(); - // Get Button and analog stick get_button(); - println_Msg(F("Controller Test")); - println_Msg(""); - println_Msg(button); - println_Msg(""); - String stickx = String("X: " + String(N64_status.stick_x, DEC) + " "); - println_Msg(stickx); - String sticky = String("Y: " + String(N64_status.stick_y, DEC) + " "); - println_Msg(sticky); - println_Msg(""); - println_Msg(F("Press START to quit")); + switch (startscreen) + { + case 1: + { + display.clearDisplay(); + oledPrint("Button Test", CENTER, 0); + display.drawLine(22 + 0, 10, 22 + 84, 10, WHITE); - display_Update(); - delay(100); + // Print Button + printSTR(" " + button + " ", CENTER, 20); - if (button == F("START")) { - quit = 0; + // Print Stick X Value + String stickx = String("X: " + String(N64_status.stick_x, DEC) + " "); + printSTR(stickx, 22 + 0, 38); + + // Print Stick Y Value + String sticky = String("Y: " + String(N64_status.stick_y, DEC) + " "); + printSTR(sticky, 22 + 60, 38); + + printSTR("(Continue with START)", 0, 55); + //Update LCD + display.display(); + + // go to next screen + if (button == "Press a button" && lastbutton == "START") + { + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + if (startscreen != 4) + startscreen = startscreen + 1; + else + { + startscreen = 1; + test = 1; + } + } + else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) + { + // Quit + quit = 0; + } + break; + } + case 2: + { + oledPrint("Range Test", CENTER, 55); + display.drawLine(22 + 0, 50, 22 + 84, 50, WHITE); + + // Print Stick X Value + String stickx = String("X:" + String(N64_status.stick_x, DEC) + " "); + printSTR(stickx, 22 + 54, 8); + + // Print Stick Y Value + String sticky = String("Y:" + String(N64_status.stick_y, DEC) + " "); + printSTR(sticky, 22 + 54, 18); + + // Draw Axis + //display.drawLine(xax - zax, yax, xax + zax, yax, WHITE); + //display.drawLine(xax, yax - zax, xax, yax + zax, WHITE); + display.drawPixel(xax, yax, WHITE); + display.drawPixel(xax, yax - 80 / 4, WHITE); + display.drawPixel(xax, yax + 80 / 4, WHITE); + display.drawPixel(xax + 80 / 4, yax, WHITE); + display.drawPixel(xax - 80 / 4, yax, WHITE); + + // Draw corners + display.drawPixel(xax - 68 / 4, yax - 68 / 4, WHITE); + display.drawPixel(xax + 68 / 4, yax + 68 / 4, WHITE); + display.drawPixel(xax + 68 / 4, yax - 68 / 4, WHITE); + display.drawPixel(xax - 68 / 4, yax + 68 / 4, WHITE); + + //Draw Analog Stick + if (mode == 1) + { + display.drawPixel(xax + N64_status.stick_x / 4, yax - N64_status.stick_y / 4, WHITE); + //Update LCD + display.display(); + } + else + { + display.drawCircle(xax + N64_status.stick_x / 4, yax - N64_status.stick_y / 4, 2, WHITE); + //Update LCD + display.display(); + display.clearDisplay(); + } + + // switch mode + if (button == "Press a button" && lastbutton == "Z") + { + if (mode == 0) + { + mode = 1; + display.clearDisplay(); + } + else + { + mode = 0; + display.clearDisplay(); + } + } + // go to next screen + if (button == "Press a button" && lastbutton == "START") + { + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + if (startscreen != 4) + startscreen = startscreen + 1; + else + { + startscreen = 1; + test = 1; + } + } + else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) + { + // Quit + quit = 0; + } + break; + } + case 3: + { + display.drawPixel(22 + prevStickX, 40, BLACK); + oledPrint("Skipping Test", CENTER, 0); + display.drawLine(22 + 0, 10, 22 + 83, 10, WHITE); + display.drawRect(22 + 0, 15, 22 + 59, 21, WHITE); + if (N64_status.stick_x > 0) { + display.drawLine(22 + N64_status.stick_x, 15, 22 + N64_status.stick_x, 35, WHITE); + display.drawPixel(22 + N64_status.stick_x, 40, WHITE); + prevStickX = N64_status.stick_x; + } + + printSTR("Try to fill box by", 0, 45); + printSTR("slowly moving right", 0, 55); + //Update LCD + display.display(); + + if (button == "Press a button" && lastbutton == "Z") + { + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + // go to next screen + if (button == "Press a button" && lastbutton == "START") + { + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + if (startscreen != 4) + startscreen = startscreen + 1; + else + { + startscreen = 1; + test = 1; + } + } + else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) + { + // Quit + quit = 0; + } + break; + } + case 4: + { + switch ( test ) + { + case 0: // Display results + { + switch (results) + { + case 0: + { + anastick = "YOURS"; + upx = bupx; + upy = bupy; + uprightx = buprightx; + uprighty = buprighty; + rightx = brightx; + righty = brighty; + downrightx = bdownrightx; + downrighty = bdownrighty; + downx = bdownx; + downy = bdowny; + downleftx = bdownleftx; + downlefty = bdownlefty; + leftx = bleftx; + lefty = blefty; + upleftx = bupleftx; + uplefty = buplefty; + + if (button == "Press a button" && lastbutton == "A") + { + // reset button + lastbutton = "N/A"; + results = 1; + } + + break; + } + case 1: + { + anastick = "ORIG"; + upx = 1; + upy = 84; + uprightx = 67; + uprighty = 68; + rightx = 83; + righty = -2; + downrightx = 67; + downrighty = -69; + downx = 3; + downy = -85; + downleftx = -69; + downlefty = -70; + leftx = -85; + lefty = 0; + upleftx = -68; + uplefty = 68; + + if (button == "Press a button" && lastbutton == "A") + { + // reset button + lastbutton = "N/A"; + results = 0; + } + break; + } + + } //results + display.clearDisplay(); + + printSTR(anastick, 22 + 50, 0); + + oledPrint("U:", 22 + 50, 10); + oledPrint(upy, 100, 10); + oledPrint("D:", 22 + 50, 20); + oledPrint(downy, 100, 20); + oledPrint("L:", 22 + 50, 30); + oledPrint(leftx, 100, 30); + oledPrint("R:", 22 + 50, 40); + oledPrint(rightx, 100, 40); + + display.drawLine(xax + upx / 4, yax - upy / 4, xax + uprightx / 4, yax - uprighty / 4, WHITE); + display.drawLine(xax + uprightx / 4, yax - uprighty / 4, xax + rightx / 4, yax - righty / 4, WHITE); + display.drawLine(xax + rightx / 4, yax - righty / 4, xax + downrightx / 4, yax - downrighty / 4, WHITE); + display.drawLine(xax + downrightx / 4, yax - downrighty / 4, xax + downx / 4, yax - downy / 4, WHITE); + display.drawLine(xax + downx / 4, yax - downy / 4, xax + downleftx / 4, yax - downlefty / 4, WHITE); + display.drawLine(xax + downleftx / 4, yax - downlefty / 4, xax + leftx / 4, yax - lefty / 4, WHITE); + display.drawLine(xax + leftx / 4, yax - lefty / 4, xax + upleftx / 4, yax - uplefty / 4, WHITE); + display.drawLine(xax + upleftx / 4, yax - uplefty / 4, xax + upx / 4, yax - upy / 4, WHITE); + + display.drawPixel(xax, yax, WHITE); + + printSTR("(Quit with Z)", 25, 55); + //Update LCD + display.display(); + break; + } //display results + + case 1:// +y Up + { + oledPrint("Hold Stick Up", CENTER, 18); + oledPrint("then press A", CENTER, 28); + //myOLED.drawBitmap(110, 60, ana1); + + if (button == "Press a button" && lastbutton == "A") + { + bupx = N64_status.stick_x; + bupy = N64_status.stick_y; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + test = 2; + } + break; + } + + case 2:// +y+x Up-Right + { + oledPrint("Up-Right", CENTER, 22 ); + //myOLED.drawBitmap(110, 60, ana2); + + if (button == "Press a button" && lastbutton == "A") + { + buprightx = N64_status.stick_x; + buprighty = N64_status.stick_y; + test = 3; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + break; + } + + case 3:// +x Right + { + oledPrint("Right", CENTER, 22 ); + //myOLED.drawBitmap(110, 60, ana3); + + if (button == "Press a button" && lastbutton == "A") + { + brightx = N64_status.stick_x; + brighty = N64_status.stick_y; + test = 4; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + break; + } + + case 4:// -y+x Down-Right + { + oledPrint("Down-Right", CENTER, 22 ); + //myOLED.drawBitmap(110, 60, ana4); + + if (button == "Press a button" && lastbutton == "A") + { + bdownrightx = N64_status.stick_x; + bdownrighty = N64_status.stick_y; + test = 5; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + break; + } + + case 5:// -y Down + { + oledPrint("Down", CENTER, 22 ); + //myOLED.drawBitmap(110, 60, ana5); + + if (button == "Press a button" && lastbutton == "A") + { + bdownx = N64_status.stick_x; + bdowny = N64_status.stick_y; + test = 6; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + break; + } + + case 6:// -y-x Down-Left + { + oledPrint("Down-Left", CENTER, 22 ); + //myOLED.drawBitmap(110, 60, ana6); + + if (button == "Press a button" && lastbutton == "A") + { + bdownleftx = N64_status.stick_x; + bdownlefty = N64_status.stick_y; + test = 7; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + break; + } + + case 7:// -x Left + { + oledPrint("Left", CENTER, 22 ); + //myOLED.drawBitmap(110, 60, ana7); + + if (button == "Press a button" && lastbutton == "A") + { + bleftx = N64_status.stick_x; + blefty = N64_status.stick_y; + test = 8; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + break; + } + + case 8:// +y+x Up-Left + { + oledPrint("Up-Left", CENTER, 22); + //myOLED.drawBitmap(110, 60, ana8); + + if (button == "Press a button" && lastbutton == "A") + { + bupleftx = N64_status.stick_x; + buplefty = N64_status.stick_y; + test = 0; + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + } + break; + } + } + if (test != 0) + { + oledPrint("Benchmark", CENTER, 0); + display.drawLine(22 + 0, 9, 22 + 83, 9, WHITE); + printSTR("(Quit with Z)", 25, 55); + } + display.display(); + // go to next screen + if (button == "Press a button" && lastbutton == "START") + { + // reset button + lastbutton = "N/A"; + + display.clearDisplay(); + if (startscreen != 4) + startscreen = startscreen + 1; + else + { + startscreen = 1; + test = 1; + } + } + else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) + { + // Quit + quit = 0; + } + break; + } } } } - /****************************************** N64 Controller Pak Functions (connected via Controller) @@ -1189,7 +1691,7 @@ static const uint32_t crc_32_tab[] PROGMEM = { /* CRC polynomial 0xedb88320 */ }; // improved strcmp function that ignores case to prevent checksum comparison issues -int strcicmp(char const *a, char const *b) +int strcicmp(char const * a, char const * b) { for (;; a++, b++) { int d = tolower((unsigned char) * a) - tolower((unsigned char) * b); diff --git a/Cart_Reader/NP.ino b/Cart_Reader/NP.ino index ca4c200..33104e1 100644 --- a/Cart_Reader/NP.ino +++ b/Cart_Reader/NP.ino @@ -1,7 +1,7 @@ //****************************************** // NINTENDO POWER MODULE //****************************************** -// (GB Memory starts at around line 1743) +// (GB Memory starts at around line 1740) /****************************************** SF Memory Cassette diff --git a/extras/controllertest/ControllerTest2.ino b/extras/controllertest/ControllerTest2.ino deleted file mode 100644 index 2fb0a23..0000000 --- a/extras/controllertest/ControllerTest2.ino +++ /dev/null @@ -1,812 +0,0 @@ -/********************************************************************************** - Nintendo 64 Controller Test for Arduino Mega - - Author: sanni - Date: 2016-04-15 - Version: V2 - - OLED lib: http://www.rinkydinkelectronics.com/library.php?id=79 - - Thanks to: - Andrew Brown/Peter Den Hartog - N64 send/get functions - -**********************************************************************************/ - -#include -extern uint8_t SmallFont[]; - -// define LCD pins -OLED myOLED(SDA, SCL, 8); - -//define LED pin -int ledPin = 10; - -// These two macros toggle the eepDataPin/ControllerDataPin between input and output -// External 1K pull-up resistor from eepDataPin to VCC required -// 0x10 = 00010000 -> Port H Pin 4 -#define N64_HIGH DDRH &= ~0x10 -#define N64_LOW DDRH |= 0x10 -// Read the current state(0/1) of the eepDataPin -#define N64_QUERY (PINH & 0x10) - -// received Controller data -char N64_raw_dump[33]; // 1 received bit per byte -String rawStr = ""; // above char array read into a string -struct { - char stick_x; - char stick_y; -} -N64_status; - -// on which screens do we start -int startscreen = 0; -int mode = 0; -int test = 1; - -//stings that hold the buttons -String button = "N/A"; -String lastbutton = "N/A"; - -//name of the current displayed result -String anastick = ""; - -// Graph -int xax = 22 + 24; // midpoint x -int yax = 24; // midpoint y -int zax = 24; // size - -// variables to display test data of different sticks -int upx = 0; -int upy = 0; -int uprightx = 0; -int uprighty = 0; -int rightx = 0; -int righty = 0; -int downrightx = 0; -int downrighty = 0; -int downx = 0; -int downy = 0; -int downleftx = 0; -int downlefty = 0; -int leftx = 0; -int lefty = 0; -int upleftx = 0; -int uplefty = 0; - -// variables to save test data -int bupx = 0; -int bupy = 0; -int buprightx = 0; -int buprighty = 0; -int brightx = 0; -int brighty = 0; -int bdownrightx = 0; -int bdownrighty = 0; -int bdownx = 0; -int bdowny = 0; -int bdownleftx = 0; -int bdownlefty = 0; -int bleftx = 0; -int blefty = 0; -int bupleftx = 0; -int buplefty = 0; -int results = 0; - -void N64_send(unsigned char *buffer, char length); -void N64_get(); - -void setup() -{ - // Communication with controller on this pin - // Don't remove these lines, we don't want to push +5V to the controller - // Output a low signal - PORTH &= ~(1 << 4); - // Set Controller Data Pin(PH4) to Input - DDRH &= ~(1 << 4); - - // Led - pinMode(ledPin, OUTPUT); - - // OLED - myOLED.begin(); - myOLED.setFont(SmallFont); -} - -// This sends the given byte sequence to the controller -// length must be at least 1 -// Oh, it destroys the buffer passed in as it writes it - -void N64_send(unsigned char *buffer, char length) -{ - // Send these bytes - char bits; - - bool bit; - - // This routine is very carefully timed by examining the assembly output. - // Do not change any statements, it could throw the timings off - // - // We get 16 cycles per microsecond, which should be plenty, but we need to - // be conservative. Most assembly ops take 1 cycle, but a few take 2 - // - // I use manually constructed for-loops out of gotos so I have more control - // over the outputted assembly. I can insert nops where it was impossible - // with a for loop - - asm volatile (";Starting outer for loop"); -outer_loop: - { - asm volatile (";Starting inner for loop"); - bits = 8; -inner_loop: - { - // Starting a bit, set the line low - asm volatile (";Setting line to low"); - N64_LOW; // 1 op, 2 cycles - - asm volatile (";branching"); - if (*buffer >> 7) { - asm volatile (";Bit is a 1"); - // 1 bit - // remain low for 1us, then go high for 3us - // nop block 1 - asm volatile ("nop\nnop\nnop\nnop\nnop\n"); - - asm volatile (";Setting line to high"); - N64_HIGH; - - // nop block 2 - // we'll wait only 2us to sync up with both conditions - // at the bottom of the if statement - asm volatile ("nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - ); - - } - else { - asm volatile (";Bit is a 0"); - // 0 bit - // remain low for 3us, then go high for 1us - // nop block 3 - asm volatile ("nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\n"); - - asm volatile (";Setting line to high"); - N64_HIGH; - - // wait for 1us - asm volatile ("; end of conditional branch, need to wait 1us more before next bit"); - - } - // end of the if, the line is high and needs to remain - // high for exactly 16 more cycles, regardless of the previous - // branch path - - asm volatile (";finishing inner loop body"); - --bits; - if (bits != 0) { - // nop block 4 - // this block is why a for loop was impossible - asm volatile ("nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\n"); - // rotate bits - asm volatile (";rotating out bits"); - *buffer <<= 1; - - goto inner_loop; - } // fall out of inner loop - } - asm volatile (";continuing outer loop"); - // In this case: the inner loop exits and the outer loop iterates, - // there are /exactly/ 16 cycles taken up by the necessary operations. - // So no nops are needed here (that was lucky!) - --length; - if (length != 0) { - ++buffer; - goto outer_loop; - } // fall out of outer loop - } - - // send a single stop (1) bit - // nop block 5 - asm volatile ("nop\nnop\nnop\nnop\n"); - N64_LOW; - // wait 1 us, 16 cycles, then raise the line - // 16-2=14 - // nop block 6 - asm volatile ("nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\n"); - N64_HIGH; - -} - -void N64_get() -{ - // listen for the expected 8 bytes of data back from the controller and - // blast it out to the N64_raw_dump array, one bit per byte for extra speed. - // Afterwards, call translate_raw_data() to interpret the raw data and pack - // it into the N64_status struct. - asm volatile (";Starting to listen"); - unsigned char timeout; - char bitcount = 32; - char *bitbin = N64_raw_dump; - - // Again, using gotos here to make the assembly more predictable and - // optimization easier (please don't kill me) -read_loop: - timeout = 0x3f; - // wait for line to go low - while (N64_QUERY) { - if (!--timeout) - return; - } - // wait approx 2us and poll the line - asm volatile ( - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - "nop\nnop\nnop\nnop\nnop\n" - ); - *bitbin = N64_QUERY; - ++bitbin; - --bitcount; - if (bitcount == 0) - return; - - // wait for line to go high again - // it may already be high, so this should just drop through - timeout = 0x3f; - while (!N64_QUERY) { - if (!--timeout) - return; - } - goto read_loop; - -} - -void get_button() -{ - // Command to send to the gamecube - // The last bit is rumble, flip it to rumble - // yes this does need to be inside the loop, the - // array gets mutilated when it goes through N64_send - unsigned char command[] = { - 0x01 - }; - - // don't want interrupts getting in the way - noInterrupts(); - // send those 3 bytes - N64_send(command, 1); - // read in data and dump it to N64_raw_dump - N64_get(); - // end of time sensitive code - interrupts(); - - // The get_N64_status function sloppily dumps its data 1 bit per byte - // into the get_status_extended char array. It's our job to go through - // that and put each piece neatly into the struct N64_status - int i; - memset(&N64_status, 0, sizeof(N64_status)); - - // bits: joystick x value - // These are 8 bit values centered at 0x80 (128) - for (i = 0; i < 8; i++) { - N64_status.stick_x |= N64_raw_dump[16 + i] ? (0x80 >> i) : 0; - } - for (i = 0; i < 8; i++) { - N64_status.stick_y |= N64_raw_dump[24 + i] ? (0x80 >> i) : 0; - } - - // read char array N64_raw_dump into string rawStr - rawStr = ""; - for (i = 0; i < 16; i++) { - rawStr = rawStr + String(N64_raw_dump[i], DEC); - } - - // Buttons (A,B,Z,S,DU,DD,DL,DR,0,0,L,R,CU,CD,CL,CR) - if (rawStr.substring(0, 16) == "0000000000000000") { - lastbutton = button; - button = "Press a button"; - digitalWrite(ledPin, LOW); - } - else - { - digitalWrite(ledPin, HIGH); - for (int i = 0; i < 16; i++) - { - // seems to be 16, 8 or 4 depending on what pin is used - if (N64_raw_dump[i] == 16) - { - switch (i) - { - case 7: - button = "D-Right"; - break; - - case 6: - button = "D-Left"; - break; - - case 5: - button = "D-Down"; - break; - - case 4: - button = "D-Up"; - break; - - case 3: - button = "START"; - break; - - case 2: - button = "Z"; - break; - - case 1: - button = "B"; - break; - - case 0: - button = "A"; - break; - - case 15: - button = "C-Right"; - break; - - case 14: - button = "C-Left"; - break; - - case 13: - button = "C-Down"; - break; - - case 12: - button = "C-Up"; - break; - - case 11: - button = "R"; - break; - - case 10: - button = "L"; - break; - } - } - } - } -} - -void printSTR(String st, int x, int y) -{ - char buf[st.length() + 1]; - - st.toCharArray(buf, st.length() + 1); - myOLED.print(buf, x, y); -} - -void nextscreen() -{ - if (button == "Press a button" && lastbutton == "START") - { - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - if (startscreen != 4) - startscreen = startscreen + 1; - else - { - startscreen = 1; - test = 1; - } - } -} - -void loop() -{ - // Get Button and analog stick - get_button(); - - switch (startscreen) - { - case 0: // Logo Screen - { - myOLED.print("ControllerTest", CENTER, 8); - myOLED.print("V1.0", CENTER, 18); - myOLED.drawLine(22 + 0, 28, 22 + 84, 28); - myOLED.print("2013 sanni", CENTER, 32); - myOLED.update(); - - delay(1500); - startscreen = 1; - myOLED.clrScr(); - break; - } - case 1: - { - myOLED.print("Button Test", CENTER, 0); - myOLED.drawLine(22 + 0, 10, 22 + 84, 10); - - // Print Button - printSTR(" " + button + " ", CENTER, 20); - - // Print Stick X Value - String stickx = String("X: " + String(N64_status.stick_x, DEC) + " "); - printSTR(stickx, 22 + 0, 38); - - // Print Stick Y Value - String sticky = String("Y: " + String(N64_status.stick_y, DEC) + " "); - printSTR(sticky, 22 + 42, 38); - - //Update LCD - myOLED.update(); - - // go to next screen - nextscreen(); - break; - } - case 2: - { - myOLED.print("Range", 22 + 52, 5); - myOLED.print("Test", 22 + 52, 15); - myOLED.drawRect(22 + 50, 0, 22 + 83, 25); - - // Print Stick X Value - String stickx = String("X:" + String(N64_status.stick_x, DEC) + " "); - printSTR(stickx, 22 + 50, 28); - - // Print Stick Y Value - String sticky = String("Y:" + String(N64_status.stick_y, DEC) + " "); - printSTR(sticky, 22 + 50, 38); - - // Draw Axis - myOLED.drawLine(xax - zax, yax, xax + zax, yax); - myOLED.drawLine(xax, yax - zax, xax, yax + zax); - myOLED.clrPixel(xax, yax - 80 / 4); - myOLED.clrPixel(xax, yax + 80 / 4); - myOLED.clrPixel(xax + 80 / 4, yax); - myOLED.clrPixel(xax - 80 / 4, yax); - - //Draw Analog Stick - if (mode == 1) - { - myOLED.setPixel(xax + N64_status.stick_x / 4, yax - N64_status.stick_y / 4); - //Update LCD - myOLED.update(); - } - else - { - myOLED.drawCircle(xax + N64_status.stick_x / 4, yax - N64_status.stick_y / 4, 2); - //Update LCD - myOLED.update(); - myOLED.clrScr(); - } - - // switch mode - if (button == "Press a button" && lastbutton == "Z") - { - if (mode == 0) - { - mode = 1; - myOLED.clrScr(); - } - else - { - mode = 0; - myOLED.clrScr(); - } - } - // go to next screen - nextscreen(); - break; - } - case 3: - { - myOLED.print("Skipping Test", CENTER, 0); - myOLED.drawLine(22 + 0, 10, 22 + 83, 10); - myOLED.drawRect(22 + 0, 20, 22 + 83, 44); - if (N64_status.stick_x > 0) - myOLED.drawLine(22 + N64_status.stick_x, 20, 22 + N64_status.stick_x, 44); - - //Update LCD - myOLED.update(); - - if (button == "Press a button" && lastbutton == "Z") - { - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - // go to next screen - nextscreen(); - break; - } - case 4: - { - switch ( test ) - { - case 0: // Display results - { - switch (results) - { - case 0: - { - anastick = "YOURS"; - upx = bupx; - upy = bupy; - uprightx = buprightx; - uprighty = buprighty; - rightx = brightx; - righty = brighty; - downrightx = bdownrightx; - downrighty = bdownrighty; - downx = bdownx; - downy = bdowny; - downleftx = bdownleftx; - downlefty = bdownlefty; - leftx = bleftx; - lefty = blefty; - upleftx = bupleftx; - uplefty = buplefty; - - if (button == "Press a button" && lastbutton == "A") - { - // reset button - lastbutton = "N/A"; - results = 1; - } - - break; - } - case 1: - { - anastick = "ORIG"; - upx = 1; - upy = 84; - uprightx = 67; - uprighty = 68; - rightx = 83; - righty = -2; - downrightx = 67; - downrighty = -69; - downx = 3; - downy = -85; - downleftx = -69; - downlefty = -70; - leftx = -85; - lefty = 0; - upleftx = -68; - uplefty = 68; - - if (button == "Press a button" && lastbutton == "A") - { - // reset button - lastbutton = "N/A"; - results = 0; - } - break; - } - - } //results - myOLED.clrScr(); - - printSTR(anastick, 22 + 50, 0); - - myOLED.print("U:", 22 + 50, 10); - myOLED.printNumI(upy, RIGHT, 10); - myOLED.print("D:", 22 + 50, 20); - myOLED.printNumI(downy, RIGHT, 20); - myOLED.print("L:", 22 + 50, 30); - myOLED.printNumI(leftx, RIGHT, 30); - myOLED.print("R:", 22 + 50, 40); - myOLED.printNumI(rightx, RIGHT, 40); - - myOLED.drawLine(xax + upx / 4, yax - upy / 4, xax + uprightx / 4, yax - uprighty / 4); - myOLED.drawLine(xax + uprightx / 4, yax - uprighty / 4, xax + rightx / 4, yax - righty / 4); - myOLED.drawLine(xax + rightx / 4, yax - righty / 4, xax + downrightx / 4, yax - downrighty / 4); - myOLED.drawLine(xax + downrightx / 4, yax - downrighty / 4, xax + downx / 4, yax - downy / 4); - myOLED.drawLine(xax + downx / 4, yax - downy / 4, xax + downleftx / 4, yax - downlefty / 4); - myOLED.drawLine(xax + downleftx / 4, yax - downlefty / 4, xax + leftx / 4, yax - lefty / 4); - myOLED.drawLine(xax + leftx / 4, yax - lefty / 4, xax + upleftx / 4, yax - uplefty / 4); - myOLED.drawLine(xax + upleftx / 4, yax - uplefty / 4, xax + upx / 4, yax - upy / 4); - - myOLED.setPixel(xax, yax); - - //Update LCD - myOLED.update(); - break; - } //display results - - case 1:// +y Up - { - myOLED.print("Hold Stick Up", CENTER, 18); - myOLED.print("then press A", CENTER, 28); - //myOLED.drawBitmap(110, 60, ana1); - - if (button == "Press a button" && lastbutton == "A") - { - bupx = N64_status.stick_x; - bupy = N64_status.stick_y; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - test = 2; - } - break; - } - - case 2:// +y+x Up-Right - { - myOLED.print("Up-Right", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana2); - - if (button == "Press a button" && lastbutton == "A") - { - buprightx = N64_status.stick_x; - buprighty = N64_status.stick_y; - test = 3; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - break; - } - - case 3:// +x Right - { - myOLED.print("Right", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana3); - - if (button == "Press a button" && lastbutton == "A") - { - brightx = N64_status.stick_x; - brighty = N64_status.stick_y; - test = 4; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - break; - } - - case 4:// -y+x Down-Right - { - myOLED.print("Down-Right", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana4); - - if (button == "Press a button" && lastbutton == "A") - { - bdownrightx = N64_status.stick_x; - bdownrighty = N64_status.stick_y; - test = 5; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - break; - } - - case 5:// -y Down - { - myOLED.print("Down", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana5); - - if (button == "Press a button" && lastbutton == "A") - { - bdownx = N64_status.stick_x; - bdowny = N64_status.stick_y; - test = 6; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - break; - } - - case 6:// -y-x Down-Left - { - myOLED.print("Down-Left", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana6); - - if (button == "Press a button" && lastbutton == "A") - { - bdownleftx = N64_status.stick_x; - bdownlefty = N64_status.stick_y; - test = 7; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - break; - } - - case 7:// -x Left - { - myOLED.print("Left", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana7); - - if (button == "Press a button" && lastbutton == "A") - { - bleftx = N64_status.stick_x; - blefty = N64_status.stick_y; - test = 8; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - break; - } - - case 8:// +y+x Up-Left - { - myOLED.print("Up-Left", CENTER, 22); - //myOLED.drawBitmap(110, 60, ana8); - - if (button == "Press a button" && lastbutton == "A") - { - bupleftx = N64_status.stick_x; - buplefty = N64_status.stick_y; - test = 0; - // reset button - lastbutton = "N/A"; - - myOLED.clrScr(); - } - break; - } - } - if (test != 0) - { - myOLED.print("Benchmark", CENTER, 0); - myOLED.drawLine(22 + 0, 9, 22 + 83, 9); - } - myOLED.update(); - // go to next screen - nextscreen(); - break; - } - } -} - - - - - - - - - - - - - - - - - diff --git a/extras/controllertest/README.md b/extras/controllertest/README.md deleted file mode 100644 index a3e5192..0000000 --- a/extras/controllertest/README.md +++ /dev/null @@ -1,2 +0,0 @@ -This is my portable N64 Controller Tester edited to run on the Cart Reader Shield. -The N64 controller's data line is connected to Arduino Mega Pin 7. diff --git a/extras/controllertest/libraries/OLED_I2C.zip b/extras/controllertest/libraries/OLED_I2C.zip deleted file mode 100644 index 30fe8e1..0000000 Binary files a/extras/controllertest/libraries/OLED_I2C.zip and /dev/null differ diff --git a/extras/controllertest/libraries/README.md b/extras/controllertest/libraries/README.md deleted file mode 100644 index dbebe98..0000000 --- a/extras/controllertest/libraries/README.md +++ /dev/null @@ -1,4 +0,0 @@ -Unzip and copy those into your Arduino library folder e.g. C:\Users\sanni\Documents\Arduino\libraries - -You can also get the latest versions from their creators page: -Oled lib: http://www.rinkydinkelectronics.com/library.php?id=79