1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
//=======================================================================================
//
// ArSid_Help - The ArSid_Help Library
//
// The Help pages. Both text as well as the functions
//
//=======================================================================================
//
// Mind you, there are severall Extern Vars from/ for other libraries
//
#ifndef ARSID_HELP_CPP
#define ARSID_HELP_CPP
#include "Arduino.h"
#include "Basic_Funk.h"
#include "ArSid_Help.h"
#include "ArSid_Panel.h"
#include "ArSid_Sid.h"
#include "ArSid_Lcd.h"
#include "ArSid_Chars.h"
#include "ArSid_Control.h"
#include "ArSid_Crsr.h"
// Next lines are needed for PROGMEM and pgm_read_byte_near-function
#include <avr/io.h>
#include <avr/pgmspace.h>
//=====================================================================================
// Some Semifores for Doing Stuff Only when Needed.
extern byte Do_Sid_Data ; // >0 => To Set Sid Data into the Sid
extern byte Do_ShowLegend ; // >0 => To Show Legend On The Screen
extern byte Do_ShowData ; // >0 => To Show Data On The Screen
// Some Cursor Vars and BitMasks
extern byte KeysCrsr ; // Keys Cursor/ Main BitPatern 0bEHRSDURL
extern byte KeysCrsrPrev ; // Keys Cursor/ Main - Vorige
//=====================================================================================
// 33 33 3333333333 33 33333333
// 33 33 33 33 33 33
// 33 33 33 33 33 33
// 3333333333 33333333 33 33333333
// 33 33 33 33 33
// 33 33 33 33 33
// 33 33 3333333333 3333333333 33
//
// The Help Texts
// Every screen is stored in one big array of 20 characters in 4 lines. An extra
// line (line 0 (NUL)) contains information about self-defined characters. There
// are 12 possible "Pages". Each page has 5 "Units".
// - Line 0 (NUL) [00..07]: The replacement characters.
// - Line 0 (NUL) [10..17]: Self-Defined char-number to copy.
// - Line 1 [all] : a title line of the screen.
// - Line 2, 3, 4 [all] : the help-text it self.
// It is possible to show self-defined characters on the screen. A maximum of 8
// different self-defined characters are possible, due to the Lcd Display. They
// are numbered 0..7.
// Because it seemed not to be possible to put the characters 0..7 directly in the
// array, a replace-mechanic has been built in. That's where line 0 (NUL) is used
// for. The first 8 characters in line 0 (NUL) is used to define which character
// in the screen will be replaced with the self-defined character 0..7. Of course
// every self-defined character can be used more than once in the screen.
// A <Space> means no-character has to replace.
// In this way, some excellent screens can be built and let others think that it's
// a special display that is used here.
// Also in the first line: Replace chars 10..17 with a single ASCII-"character" to
// define which self-defined character has to copy to place 0..7. In this way, each
// unit can have its own self-defined characters, undepending from the other units
// in the same page. Of course <Space> means nothing to copy - and may not to be
// used.
//=====================================================================================
const byte Max_HelpPage = 11; // Max Number of HelpPages [0..Max.
const byte Max_HelpLines = 4; // Max Number of HelpLines on a Page [1..Max]
const byte Max_HelpUnits = 4; // Max Number of HelpUnits [0..Max]
static const unsigned char HelpText_Lines[12][5][5][21] PROGMEM = // [0..11][0..4][0..4][0..20]
// [NumberPage][Line][NumberUnit][char]
{ { // NumberPage = 0 ====> Help Check
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " @#$ Q~~89:; Q~~" , " @#$ Q~~89:; Q~~" , " @#$ Q~~89:; Q~~" , " @#$ Q~~89:; Q~~" , " @#$~ Q~~89:;P Q~~" },
{ "0__[Check]__txxxQs_0" , "0__[Check]__txxxQs_1" , "0__[Check]__txxxQs_2" , "0__[Check]__txxxQs_3" , "0__[Check]__txxxQs_4" },
{ "@0022 4466 88AA CCEE" , "@0022 4466 88AA CCEE" , "#1133 5577 99BB DDFF" , "$0123 4567 89AB CDEF" , "txxxQs = Timing van " },
{ "#1133 5577 99BB DDFF" , "Schakelaars omHoog " , "Schakelaars omLaag " , "Potmeter controle, " , "het Lcd Display. " },
{ "$0123 4567 89AB CDEF" , "standen controle. " , "standen controle. " , "bereik [0..9 A..F]. " , "Deze is ong. 42~2Qs " }
},
{ // NumberPage = 1 ====> Help on Help
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , "^ ~~89:; ~~" },
{ "1___[ArSid_Help]___0" , "1___[ArSid_Help]___1" , "1___[ArSid_Help]___2" , "1___[ArSid_Help]___3" , "1_[ArSid_HelpKeys]_4" },
{ "1)Help 4)Note " , "Sid Data: Controler " , "Midi Data: Inkomend " , "Monitor: Inkomend " , "Keys <> Links/Rechts" },
{ "2)Controls 5)Midi " , "standen worden " , "Midi gegevens " , "Midi verkeer wordt " , " ^v Op / Neer " },
{ "3)Sids 6)Monitor" , "getoond. " , "wordt getoond. " , "weergegeven. " , " Esc Verlaat Help" }
},
{ // NumberPage = 2 ====> Help Control
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" },
{ "2__[Controls_Help]_0" , "2__[Controls_Help]_1" , "2__[Controls_Help]_2" , "2__[Controls_Help]_3" , "2__[Controls_Help]_4" },
{ "Tonen Controler " , "Tonen Controler " , "Tonen Controler " , " " , "Toont Controler " },
{ "standen: " , "standen: " , "standen: " , " (gereserveerd) " , "waardes (potmeters &" },
{ "Decimaal " , "Hexadecimaal " , "Tijden en % " , " " , "schakelaars). " }
},
{ // NumberPage = 3 ====> Help Sids
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" },
{ "3____[Sids_Help]___0" , "3____[Sids_Help]___1" , "3____[Sids_Help]___2" , "3____[Sids_Help]___3" , "3____[Sids_Help]___4" },
{ "Tonen Controler Sid " , "Tonen Sid waardes: " , "Tonen Sid waardes: " , " " , "Toont Sid waardes. " },
{ "standen: " , " " , " " , " (gereserveerd) " , " " },
{ "Decimaal " , "Hexadecimaal " , "Tijden en % " , " " , " " }
},
{ // NumberPage = 4 ====> Help Note
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" },
{ "4____[Note_Help]___0" , "4____[Note_Help]___1" , "4____[Note_Help]___2" , "4____[Note_Help]___3" , "4____[Note_Help]___4" },
{ "Tonen Noot waardes " , "Tonen Noot waardes " , "Tonen Akkoord-naam " , " " , "Toont Noot waardes " },
{ "en Akkoord-naam: " , "en Akkoord-naam: " , "en Akkoord-noten. " , " (gereserveerd) " , "en Akkoord waardes. " },
{ "Decimaal " , "Hexadecimaal " , " " , " " , " " }
},
{ // NumberPage = 5 ====> Help Midi
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" },
{ "5____[Midi_Help]___0" , "5____[Midi_Help]___1" , "5____[Midi_Help]___2" , "5____[Midi_Help]___3" , "5____[Midi_Help]___4" },
{ "Tonen Inkomende " , "Tonen Inkomende " , " " , " " , "Toont Inkomende Midi" },
{ "Midi gegevens: " , "Midi gegevens: " , " (gereserveerd) " , " (gereserveerd) " , "als noten en " },
{ "Decimaal " , "Hexadecimaal " , " " , " " , "waardes " }
},
{ // NumberPage = 6 ====> Help Monitor
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" },
{ "6__[Monitor_Help]__0" , "6__[Monitor_Help]__1" , "6__[Monitor_Help]__2" , "6__[Monitor_Help]__3" , "6__[Monitor_Help]__4" },
{ "Tonen inkomend Midi " , "Tonen inkomend Midi " , " " , " " , "Toont Inkoment Data " },
{ "verkeer Kabel: " , "verkeer Kabel: " , " (gereserveerd) " , " (gereserveerd) " , "Dataverkeer recht- " },
{ "Decimaal " , "Hexadecimaal " , " " , " " , "streeks als nummers " }
},
{ // NumberPage = 7 ====> Help Cursors
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " ~~89:; ~~" , "^ ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" , " ~~89:; ~~" },
{ "7____[Keys_Help]___0" , "7____[Keys_Help]___1" , "7____[Keys_Help]___2" , "7____[Keys_Help]___3" , "7____[Keys_Help]___4" },
{ "Esc-Help Left-Right" , "<> Ga Linker/Rechts " , "Esc Verlaat Scherm" , "Voice Selecteer Stem" , "Set Doe Instelling " },
{ " Quiet PageUp " , "^ Ga Pagina Op " , "Help Help Pagina's " , "Sid Selecteer Sid " , " in Stem/Sid " },
{ " Enter PageDown " , "v Ga Pagina Neer " , "Quiet Zwijg Sids " , " " , "Play Speel Noot af " }
},
{ // NumberPage = 8 ====> Help Audio / Backside
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ "*@#$%& ~~IGH;=>JK~~" , "*@#$%& ~~IGH;=>JK~~" , "*@#$%& ~~IGH;=>JK~~" , " !?~~IGH;=>JK~~" , " !?~~IGH;=>JK~~" },
{ "8___[Audio_Help]___0" , "8_ [Aansluit_Help]_1" , "8__[Aansluit_Help]_2" , "8_[DipSwitch_Help]_3" , "8_[DipSwitch_Help]_4" },
{ " $ $ $ $ Sid 1" , "Audio In * * " , " Thru %& Out " , "!!!? !!!? !!!? !!!! " , " !!!? = Channel 01" },
{ "Lin Rin LuitRuit " , " L R " , " @# @# Update " , "Chan Chan Chan Optie" , "tm ???? = Channel 15" },
{ " $ $ $ $ Sid 2" , "Audio Uit * * " , "M in M uit [USB] " , "In 1 In 2 Out " , " !!!! = Channel 16" }
},
{ // NumberPage = 9 ====> Help Leds/ Select
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ "* |!~~< CD=>EF~~" , "* |!~~< CD=>EF~~" , "* |!~~< CD=>EF~~" , "* ~~< CD=>EF~~" , " @#%& ~~< CD=>EF~~" },
{ "9__[Led-Rij_Links]_0" , "9_[Led-Rij_Midden]_1" , "9_[Led-Rij_Rechts]_2" , "9_____[3_Leds]_____3" , "9__[Voice Select]__4" },
{ " * * * *|!* " , " * * *|!* * * " , " *|!* * * * " , "Fil- * * * Set" , "Select % @# Select" },
{ " 0 1 2 3 4 " , " 5 6 7 8 9 10 " , " 11 12 13 14 15 " , "ter | Play" , "Stem--< >---Sid" },
{ " Midi In Clock " , " Midi In Clock " , " Midi In Clock " , " Midi Start/Stop " , " 1/All % & 1/All " }
},
{ // NumberPage = 10 ====> Help Upper Controls/ Select
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ " @#$ <>~~ 9:;=>?@~~" , " @#$ <>~~ 9:;=>?@~~" , " @#$ <>~~ 9:;=>?@~~" , " @#$ <>~~ 9:;=>?@~~" , " @#$%&<>~~ 9:;=>?@~~" },
{ "10[Potmeter_Links]_0" , "10[Potmeter_Rechts]1" , "10_[Schaks_Links]__2" , "10_[Schaks_Rechts]_3" , "10__[Toon_Select]__4" },
{ " $ $ $ $ " , " $ $ $ $ " , " @ @ @ @ " , " @ @ @ @ " , "Midi/ Monofoon " },
{ "AttacDecaySustaRelea" , "Duty FilteResonVolum" , "DriehZaag Blok Ruis " , "OnOff Lp Bp Hp " , " % & " },
{ "<---ADSR Envelop--->" , "Blok <-Filter-> " , "<-----Golfvorm----->" , "<------Filter------>" , " Controle Polyfoon" }
},
{ // NumberPage = 11 ====> Help Lower Controls/ Select
// NumberUnit = 0 , NumberUnit = 1 , NumberUnit = 2 , NumberUnit = 3 , NumberUnit = 4
{ "{}#$ <>~~?@:;=>AB~~" , "{}#$ <>~~?@:;=>AB~~" , "{}#$ <>~~?@:;=>AB~~" , "{}#$ <>~~?@:;=>AB~~" , "{}#$%&<>~~?@:;=>AB~~" },
{ "11[Potmeter_Links]_0" , "11[Potmeter_Rechts]1" , "11_[Schaks_Links]__2" , "11_[Schaks_Rechts]_3" , "11___[Set/Play]____4" },
{ "<Noot/Fre><NootAkko>" , " <Transpos> " , "<-----Modulatie---->" , " " , "Const-> <-Const" },
{ "Noot Fine Noot2Noot3" , " nc Noot OctafAkord" , "Gate Sync Ringm Test" , " nc nc nc nc " , " Set # # Play" },
{ " $ $ $ $ " , " $ $ $ $ " , " # # # # " , " # # # # " , "Puls--} {--Puls" }
}
};
//=====================================================================================
void Write_HelpToLcd(byte page, byte unit, byte lcdkleur)
{ // Write the title-text of the help.
if (Do_ShowLegend != 0)
{ // Display All Data onto the Lcd.
// Sent Characters
Clear_Led(0,19);
Lcd_Clr();
Write_Lcdback(lcdkleur);
Lcd_Gotoxy(0,0); Lcd_Print("____[ArSid_Help]____");
Lcd_Gotoxy(0,1); Lcd_Print(" ");
Lcd_Gotoxy(0,2); Lcd_Print(" ");
Lcd_Gotoxy(0,3); Lcd_Print(" ");
Do_ShowLegend = 0;
}
}
void Poke_HelpPageChars(byte page, byte unit)
{ // Store some Self-defined Characters into the Lcd memory.
// Look at the chars of the first-line, position [10]..[17]
// And copy that character-number (= ASC() function).
// FOR-loop 0 to 7; copy char into Lcd
// Poke_Char (0, Asc(Char), Lcd_Char);
char cc=' ';
for (byte qc=0; qc<=7; qc=qc+1)
{ // Get a char from the help-screen
cc = pgm_read_byte_near( &(HelpText_Lines[page][0][unit][10+qc]) );
// Now check if the Char is <Space>
if (cc != ' ')
{ // Copy the Self-Defined Char
Poke_Char (0, cc, qc);
}
} // next qc
}
void Display_HelpPage(byte page, byte unit, byte lcdkleur)
{ // Display More Help on the Display
// First Copy some self-defines chars into the Lcd Memory
Poke_HelpPageChars(page, unit);
// Declare some temp vars
char cc = ' ';
char c2 = ' ';
// Display one page of Help
for (byte qy=1; qy<=Max_HelpLines; qy=qy+1)
{ Lcd_Gotoxy(0,qy-1);
for (byte qx=0; qx<=19; qx=qx+1)
{ // Get Help Page Char
cc = pgm_read_byte_near( & (HelpText_Lines[page][qy][unit][qx]) );
// Replace some chars into self-defined chars
for (byte qc=0; qc<=7; qc=qc+1)
{ // Get a char from the help-screen
c2 = pgm_read_byte_near( &(HelpText_Lines[page][0][unit][qc]) );
// Now check if the Char is special
if ( (cc == c2) && (c2 != ' ') )
{ // Replace the Char
cc = qc;
}
} // next qc
// Display the char onto the screen.
Lcd_Out(1, cc);
} // next qx
} // next qy
// // In case of debugging, you can display the PAGE and UNIT number in the title-line
// Lcd_Gotoxy( 0,0); Lcd_Number(page ,1);
// Lcd_Gotoxy(19,0); Lcd_Number(unit ,1);
}
void Do_PageHelp(byte page, byte unit, byte lcdkleur)
{ // Show some Page Help on the Display
byte Do_ShowHelp = 255;
// Continue, until some keys are activated
boolean continue_loop=true;
while (continue_loop)
{ // First check if Pages must be shown
if ( Do_ShowHelp != 0)
{ // Now Show the HelpText
Write_HelpToLcd (page, unit, lcdkleur);
Display_HelpPage (page, unit, lcdkleur);
Do_ShowHelp = 0;
}
// Wait till Keys are Released
while (KeysCrsr != 0)
{ // Keep on checking
Check_KeysCrsr();
}
// Check Cursor Switches to scroll and to stop this mode.
Check_KeysCrsr();
// Now Handle the Crsr Locally
if (KeysCrsr != 0)
{ // A key is pressed
if ( (KeysCrsr & MaskLeft) != 0)
{ // Help Left
if (unit > 0) { unit = unit -1; }
else { unit = Max_HelpUnits;
KeysCrsr = KeysCrsr | MaskUp;
}
Do_ShowHelp = 3;
}
if ( (KeysCrsr & MaskRight) != 0)
{ // Help Right
if (unit < Max_HelpUnits) { unit = unit +1; }
else { unit = 0;
KeysCrsr = KeysCrsr | MaskDown;
}
Do_ShowHelp = 4;
}
if ( (KeysCrsr & MaskUp) != 0)
{ // Help Up
if (page > 0) { page = page -1; }
else { page = Max_HelpPage; }
Do_ShowHelp = 1;
}
if ( (KeysCrsr & MaskDown) != 0)
{ // Help Down
if (page < Max_HelpPage) { page = page +1; }
else { page = 0; }
Do_ShowHelp = 2;
}
if ( (KeysCrsr & MaskHelp) != 0)
{ // Quiet the Sids
Display_HelpOnHelp(page,unit,lcdkleur);
}
if ( (KeysCrsr & MaskQuiet) != 0)
{ // Quiet the Sids
Sid_Init();
}
if ( (KeysCrsr & MaskEscape) != 0)
{ // Escape The Help
Show_Escape();
continue_loop = false;
}
}
}
// Wait till Keys are Released
while (KeysCrsr != 0)
{ // Keep on checking
Check_KeysCrsr();
}
// Clear Screen and "Clearing" Some Vars
Lcd_Clr();
KeysCrsr = 0;
Do_Sid_Data = 255;
Do_ShowLegend = 255;
Do_ShowData = 255;
}
void Display_HelpOnHelp(byte page, byte unit, byte lcdkleur)
{ // Display Help The Screen - Help on Help
// Show the text
Lcd_Gotoxy(0,0); Lcd_Print("?__[Help-On-Help]__?");
Lcd_Gotoxy(0,1); Lcd_Print("Blader door deze ");
Lcd_Gotoxy(0,2); Lcd_Print("pagina's met de Crsr");
Lcd_Gotoxy(0,3); Lcd_Print("Toetsen. <Esc>=Einde");
}
void Display_CursorHelp(byte page, byte unit, byte lcdkleur)
{ // Display Help On The Screen - Help on Cursor Keys
if (Do_ShowLegend != 0)
{ // Display All Data onto the Lcd.
Lcd_Clr();
Write_Lcdback(lcdkleur);
// Store Music Notes into the Lcd memory
Poke_Char (54,0,6);
Poke_Char (54,1,7);
// Show the text
Lcd_Gotoxy(0,0); Lcd_Print("\7___[Cursor_Keys]__\6");
Lcd_Gotoxy(0,1); Lcd_Print("Esc-Help Left-Right");
Lcd_Gotoxy(0,2); Lcd_Print(" Quiet PageUp ");
Lcd_Gotoxy(0,3); Lcd_Print(" Enter PageDown ");
Do_ShowLegend = 0;
}
}
//=====================================================================================
#endif // ARSID_HELP_CPP
|