Skip to content

Commit

Permalink
reuse GB common functions
Browse files Browse the repository at this point in the history
  • Loading branch information
smesgr9000 committed Jun 3, 2024
1 parent 2b01f7f commit ccbb544
Showing 1 changed file with 19 additions and 64 deletions.
83 changes: 19 additions & 64 deletions Cart_Reader/GB.ino
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ bool gbxFlashCFI() {
return true;
}

void feedbackPressAndReset() {
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
}

// Start menu for both GB and GBA
void gbxMenu() {
// create menu with title and 5 options to choose from
Expand Down Expand Up @@ -133,12 +141,7 @@ void gbxMenu() {
sd.chdir("/");
//MBC3
writeFlash29F_GB(3, 1);
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 1:
Expand All @@ -152,12 +155,7 @@ void gbxMenu() {
sd.chdir("/");
//MBC5
writeFlash29F_GB(5, 1);
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 2:
Expand All @@ -178,12 +176,7 @@ void gbxMenu() {
sd.chdir("/");
//MBC5
writeFlash29F_GB(3, 1);
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 3:
Expand Down Expand Up @@ -223,11 +216,7 @@ void gbxMenu() {

// Reset
println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 4:
Expand Down Expand Up @@ -359,22 +348,12 @@ void gbxMenu() {
switch (gbPelican) {
case 0:
readPelican_GB();
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 1:
writePelican_GB();
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;
}
break;
Expand Down Expand Up @@ -416,42 +395,22 @@ void gbxMenu() {
switch (gbDatel) {
case 0:
readMegaMem_GB();
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 1:
writeMegaMem_GB();
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 2:
readGameshark_GB();
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;

case 3:
writeGameshark_GB();
// Reset
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
break;
}
break;
Expand Down Expand Up @@ -2315,11 +2274,7 @@ bool writeCFI_GB() {
print_Msg(F("but needs "));
print_Msg(romBanks);
println_Msg(F("."));
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
feedbackPressAndReset();
}

// Set ROM bank hi 0
Expand Down

0 comments on commit ccbb544

Please sign in to comment.