From e6db96f1d6cefbf0b4f00dacba97b8ef1c382120 Mon Sep 17 00:00:00 2001 From: CrazyRedMachine Date: Sun, 1 Nov 2020 15:55:57 +0100 Subject: [PATCH 1/2] Nostalgia support + fix compilation warnings --- README.md | 6 ++++-- acrealio/IoBoard.cpp | 2 +- acrealio/IoBoard.h | 2 +- acrealio/acrealio.ino | 15 ++++++++++++--- acrealio/pinoutconfig.h | 14 +++++++------- acrealio/src/PN5180/PN5180.cpp | 2 +- acrealio/src/PN5180/PN5180.h | 6 +++--- 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0bc5257..99b5793 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,14 @@ drum mania (1 old reader) guitar freaks (2 old readers) -Sound voltex (1 new wavepass reader + 1 IoBoard ) +Sound voltex (1 new wavepass reader + 1 IoBoard) + +Nostalgia (1 IoBoard + 1 new wavepass reader) How to use ---------- -Flash the firmware on an arduino mega 2560, scratch the "reset-en" bridge on the pcb, change COM port to COM1 +Flash the firmware on an arduino mega 2560, scratch the "reset-en" bridge on the pcb, change COM port to COM1 (COM2 for Nostalgia) PN5180 support -------------- diff --git a/acrealio/IoBoard.cpp b/acrealio/IoBoard.cpp index d3b9184..8d7077a 100644 --- a/acrealio/IoBoard.cpp +++ b/acrealio/IoBoard.cpp @@ -4,7 +4,7 @@ byte lightPin[] = {LT_START, LT_A, LT_B, LT_C, LT_D, LT_FXL, LT_FXR}; //contructor -IoBoard::IoBoard(char* rCode) +IoBoard::IoBoard(const char* rCode) { byte rType[] = {0x09, 0x06, 0x00, 0x00}; byte rVersion[] = {0x01, 0x01, 0x00}; diff --git a/acrealio/IoBoard.h b/acrealio/IoBoard.h index 92a00c9..68a0f67 100644 --- a/acrealio/IoBoard.h +++ b/acrealio/IoBoard.h @@ -8,7 +8,7 @@ class IoBoard: public Node { public: - IoBoard(char* rCode); //contructor + IoBoard(const char* rCode); //contructor void init(); short processRequest(byte* request, byte* sendBuff); void update(); diff --git a/acrealio/acrealio.ino b/acrealio/acrealio.ino index f8e7308..077d5f3 100644 --- a/acrealio/acrealio.ino +++ b/acrealio/acrealio.ino @@ -58,7 +58,7 @@ Reader nod2;//second reader Reader nod1;//first reader LedBoard nod2("LEDB");//led board -#elif GAMETYPE == 4 // reader + ioboard +#elif GAMETYPE == 4 || GAMETYPE == 5 // reader + ioboard Reader nod1;//first reader IoBoard nod2("KFCA");//io board @@ -88,7 +88,7 @@ PN5180Reader mod1; //2P rfid module allocation -#if GAMETYPE == 2 || GAMETYPE == 5 +#if GAMETYPE == 2 || GAMETYPE == 6 #if RFID_MODULE2 == 1 SL015M mod2; #elif RFID_MODULE2 == 2 @@ -165,6 +165,15 @@ void setup() nbnodes = 2; +#elif GAMETYPE == 5 // Nostalgia: KFCA ioboard + ICCC reader + + //1p reader + nod1.setrCode("ICCC",0); + nodes[0] = &nod2; //KFCA first + nodes[1] = &nod1; + + nbnodes = 2; + #else // 2readers + DDR ??? board //1p reader @@ -429,7 +438,7 @@ void sendAnswer(byte* answer) // long detRate() { - long baudrates[] = {57600,38400,19200};//baudrates to try + long baudrates[] = {57600,38400,19200,115200};//baudrates to try int i=0; boolean allAA; diff --git a/acrealio/pinoutconfig.h b/acrealio/pinoutconfig.h index ba59546..1469a59 100644 --- a/acrealio/pinoutconfig.h +++ b/acrealio/pinoutconfig.h @@ -1,7 +1,7 @@ #ifndef CONFIG_H #define CONFIG_H -#define GAMETYPE 1 //0:pop'n with card dispenser 1: pop'n, drummania(1 reader) 2:iidx/ddr sd/gf(2readers) 3:jubeat (1reader+Ledboard) 4: sdvx (1reader+ioboard) 5: ddr hd (2readers + ??? board) +#define GAMETYPE 1 //0:pop'n with card dispenser 1: pop'n, drummania(1 reader) 2:iidx/ddr sd/gf(2readers) 3:jubeat (1reader+Ledboard) 4: sdvx (1reader+ioboard) 5: nostalgia (ioboard+1reader) 6: ddr hd (2readers + ??? board) #define RFID_BAUD 115200 //Baud rate for RFID Module @@ -18,9 +18,9 @@ #define BT_B A3 #define BT_C A4 #define BT_D A5 -#define BT_START 52 -#define BT_TEST 50 -#define BT_SVC 48 +#define BT_START A6 +#define BT_TEST A7 +#define BT_SVC A8 //input pins for volume encoders (phase A and phase B for each) #define VOLR_A 36 @@ -58,9 +58,9 @@ #define LED5_G 45 #define LED5_B 44 -#define LED6_R A8 -#define LED6_G A9 -#define LED6_B A10 +#define LED6_R A9 +#define LED6_G A10 +#define LED6_B A11 //pins for card reader 1 keypad (colls ABC, rows 1234) /* ### Keypad 3x4 Matrix ### diff --git a/acrealio/src/PN5180/PN5180.cpp b/acrealio/src/PN5180/PN5180.cpp index cda72ff..8212bd2 100644 --- a/acrealio/src/PN5180/PN5180.cpp +++ b/acrealio/src/PN5180/PN5180.cpp @@ -217,7 +217,7 @@ bool PN5180::writeEEprom(uint8_t addr, uint8_t *buffer, uint8_t len) { * not go beyond EEPROM address 254. If the condition is not fulfilled, an exception is * raised. */ -bool PN5180::readEEprom(uint8_t addr, uint8_t *buffer, int len) { +bool PN5180::readEEprom(uint8_t addr, uint8_t *buffer, uint8_t len) { if ((addr > 254) || ((addr+len) > 254)) { PN5180DEBUG(F("ERROR: Reading beyond addr 254!\n")); return false; diff --git a/acrealio/src/PN5180/PN5180.h b/acrealio/src/PN5180/PN5180.h index b2c7935..6b31afc 100644 --- a/acrealio/src/PN5180/PN5180.h +++ b/acrealio/src/PN5180/PN5180.h @@ -68,8 +68,8 @@ enum PN5180TransceiveStat { #define TX_RFOFF_IRQ_STAT (1<<8) // RF Field OFF in PCD IRQ #define TX_RFON_IRQ_STAT (1<<9) // RF Field ON in PCD IRQ #define RX_SOF_DET_IRQ_STAT (1<<14) // RF SOF Detection IRQ -#define GENERAL_ERROR_IRQ_STAT (1<<17) // General error IRQ -#define LPCD_IRQ_STAT (1<<19) // LPCD Detection IRQ +#define GENERAL_ERROR_IRQ_STAT ((uint32_t)1<<17) // General error IRQ +#define LPCD_IRQ_STAT ((uint32_t)1<<19) // LPCD Detection IRQ class PN5180 { private: @@ -103,7 +103,7 @@ class PN5180 { /* cmd 0x06 */ bool writeEEprom(uint8_t addr, uint8_t *buffer, uint8_t len); /* cmd 0x07 */ - bool readEEprom(uint8_t addr, uint8_t *buffer, int len); + bool readEEprom(uint8_t addr, uint8_t *buffer, uint8_t len); /* cmd 0x09 */ bool sendData(uint8_t *data, int len, uint8_t validBits = 0); From 04f36c3b10609e7ff51aa576d656efc72b574e05 Mon Sep 17 00:00:00 2001 From: CrazyRedMachine Date: Thu, 7 Jan 2021 17:59:14 +0100 Subject: [PATCH 2/2] Beatstream support --- README.md | 4 +++- acrealio/Reader.cpp | 14 ++++++++++++++ acrealio/acrealio.ino | 4 ++-- acrealio/pinoutconfig.h | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 99b5793..fc17539 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,14 @@ guitar freaks (2 old readers) Sound voltex (1 new wavepass reader + 1 IoBoard) +Beatstream (1 IoBoard + 1 new wavepass reader) + Nostalgia (1 IoBoard + 1 new wavepass reader) How to use ---------- -Flash the firmware on an arduino mega 2560, scratch the "reset-en" bridge on the pcb, change COM port to COM1 (COM2 for Nostalgia) +Flash the firmware on an arduino mega 2560, scratch the "reset-en" bridge on the pcb, change COM port to COM1 (COM2 for Beatstream/Nostalgia) PN5180 support -------------- diff --git a/acrealio/Reader.cpp b/acrealio/Reader.cpp index 51edbdf..45fc7fe 100644 --- a/acrealio/Reader.cpp +++ b/acrealio/Reader.cpp @@ -354,6 +354,20 @@ short Reader::processRequest(byte* request, byte* answer) answer[5] = 0x00;//no card answer[6] = 0x00; break; + case 3: + //hack: behaves like 0 (for Nostalgia) and 1 (for Beatstream) alternatively + static byte l_cmd61 = 0; + l_cmd61 = 1 - l_cmd61; + if (l_cmd61) + { + answer[4] = 1; + answer[5] = 0x01; + } + else + { + answer[4] = 0; + } + break; default: answer[4] = 0; } diff --git a/acrealio/acrealio.ino b/acrealio/acrealio.ino index 077d5f3..a2a2854 100644 --- a/acrealio/acrealio.ino +++ b/acrealio/acrealio.ino @@ -165,10 +165,10 @@ void setup() nbnodes = 2; -#elif GAMETYPE == 5 // Nostalgia: KFCA ioboard + ICCC reader +#elif GAMETYPE == 5 // Beatstream/Nostalgia: KFCA ioboard + ICCC reader //1p reader - nod1.setrCode("ICCC",0); + nod1.setrCode("ICCC",3); nodes[0] = &nod2; //KFCA first nodes[1] = &nod1; diff --git a/acrealio/pinoutconfig.h b/acrealio/pinoutconfig.h index 1469a59..d497fc2 100644 --- a/acrealio/pinoutconfig.h +++ b/acrealio/pinoutconfig.h @@ -1,7 +1,7 @@ #ifndef CONFIG_H #define CONFIG_H -#define GAMETYPE 1 //0:pop'n with card dispenser 1: pop'n, drummania(1 reader) 2:iidx/ddr sd/gf(2readers) 3:jubeat (1reader+Ledboard) 4: sdvx (1reader+ioboard) 5: nostalgia (ioboard+1reader) 6: ddr hd (2readers + ??? board) +#define GAMETYPE 1 //0:pop'n with card dispenser 1: pop'n, drummania(1 reader) 2:iidx/ddr sd/gf(2readers) 3:jubeat (1reader+Ledboard) 4: sdvx (1reader+ioboard) 5: beatstream/nostalgia (ioboard+1reader) 6: ddr hd (2readers + ??? board) #define RFID_BAUD 115200 //Baud rate for RFID Module