A twist to the computer that landed man on the moon. More information can be found at http://hackaday.io/project/294-Open-Source-DSKY

Dependencies:   DS1302 keypad mbed

Hardware

Committer:
VivaPenguinos
Date:
Mon Jul 21 23:28:22 2014 +0000
Revision:
4:99535d368a9f
Parent:
3:29cff763ae36
Child:
5:5f08974ef8bb
Contains GET, Configure GET, and Test Light;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
VivaPenguinos 0:3ff58b093415 1 /* Introduction
VivaPenguinos 2:aee9ee1296cd 2 MBED DSKY
VivaPenguinos 0:3ff58b093415 3 This is a personal project used developed by penguinos to mix old school technology with a modern twist.
VivaPenguinos 4:99535d368a9f 4 Version 0.04: July. 5 2014
VivaPenguinos 4:99535d368a9f 5 - DS1302 Added
VivaPenguinos 4:99535d368a9f 6 - Shift Register Variable has been added
VivaPenguinos 4:99535d368a9f 7 - void Button_Sort(int sort); is now int Button_Sort(int sort);
VivaPenguinos 4:99535d368a9f 8 Button sort has 90% of all the variables in there.
VivaPenguinos 4:99535d368a9f 9 - Void shifting out no longer takes 8 bits but rather 4 bits. (Makes things easier to compute)
VivaPenguinos 4:99535d368a9f 10 - Added Concatenation Functionality
VivaPenguinos 4:99535d368a9f 11 - Added NO_Lights Functionality
VivaPenguinos 4:99535d368a9f 12 - Added R_GET Functionality
VivaPenguinos 4:99535d368a9f 13 - Test Light Program working
VivaPenguinos 4:99535d368a9f 14 - GET Program Working
VivaPenguinos 4:99535d368a9f 15 - GET Configuration Working
VivaPenguinos 4:99535d368a9f 16
VivaPenguinos 4:99535d368a9f 17
VivaPenguinos 0:3ff58b093415 18 Notable Credits:
VivaPenguinos 0:3ff58b093415 19 NASA! - Release of technical documentations regarding the AGC and DSKY
VivaPenguinos 0:3ff58b093415 20 Ron Burkley and Contributers of "Virtual AGC — AGS — LVDC — Gemini" - Providing Technical documentations, Source Code, explanations,
VivaPenguinos 0:3ff58b093415 21 and refrences on other sites to make this project successful
VivaPenguinos 0:3ff58b093415 22
VivaPenguinos 4:99535d368a9f 23 Warning: This may contain author's crude language, and random thoughts.
VivaPenguinos 4:99535d368a9f 24
VivaPenguinos 4:99535d368a9f 25 Pin Usage:
VivaPenguinos 4:99535d368a9f 26
VivaPenguinos 3:29cff763ae36 27 Real Time Clock
VivaPenguinos 3:29cff763ae36 28 SCLK PTC5
VivaPenguinos 3:29cff763ae36 29 IO PTC4
VivaPenguinos 3:29cff763ae36 30 CE PTC3
VivaPenguinos 3:29cff763ae36 31 Keypad
VivaPenguinos 3:29cff763ae36 32 Row0 PTD4
VivaPenguinos 3:29cff763ae36 33 Row1 PTA12
VivaPenguinos 3:29cff763ae36 34 Row2 PTD3
VivaPenguinos 3:29cff763ae36 35 Row3 PTA5
VivaPenguinos 3:29cff763ae36 36 Col1 PTA13
VivaPenguinos 3:29cff763ae36 37 Col2 PTD5
VivaPenguinos 3:29cff763ae36 38 Col3 PTD0
VivaPenguinos 3:29cff763ae36 39 Col4 PTD2
VivaPenguinos 3:29cff763ae36 40 Shift Registers
VivaPenguinos 3:29cff763ae36 41 Latch PTC6
VivaPenguinos 3:29cff763ae36 42 Clock PTC10
VivaPenguinos 3:29cff763ae36 43 Data PTC11
VivaPenguinos 4:99535d368a9f 44
VivaPenguinos 4:99535d368a9f 45 Shift Registers Data:
VivaPenguinos 4:99535d368a9f 46 Because the project contains 11 shift registers, All data must be properly formatted before shifting out. each shift register controls 2 7 segments.
VivaPenguinos 4:99535d368a9f 47 R1_A [P_A | P_B]
VivaPenguinos 4:99535d368a9f 48 R1_B
VivaPenguinos 4:99535d368a9f 49 R1_C [V_A | V_B] [N_A | N_B]
VivaPenguinos 4:99535d368a9f 50 R1_D
VivaPenguinos 4:99535d368a9f 51 R1_E [R3_E | R3_D | R3_C | R3_B | R3_A]
VivaPenguinos 4:99535d368a9f 52 R2_A
VivaPenguinos 4:99535d368a9f 53 R2_B [R2_E | R2_D | R2_C | R2_B | R2_A]
VivaPenguinos 4:99535d368a9f 54 R2_C
VivaPenguinos 4:99535d368a9f 55 R2_D [R1_E | R1_D | R1_C | R1_B | R1_A]
VivaPenguinos 4:99535d368a9f 56 R2_E
VivaPenguinos 4:99535d368a9f 57 R3_A
VivaPenguinos 4:99535d368a9f 58 R3_B
VivaPenguinos 4:99535d368a9f 59 R3_C
VivaPenguinos 4:99535d368a9f 60 R3_D
VivaPenguinos 4:99535d368a9f 61 R3_E
VivaPenguinos 4:99535d368a9f 62 V_A
VivaPenguinos 4:99535d368a9f 63 V_B
VivaPenguinos 4:99535d368a9f 64 N_A
VivaPenguinos 4:99535d368a9f 65 N_B
VivaPenguinos 4:99535d368a9f 66 P_A
VivaPenguinos 4:99535d368a9f 67 P_B
VivaPenguinos 3:29cff763ae36 68 */
VivaPenguinos 3:29cff763ae36 69
VivaPenguinos 3:29cff763ae36 70 // For RTC
VivaPenguinos 3:29cff763ae36 71 #define SCLK PTC5
VivaPenguinos 3:29cff763ae36 72 #define IO PTC4
VivaPenguinos 3:29cff763ae36 73 #define CE PTC3
VivaPenguinos 3:29cff763ae36 74
VivaPenguinos 3:29cff763ae36 75 // Comment Line if DS1302 is already running
VivaPenguinos 3:29cff763ae36 76 #define INITIAL_RUN
VivaPenguinos 3:29cff763ae36 77
VivaPenguinos 0:3ff58b093415 78 using namespace std;
VivaPenguinos 0:3ff58b093415 79 #include "mbed.h"
VivaPenguinos 1:24446776f0d2 80 #include "Keypad.h" // Keypad
VivaPenguinos 3:29cff763ae36 81 #include "DS1302.h" // RTC for DS1032
VivaPenguinos 4:99535d368a9f 82
VivaPenguinos 3:29cff763ae36 83 DS1302 clk(SCLK, IO, CE); //DS1302 clk(SCLK, IO, PTC3);
VivaPenguinos 0:3ff58b093415 84
VivaPenguinos 0:3ff58b093415 85 //Declare Variables
VivaPenguinos 4:99535d368a9f 86 // int shift = 0; // Shift Data
VivaPenguinos 0:3ff58b093415 87 // In the Arduino Version it uses a String. Will use an Int instead to see if this works on Mbed
VivaPenguinos 1:24446776f0d2 88 int Verb_Number1 = 0;
VivaPenguinos 1:24446776f0d2 89 int Verb_Number2 = 0;
VivaPenguinos 1:24446776f0d2 90 int Noun_Number1 = 0;
VivaPenguinos 1:24446776f0d2 91 int Noun_Number2 = 0;
VivaPenguinos 1:24446776f0d2 92 int Enter_Number1 = 0;
VivaPenguinos 1:24446776f0d2 93 int Enter_Number2 = 0;
VivaPenguinos 1:24446776f0d2 94 int Verb; // DSKY Verb
VivaPenguinos 1:24446776f0d2 95 int Noun; // DSkY Noun
VivaPenguinos 1:24446776f0d2 96 int Enter; // DSKY Enter
VivaPenguinos 4:99535d368a9f 97
VivaPenguinos 4:99535d368a9f 98 // For shift register use. Refer to shift register data for additional information.
VivaPenguinos 4:99535d368a9f 99 int R1_A = 0x0f;
VivaPenguinos 4:99535d368a9f 100 int R1_B = 0x0f;
VivaPenguinos 4:99535d368a9f 101 int R1_C = 0x0f;
VivaPenguinos 4:99535d368a9f 102 int R1_D = 0x0f;
VivaPenguinos 4:99535d368a9f 103 int R1_E = 0x0f;
VivaPenguinos 4:99535d368a9f 104 int R2_A = 0x0f;
VivaPenguinos 4:99535d368a9f 105 int R2_B = 0x0f;
VivaPenguinos 4:99535d368a9f 106 int R2_C = 0x0f;
VivaPenguinos 4:99535d368a9f 107 int R2_D = 0x0f;
VivaPenguinos 4:99535d368a9f 108 int R2_E = 0x0f;
VivaPenguinos 4:99535d368a9f 109 int R3_A = 0x0f;
VivaPenguinos 4:99535d368a9f 110 int R3_B = 0x0f;
VivaPenguinos 4:99535d368a9f 111 int R3_C = 0x0f;
VivaPenguinos 4:99535d368a9f 112 int R3_D = 0x0f;
VivaPenguinos 4:99535d368a9f 113 int R3_E = 0x0f;
VivaPenguinos 4:99535d368a9f 114 int V_A = 0x0f;
VivaPenguinos 4:99535d368a9f 115 int V_B = 0x0f;
VivaPenguinos 4:99535d368a9f 116 int N_A = 0x0f;
VivaPenguinos 4:99535d368a9f 117 int N_B = 0x0f;
VivaPenguinos 4:99535d368a9f 118 int P_A = 0x0f;
VivaPenguinos 4:99535d368a9f 119 int P_B = 0x0f;
VivaPenguinos 4:99535d368a9f 120
VivaPenguinos 4:99535d368a9f 121 // For GET use. Refer to R3_GET, R2_GET, and R1_GET
VivaPenguinos 4:99535d368a9f 122 int RA = 0;
VivaPenguinos 4:99535d368a9f 123 int RB = 0;
VivaPenguinos 4:99535d368a9f 124 int RC = 0;
VivaPenguinos 4:99535d368a9f 125 int RD = 0;
VivaPenguinos 4:99535d368a9f 126 int RE = 0;
VivaPenguinos 4:99535d368a9f 127 int RVA = 0x0f;
VivaPenguinos 4:99535d368a9f 128 int RVB = 0x0f;
VivaPenguinos 4:99535d368a9f 129 int RVC = 0x0f;
VivaPenguinos 4:99535d368a9f 130 int RVD = 0x0f;
VivaPenguinos 4:99535d368a9f 131 int RVE = 0x0f;
VivaPenguinos 4:99535d368a9f 132 int R_Position = 1;
VivaPenguinos 4:99535d368a9f 133 int R1_Position = 1;
VivaPenguinos 4:99535d368a9f 134 int R2_Position = 1;
VivaPenguinos 4:99535d368a9f 135 int R3_Position = 1;
VivaPenguinos 4:99535d368a9f 136 int GET_Config_Time = 0;
VivaPenguinos 4:99535d368a9f 137
VivaPenguinos 3:29cff763ae36 138 // Keypad
VivaPenguinos 1:24446776f0d2 139 char Keytable[] = { '1', '2', '3', '+', // R0
VivaPenguinos 1:24446776f0d2 140 '4', '5', '6', '-', // R1
VivaPenguinos 1:24446776f0d2 141 '7', '8', '9', 'E', // R2
VivaPenguinos 1:24446776f0d2 142 'V', '0', 'N', 'R', // R3
VivaPenguinos 1:24446776f0d2 143 };
VivaPenguinos 4:99535d368a9f 144 // C0 C1 C2 C3
VivaPenguinos 1:24446776f0d2 145
VivaPenguinos 3:29cff763ae36 146 // RTC Variables
VivaPenguinos 3:29cff763ae36 147 int TIME_VALUE = 1397702161;
VivaPenguinos 4:99535d368a9f 148 int Time_Difference = 0%60;
VivaPenguinos 3:29cff763ae36 149
VivaPenguinos 3:29cff763ae36 150 // Button State
VivaPenguinos 1:24446776f0d2 151 int32_t Index = -1; // Button
VivaPenguinos 1:24446776f0d2 152 int State;
VivaPenguinos 0:3ff58b093415 153
VivaPenguinos 0:3ff58b093415 154 // Function Declaration
VivaPenguinos 1:24446776f0d2 155 void Verb_Button();
VivaPenguinos 1:24446776f0d2 156 void Noun_Button();
VivaPenguinos 1:24446776f0d2 157 void Enter_Button();
VivaPenguinos 1:24446776f0d2 158 void compare();
VivaPenguinos 4:99535d368a9f 159 int Button_Sort(int sort); // Function that sorts Verb Values
VivaPenguinos 0:3ff58b093415 160 void blinkAll(int amount, int delay);// Function that Blinks all LED
VivaPenguinos 4:99535d368a9f 161 void Shift(); // Function that shifts all data
VivaPenguinos 4:99535d368a9f 162 void R_GET(int R); // Grab inputs for the Rows
VivaPenguinos 4:99535d368a9f 163 int R_Concatenate(int C); // Used for concatenating information
VivaPenguinos 4:99535d368a9f 164 void NO_Light(int L); // Configures shift registers to 0
VivaPenguinos 0:3ff58b093415 165 //void ShiftingOut(char myDataOut);
VivaPenguinos 0:3ff58b093415 166
VivaPenguinos 3:29cff763ae36 167 // Program Names
VivaPenguinos 4:99535d368a9f 168 void Ground_Elapse_Time(); // Ground Elapse Time
VivaPenguinos 4:99535d368a9f 169 void Test_Lights(); // Test Lights
VivaPenguinos 4:99535d368a9f 170 void GET_Config(); // Configures Ground Elapse Time
VivaPenguinos 1:24446776f0d2 171
VivaPenguinos 0:3ff58b093415 172 // Pin modes for each pins
VivaPenguinos 3:29cff763ae36 173 DigitalOut LatchPin(PTC6); //Pin for ST_CP of 74HC595 Pin # 12
VivaPenguinos 3:29cff763ae36 174 DigitalOut ClockPin(PTC10); //Pin for SH_CP of 74HC595 Pin # 11
VivaPenguinos 3:29cff763ae36 175 DigitalOut DataPin(PTC11); //Pin for to DS of 74HC595 Pin # 14
VivaPenguinos 0:3ff58b093415 176
VivaPenguinos 0:3ff58b093415 177 DigitalOut myled(LED1);
VivaPenguinos 0:3ff58b093415 178 Serial pc(USBTX, USBRX); // tx, rx Serial Output to PC Enabling this WILL consume resources. Use only for debug
VivaPenguinos 1:24446776f0d2 179
VivaPenguinos 4:99535d368a9f 180 unsigned concatenate(unsigned x, unsigned y);
VivaPenguinos 4:99535d368a9f 181
VivaPenguinos 1:24446776f0d2 182 uint32_t cbAfterInput(uint32_t index)
VivaPenguinos 1:24446776f0d2 183 {
VivaPenguinos 1:24446776f0d2 184 Index = index;
VivaPenguinos 1:24446776f0d2 185 return 0;
VivaPenguinos 1:24446776f0d2 186 }
VivaPenguinos 1:24446776f0d2 187
VivaPenguinos 0:3ff58b093415 188 int main()
VivaPenguinos 0:3ff58b093415 189 {
VivaPenguinos 4:99535d368a9f 190 pc.printf("Initialization...\n");
VivaPenguinos 0:3ff58b093415 191 wait(1);
VivaPenguinos 4:99535d368a9f 192 pc.printf("Testing shift registers.\n");
VivaPenguinos 0:3ff58b093415 193 blinkAll(4,1);
VivaPenguinos 4:99535d368a9f 194 pc.printf("Shift Register: PASS \n");
VivaPenguinos 0:3ff58b093415 195 wait(1);
VivaPenguinos 4:99535d368a9f 196 pc.printf("Energizing keypad\n");
VivaPenguinos 1:24446776f0d2 197 State = 1;
VivaPenguinos 1:24446776f0d2 198 // r0 r1 r2 r3 c0 c1 c2 c3
VivaPenguinos 1:24446776f0d2 199 Keypad keypad(PTD4, PTA12, PTD3, PTA5, PTA13, PTD5, PTD0, PTD2, 20);
VivaPenguinos 1:24446776f0d2 200 keypad.attach(&cbAfterInput);
VivaPenguinos 1:24446776f0d2 201 keypad.start(); // energize the columns c0-c3 of the keypad
VivaPenguinos 4:99535d368a9f 202 pc.printf("Keypad: PASS \n");
VivaPenguinos 4:99535d368a9f 203 pc.printf("Initialize RTC Clock. \n");
VivaPenguinos 4:99535d368a9f 204 #ifdef INITIAL_RUN
VivaPenguinos 4:99535d368a9f 205 clk.set_time(TIME_VALUE);
VivaPenguinos 4:99535d368a9f 206 #endif
VivaPenguinos 4:99535d368a9f 207 //char storedByte = clk.recallByte(0);
VivaPenguinos 4:99535d368a9f 208 //clk.storeByte(0, storedByte + 1);
VivaPenguinos 4:99535d368a9f 209 pc.printf("RTC: PASS \n");
VivaPenguinos 4:99535d368a9f 210 pc.printf("Welcome to DSKY!\n");
VivaPenguinos 1:24446776f0d2 211 while (1) {
VivaPenguinos 1:24446776f0d2 212 __wfi();
VivaPenguinos 1:24446776f0d2 213 if (Index >-1) {
VivaPenguinos 1:24446776f0d2 214 pc.printf("Interrupted");
VivaPenguinos 1:24446776f0d2 215 pc.printf("Index:%d => Key:%c\r\n", Index, Keytable[Index]);
VivaPenguinos 1:24446776f0d2 216 if (Index == 12) { // Index 12 = Verb Button
VivaPenguinos 4:99535d368a9f 217 Verb_Button(); // Goes to Verb_Button
VivaPenguinos 1:24446776f0d2 218 }
VivaPenguinos 1:24446776f0d2 219 if (Index == 14) { // Index 14 = Noun Button
VivaPenguinos 1:24446776f0d2 220 Noun_Button(); // Goes to Noun_Button
VivaPenguinos 1:24446776f0d2 221 }
VivaPenguinos 1:24446776f0d2 222 if (Index == 11) { // Index 11 = Enter Button
VivaPenguinos 4:99535d368a9f 223 Enter_Button(); // Goes to Enter_Button
VivaPenguinos 1:24446776f0d2 224 }
VivaPenguinos 1:24446776f0d2 225 Index = -1;
VivaPenguinos 1:24446776f0d2 226 }
VivaPenguinos 1:24446776f0d2 227 // Debug use only
VivaPenguinos 1:24446776f0d2 228 //pc.printf("%c", Keytable[Verb_Number1]);
VivaPenguinos 1:24446776f0d2 229 //pc.printf("%c", Keytable[Verb_Number2]);
VivaPenguinos 1:24446776f0d2 230 //pc.printf("%c", Keytable[Noun_Number1]);
VivaPenguinos 1:24446776f0d2 231 //pc.printf("%c", Keytable[Noun_Number2]);
VivaPenguinos 0:3ff58b093415 232 }
VivaPenguinos 1:24446776f0d2 233 }
VivaPenguinos 1:24446776f0d2 234
VivaPenguinos 1:24446776f0d2 235 /* This function is used when the Verb Button has been pressed. Take the inputs of the button twice and determine if the buttons are integers.
VivaPenguinos 1:24446776f0d2 236 If other buttons are pressed send it to their perspective locations.
VivaPenguinos 1:24446776f0d2 237 */
VivaPenguinos 1:24446776f0d2 238 void Verb_Button(){
VivaPenguinos 1:24446776f0d2 239 Verbz: // Don't Ask
VivaPenguinos 1:24446776f0d2 240 // All Variables for Verb, Noun and Enter are zeroed out
VivaPenguinos 4:99535d368a9f 241 Verb_Number1 = 0;
VivaPenguinos 4:99535d368a9f 242 Verb_Number2 = 0;
VivaPenguinos 4:99535d368a9f 243 Noun_Number1 = 0;
VivaPenguinos 4:99535d368a9f 244 Noun_Number2 = 0;
VivaPenguinos 4:99535d368a9f 245 Enter_Number1 = 0;
VivaPenguinos 4:99535d368a9f 246 Enter_Number2 = 0;
VivaPenguinos 1:24446776f0d2 247 pc.printf("Please enter a Verb Number");
VivaPenguinos 1:24446776f0d2 248 __wfi();
VivaPenguinos 1:24446776f0d2 249 Verb_Number1 = Index;
VivaPenguinos 1:24446776f0d2 250 if (Verb_Number1 == 12){ // This is section is used on atleast one of the two Verb_Number variabels to prevent a Nestled If within if within if.
VivaPenguinos 1:24446776f0d2 251 goto Verbz; // Line 110
VivaPenguinos 4:99535d368a9f 252 } else {
VivaPenguinos 4:99535d368a9f 253 V_A = Button_Sort(Verb_Number1);
VivaPenguinos 4:99535d368a9f 254 Shift();
VivaPenguinos 1:24446776f0d2 255 }
VivaPenguinos 1:24446776f0d2 256 //pc.printf("%c", Verb_Number1);
VivaPenguinos 1:24446776f0d2 257 //pc.printf("%c", Keytable[Index]);
VivaPenguinos 1:24446776f0d2 258 __wfi();
VivaPenguinos 1:24446776f0d2 259 Verb_Number2 = Index;
VivaPenguinos 4:99535d368a9f 260 V_B = Button_Sort(Verb_Number2);
VivaPenguinos 4:99535d368a9f 261 Shift();
VivaPenguinos 1:24446776f0d2 262 //pc.printf("%c", Verb_Number2);
VivaPenguinos 1:24446776f0d2 263 //pc.printf("%c", Verb_Number1);
VivaPenguinos 1:24446776f0d2 264 //pc.printf("%c\n", Verb_Number2);
VivaPenguinos 0:3ff58b093415 265 }
VivaPenguinos 1:24446776f0d2 266
VivaPenguinos 1:24446776f0d2 267 /* This Function is used when the Verb Button has been Pressed. Take the inputs of the button twice and determine if the buttons are integers.
VivaPenguinos 1:24446776f0d2 268 If other buttons are pressed send it to their perspective locations.
VivaPenguinos 1:24446776f0d2 269 */
VivaPenguinos 1:24446776f0d2 270 void Noun_Button()
VivaPenguinos 1:24446776f0d2 271 {
VivaPenguinos 1:24446776f0d2 272 Nounz:
VivaPenguinos 1:24446776f0d2 273 pc.printf("Please enter a Noun Number");
VivaPenguinos 1:24446776f0d2 274 __wfi();
VivaPenguinos 1:24446776f0d2 275 Noun_Number1 = Index;
VivaPenguinos 1:24446776f0d2 276 if (Noun_Number1 == 14) {// This is section is used on atleast one of the two Noun_Number variabels to prevent a Nestled If within if within if.
VivaPenguinos 4:99535d368a9f 277 goto Nounz;
VivaPenguinos 0:3ff58b093415 278 }
VivaPenguinos 1:24446776f0d2 279 else{
VivaPenguinos 4:99535d368a9f 280 N_A = Button_Sort(Noun_Number1);
VivaPenguinos 4:99535d368a9f 281 Shift();
VivaPenguinos 0:3ff58b093415 282 }
VivaPenguinos 1:24446776f0d2 283 __wfi();
VivaPenguinos 1:24446776f0d2 284 Noun_Number2 = Index;
VivaPenguinos 4:99535d368a9f 285 N_B = Button_Sort(Noun_Number2);
VivaPenguinos 4:99535d368a9f 286 Shift();
VivaPenguinos 1:24446776f0d2 287 }
VivaPenguinos 1:24446776f0d2 288
VivaPenguinos 1:24446776f0d2 289 /* This function is used wen the Enter button has been pressed. This function is a special circumstance since it will be checking both the Verb and Noun variables before entering variable to Enter.
VivaPenguinos 1:24446776f0d2 290 */
VivaPenguinos 1:24446776f0d2 291 void Enter_Button()
VivaPenguinos 1:24446776f0d2 292 {
VivaPenguinos 1:24446776f0d2 293 Enterz:
VivaPenguinos 4:99535d368a9f 294 pc.printf("Checking Whether there is a variable stored in Noun or Verb 35\n");
VivaPenguinos 4:99535d368a9f 295 if (Noun_Number1 == 0 && Noun_Number2 == 0 && Verb_Number1 != 2 && Verb_Number2 != 5){
VivaPenguinos 1:24446776f0d2 296 pc.printf("Please enter a Enter Number");
VivaPenguinos 1:24446776f0d2 297 __wfi();
VivaPenguinos 1:24446776f0d2 298 Enter_Number1 = Index;
VivaPenguinos 1:24446776f0d2 299 if (Enter_Number1 == 11) { // This section is used on atleast one of the two Enter_Number variable to prevent a nestled if within if within if.
VivaPenguinos 1:24446776f0d2 300 goto Enterz;
VivaPenguinos 1:24446776f0d2 301 }
VivaPenguinos 1:24446776f0d2 302 else{
VivaPenguinos 1:24446776f0d2 303 Button_Sort(Enter_Number1);
VivaPenguinos 1:24446776f0d2 304 }
VivaPenguinos 1:24446776f0d2 305 __wfi();
VivaPenguinos 1:24446776f0d2 306 Enter_Number2 = Index;
VivaPenguinos 1:24446776f0d2 307 Button_Sort(Enter_Number2);
VivaPenguinos 1:24446776f0d2 308 }
VivaPenguinos 4:99535d368a9f 309 else {// (Noun_Number1 != 0 && Noun_Number2 != 0){
VivaPenguinos 1:24446776f0d2 310 pc.printf("Check completed, Executing");
VivaPenguinos 4:99535d368a9f 311 Index = -1;
VivaPenguinos 1:24446776f0d2 312 compare();
VivaPenguinos 1:24446776f0d2 313 }
VivaPenguinos 1:24446776f0d2 314
VivaPenguinos 1:24446776f0d2 315 }
VivaPenguinos 1:24446776f0d2 316
VivaPenguinos 1:24446776f0d2 317 // This function is used to sort the button press for Verb and Noun.
VivaPenguinos 4:99535d368a9f 318 int Button_Sort(int Sort)
VivaPenguinos 1:24446776f0d2 319 {
VivaPenguinos 4:99535d368a9f 320 if (Sort == 0){ // Index 0 - Char 1
VivaPenguinos 4:99535d368a9f 321 return 0x01;
VivaPenguinos 1:24446776f0d2 322 }
VivaPenguinos 4:99535d368a9f 323 else if (Sort == 1) { // Index 1 - Char 2
VivaPenguinos 4:99535d368a9f 324 return 0x02;
VivaPenguinos 1:24446776f0d2 325 }
VivaPenguinos 4:99535d368a9f 326 else if (Sort == 2) { // Index 2 - Char 3
VivaPenguinos 4:99535d368a9f 327 return 0x03;
VivaPenguinos 4:99535d368a9f 328 }
VivaPenguinos 4:99535d368a9f 329 else if (Sort == 3) { // Index 3 - Char + comparing the array number NOT what value in the array it is. Actual Array value is +
VivaPenguinos 1:24446776f0d2 330 pc.printf("+");
VivaPenguinos 1:24446776f0d2 331 }
VivaPenguinos 4:99535d368a9f 332 else if (Sort == 4) { // Index 4 - Char 4
VivaPenguinos 4:99535d368a9f 333 return 0x04;
VivaPenguinos 4:99535d368a9f 334 }
VivaPenguinos 4:99535d368a9f 335 else if (Sort == 5) { // Index 5 - Char 5
VivaPenguinos 4:99535d368a9f 336 return 0x05;
VivaPenguinos 4:99535d368a9f 337 }
VivaPenguinos 4:99535d368a9f 338 else if (Sort == 6) { // Index 6 - Char 6
VivaPenguinos 4:99535d368a9f 339 return 0x06;
VivaPenguinos 4:99535d368a9f 340 }
VivaPenguinos 4:99535d368a9f 341 else if (Sort == 7) { // Index 7 - Char - comparing the array number NOT what value in the array it is. Actual Array value is -
VivaPenguinos 1:24446776f0d2 342 pc.printf("-");
VivaPenguinos 1:24446776f0d2 343 }
VivaPenguinos 4:99535d368a9f 344 else if (Sort == 8) { // Index 8 - Char 7
VivaPenguinos 4:99535d368a9f 345 return 0x07;
VivaPenguinos 4:99535d368a9f 346 }
VivaPenguinos 4:99535d368a9f 347 else if (Sort == 9) { // Index 9 - Char 8
VivaPenguinos 4:99535d368a9f 348 return 0x08;
VivaPenguinos 4:99535d368a9f 349 }
VivaPenguinos 4:99535d368a9f 350 else if (Sort == 10) { // Index 10 - Char 9
VivaPenguinos 4:99535d368a9f 351 return 0x09;
VivaPenguinos 4:99535d368a9f 352 }
VivaPenguinos 4:99535d368a9f 353 else if (Sort == 12){ // Index 12 - Char V comparing the array number NOT what value in the array it is. Actual Array value is V
VivaPenguinos 4:99535d368a9f 354 Verb_Button();
VivaPenguinos 4:99535d368a9f 355 }
VivaPenguinos 4:99535d368a9f 356 else if (Sort == 13) { // Index 13 - Char 0
VivaPenguinos 4:99535d368a9f 357 return 0x00;
VivaPenguinos 4:99535d368a9f 358 }
VivaPenguinos 4:99535d368a9f 359 else if (Sort == 14) { // Index 14 - Char N comparing the array number NOT what value in the array it is. Actual Array value is N
VivaPenguinos 4:99535d368a9f 360 Noun_Button();
VivaPenguinos 4:99535d368a9f 361 }
VivaPenguinos 1:24446776f0d2 362 else if (Sort == 15) { //comparing the array number NOT what value in the array it is. Actual Array value is R
VivaPenguinos 1:24446776f0d2 363 pc.printf("R");
VivaPenguinos 1:24446776f0d2 364 }
VivaPenguinos 4:99535d368a9f 365 return 0;
VivaPenguinos 1:24446776f0d2 366 }
VivaPenguinos 4:99535d368a9f 367
VivaPenguinos 1:24446776f0d2 368 // Compares the button to what program the DSKY should be running. This section will be inefficent until I can improve on my programming skills :]
VivaPenguinos 1:24446776f0d2 369 void compare()
VivaPenguinos 1:24446776f0d2 370 {
VivaPenguinos 1:24446776f0d2 371 if (Verb_Number1 == 0 && Verb_Number2 == 6 && Noun_Number1 == 2 && Noun_Number2 == 6 && Enter_Number1 == 0 && Enter_Number2 == 0) {// Verb 16, Noun 36, Enter 00
VivaPenguinos 4:99535d368a9f 372 // Configure GET
VivaPenguinos 4:99535d368a9f 373 pc.printf("Display GET");
VivaPenguinos 1:24446776f0d2 374 Ground_Elapse_Time();
VivaPenguinos 4:99535d368a9f 375 } else if (Verb_Number1 == 2 && Verb_Number2 == 5 && Noun_Number1 == 0 && Noun_Number2 == 0 && Enter_Number1 == 0 && Enter_Number2 == 0) { // Verb 35 Noun 00 Enter 00
VivaPenguinos 4:99535d368a9f 376 // Test Lights
VivaPenguinos 4:99535d368a9f 377 pc.printf("Testing Lights");
VivaPenguinos 4:99535d368a9f 378 Test_Lights();
VivaPenguinos 4:99535d368a9f 379 } else if (Verb_Number1 == 1 && Verb_Number2 == 5 && Noun_Number1 == 2 && Noun_Number2 == 6 && Enter_Number1 == 0 && Enter_Number2 == 0) { // Verb 25, Noun 36, Enter 00
VivaPenguinos 4:99535d368a9f 380 // GET COnfiguration
VivaPenguinos 4:99535d368a9f 381 pc.printf("GET configuration");
VivaPenguinos 4:99535d368a9f 382 GET_Config();
VivaPenguinos 1:24446776f0d2 383 } else if (Verb == 37 && Enter == 00) {
VivaPenguinos 0:3ff58b093415 384 // Idle Program
VivaPenguinos 0:3ff58b093415 385 }
VivaPenguinos 1:24446776f0d2 386 }
VivaPenguinos 0:3ff58b093415 387
VivaPenguinos 1:24446776f0d2 388 void ShiftingOut(int myDataOut)
VivaPenguinos 1:24446776f0d2 389 {
VivaPenguinos 0:3ff58b093415 390 // This shifts 8 bits out to the MSB first, The the rising edge of the clock, while clock idles low.
VivaPenguinos 0:3ff58b093415 391 // Internal Fucntions
VivaPenguinos 0:3ff58b093415 392 DataPin = 0;
VivaPenguinos 0:3ff58b093415 393 ClockPin = 0;
VivaPenguinos 0:3ff58b093415 394 int i= 0;
VivaPenguinos 0:3ff58b093415 395 int pinState;
VivaPenguinos 0:3ff58b093415 396 // Clears Everything within shift registers
VivaPenguinos 0:3ff58b093415 397 DataPin = 0;
VivaPenguinos 0:3ff58b093415 398 ClockPin = 0;
VivaPenguinos 1:24446776f0d2 399
VivaPenguinos 4:99535d368a9f 400 for (i=3; i>= 0; i--) {
VivaPenguinos 0:3ff58b093415 401 ClockPin = 0;
VivaPenguinos 1:24446776f0d2 402
VivaPenguinos 0:3ff58b093415 403 // Value passed to my data out
VivaPenguinos 0:3ff58b093415 404 if ( myDataOut & (1<<i)) {
VivaPenguinos 0:3ff58b093415 405 pinState = 1;
VivaPenguinos 0:3ff58b093415 406 myled = 1;
VivaPenguinos 4:99535d368a9f 407 //pc.printf("1");
VivaPenguinos 1:24446776f0d2 408 } else {
VivaPenguinos 0:3ff58b093415 409 pinState = 0;
VivaPenguinos 0:3ff58b093415 410 myled = 0;
VivaPenguinos 4:99535d368a9f 411 //pc.printf("0");
VivaPenguinos 0:3ff58b093415 412 }
VivaPenguinos 0:3ff58b093415 413 DataPin = pinState;
VivaPenguinos 0:3ff58b093415 414 ClockPin = 1;
VivaPenguinos 0:3ff58b093415 415 DataPin = 0;
VivaPenguinos 1:24446776f0d2 416 }
VivaPenguinos 4:99535d368a9f 417 //pc.printf("\n");
VivaPenguinos 0:3ff58b093415 418 ClockPin = 0;
VivaPenguinos 0:3ff58b093415 419 DataPin = 1;
VivaPenguinos 1:24446776f0d2 420 }
VivaPenguinos 0:3ff58b093415 421
VivaPenguinos 4:99535d368a9f 422 // This function is used for shifting all Shift_X variables into the 7 segment display.
VivaPenguinos 4:99535d368a9f 423 void Shift()
VivaPenguinos 4:99535d368a9f 424 {
VivaPenguinos 4:99535d368a9f 425 LatchPin = 0;
VivaPenguinos 4:99535d368a9f 426 ShiftingOut(P_B);
VivaPenguinos 4:99535d368a9f 427 ShiftingOut(P_A);
VivaPenguinos 4:99535d368a9f 428 ShiftingOut(V_B);
VivaPenguinos 4:99535d368a9f 429 ShiftingOut(V_A);
VivaPenguinos 4:99535d368a9f 430 ShiftingOut(N_B);
VivaPenguinos 4:99535d368a9f 431 ShiftingOut(N_A);
VivaPenguinos 4:99535d368a9f 432 ShiftingOut(R3_E);
VivaPenguinos 4:99535d368a9f 433 ShiftingOut(R3_D);
VivaPenguinos 4:99535d368a9f 434 ShiftingOut(R3_C);
VivaPenguinos 4:99535d368a9f 435 ShiftingOut(R3_B);
VivaPenguinos 4:99535d368a9f 436 ShiftingOut(R3_A);
VivaPenguinos 4:99535d368a9f 437 ShiftingOut(R2_E);
VivaPenguinos 4:99535d368a9f 438 ShiftingOut(R2_D);
VivaPenguinos 4:99535d368a9f 439 ShiftingOut(R2_C);
VivaPenguinos 4:99535d368a9f 440 ShiftingOut(R2_B);
VivaPenguinos 4:99535d368a9f 441 ShiftingOut(R2_A);
VivaPenguinos 4:99535d368a9f 442 ShiftingOut(R1_E);
VivaPenguinos 4:99535d368a9f 443 ShiftingOut(R1_D);
VivaPenguinos 4:99535d368a9f 444 ShiftingOut(R1_C);
VivaPenguinos 4:99535d368a9f 445 ShiftingOut(R1_B);
VivaPenguinos 4:99535d368a9f 446 ShiftingOut(R1_A);
VivaPenguinos 4:99535d368a9f 447 LatchPin = 1;
VivaPenguinos 4:99535d368a9f 448 }
VivaPenguinos 4:99535d368a9f 449
VivaPenguinos 1:24446776f0d2 450 //blinks the whole registered based on the number of times you want to blink with a certain delay
VivaPenguinos 1:24446776f0d2 451 void blinkAll(int amount, int delay)
VivaPenguinos 1:24446776f0d2 452 {
VivaPenguinos 4:99535d368a9f 453 LatchPin = 0; // Before shift
VivaPenguinos 4:99535d368a9f 454 //ShiftingOut(0);
VivaPenguinos 4:99535d368a9f 455 //ShiftingOut(0);
VivaPenguinos 4:99535d368a9f 456 LatchPin = 1; // Done shift
VivaPenguinos 0:3ff58b093415 457 wait(0.2);
VivaPenguinos 0:3ff58b093415 458 for (int x = 0; x < amount; x++) {
VivaPenguinos 0:3ff58b093415 459 LatchPin = 0;
VivaPenguinos 4:99535d368a9f 460 pc.printf("sending\n");
VivaPenguinos 4:99535d368a9f 461 for (int s = 0; s < 22; s++)
VivaPenguinos 4:99535d368a9f 462 {
VivaPenguinos 4:99535d368a9f 463 ShiftingOut(0x08);
VivaPenguinos 4:99535d368a9f 464 }
VivaPenguinos 0:3ff58b093415 465 LatchPin = 1;
VivaPenguinos 0:3ff58b093415 466 wait(delay);
VivaPenguinos 0:3ff58b093415 467 LatchPin = 0;
VivaPenguinos 4:99535d368a9f 468 for (int s = 0; s < 22; s++)
VivaPenguinos 4:99535d368a9f 469 {
VivaPenguinos 4:99535d368a9f 470 ShiftingOut(0xf);
VivaPenguinos 4:99535d368a9f 471 }
VivaPenguinos 0:3ff58b093415 472 LatchPin = 1;
VivaPenguinos 0:3ff58b093415 473 wait(delay);
VivaPenguinos 1:24446776f0d2 474 }
VivaPenguinos 1:24446776f0d2 475 }
VivaPenguinos 1:24446776f0d2 476
VivaPenguinos 4:99535d368a9f 477 // The Ground Elapse Time is refrence to range zero or the last integeral before liftoff.
VivaPenguinos 4:99535d368a9f 478 // Page CM-9
VivaPenguinos 4:99535d368a9f 479 // 00XXX h
VivaPenguinos 4:99535d368a9f 480 // 000XX min
VivaPenguinos 4:99535d368a9f 481 // 0XX.XX s (Code current does not follow this format)
VivaPenguinos 1:24446776f0d2 482 void Ground_Elapse_Time()
VivaPenguinos 1:24446776f0d2 483 {
VivaPenguinos 4:99535d368a9f 484 NO_Light(7); // Clears all the 7 Segment first.
VivaPenguinos 4:99535d368a9f 485 // Displays V16N36 on the 7 segments
VivaPenguinos 4:99535d368a9f 486 V_A = 0x01;
VivaPenguinos 4:99535d368a9f 487 V_B = 0x06;
VivaPenguinos 4:99535d368a9f 488 N_A = 0x03;
VivaPenguinos 4:99535d368a9f 489 N_B = 0x06;
VivaPenguinos 4:99535d368a9f 490 Shift();
VivaPenguinos 4:99535d368a9f 491 int GET_FLAG = 1;
VivaPenguinos 4:99535d368a9f 492 while(GET_FLAG == 1) {
VivaPenguinos 4:99535d368a9f 493 int minute = 0;
VivaPenguinos 4:99535d368a9f 494 int Seconds = 0;
VivaPenguinos 4:99535d368a9f 495 int Hours = 0;
VivaPenguinos 4:99535d368a9f 496 int minutemod = 0; // Minute Modulo
VivaPenguinos 4:99535d368a9f 497 int R1D = 0x00;
VivaPenguinos 4:99535d368a9f 498 int R1E = 0x00;
VivaPenguinos 4:99535d368a9f 499 int R2D = 0x00;
VivaPenguinos 4:99535d368a9f 500 int R2E = 0x00;
VivaPenguinos 4:99535d368a9f 501 int R3D = 0x00;
VivaPenguinos 4:99535d368a9f 502 int R3E = 0x00;
VivaPenguinos 4:99535d368a9f 503 time_t seconds = clk.time(NULL);
VivaPenguinos 4:99535d368a9f 504 pc.printf ("S = %d\n", seconds);
VivaPenguinos 4:99535d368a9f 505 Time_Difference = (seconds + GET_Config_Time) - TIME_VALUE;
VivaPenguinos 4:99535d368a9f 506 printf("TIME=%d \n", Time_Difference); // Displays time elapsed based on seconds elapsed.
VivaPenguinos 4:99535d368a9f 507 Hours = Time_Difference/3600; // Divide seconds by 3600 seconds
VivaPenguinos 4:99535d368a9f 508 Seconds = Time_Difference%60; // Get the remainder of time difference after 60 seconds
VivaPenguinos 4:99535d368a9f 509 minute = Time_Difference/60; // Divide the seconds by 3600
VivaPenguinos 4:99535d368a9f 510 // Comments: 7 Segments Location
VivaPenguinos 4:99535d368a9f 511 minutemod = minute%60; // Get the remainder of the minutemod after 60 seconds
VivaPenguinos 4:99535d368a9f 512 R3D = (Hours%60)/10; // Get the modulo of the hour variable then divde by 10 to get single digit [][][][x][]
VivaPenguinos 4:99535d368a9f 513 R3E = Hours%10; // Get the modulo of the Hours variable by 10 to get single digit [][][][][x]
VivaPenguinos 4:99535d368a9f 514 R2D = minutemod/10; // Divide the minute variable by 10 to get single digit [][][][x][]
VivaPenguinos 4:99535d368a9f 515 R2E = minute%10; // Get the remainder of the minute variable to get single digit [][][][][x]
VivaPenguinos 4:99535d368a9f 516 R1D = Seconds/10; // Divide the seconds variable by 10 to get single digit [][][][x][]
VivaPenguinos 4:99535d368a9f 517 R1E = Time_Difference%10; // Get the remainder of the Time_Difference to get single digit [][][][][x]
VivaPenguinos 4:99535d368a9f 518 // Debug Use:
VivaPenguinos 4:99535d368a9f 519 // pc.printf("%d \n", minute);
VivaPenguinos 4:99535d368a9f 520 // pc.printf("%o \n", R2E);
VivaPenguinos 4:99535d368a9f 521 // pc.printf("%o \n", R2D);
VivaPenguinos 4:99535d368a9f 522 R3_E = R3E;
VivaPenguinos 4:99535d368a9f 523 R3_D = R3D;
VivaPenguinos 4:99535d368a9f 524 R1_E = R1E;
VivaPenguinos 4:99535d368a9f 525 R1_D = R1D;
VivaPenguinos 4:99535d368a9f 526 R2_E = R2E;
VivaPenguinos 4:99535d368a9f 527 R2_D = R2D;
VivaPenguinos 4:99535d368a9f 528 Shift();
VivaPenguinos 4:99535d368a9f 529 //pc.printf("%i \n",(Time_Difference%10) + ((Time_Difference/10)<<4)); // Decimal to BCD
VivaPenguinos 4:99535d368a9f 530 //printf("Time as a basic string = %s\r", ctime(&seconds));
VivaPenguinos 4:99535d368a9f 531 if (Index >-1) {
VivaPenguinos 4:99535d368a9f 532 GET_FLAG = 0;
VivaPenguinos 4:99535d368a9f 533 pc.printf("Interrupted");
VivaPenguinos 4:99535d368a9f 534 pc.printf("Index:%d => Key:%c\r\n", Index, Keytable[Index]);
VivaPenguinos 4:99535d368a9f 535 if (Index == 12) { // Index 12 = Verb Button
VivaPenguinos 4:99535d368a9f 536 Verb_Button(); // Goes to Verb_Button
VivaPenguinos 4:99535d368a9f 537 GET_FLAG = 0;
VivaPenguinos 4:99535d368a9f 538 break;
VivaPenguinos 4:99535d368a9f 539 } else if (Index == 14) { // Index 14 = Noun Button
VivaPenguinos 4:99535d368a9f 540 Noun_Button(); // Goes to Noun_Button
VivaPenguinos 4:99535d368a9f 541 GET_FLAG = 0;
VivaPenguinos 4:99535d368a9f 542 break;
VivaPenguinos 4:99535d368a9f 543 } else if (Index == 11) { // Index 11 = Enter Button
VivaPenguinos 4:99535d368a9f 544 Enter_Button(); // Goes to Enter_Button
VivaPenguinos 4:99535d368a9f 545 GET_FLAG = 0;
VivaPenguinos 4:99535d368a9f 546 break;
VivaPenguinos 4:99535d368a9f 547 }
VivaPenguinos 4:99535d368a9f 548 Index = -1;
VivaPenguinos 4:99535d368a9f 549 GET_FLAG = 0;
VivaPenguinos 4:99535d368a9f 550 break;
VivaPenguinos 4:99535d368a9f 551 }
VivaPenguinos 4:99535d368a9f 552 wait(1);
VivaPenguinos 4:99535d368a9f 553 }
VivaPenguinos 4:99535d368a9f 554 }
VivaPenguinos 4:99535d368a9f 555
VivaPenguinos 4:99535d368a9f 556 // This function tells the shift registers to not display anything on the 7 segments. The integer L is used to specificy which area to zero.
VivaPenguinos 4:99535d368a9f 557 // 1 = Row 1
VivaPenguinos 4:99535d368a9f 558 // 2 = Row 2
VivaPenguinos 4:99535d368a9f 559 // 3 = Row 3
VivaPenguinos 4:99535d368a9f 560 // 4 = Verb
VivaPenguinos 4:99535d368a9f 561 // 5 = Nouns
VivaPenguinos 4:99535d368a9f 562 // 6 = Program Number
VivaPenguinos 4:99535d368a9f 563 // 7 = All lights off
VivaPenguinos 4:99535d368a9f 564 void NO_Light(int L)
VivaPenguinos 4:99535d368a9f 565 {
VivaPenguinos 4:99535d368a9f 566
VivaPenguinos 4:99535d368a9f 567 switch(L) {
VivaPenguinos 4:99535d368a9f 568 case 1:
VivaPenguinos 4:99535d368a9f 569 R1_A = 0x0f;
VivaPenguinos 4:99535d368a9f 570 R1_B = 0x0f;
VivaPenguinos 4:99535d368a9f 571 R1_C = 0x0f;
VivaPenguinos 4:99535d368a9f 572 R1_D = 0x0f;
VivaPenguinos 4:99535d368a9f 573 R1_E = 0x0f;
VivaPenguinos 4:99535d368a9f 574 Shift();
VivaPenguinos 4:99535d368a9f 575 case 2:
VivaPenguinos 4:99535d368a9f 576 R2_A = 0x0f;
VivaPenguinos 4:99535d368a9f 577 R2_B = 0x0f;
VivaPenguinos 4:99535d368a9f 578 R2_C = 0x0f;
VivaPenguinos 4:99535d368a9f 579 R2_D = 0x0f;
VivaPenguinos 4:99535d368a9f 580 R2_E = 0x0f;
VivaPenguinos 4:99535d368a9f 581 Shift();
VivaPenguinos 4:99535d368a9f 582 case 3:
VivaPenguinos 4:99535d368a9f 583 R3_A = 0x0f;
VivaPenguinos 4:99535d368a9f 584 R3_B = 0x0f;
VivaPenguinos 4:99535d368a9f 585 R3_C = 0x0f;
VivaPenguinos 4:99535d368a9f 586 R3_D = 0x0f;
VivaPenguinos 4:99535d368a9f 587 R3_E = 0x0f;
VivaPenguinos 4:99535d368a9f 588 Shift();
VivaPenguinos 4:99535d368a9f 589 case 4:
VivaPenguinos 4:99535d368a9f 590 V_A = 0x0f;
VivaPenguinos 4:99535d368a9f 591 V_B = 0x0f;
VivaPenguinos 4:99535d368a9f 592 Shift();
VivaPenguinos 4:99535d368a9f 593 case 5:
VivaPenguinos 4:99535d368a9f 594 N_A = 0x0f;
VivaPenguinos 4:99535d368a9f 595 N_B = 0x0f;
VivaPenguinos 4:99535d368a9f 596 Shift();
VivaPenguinos 4:99535d368a9f 597 case 6:
VivaPenguinos 4:99535d368a9f 598 P_A = 0x0f;
VivaPenguinos 4:99535d368a9f 599 P_B = 0x0f;
VivaPenguinos 4:99535d368a9f 600 Shift();
VivaPenguinos 4:99535d368a9f 601 case 7:
VivaPenguinos 4:99535d368a9f 602 R1_A = 0x0f;
VivaPenguinos 4:99535d368a9f 603 R1_B = 0x0f;
VivaPenguinos 4:99535d368a9f 604 R1_C = 0x0f;
VivaPenguinos 4:99535d368a9f 605 R1_D = 0x0f;
VivaPenguinos 4:99535d368a9f 606 R1_E = 0x0f;
VivaPenguinos 4:99535d368a9f 607 R2_A = 0x0f;
VivaPenguinos 4:99535d368a9f 608 R2_B = 0x0f;
VivaPenguinos 4:99535d368a9f 609 R2_C = 0x0f;
VivaPenguinos 4:99535d368a9f 610 R2_D = 0x0f;
VivaPenguinos 4:99535d368a9f 611 R2_E = 0x0f;
VivaPenguinos 4:99535d368a9f 612 R3_A = 0x0f;
VivaPenguinos 4:99535d368a9f 613 R3_B = 0x0f;
VivaPenguinos 4:99535d368a9f 614 R3_C = 0x0f;
VivaPenguinos 4:99535d368a9f 615 R3_D = 0x0f;
VivaPenguinos 4:99535d368a9f 616 R3_E = 0x0f;
VivaPenguinos 4:99535d368a9f 617 V_A = 0x0f;
VivaPenguinos 4:99535d368a9f 618 V_B = 0x0f;
VivaPenguinos 4:99535d368a9f 619 N_A = 0x0f;
VivaPenguinos 4:99535d368a9f 620 N_B = 0x0f;
VivaPenguinos 4:99535d368a9f 621 P_A = 0x0f;
VivaPenguinos 4:99535d368a9f 622 P_B = 0x0f;
VivaPenguinos 4:99535d368a9f 623 Shift();
VivaPenguinos 4:99535d368a9f 624 }
VivaPenguinos 4:99535d368a9f 625 }
VivaPenguinos 4:99535d368a9f 626
VivaPenguinos 4:99535d368a9f 627 // Test lights is to make sure all the 7 segments and indicator lights worked prior to lift-off.
VivaPenguinos 4:99535d368a9f 628 void Test_Lights()
VivaPenguinos 4:99535d368a9f 629 {
VivaPenguinos 4:99535d368a9f 630 for(int x = 0; x < 7; x++) {
VivaPenguinos 4:99535d368a9f 631 R1_A = 0x08;
VivaPenguinos 4:99535d368a9f 632 R1_B = 0x08;
VivaPenguinos 4:99535d368a9f 633 R1_C = 0x08;
VivaPenguinos 4:99535d368a9f 634 R1_D = 0x08;
VivaPenguinos 4:99535d368a9f 635 R1_E = 0x08;
VivaPenguinos 4:99535d368a9f 636 R2_A = 0x08;
VivaPenguinos 4:99535d368a9f 637 R2_B = 0x08;
VivaPenguinos 4:99535d368a9f 638 R2_C = 0x08;
VivaPenguinos 4:99535d368a9f 639 R2_D = 0x08;
VivaPenguinos 4:99535d368a9f 640 R2_E = 0x08;
VivaPenguinos 4:99535d368a9f 641 R3_A = 0x08;
VivaPenguinos 4:99535d368a9f 642 R3_B = 0x08;
VivaPenguinos 4:99535d368a9f 643 R3_C = 0x08;
VivaPenguinos 4:99535d368a9f 644 R3_D = 0x08;
VivaPenguinos 4:99535d368a9f 645 R3_E = 0x08;
VivaPenguinos 4:99535d368a9f 646 V_A = 0x08;
VivaPenguinos 4:99535d368a9f 647 V_B = 0x08;
VivaPenguinos 4:99535d368a9f 648 N_A = 0x08;
VivaPenguinos 4:99535d368a9f 649 N_B = 0x08;
VivaPenguinos 4:99535d368a9f 650 P_A = 0x08;
VivaPenguinos 4:99535d368a9f 651 P_B = 0x08;
VivaPenguinos 4:99535d368a9f 652 Shift();
VivaPenguinos 4:99535d368a9f 653 wait(1);
VivaPenguinos 4:99535d368a9f 654 V_A = 0x0f;
VivaPenguinos 4:99535d368a9f 655 V_B = 0x0f;
VivaPenguinos 4:99535d368a9f 656 N_A = 0x0f;
VivaPenguinos 4:99535d368a9f 657 N_B = 0x0f;
VivaPenguinos 4:99535d368a9f 658 Shift();
VivaPenguinos 4:99535d368a9f 659 wait(1);
VivaPenguinos 4:99535d368a9f 660 }
VivaPenguinos 4:99535d368a9f 661 }
VivaPenguinos 4:99535d368a9f 662
VivaPenguinos 4:99535d368a9f 663 // This configs the Ground Elapse Time
VivaPenguinos 4:99535d368a9f 664 // This portion of code converts the value retrived into seconds and replaces the value in the RTC module.
VivaPenguinos 4:99535d368a9f 665 // Process:
VivaPenguinos 4:99535d368a9f 666 // V25N36
VivaPenguinos 4:99535d368a9f 667 // Displays V21N36
VivaPenguinos 4:99535d368a9f 668 // +-00XXX 750 hours max (equates to 31.25 days) Longest Apollo mission was only 12 hours, 13 hours. So 750 Hours is more than enough.
VivaPenguinos 4:99535d368a9f 669 // Displays V22N36
VivaPenguinos 4:99535d368a9f 670 // +-000XX 60 Minutes Max
VivaPenguinos 4:99535d368a9f 671 // Displays V23N36
VivaPenguinos 4:99535d368a9f 672 // +-0XXXX 60 Seconds Max, Currently follows 000XX will change in future revisions
VivaPenguinos 4:99535d368a9f 673 void GET_Config()
VivaPenguinos 4:99535d368a9f 674 {
VivaPenguinos 4:99535d368a9f 675 int GET_Hours = 0;
VivaPenguinos 4:99535d368a9f 676 int GET_Minute = 0;
VivaPenguinos 4:99535d368a9f 677 int GET_Seconds = 0;
VivaPenguinos 4:99535d368a9f 678 // Configures Hours, Minutes, and Seconds for RTC
VivaPenguinos 4:99535d368a9f 679 NO_Light(3);
VivaPenguinos 4:99535d368a9f 680 do {
VivaPenguinos 4:99535d368a9f 681 NO_Light(3);
VivaPenguinos 4:99535d368a9f 682 pc.printf("Debug");
VivaPenguinos 4:99535d368a9f 683 R_GET(3);
VivaPenguinos 4:99535d368a9f 684 V_A = 0x02;
VivaPenguinos 4:99535d368a9f 685 V_B = 0x01;
VivaPenguinos 4:99535d368a9f 686 N_A = 0x03;
VivaPenguinos 4:99535d368a9f 687 N_B = 0x06;
VivaPenguinos 4:99535d368a9f 688 R_GET(3);
VivaPenguinos 4:99535d368a9f 689 Shift();
VivaPenguinos 4:99535d368a9f 690 wait(.5);
VivaPenguinos 4:99535d368a9f 691 R_GET(3);
VivaPenguinos 4:99535d368a9f 692 V_A = 0x0f;
VivaPenguinos 4:99535d368a9f 693 V_B = 0x0f;
VivaPenguinos 4:99535d368a9f 694 N_A = 0x0f;
VivaPenguinos 4:99535d368a9f 695 N_B = 0x0f;
VivaPenguinos 4:99535d368a9f 696 R_GET(3);
VivaPenguinos 4:99535d368a9f 697 Shift();
VivaPenguinos 4:99535d368a9f 698 wait(.5);
VivaPenguinos 4:99535d368a9f 699 } while (R3_Position != 6);
VivaPenguinos 4:99535d368a9f 700 R_Position = 1;
VivaPenguinos 4:99535d368a9f 701 RVA = 0x0f;
VivaPenguinos 4:99535d368a9f 702 RVB = 0x0f;
VivaPenguinos 4:99535d368a9f 703 RVC = 0x0f;
VivaPenguinos 4:99535d368a9f 704 RVD = 0x0f;
VivaPenguinos 4:99535d368a9f 705 RVE = 0x0f;
VivaPenguinos 4:99535d368a9f 706 do {
VivaPenguinos 4:99535d368a9f 707 pc.printf("Debug R2");
VivaPenguinos 4:99535d368a9f 708 R_GET(2);
VivaPenguinos 4:99535d368a9f 709 V_A = 0x02;
VivaPenguinos 4:99535d368a9f 710 V_B = 0x02;
VivaPenguinos 4:99535d368a9f 711 N_A = 0x03;
VivaPenguinos 4:99535d368a9f 712 N_B = 0x06;
VivaPenguinos 4:99535d368a9f 713 R_GET(2);
VivaPenguinos 4:99535d368a9f 714 Shift();
VivaPenguinos 4:99535d368a9f 715 wait(.5);
VivaPenguinos 4:99535d368a9f 716 R_GET(2);
VivaPenguinos 4:99535d368a9f 717 V_A = 0x0f;
VivaPenguinos 4:99535d368a9f 718 V_B = 0x0f;
VivaPenguinos 4:99535d368a9f 719 N_A = 0x0f;
VivaPenguinos 4:99535d368a9f 720 N_B = 0x0f;
VivaPenguinos 4:99535d368a9f 721 R_GET(2);
VivaPenguinos 4:99535d368a9f 722 Shift();
VivaPenguinos 4:99535d368a9f 723 wait(.5);
VivaPenguinos 4:99535d368a9f 724 } while(R2_Position != 6);
VivaPenguinos 4:99535d368a9f 725 R_Position = 1;
VivaPenguinos 4:99535d368a9f 726 RVA = 0x0f;
VivaPenguinos 4:99535d368a9f 727 RVB = 0x0f;
VivaPenguinos 4:99535d368a9f 728 RVC = 0x0f;
VivaPenguinos 4:99535d368a9f 729 RVD = 0x0f;
VivaPenguinos 4:99535d368a9f 730 RVE = 0x0f;
VivaPenguinos 4:99535d368a9f 731 do {
VivaPenguinos 4:99535d368a9f 732 pc.printf("Debug R1");
VivaPenguinos 4:99535d368a9f 733 R_GET(1);
VivaPenguinos 4:99535d368a9f 734 V_A = 0x02;
VivaPenguinos 4:99535d368a9f 735 V_B = 0x03;
VivaPenguinos 4:99535d368a9f 736 N_A = 0x03;
VivaPenguinos 4:99535d368a9f 737 N_B = 0x06;
VivaPenguinos 4:99535d368a9f 738 R_GET(1);
VivaPenguinos 4:99535d368a9f 739 Shift();
VivaPenguinos 4:99535d368a9f 740 wait(.5);
VivaPenguinos 4:99535d368a9f 741 R_GET(1);
VivaPenguinos 4:99535d368a9f 742 V_A = 0x0f;
VivaPenguinos 4:99535d368a9f 743 V_B = 0x0f;
VivaPenguinos 4:99535d368a9f 744 N_A = 0x0f;
VivaPenguinos 4:99535d368a9f 745 N_B = 0x0f;
VivaPenguinos 4:99535d368a9f 746 R_GET(1);
VivaPenguinos 4:99535d368a9f 747 Shift();
VivaPenguinos 4:99535d368a9f 748 wait(.5);
VivaPenguinos 4:99535d368a9f 749 } while(R1_Position != 6);
VivaPenguinos 4:99535d368a9f 750 R_Position = 1;
VivaPenguinos 4:99535d368a9f 751 RVA = 0x0f;
VivaPenguinos 4:99535d368a9f 752 RVB = 0x0f;
VivaPenguinos 4:99535d368a9f 753 RVC = 0x0f;
VivaPenguinos 4:99535d368a9f 754 RVD = 0x0f;
VivaPenguinos 4:99535d368a9f 755 RVE = 0x0f;
VivaPenguinos 4:99535d368a9f 756
VivaPenguinos 4:99535d368a9f 757 // The Actual Configuration of GET
VivaPenguinos 4:99535d368a9f 758 // Concatenate the values from each row based on it's value
VivaPenguinos 4:99535d368a9f 759 GET_Hours = R_Concatenate(3);
VivaPenguinos 4:99535d368a9f 760 GET_Minute = R_Concatenate(2);
VivaPenguinos 4:99535d368a9f 761 GET_Seconds = R_Concatenate(1);
VivaPenguinos 4:99535d368a9f 762
VivaPenguinos 4:99535d368a9f 763 // Checks if value exceeds the Hours, Minute, and Seconds
VivaPenguinos 4:99535d368a9f 764 if (GET_Hours > 750 or GET_Minute > 60 or GET_Seconds > 60) {
VivaPenguinos 4:99535d368a9f 765 pc.printf("Error! Check your Hours, Minute, and Seconds Value");
VivaPenguinos 4:99535d368a9f 766 R3_Position = 1;
VivaPenguinos 4:99535d368a9f 767 GET_Config();
VivaPenguinos 4:99535d368a9f 768 } else {
VivaPenguinos 4:99535d368a9f 769 pc.printf("Pass!, Going to configure RTC Now");
VivaPenguinos 4:99535d368a9f 770 GET_Config_Time = GET_Hours * 3600;
VivaPenguinos 4:99535d368a9f 771 GET_Config_Time += GET_Minute * 60;
VivaPenguinos 4:99535d368a9f 772 GET_Config_Time += GET_Seconds;
VivaPenguinos 4:99535d368a9f 773 pc.printf("Time Conversion is %d", GET_Config_Time);
VivaPenguinos 4:99535d368a9f 774 }
VivaPenguinos 4:99535d368a9f 775
VivaPenguinos 4:99535d368a9f 776 // Reconfigures the timee so the values can be resetted.
VivaPenguinos 3:29cff763ae36 777 #ifdef INITIAL_RUN
VivaPenguinos 3:29cff763ae36 778 clk.set_time(TIME_VALUE);
VivaPenguinos 3:29cff763ae36 779 #endif
VivaPenguinos 1:24446776f0d2 780
VivaPenguinos 4:99535d368a9f 781 // Debug Use Only
VivaPenguinos 4:99535d368a9f 782 //pc.printf("%d\n", GET_Hours);
VivaPenguinos 4:99535d368a9f 783 //pc.printf("%d\n", GET_Minute);
VivaPenguinos 4:99535d368a9f 784 //pc.printf("%d\n", GET_Seconds);
VivaPenguinos 4:99535d368a9f 785 Ground_Elapse_Time();
VivaPenguinos 4:99535d368a9f 786 }
VivaPenguinos 4:99535d368a9f 787
VivaPenguinos 4:99535d368a9f 788 // This is used to concatenate Row 3, Useful for when verifying inputs.
VivaPenguinos 4:99535d368a9f 789 int R_Concatenate(int C) {
VivaPenguinos 4:99535d368a9f 790
VivaPenguinos 4:99535d368a9f 791 // Used for concatenation only
VivaPenguinos 4:99535d368a9f 792 int RAB = 0;
VivaPenguinos 4:99535d368a9f 793 int RCD = 0;
VivaPenguinos 4:99535d368a9f 794 int RABCD = 0;
VivaPenguinos 4:99535d368a9f 795 int RABCDE = 0;
VivaPenguinos 4:99535d368a9f 796
VivaPenguinos 4:99535d368a9f 797 // Actual Physical Interaces, Row Physical
VivaPenguinos 4:99535d368a9f 798 int RPA = 0;
VivaPenguinos 4:99535d368a9f 799 int RPB = 0;
VivaPenguinos 4:99535d368a9f 800 int RPC = 0;
VivaPenguinos 4:99535d368a9f 801 int RPD = 0;
VivaPenguinos 4:99535d368a9f 802 int RPE = 0;
VivaPenguinos 4:99535d368a9f 803
VivaPenguinos 4:99535d368a9f 804 // This if Statement compares which rows to concatenate then replaces the variables with the correct one.
VivaPenguinos 4:99535d368a9f 805 if (C == 3) {
VivaPenguinos 4:99535d368a9f 806 RPA = R3_A;
VivaPenguinos 4:99535d368a9f 807 RPB = R3_B;
VivaPenguinos 4:99535d368a9f 808 RPC = R3_C;
VivaPenguinos 4:99535d368a9f 809 RPD = R3_D;
VivaPenguinos 4:99535d368a9f 810 RPE = R3_E;
VivaPenguinos 4:99535d368a9f 811 }
VivaPenguinos 4:99535d368a9f 812 if (C == 2) {
VivaPenguinos 4:99535d368a9f 813 RPA = R2_A;
VivaPenguinos 4:99535d368a9f 814 RPB = R3_B;
VivaPenguinos 4:99535d368a9f 815 RPC = R2_C;
VivaPenguinos 4:99535d368a9f 816 RPD = R2_D;
VivaPenguinos 4:99535d368a9f 817 RPE = R2_E;
VivaPenguinos 4:99535d368a9f 818 }
VivaPenguinos 4:99535d368a9f 819 if (C == 1) {
VivaPenguinos 4:99535d368a9f 820 RPA = R1_A;
VivaPenguinos 4:99535d368a9f 821 RPB = R1_B;
VivaPenguinos 4:99535d368a9f 822 RPC = R1_C;
VivaPenguinos 4:99535d368a9f 823 RPD = R1_D;
VivaPenguinos 4:99535d368a9f 824 RPE = R1_E;
VivaPenguinos 3:29cff763ae36 825 }
VivaPenguinos 4:99535d368a9f 826 RAB = concatenate(RPA, RPB); // R3A + R3B
VivaPenguinos 4:99535d368a9f 827 RCD = concatenate(RPC, RPD); // R3C + R3D
VivaPenguinos 4:99535d368a9f 828 RABCD = concatenate(RAB, RCD); // R3AB + R3CD
VivaPenguinos 4:99535d368a9f 829 RABCDE = concatenate(RABCD, RPE); // R3ABCD = R3E
VivaPenguinos 4:99535d368a9f 830 //Debug Use:
VivaPenguinos 4:99535d368a9f 831 //pc.printf("%d\n", RAB);
VivaPenguinos 4:99535d368a9f 832 //pc.printf("%d\n", RCD);
VivaPenguinos 4:99535d368a9f 833 //pc.printf("%d\n", RABCD);
VivaPenguinos 4:99535d368a9f 834 //pc.printf("%d\n", RABCDE);
VivaPenguinos 4:99535d368a9f 835 return RABCDE;
VivaPenguinos 4:99535d368a9f 836 }
VivaPenguinos 4:99535d368a9f 837
VivaPenguinos 4:99535d368a9f 838
VivaPenguinos 4:99535d368a9f 839 // Concatenate two Integers. Credits to Mooing Duck. http://stackoverflow.com/questions/12700497/how-to-concatenate-two-integers-in-c
VivaPenguinos 4:99535d368a9f 840 // Decided not modify the code to do 5 at a time since I can use it to concatenate the Verb, Noun, and Program Number.
VivaPenguinos 4:99535d368a9f 841 unsigned concatenate(unsigned x, unsigned y) {
VivaPenguinos 4:99535d368a9f 842 unsigned pow = 10;
VivaPenguinos 4:99535d368a9f 843 while(y >= pow)
VivaPenguinos 4:99535d368a9f 844 pow *= 10;
VivaPenguinos 4:99535d368a9f 845 return x * pow + y;
VivaPenguinos 4:99535d368a9f 846 }
VivaPenguinos 4:99535d368a9f 847
VivaPenguinos 4:99535d368a9f 848 void R_GET(int R)
VivaPenguinos 4:99535d368a9f 849 {
VivaPenguinos 4:99535d368a9f 850 if (R == 3) {
VivaPenguinos 4:99535d368a9f 851 R3_A = RVA;
VivaPenguinos 4:99535d368a9f 852 R3_B = RVB;
VivaPenguinos 4:99535d368a9f 853 R3_C = RVC;
VivaPenguinos 4:99535d368a9f 854 R3_D = RVD;
VivaPenguinos 4:99535d368a9f 855 R3_E = RVE;
VivaPenguinos 4:99535d368a9f 856 R3_Position = R_Position;
VivaPenguinos 4:99535d368a9f 857 }
VivaPenguinos 4:99535d368a9f 858 if (R == 2) {
VivaPenguinos 4:99535d368a9f 859 R2_A = RVA;
VivaPenguinos 4:99535d368a9f 860 R2_B = RVB;
VivaPenguinos 4:99535d368a9f 861 R2_C = RVC;
VivaPenguinos 4:99535d368a9f 862 R2_D = RVD;
VivaPenguinos 4:99535d368a9f 863 R2_E = RVE;
VivaPenguinos 4:99535d368a9f 864 R2_Position = R_Position;
VivaPenguinos 4:99535d368a9f 865 }
VivaPenguinos 4:99535d368a9f 866 if (R == 1) {
VivaPenguinos 4:99535d368a9f 867 R1_A = RVA;
VivaPenguinos 4:99535d368a9f 868 R1_B = RVB;
VivaPenguinos 4:99535d368a9f 869 R1_C = RVC;
VivaPenguinos 4:99535d368a9f 870 R1_D = RVD;
VivaPenguinos 4:99535d368a9f 871 R1_E = RVE;
VivaPenguinos 4:99535d368a9f 872 R1_Position = R_Position;
VivaPenguinos 4:99535d368a9f 873 }
VivaPenguinos 4:99535d368a9f 874
VivaPenguinos 4:99535d368a9f 875 switch (R_Position){
VivaPenguinos 4:99535d368a9f 876 case 1:
VivaPenguinos 4:99535d368a9f 877 if (Index >-1) {
VivaPenguinos 4:99535d368a9f 878 pc.printf("RA\n");
VivaPenguinos 4:99535d368a9f 879 RA = Button_Sort(Index);
VivaPenguinos 4:99535d368a9f 880 RVA = RA;
VivaPenguinos 4:99535d368a9f 881 Shift();
VivaPenguinos 4:99535d368a9f 882 Index = -1;
VivaPenguinos 4:99535d368a9f 883 R_Position = 2;
VivaPenguinos 4:99535d368a9f 884 }
VivaPenguinos 4:99535d368a9f 885 case 2:
VivaPenguinos 4:99535d368a9f 886 if (Index >-1) {
VivaPenguinos 4:99535d368a9f 887 pc.printf("RB\n");
VivaPenguinos 4:99535d368a9f 888 RB = Button_Sort(Index);
VivaPenguinos 4:99535d368a9f 889 RVB = RB;
VivaPenguinos 4:99535d368a9f 890 Shift();
VivaPenguinos 4:99535d368a9f 891 Index = -1;
VivaPenguinos 4:99535d368a9f 892 R_Position = 3;
VivaPenguinos 4:99535d368a9f 893 }
VivaPenguinos 4:99535d368a9f 894 case 3:
VivaPenguinos 4:99535d368a9f 895 if (Index >-1) {
VivaPenguinos 4:99535d368a9f 896 pc.printf("RC\n");
VivaPenguinos 4:99535d368a9f 897 RC = Button_Sort(Index);
VivaPenguinos 4:99535d368a9f 898 RVC = RC;
VivaPenguinos 4:99535d368a9f 899 Shift();
VivaPenguinos 4:99535d368a9f 900 Index = -1;
VivaPenguinos 4:99535d368a9f 901 R_Position = 4;
VivaPenguinos 4:99535d368a9f 902 }
VivaPenguinos 4:99535d368a9f 903 case 4:
VivaPenguinos 4:99535d368a9f 904 if (Index >-1) {
VivaPenguinos 4:99535d368a9f 905 pc.printf("RD\n");
VivaPenguinos 4:99535d368a9f 906 RD = Button_Sort(Index);
VivaPenguinos 4:99535d368a9f 907 RVD = RD;
VivaPenguinos 4:99535d368a9f 908 Shift();
VivaPenguinos 4:99535d368a9f 909 Index = -1;
VivaPenguinos 4:99535d368a9f 910 R_Position = 5;
VivaPenguinos 4:99535d368a9f 911 }
VivaPenguinos 4:99535d368a9f 912 case 5:
VivaPenguinos 4:99535d368a9f 913 if (Index >-1) {
VivaPenguinos 4:99535d368a9f 914 pc.printf("RE\n");
VivaPenguinos 4:99535d368a9f 915 RE = Button_Sort(Index);
VivaPenguinos 4:99535d368a9f 916 RVE = RE;
VivaPenguinos 4:99535d368a9f 917 Shift();
VivaPenguinos 4:99535d368a9f 918 Index = -1;
VivaPenguinos 4:99535d368a9f 919 R_Position = 6;
VivaPenguinos 4:99535d368a9f 920 }
VivaPenguinos 4:99535d368a9f 921 }
VivaPenguinos 4:99535d368a9f 922
VivaPenguinos 4:99535d368a9f 923
VivaPenguinos 4:99535d368a9f 924 }
VivaPenguinos 4:99535d368a9f 925