mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-14 17:05:08 +01:00
Fix default compiler warnings
This commit is contained in:
parent
343c95ae8c
commit
4cc73852f0
@ -74,7 +74,7 @@ Si5351 clockgen;
|
|||||||
// set pins of red, green and blue
|
// set pins of red, green and blue
|
||||||
RGBTools rgb(12, 11, 10);
|
RGBTools rgb(12, 11, 10);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum COLOR_T{
|
||||||
blue_color,
|
blue_color,
|
||||||
red_color,
|
red_color,
|
||||||
purple_color,
|
purple_color,
|
||||||
@ -82,7 +82,7 @@ typedef enum {
|
|||||||
turquoise_color,
|
turquoise_color,
|
||||||
yellow_color,
|
yellow_color,
|
||||||
white_color,
|
white_color,
|
||||||
};
|
} color_t;
|
||||||
|
|
||||||
// SD Card (Pin 50 = MISO, Pin 51 = MOSI, Pin 52 = SCK, Pin 53 = SS)
|
// SD Card (Pin 50 = MISO, Pin 51 = MOSI, Pin 52 = SCK, Pin 53 = SS)
|
||||||
#include <SdFat.h>
|
#include <SdFat.h>
|
||||||
@ -549,7 +549,7 @@ void print_Msg(const __FlashStringHelper *string) {
|
|||||||
Serial.print(string);
|
Serial.print(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_Msg(char string[]) {
|
void print_Msg(const char string[]) {
|
||||||
if (enable_OLED)
|
if (enable_OLED)
|
||||||
display.print(string);
|
display.print(string);
|
||||||
if (enable_Serial)
|
if (enable_Serial)
|
||||||
@ -591,7 +591,7 @@ void println_Msg(byte message, int outputFormat) {
|
|||||||
Serial.println(message, outputFormat);
|
Serial.println(message, outputFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void println_Msg(char message[]) {
|
void println_Msg(const char message[]) {
|
||||||
if (enable_OLED)
|
if (enable_OLED)
|
||||||
display.println(message);
|
display.println(message);
|
||||||
if (enable_Serial)
|
if (enable_Serial)
|
||||||
@ -624,7 +624,7 @@ void display_Clear() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char question_box(char* question, char answers[7][20], int num_answers, int default_choice) {
|
unsigned char question_box(const char* question, char answers[7][20], int num_answers, int default_choice) {
|
||||||
if (enable_OLED) {
|
if (enable_OLED) {
|
||||||
return questionBox_OLED(question, answers, num_answers, default_choice);
|
return questionBox_OLED(question, answers, num_answers, default_choice);
|
||||||
}
|
}
|
||||||
@ -633,7 +633,7 @@ unsigned char question_box(char* question, char answers[7][20], int num_answers,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fileBrowser(char browserTitle[]) {
|
void fileBrowser(const char browserTitle[]) {
|
||||||
if (enable_OLED) {
|
if (enable_OLED) {
|
||||||
fileBrowser_OLED(browserTitle);
|
fileBrowser_OLED(browserTitle);
|
||||||
}
|
}
|
||||||
@ -652,7 +652,7 @@ void wait_serial() {
|
|||||||
Serial.println("");
|
Serial.println("");
|
||||||
}
|
}
|
||||||
|
|
||||||
byte questionBox_Serial(char* question, char answers[7][20], int num_answers, int default_choice) {
|
byte questionBox_Serial(const char* question, char answers[7][20], int num_answers, int default_choice) {
|
||||||
// Print menu to serial monitor
|
// Print menu to serial monitor
|
||||||
Serial.print(question);
|
Serial.print(question);
|
||||||
Serial.println(F(" Menu"));
|
Serial.println(F(" Menu"));
|
||||||
@ -677,7 +677,7 @@ byte questionBox_Serial(char* question, char answers[7][20], int num_answers, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prompt a filename from the Serial Monitor
|
// Prompt a filename from the Serial Monitor
|
||||||
void fileBrowser_Serial(char browserTitle[]) {
|
void fileBrowser_Serial(const char browserTitle[]) {
|
||||||
Serial.println(browserTitle);
|
Serial.println(browserTitle);
|
||||||
// Print all files in root of SD
|
// Print all files in root of SD
|
||||||
Serial.println(F("Name - Size"));
|
Serial.println(F("Name - Size"));
|
||||||
@ -832,7 +832,7 @@ void wait_btn() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display a question box with selectable answers. Make sure default choice is in (0, num_answers]
|
// Display a question box with selectable answers. Make sure default choice is in (0, num_answers]
|
||||||
unsigned char questionBox_OLED(char* question, char answers[7][20], int num_answers, int default_choice) {
|
unsigned char questionBox_OLED(const char* question, char answers[7][20], int num_answers, int default_choice) {
|
||||||
|
|
||||||
//clear the screen
|
//clear the screen
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
@ -956,7 +956,7 @@ unsigned char questionBox_OLED(char* question, char answers[7][20], int num_answ
|
|||||||
/******************************************
|
/******************************************
|
||||||
Filebrowser Module
|
Filebrowser Module
|
||||||
*****************************************/
|
*****************************************/
|
||||||
void fileBrowser_OLED(char browserTitle[]) {
|
void fileBrowser_OLED(const char browserTitle[]) {
|
||||||
char fileNames[30][26];
|
char fileNames[30][26];
|
||||||
int currFile;
|
int currFile;
|
||||||
filebrowse = 1;
|
filebrowse = 1;
|
||||||
|
@ -802,8 +802,8 @@ void readBlock(word myAddress) {
|
|||||||
// Read Controller Pak command
|
// Read Controller Pak command
|
||||||
unsigned char command[] = {0x02};
|
unsigned char command[] = {0x02};
|
||||||
// Address Command
|
// Address Command
|
||||||
unsigned char addressHigh[] = {myAddressCRC >> 8};
|
unsigned char addressHigh[] = {(unsigned char)(myAddressCRC >> 8)};
|
||||||
unsigned char addressLow[] = {myAddressCRC & 0xff};
|
unsigned char addressLow[] = {(unsigned char)(myAddressCRC & 0xff)};
|
||||||
|
|
||||||
// don't want interrupts getting in the way
|
// don't want interrupts getting in the way
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
@ -902,8 +902,8 @@ void writeMPK() {
|
|||||||
// Write Controller Pak command
|
// Write Controller Pak command
|
||||||
unsigned char command[] = {0x03};
|
unsigned char command[] = {0x03};
|
||||||
// Address Command
|
// Address Command
|
||||||
unsigned char addressHigh[] = {myAddressCRC >> 8};
|
unsigned char addressHigh[] = {(unsigned char)(myAddressCRC >> 8)};
|
||||||
unsigned char addressLow[] = {myAddressCRC & 0xff};
|
unsigned char addressLow[] = {(unsigned char)(myAddressCRC & 0xff)};
|
||||||
|
|
||||||
// don't want interrupts getting in the way
|
// don't want interrupts getting in the way
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
|
@ -616,14 +616,14 @@ void resetFlash_NP(int startBank) {
|
|||||||
|
|
||||||
// Reset command sequence
|
// Reset command sequence
|
||||||
if (romType) {
|
if (romType) {
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xf0);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xf0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0xaa);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0xaa);
|
||||||
writeBank_SNES(0, 0x8000 + 0x2AAA * 2, 0x55);
|
writeBank_SNES(0, 0x8000 + 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0xf0);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0xf0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,9 +636,9 @@ void idFlash_NP(int startBank) {
|
|||||||
|
|
||||||
if (romType) {
|
if (romType) {
|
||||||
// ID command sequence
|
// ID command sequence
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0x90);
|
writeBank_SNES(startBank, 0x5555L * 2, 0x90);
|
||||||
|
|
||||||
// Set data pins to input again
|
// Set data pins to input again
|
||||||
dataIn();
|
dataIn();
|
||||||
@ -649,9 +649,9 @@ void idFlash_NP(int startBank) {
|
|||||||
sprintf(flashid, "%x%x", readBank_SNES(startBank, 0x00), readBank_SNES(startBank, 0x02));
|
sprintf(flashid, "%x%x", readBank_SNES(startBank, 0x00), readBank_SNES(startBank, 0x02));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0xaa);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0xaa);
|
||||||
writeBank_SNES(0, 0x8000 + 0x2AAA * 2, 0x55);
|
writeBank_SNES(0, 0x8000 + 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0x90);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0x90);
|
||||||
|
|
||||||
// Set data pins to input again
|
// Set data pins to input again
|
||||||
dataIn();
|
dataIn();
|
||||||
@ -690,9 +690,9 @@ void writeFlash_NP(int startBank, uint32_t pos) {
|
|||||||
for (unsigned long currByte = 0; currByte < 0x10000; currByte += 128) {
|
for (unsigned long currByte = 0; currByte < 0x10000; currByte += 128) {
|
||||||
myFile.read(sdBuffer, 128);
|
myFile.read(sdBuffer, 128);
|
||||||
// Write command sequence
|
// Write command sequence
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xa0);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xa0);
|
||||||
|
|
||||||
for (byte c = 0; c < 128; c++) {
|
for (byte c = 0; c < 128; c++) {
|
||||||
|
|
||||||
@ -715,9 +715,9 @@ void writeFlash_NP(int startBank, uint32_t pos) {
|
|||||||
for (unsigned long currByte = 0x8000; currByte < 0x10000; currByte += 128) {
|
for (unsigned long currByte = 0x8000; currByte < 0x10000; currByte += 128) {
|
||||||
myFile.read(sdBuffer, 128);
|
myFile.read(sdBuffer, 128);
|
||||||
// Write command sequence
|
// Write command sequence
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0xaa);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0xaa);
|
||||||
writeBank_SNES(0, 0x8000 + 0x2AAA * 2, 0x55);
|
writeBank_SNES(0, 0x8000 + 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0xa0);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0xa0);
|
||||||
|
|
||||||
for (byte c = 0; c < 128; c++) {
|
for (byte c = 0; c < 128; c++) {
|
||||||
// Write one byte of data
|
// Write one byte of data
|
||||||
@ -786,20 +786,20 @@ void eraseFlash_NP(int startBank) {
|
|||||||
|
|
||||||
if (romType) {
|
if (romType) {
|
||||||
// Erase command sequence
|
// Erase command sequence
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0x80);
|
writeBank_SNES(startBank, 0x5555L * 2, 0x80);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0x10);
|
writeBank_SNES(startBank, 0x5555L * 2, 0x10);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0xaa);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0xaa);
|
||||||
writeBank_SNES(0, 0x8000 + 0x2AAA * 2, 0x55);
|
writeBank_SNES(0, 0x8000 + 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0x80);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0x80);
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0xaa);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0xaa);
|
||||||
writeBank_SNES(0, 0x8000 + 0x2AAA * 2, 0x55);
|
writeBank_SNES(0, 0x8000 + 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(1, 0x8000 + 0x1555 * 2, 0x10);
|
writeBank_SNES(1, 0x8000 + 0x1555L * 2, 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for erase to complete
|
// Wait for erase to complete
|
||||||
@ -943,9 +943,9 @@ void readSectorProtection_NP(byte startBank) {
|
|||||||
dataOut();
|
dataOut();
|
||||||
|
|
||||||
// Display Sector Protection Status
|
// Display Sector Protection Status
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0x90);
|
writeBank_SNES(startBank, 0x5555L * 2, 0x90);
|
||||||
|
|
||||||
// Configure control pins
|
// Configure control pins
|
||||||
controlIn_SNES();
|
controlIn_SNES();
|
||||||
@ -1002,14 +1002,14 @@ void printMapping() {
|
|||||||
controlOut_SNES();
|
controlOut_SNES();
|
||||||
|
|
||||||
// Reset Flash
|
// Reset Flash
|
||||||
writeBank_SNES(0xC0, 0x5555 * 2, 0xaa);
|
writeBank_SNES(0xC0, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(0xC0, 0x2AAA * 2, 0x55);
|
writeBank_SNES(0xC0, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(0xC0, 0x5555 * 2, 0xf0);
|
writeBank_SNES(0xC0, 0x5555L * 2, 0xf0);
|
||||||
|
|
||||||
// Reset Flash
|
// Reset Flash
|
||||||
writeBank_SNES(0xE0, 0x5555 * 2, 0xaa);
|
writeBank_SNES(0xE0, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(0xE0, 0x2AAA * 2, 0x55);
|
writeBank_SNES(0xE0, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(0xE0, 0x5555 * 2, 0xf0);
|
writeBank_SNES(0xE0, 0x5555L * 2, 0xf0);
|
||||||
|
|
||||||
// Switch to read
|
// Switch to read
|
||||||
dataIn();
|
dataIn();
|
||||||
@ -1089,14 +1089,14 @@ void readMapping() {
|
|||||||
controlOut_SNES();
|
controlOut_SNES();
|
||||||
|
|
||||||
// Reset Flash
|
// Reset Flash
|
||||||
writeBank_SNES(0xC0, 0x5555 * 2, 0xaa);
|
writeBank_SNES(0xC0, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(0xC0, 0x2AAA * 2, 0x55);
|
writeBank_SNES(0xC0, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(0xC0, 0x5555 * 2, 0xf0);
|
writeBank_SNES(0xC0, 0x5555L * 2, 0xf0);
|
||||||
|
|
||||||
// Reset Flash
|
// Reset Flash
|
||||||
writeBank_SNES(0xE0, 0x5555 * 2, 0xaa);
|
writeBank_SNES(0xE0, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(0xE0, 0x2AAA * 2, 0x55);
|
writeBank_SNES(0xE0, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(0xE0, 0x5555 * 2, 0xf0);
|
writeBank_SNES(0xE0, 0x5555L * 2, 0xf0);
|
||||||
|
|
||||||
// Switch to read
|
// Switch to read
|
||||||
dataIn();
|
dataIn();
|
||||||
@ -1121,13 +1121,13 @@ void eraseMapping(byte startBank) {
|
|||||||
controlOut_SNES();
|
controlOut_SNES();
|
||||||
|
|
||||||
// Prepare to erase/write Page Buffer
|
// Prepare to erase/write Page Buffer
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0x77);
|
writeBank_SNES(startBank, 0x5555L * 2, 0x77);
|
||||||
// Erase Page Buffer
|
// Erase Page Buffer
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xe0);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xe0);
|
||||||
|
|
||||||
// Wait until complete
|
// Wait until complete
|
||||||
busyCheck_NP(startBank);
|
busyCheck_NP(startBank);
|
||||||
@ -1204,14 +1204,14 @@ byte blankcheckMapping() {
|
|||||||
controlOut_SNES();
|
controlOut_SNES();
|
||||||
|
|
||||||
// Reset Flash
|
// Reset Flash
|
||||||
writeBank_SNES(0xC0, 0x5555 * 2, 0xaa);
|
writeBank_SNES(0xC0, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(0xC0, 0x2AAA * 2, 0x55);
|
writeBank_SNES(0xC0, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(0xC0, 0x5555 * 2, 0xf0);
|
writeBank_SNES(0xC0, 0x5555L * 2, 0xf0);
|
||||||
|
|
||||||
// Reset Flash
|
// Reset Flash
|
||||||
writeBank_SNES(0xE0, 0x5555 * 2, 0xaa);
|
writeBank_SNES(0xE0, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(0xE0, 0x2AAA * 2, 0x55);
|
writeBank_SNES(0xE0, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(0xE0, 0x5555 * 2, 0xf0);
|
writeBank_SNES(0xE0, 0x5555L * 2, 0xf0);
|
||||||
|
|
||||||
// Switch to read
|
// Switch to read
|
||||||
dataIn();
|
dataIn();
|
||||||
@ -1242,13 +1242,13 @@ void writeMapping(byte startBank, uint32_t pos) {
|
|||||||
// Write to Page Buffer
|
// Write to Page Buffer
|
||||||
for (unsigned long currByte = 0xFF00; currByte < 0xFFFF; currByte += 128) {
|
for (unsigned long currByte = 0xFF00; currByte < 0xFFFF; currByte += 128) {
|
||||||
// Prepare to erase/write Page Buffer
|
// Prepare to erase/write Page Buffer
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0x77);
|
writeBank_SNES(startBank, 0x5555L * 2, 0x77);
|
||||||
// Write Page Buffer Command
|
// Write Page Buffer Command
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0xaa);
|
writeBank_SNES(startBank, 0x5555L * 2, 0xaa);
|
||||||
writeBank_SNES(startBank, 0x2AAA * 2, 0x55);
|
writeBank_SNES(startBank, 0x2AAAL * 2, 0x55);
|
||||||
writeBank_SNES(startBank, 0x5555 * 2, 0x99);
|
writeBank_SNES(startBank, 0x5555L * 2, 0x99);
|
||||||
|
|
||||||
myFile.read(sdBuffer, 128);
|
myFile.read(sdBuffer, 128);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user