diff --git a/N64Controller/N64Controller.cpp b/N64Controller/N64Controller.cpp index 62ee1ee..fba58fe 100644 --- a/N64Controller/N64Controller.cpp +++ b/N64Controller/N64Controller.cpp @@ -23,16 +23,12 @@ #define N64_PINB_LOW DDRB |= pincode #define N64_PINB_QUERY (PINB & pincode) -N64Controller::N64Controller() { +N64Controller::N64Controller(unsigned char serialPin) { + if(serialPin > 13) + serialPin = 2; + n64_PIN = serialPin; } -N64Controller::N64Controller(int serialPin) { - n64_PIN = serialPin; -} -void N64Controller::begin(int serialPin) { - n64_PIN = serialPin; - begin(); -} void N64Controller::begin() { // Communication with N64 controller controller on this pin // Don't remove these lines, we don't want to push +5V to the controller diff --git a/N64Controller/N64Controller.h b/N64Controller/N64Controller.h index 4601e27..db089c8 100644 --- a/N64Controller/N64Controller.h +++ b/N64Controller/N64Controller.h @@ -41,9 +41,7 @@ class N64Controller { public: - N64Controller(); - N64Controller(int serialPin); // first thing to call - void begin(int serialPin); + N64Controller(unsigned char serialPin); // first thing to call void begin(); // second thing to call void update(); // then update always and get button info // consider to have a delay instead of @@ -68,7 +66,7 @@ class N64Controller { void print_N64_status(); private: void set_up(); - int n64_PIN; // might also be set by constructor or begin() + char n64_PIN; // might also be set by constructor or begin() char n64_pincode; bool n64_first_register; // PIN0-7: DDRD PIN8-13: DDRB