diff --git a/Universal_Serial_Adapter/Project.h b/Universal_Serial_Adapter/Project.h index 5e84654..11208f7 100644 --- a/Universal_Serial_Adapter/Project.h +++ b/Universal_Serial_Adapter/Project.h @@ -22,11 +22,6 @@ // Don't change anything below here // ----------------------------------------------------------------------------- -// Standard colors -#define BACKGROUND BLACK -#define TEXT GRAY -#define HILIGHT GOLD - // Serial modes supported // Abused in for loops / lookup tables -- DO NOT CHANGE none or set values enum serialmode { diff --git a/Universal_Serial_Adapter/UI.cpp b/Universal_Serial_Adapter/UI.cpp index 9e4d7f2..e84cece 100644 --- a/Universal_Serial_Adapter/UI.cpp +++ b/Universal_Serial_Adapter/UI.cpp @@ -7,4 +7,4 @@ use this code however you'd like, just keep this license and attribute. */ - + \ No newline at end of file diff --git a/Universal_Serial_Adapter/UI.h b/Universal_Serial_Adapter/UI.h index 9e4d7f2..22145e8 100644 --- a/Universal_Serial_Adapter/UI.h +++ b/Universal_Serial_Adapter/UI.h @@ -8,3 +8,17 @@ attribute. */ +UI State machine (current element = config / stats / inline display of data) +Configuration state machine (speed, pinout, logic level, sd card on/off, boot logo on/off) +Message to config (element + new value) +Message to UI (element + success/fail) + +// Button's controlling UI +UIButton* okButton = new UIButton(22, 23); +UIButton* cancelButton = new UIButton(24, 25); + + // Select / Enter + if (okButton->isPressed()) { + //FIXME: Re-enable once new LCD is online + //setMode(selectedMode); + } \ No newline at end of file diff --git a/Universal_Serial_Adapter/UIJoystickPSP.h b/Universal_Serial_Adapter/UIJoystickPSP.h index 9e4d7f2..63f043c 100644 --- a/Universal_Serial_Adapter/UIJoystickPSP.h +++ b/Universal_Serial_Adapter/UIJoystickPSP.h @@ -8,3 +8,44 @@ attribute. */ +// PSP joystick tracking +long pspUpCount = 0; // Used to slow down how fast we repeat up movement +long pspDownCount = 0; // Used to slow down how fast we repeat down movement +int pspXAxisValue; +int pspYAxisValue; + +// Read the x/y values from the joystick + pspXAxisValue=map(analogRead(pspXPin), 0, 1023, 0, 10); + pspYAxisValue=map(analogRead(pspYPin), 0, 1023, 0, 10); + + // Move cursor Up + if (pspYAxisValue > 6 ) { + pspUpCount++; + if (pspUpCount > 768) { + pspUpCount = 0; + serialmode newMode = (serialmode)(selectedMode - 1); + if (newMode >= 0) { + //FIXME: Re-enable once new LCD is online + //setSelection(newMode); + } + } + } + else { + pspUpCount = 0; + } + + // Move cursor Down + if (pspYAxisValue < 4 ) { + pspDownCount++; + if (pspDownCount > 768) { + serialmode newMode = (serialmode)(selectedMode + 1); + if (newMode <= modelinespeed) { + //FIXME: Re-enable once new LCD is online + //setSelection(newMode); + } + pspDownCount = 0; + } + } + else { + pspDownCount = 0; + } \ No newline at end of file diff --git a/Universal_Serial_Adapter/UILCD.h b/Universal_Serial_Adapter/UILCD.h index 9e4d7f2..5ecd84e 100644 --- a/Universal_Serial_Adapter/UILCD.h +++ b/Universal_Serial_Adapter/UILCD.h @@ -8,3 +8,7 @@ attribute. */ +// Standard colors +#define BACKGROUND BLACK +#define TEXT GRAY +#define HILIGHT GOLD diff --git a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino index 3782cd2..1205947 100644 --- a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino +++ b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino @@ -9,17 +9,6 @@ */ #include "Project.h" -#include "UIButton.h" - -// Button's controlling UI -UIButton* okButton = new UIButton(22, 23); -UIButton* cancelButton = new UIButton(24, 25); - -// PSP joystick tracking -long pspUpCount = 0; // Used to slow down how fast we repeat up movement -long pspDownCount = 0; // Used to slow down how fast we repeat down movement -int pspXAxisValue; -int pspYAxisValue; // Mode info needed serialmode currentMode = none; @@ -44,49 +33,5 @@ void setup() { } void loop() { - // Read the x/y values from the joystick - pspXAxisValue=map(analogRead(pspXPin), 0, 1023, 0, 10); - pspYAxisValue=map(analogRead(pspYPin), 0, 1023, 0, 10); - - // Move cursor Up - if (pspYAxisValue > 6 ) { - pspUpCount++; - if (pspUpCount > 768) { - pspUpCount = 0; - serialmode newMode = (serialmode)(selectedMode - 1); - if (newMode >= 0) { - //FIXME: Re-enable once new LCD is online - //setSelection(newMode); - } - } - } - else { - pspUpCount = 0; - } - - // Move cursor Down - if (pspYAxisValue < 4 ) { - pspDownCount++; - if (pspDownCount > 768) { - serialmode newMode = (serialmode)(selectedMode + 1); - if (newMode <= modelinespeed) { - //FIXME: Re-enable once new LCD is online - //setSelection(newMode); - } - pspDownCount = 0; - } - } - else { - pspDownCount = 0; - } - - - // Select / Enter - if (okButton->isPressed()) { - //FIXME: Re-enable once new LCD is online - //setMode(selectedMode); - } + } - - -