From b3b3c34756d4efbafd283aff4aa0698030f718dc Mon Sep 17 00:00:00 2001 From: Mike C Date: Sun, 10 Mar 2013 16:59:21 -0400 Subject: [PATCH] Code cleanup / organization --- Universal_Serial_Adapter/Project.h | 61 ------------------- .../Universal_Serial_Adapter.ino | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Universal_Serial_Adapter/Project.h b/Universal_Serial_Adapter/Project.h index 9ef4762..5212e80 100644 --- a/Universal_Serial_Adapter/Project.h +++ b/Universal_Serial_Adapter/Project.h @@ -100,13 +100,6 @@ void setMode(serialmode aMode); void setSelection(serialmode aMode); void setLineSpeed(linespeed aLineSpeed); -// Defaults -void setDefaults() { - setMode(phone); - setSelection(phone); - setLineSpeed(oneNineteenTwoK); -} - // Figure out offsets for text printing int xLoc(float toSkip) { // Physically -- vertical return (CHAR_HEIGHT * toSkip) + (CHAR_HEIGHT / 2); @@ -115,59 +108,5 @@ int yLoc (float toSkip) { // Physical -- horizontal return (CHAR_WIDTH * toSkip) + (CHAR_WIDTH / 2); } -void printTitles() { - lcd.setStr(" RX Ln Spd Tx ", xLoc(5), 0, TEXT, BACKGROUND); -} - -void printRx(bool show) { - int vertXPosStart = xLoc(6.25); - int vertYPosStart = yLoc(1.5); - int vertXPosEnd = xLoc(7.25); - int vertYPosEnd = yLoc(1.5); - - int lftXPosStart = vertXPosEnd; - int lftYPosStart = vertYPosStart; - int lftXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); - int lftYPosEnd = vertYPosStart - CHAR_WIDTH; - - int rtXPosStart = vertXPosEnd; - int rtYPosStart = vertYPosStart; - int rtXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); - int rtYPosEnd = vertYPosStart + CHAR_WIDTH; - - int color = show ? EMERALD : BACKGROUND; - - lcd.setLine(vertXPosStart, vertYPosStart, vertXPosEnd, vertYPosEnd, color); - lcd.setLine(lftXPosStart, lftYPosStart, lftXPosEnd, lftYPosEnd, color); - lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color); -} - -void printTx(bool show) { - int vertXPosStart = xLoc(6.25); - int vertYPosStart = yLoc(13.5); - int vertXPosEnd = xLoc(7.25); - int vertYPosEnd = yLoc(13.5); - - int lftXPosStart = vertXPosStart; - int lftYPosStart = vertYPosStart; - int lftXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); - int lftYPosEnd = vertYPosStart - CHAR_WIDTH; - - int rtXPosStart = vertXPosStart; - int rtYPosStart = vertYPosStart; - int rtXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); - int rtYPosEnd = vertYPosStart + CHAR_WIDTH; - - int color = show ? SKYBLUE : BACKGROUND; - - lcd.setLine(vertXPosStart, vertYPosStart, vertXPosEnd, vertYPosEnd, color); - lcd.setLine(lftXPosStart, lftYPosStart, lftXPosEnd, lftYPosEnd, color); - lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color); -} - -void printMode(serialmode aMode) { - lcd.setStr(modeToText[aMode], xLoc(aMode), yLoc(1), TEXT, BACKGROUND); -} - diff --git a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino index d1a2f9d..595e6d5 100644 --- a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino +++ b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino @@ -82,6 +82,13 @@ void loop() { } } +// Defaults +void setDefaults() { + setMode(phone); + setSelection(phone); + setLineSpeed(oneNineteenTwoK); +} + void setLineSpeed(linespeed aLineSpeed) { currentLineSpeed = aLineSpeed; bool sel = selectedMode == modelinespeed ? true : false; @@ -110,6 +117,14 @@ void setSelection(serialmode aMode) { lcd.setLine(xPrevious, yLocOne, xPrevious, yLocOne + previousLength, BACKGROUND); } +void printTitles() { + lcd.setStr(" RX Ln Spd Tx ", xLoc(5), 0, TEXT, BACKGROUND); +} + +void printMode(serialmode aMode) { + lcd.setStr(modeToText[aMode], xLoc(aMode), yLoc(1), TEXT, BACKGROUND); +} + void printLineSpeed(linespeed aLineSpeed, bool selected) { int xPosText = xLoc(6); int yPosText = yLoc(5); @@ -128,3 +143,49 @@ void printLineSpeed(linespeed aLineSpeed, bool selected) { lcd.setLine(xPosLine, yPosLine, xPosLine, yPosLine + length * CHAR_WIDTH, HILIGHT); } } + +void printRx(bool show) { + int vertXPosStart = xLoc(6.25); + int vertYPosStart = yLoc(1.5); + int vertXPosEnd = xLoc(7.25); + int vertYPosEnd = yLoc(1.5); + + int lftXPosStart = vertXPosEnd; + int lftYPosStart = vertYPosStart; + int lftXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); + int lftYPosEnd = vertYPosStart - CHAR_WIDTH; + + int rtXPosStart = vertXPosEnd; + int rtYPosStart = vertYPosStart; + int rtXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); + int rtYPosEnd = vertYPosStart + CHAR_WIDTH; + + int color = show ? EMERALD : BACKGROUND; + + lcd.setLine(vertXPosStart, vertYPosStart, vertXPosEnd, vertYPosEnd, color); + lcd.setLine(lftXPosStart, lftYPosStart, lftXPosEnd, lftYPosEnd, color); + lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color); +} + +void printTx(bool show) { + int vertXPosStart = xLoc(6.25); + int vertYPosStart = yLoc(13.5); + int vertXPosEnd = xLoc(7.25); + int vertYPosEnd = yLoc(13.5); + + int lftXPosStart = vertXPosStart; + int lftYPosStart = vertYPosStart; + int lftXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); + int lftYPosEnd = vertYPosStart - CHAR_WIDTH; + + int rtXPosStart = vertXPosStart; + int rtYPosStart = vertYPosStart; + int rtXPosEnd = vertXPosStart + (CHAR_HEIGHT / 2); + int rtYPosEnd = vertYPosStart + CHAR_WIDTH; + + int color = show ? SKYBLUE : BACKGROUND; + + lcd.setLine(vertXPosStart, vertYPosStart, vertXPosEnd, vertYPosEnd, color); + lcd.setLine(lftXPosStart, lftYPosStart, lftXPosEnd, lftYPosEnd, color); + lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color); +}