forked from Ho-Ro/ComponentTester
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.c
More file actions
1346 lines (1024 loc) · 31.2 KB
/
display.c
File metadata and controls
1346 lines (1024 loc) · 31.2 KB
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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* ************************************************************************
*
* common display functions and common functions for LCD modules
*
* (c) 2015-2021 by Markus Reschke
*
* ************************************************************************ */
/*
* local constants
*/
/* source management */
#define DISPLAY_C
/*
* include header files
*/
/* local includes */
#include "config.h" /* global configuration */
#include "common.h" /* common header file */
#include "variables.h" /* global variables */
#include "functions.h" /* external functions */
/* ************************************************************************
* display of characters and strings
* ************************************************************************ */
/*
* next line automation
* - move to next line
* - clear display if no lines are left
* - controlled by global variable UI.LineMode
*
* Flags:
* - LINE_STD move to next line,
* clear display when last line is exceeded
* - LINE_KEY same as LINE_STD,
* but also wait for test key/timeout
* - LINE_KEEP keep first line when clearing the display
*/
void Display_NextLine(void)
{
uint8_t Mode; /* line mode */
uint8_t Line; /* line number */
/*
* display module
*/
#if defined (UI_SERIAL_COPY) || defined (UI_SERIAL_COMMANDS)
if (Cfg.OP_Control & OP_OUT_LCD) /* copy to LCD enabled */
{
#endif
Mode = UI.LineMode; /* get current mode */
Line = UI.CharPos_Y; /* get current line number */
/* check if we reached the last line */
if (Line == UI.CharMax_Y)
{
if (Mode & LINE_KEY) WaitKey(); /* wait for key press */
/* clear screen */
if (Mode & LINE_KEEP) /* keep first line */
{
Line = UI.CharMax_Y; /* start at the last line */
while (Line > 1)
{
LCD_ClearLine(Line); /* clear line */
Line--; /* next line */
}
LCD_CharPos(1, 2); /* move to second line */
}
else /* clear complete screen */
{
LCD_Clear(); /* clear screen */
}
}
else
{
/* simply move to the next line */
Line++; /* add one line */
LCD_CharPos(1, Line); /* move to new line */
}
#if defined (UI_SERIAL_COPY) || defined (UI_SERIAL_COMMANDS)
}
#endif
/*
* TTL serial
*/
#if defined (UI_SERIAL_COPY) || defined (UI_SERIAL_COMMANDS)
if (Cfg.OP_Control & OP_OUT_SER) /* copy to serial enabled */
{
Serial_NewLine(); /* serial: new line */
}
#endif
}
#ifdef UI_KEY_HINTS
/*
* last line automation for key hint
*/
void Display_LastLine(void)
{
uint8_t Line; /* line number */
/*
* display module
*/
#if defined (UI_SERIAL_COPY) || defined (UI_SERIAL_COMMANDS)
if (Cfg.OP_Control & OP_OUT_LCD) /* copy to LCD enabled */
{
#endif
Line = UI.CharPos_Y; /* get current line number */
/* check if we reached the last line */
if (Line == UI.CharMax_Y)
{
WaitKey(); /* wait for key press */
LCD_ClearLine(Line); /* clear last line */
LCD_CharPos(1, Line); /* move to start of last line */
MilliSleep(500); /* smooth UI */
}
#if defined (UI_SERIAL_COPY) || defined (UI_SERIAL_COMMANDS)
}
#endif
}
#endif
/*
* display a single character
* - wrapper for outputting a character to different channels
* - if we have only the display we simply create an alias for
* LCD_Char() in functions.h to save a few bytes
*
* requires:
* - Char: character
*/
#if defined (UI_SERIAL_COPY) || defined (UI_SERIAL_COMMANDS)
void Display_Char(unsigned char Char)
{
/*
* display module
*/
if (Cfg.OP_Control & OP_OUT_LCD) /* copy to LCD enabled */
{
LCD_Char(Char); /* send char to display */
}
/*
* TTL serial
*/
if (Cfg.OP_Control & OP_OUT_SER) /* copy to serial enabled */
{
Serial_Char(Char); /* send char to serial */
}
}
#endif
/*
* display a fixed string stored in EEPROM/Flash
*
* requires:
* - pointer to fixed string
*/
void Display_EEString(const unsigned char *String)
{
unsigned char Char;
/* read characters until we get the terminating 0 */
while ((Char = DATA_read_byte(String)))
{
Display_Char(Char); /* send character */
String++; /* next one */
}
}
/* ************************************************************************
* convenience functions to save some bytes of flash memory
* ************************************************************************ */
/*
* display probe number
* - probe-1 -> '1'
* - probe-2 -> '2'
* - probe-3 -> '3'
*
* requires:
* - probe/testpin ID (0-2)
*/
void Display_ProbeNumber(uint8_t Probe)
{
#ifdef UI_PROBE_COLORS
uint16_t Color; /* color value */
Color = UI.PenColor; /* save current color */
UI.PenColor = ProbeColors[Probe]; /* set probe color */
#endif
/* since probe-1 is 0 we simply add the value to ASCII '1' */
Display_Char('1' + Probe); /* send char */
#ifdef UI_PROBE_COLORS
UI.PenColor = Color; /* restore old color */
#endif
}
/*
* display a space
*/
void Display_Space(void)
{
Display_Char(' '); /* print a space */
}
/*
* display a minus sign
*/
void Display_Minus(void)
{
Display_Char('-'); /* print a minus */
}
/*
* display a colon
*/
void Display_Colon(void)
{
Display_Char(':'); /* print a minus */
}
/*
* display a fixed string stored in EEPROM followed by a space
*
* requires:
* - pointer to fixed string
*/
void Display_EEString_Space(const unsigned char *String)
{
Display_EEString(String); /* display string */
Display_Space(); /* print space */
}
/*
* move to the next line and
* display a fixed string stored in EEPROM
*
* requires:
* - pointer to fixed string
*/
void Display_NL_EEString(const unsigned char *String)
{
Display_NextLine();
Display_EEString(String); /* display string */
}
/*
* move to the next line and
* display a fixed string stored in EEPROM followed by a space
*
* requires:
* - pointer to fixed string
*/
void Display_NL_EEString_Space(const unsigned char *String)
{
Display_NextLine();
Display_EEString(String); /* display string */
Display_Space(); /* print space */
}
/*
* clear line #2 of display
* - cursor is set to first char of line
*/
void LCD_ClearLine2(void)
{
LCD_ClearLine(2); /* clear line #2 */
LCD_CharPos(1, 2); /* move to beginning of line #2 */
}
#ifdef UI_SERIAL_COPY
/*
* enable output to TTL serial and send newline
* - output to display and serial
*/
void Display_Serial_On(void)
{
Serial_NewLine(); /* serial: new line */
Cfg.OP_Control |= OP_OUT_SER; /* enable output to serial */
}
/*
* disable output to TTL serial and send newline
* - keep output to display enabled
*/
void Display_Serial_Off(void)
{
Cfg.OP_Control &= ~OP_OUT_SER; /* disable output to serial */
Serial_NewLine(); /* serial: new line */
}
#endif
#if defined (UI_SERIAL_COMMANDS) || defined (SW_DISPLAY_REG)
/*
* set output to TTL serial
* - and disable output to display
*/
void Display_Serial_Only(void)
{
Cfg.OP_Control &= ~OP_OUT_LCD; /* disable display output */
Cfg.OP_Control |= OP_OUT_SER; /* enable serial output */
}
/*
* set output to display
* - and disable output to TTL serial
*/
void Display_LCD_Only(void)
{
Cfg.OP_Control &= ~OP_OUT_SER; /* disable serial output */
Cfg.OP_Control |= OP_OUT_LCD; /* enable display output */
}
#endif
#ifdef UI_SERIAL_COMMANDS
/*
* display a fixed string stored in EEPROM
* and move to next line
*
* requires:
* - pointer to fixed string
*/
void Display_EEString_NL(const unsigned char *String)
{
Display_EEString(String); /* display string */
Display_NextLine(); /* new line */
}
#endif
#ifdef UI_COLORED_TITLES
/*
* display a fixed string stored in EEPROM using a specific color
*
* requires:
* - pointer to fixed string
* - color
*/
void Display_ColoredEEString(const unsigned char *String, uint16_t Color)
{
uint16_t OldColor;
OldColor = UI.PenColor; /* get current color */
UI.PenColor = Color; /* set new color */
Display_EEString(String); /* display string */
UI.PenColor = OldColor; /* reset color to old one */
}
/*
* display a fixed string stored in EEPROM using a specific color and
* folowed by a space
*
* requires:
* - pointer to fixed string
* - color
*/
void Display_ColoredEEString_Space(const unsigned char *String, uint16_t Color)
{
Display_ColoredEEString(String, Color); /* display string */
Display_Space(); /* print space */
}
/*
* set pen color to COLOR_TITLE
*/
void Display_UseTitleColor(void)
{
UI.PenColor = COLOR_TITLE; /* set pen color */
}
/*
* set pen color to COLOR_PEN
*/
void Display_UsePenColor(void)
{
UI.PenColor = COLOR_PEN; /* reset pen color */
}
#endif
/* ************************************************************************
* display of values and units
* ************************************************************************ */
#if defined (FUNC_DISPLAY_HEXBYTE) || defined (FUNC_DISPLAY_HEXVALUE)
/*
* display single hexadecimal digit
*
* requires:
* - value to display (0-15)
*/
void Display_HexDigit(uint8_t Digit)
{
/*
* convert value into hex digit:
* - 0-9: ascii 48-57
* - A-F: ascii 65-70
* a-f: ascii 97-102
*/
if (Digit < 10) /* 0-9 */
{
/* char '0' is ASCII 48 */
Digit += 48; /* char 0-9 */
}
else /* a-f */
{
#ifdef UI_HEX_UPPERCASE
/* char 'A' is ASCII 65 */
Digit += (65 - 10); /* char A-F */
#else
/* char 'a' is ASCII 97 */
Digit += (97 - 10); /* char a-f */
#endif
}
Display_Char(Digit); /* display digit */
}
#endif
#ifdef FUNC_DISPLAY_HEXBYTE
/*
* display byte as hexadecimal number
*
* requires:
* - value to display (0-255)
*/
void Display_HexByte(uint8_t Value)
{
uint8_t Digit;
/* first digit */
Digit = Value / 16;
Display_HexDigit(Digit);
/* second digit */
Digit = Value % 16;
Display_HexDigit(Digit);
}
#endif
#ifdef FUNC_DISPLAY_HEXVALUE
/*
* display value as hexadecimal number
*
* requires:
* - Value: value to display
* - Bits: max. bit depth of value (1-16)
*/
void Display_HexValue(uint16_t Value, uint8_t Bits)
{
uint8_t Nibble[4]; /* nibbles */
uint8_t n; /* counter */
/* calculate number of nibbles/digits */
Bits += 3; /* for a partial nibble */
Bits /= 4; /* number of nibbles */
/* get nibbles (from LSB to MSB) */
n = 0;
while (n < Bits)
{
Nibble[n] = Value & 0x000F; /* get LSB nibble */
Value >>= 4; /* shift one nibble */
n++; /* next nibble */
}
/* output nibbles (from MSB to LSB) */
n = Bits;
while (n > 0)
{
Display_HexDigit(Nibble[n - 1]);
n--; /* next nibble */
}
}
#endif
#if defined (FUNC_DISPLAY_FULLVALUE) || defined (FUNC_DISPLAY_SIGNEDFULLVALUE)
/*
* display unsigned value plus unit
* - outputs all digits
*
* requires:
* - Value: unsigned value
* - DecPlaces: decimal places (0 = none)
* - Unit: character for unit (0 = none)
*/
void Display_FullValue(uint32_t Value, uint8_t DecPlaces, unsigned char Unit)
{
uint8_t n; /* counter */
uint8_t Length; /* string length */
uint8_t Pos = 0; /* position of dot */
/* convert value into string */
ultoa(Value, OutBuffer, 10); /* radix 10: max. 10 chars + /0 */
Length = strlen(OutBuffer); /* get string length */
/* determine position of dot */
if (DecPlaces == 0) /* no dot requested */
{
Pos = 100; /* disable dot */
}
else if (Length >= DecPlaces) /* position within string */
{
Pos = Length - DecPlaces; /* position of dot */
DecPlaces = 0; /* no additional zeros needed */
}
else /* position outside string */
{
DecPlaces = DecPlaces - Length; /* number of zeros after dot */
}
/* leading zero (followed by dot) */
if (Pos == 0) Display_Char('0'); /* display: 0 */
/* display digits */
n = 0;
while (n < Length) /* process string */
{
if (n == Pos) /* at position of dot */
{
#ifdef UI_COMMA
Display_Char(','); /* display: , */
#else
Display_Char('.'); /* display: . */
#endif
while (DecPlaces > 0) /* fill in more zeros if needed */
{
Display_Char('0'); /* display: 0 */
DecPlaces--;
}
}
Display_Char(OutBuffer[n]); /* display digit */
n++; /* next digit */
}
/* display unit */
if (Unit) Display_Char(Unit);
}
#endif
#ifdef FUNC_DISPLAY_SIGNEDFULLVALUE
/*
* display signed value plus unit
* - outputs all digits
*
* requires:
* - Value: signed value
* - DecPlaces: decimal places (0 = none)
* - Unit: character for unit (0 = none)
*/
void Display_SignedFullValue(int32_t Value, uint8_t DecPlaces, unsigned char Unit)
{
/* take care about sign */
if (Value < 0) /* negative value */
{
Display_Minus(); /* display: "-" */
Value = -Value; /* make value positive */
}
/* and display unsigned value */
Display_FullValue((uint32_t)Value, DecPlaces, Unit);
}
#endif
/*
* display unsigned value plus unit (character)
* - scales value to max. 4 digits excluding "." and unit
*
* requires:
* - unsigned value
* - exponent of factor related to base unit (value * 10^x)
* e.g: p = 10^-12 -> -12
* - unit character (0 = none)
*/
void Display_Value(uint32_t Value, int8_t Exponent, unsigned char Unit)
{
unsigned char Prefix = 0; /* prefix character */
uint8_t Offset = 0; /* exponent offset to lower 10^3 step */
uint8_t Index; /* index ID */
uint8_t Length; /* string length */
/* scale value down to 4 digits */
while (Value >= 10000)
{
Value += 5; /* for automagic rounding */
Value = Value / 10; /* scale down by 10^1 */
Exponent++; /* increase exponent by 1 */
}
/*
* determine prefix and offset (= number of digits right of dot)
*/
if (Exponent >= -15) /* prevent index underflow */
{
Exponent += 15; /* shift exponent to be >= 0 */
Index = Exponent / 3; /* number of 10^3 steps */
Offset = Exponent % 3; /* offset to lower 10^3 step */
if (Offset > 0) /* dot required */
{
Index++; /* upscale prefix */
Offset = 3 - Offset; /* reverse value (1 or 2) */
}
/* look up prefix in table */
if (Index < NUM_PREFIXES) /* prevent array overflow */
{
Prefix = DATA_read_byte(&Prefix_table[Index]);
}
}
/*
* display value
*/
/* convert value into string */
utoa((uint16_t)Value, OutBuffer, 10); /* radix 10: max. 5 chars + /0 */
Length = strlen(OutBuffer); /* get string length */
/* we misuse Exponent for the dot position */
Exponent = Length - Offset; /* calculate position */
if (Exponent <= 0) /* we have to prepend "0." */
{
/* 0: factor 10 / -1: factor 100 */
Display_Char('0'); /* display: 0 */
#ifdef UI_COMMA
Display_Char(','); /* display: , */
#else
Display_Char('.'); /* display: . */
#endif
if (Exponent < 0) /* factor 100 */
{
Display_Char('0'); /* additional 0 */
}
}
if (Offset == 0) /* no dot needed */
{
Exponent = -1; /* disable dot */
}
/* adjust position to match array or disable dot if set to 0 */
Exponent--;
/* display value and add dot if requested */
Index = 0;
while (Index < Length) /* loop through string */
{
Display_Char(OutBuffer[Index]); /* display char/digit */
if (Index == Exponent) /* starting point of decimal fraction */
{
#ifdef UI_COMMA
Display_Char(','); /* display: , */
#else
Display_Char('.'); /* display: . */
#endif
}
Index++; /* next one */
}
/* display prefix and unit */
if (Prefix) Display_Char(Prefix);
if (Unit) Display_Char(Unit);
}
/*
* display signed value and unit
* - max. 4 digits excluding sign, "." and unit
*
* requires:
* - signed value
* - exponent of factor related to base unit (value * 10^x)
* e.g: p = 10^-12 -> -12
* - unit character (0 = none)
*/
void Display_SignedValue(int32_t Value, int8_t Exponent, unsigned char Unit)
{
/* take care about sign */
if (Value < 0) /* negative value */
{
Display_Minus(); /* display: "-" */
Value = -Value; /* make value positive */
}
/* and display unsigned value */
Display_Value((uint32_t)Value, Exponent, Unit);
}
#ifdef FUNC_EVALUE
/*
* display E norm value
*
* requires:
* - Value: unsigned value (2 or 3 digits)
* - Scale: exponent/multiplier (10^n with n >= -12)
* - Unit: unit character
*/
void Display_EValue(uint16_t Value, int8_t Scale, unsigned char Unit)
{
uint8_t Offset = 0; /* exponent offset to lower 10^3 step */
int8_t Temp; /* temporary value */
/* calculate exponent offset to lower 10^3 step */
Temp = Scale; /* copy exponent */
Temp += 12; /* shift exponent to be >= 0 */
Offset = Temp % 3; /* offset to lower 10^3 step */
/*
* Since Display_Value() scales values to the next higher 10^3 step
* we have to beautify some special cases to prevent things like
* 0.15M (150k looks much nicer).
*/
if ((Offset == 1) && (Value < 100)) /* 0.01u and 0.11u */
{
/* scale value to lower 10^3 step */
Value *= 10; /* *10 */
Scale--; /* /10 */
}
#if 0
else if ((Offset == 2) && (Value < 10)) /* 0.1u */
{
/* scale value to lower 10^3 step */
Value *= 100; /* *100 */
Scale -= 2; /* /100 */
}
#endif
Display_Value(Value, Scale, Unit); /* display value */
}
#endif
#ifdef FUNC_EIA96
/*
* display EIA-96 code
*
* requires:
* - Index: index number of norm value (1-96)
* - Scale: exponent/multiplier (10^n with n >= -12)
*/
void Display_EIA96(uint8_t Index, int8_t Scale)
{
uint8_t n; /* counter */
unsigned char MultCode; /* multiplier code */
/*
* value code (index number of value)
* - 2 digits
* - prepend 0 for single digit number
*/
if (Index < 10) /* single digit */
{
Display_Char('0'); /* display: 0 */
}
Display_FullValue(Index, 0, 0); /* display index number */
/*
* multiplier code
* - 0.001 0.01 0.1 1 10 100 1k 10k 100k
* Z Y/R X/S A B/H C D E F
*/
n = 0; /* reset index counter */
/* get table index for multiplier */
while (Scale > -3) /* 10^-3 / 0.001 */
{
Scale--; /* decrease multiplier */
n++; /* increase index */
}
/* read multiplier code */
MultCode = DATA_read_byte(&EIA96_Mult_table[n]);
Display_Char(MultCode); /* display multiplier code */
}
#endif
/* ************************************************************************
* fancy pinout
* ************************************************************************ */
#ifdef SW_SYMBOLS
/*
* external variables
*/
/* pin position lookup table from symbols_<size>_<format>.h */
extern const uint8_t PinTable[];
/*
* display fancy probe number
* - display pin numbers left and right of symbol
*
* requires:
* - Probe: probe number
* - Index: pin index (0-2)
*/
void LCD_FancyProbeNumber(uint8_t Probe, uint8_t Index)
{
uint8_t *Table; /* pointer to pin table */
uint8_t Data; /* pinout data */
uint8_t x; /* x position */
uint8_t y; /* y position */
/* calculate start address of pinout details */
Table = (uint8_t *)&PinTable; /* start address of pin table */
x = Check.Symbol * 3; /* offset for symbol's pin details */
Table += x; /* start address of symbol's pin details */
Table += Index; /* address of specific pin's details */
Data = pgm_read_byte(Table); /* read pinout details */
if (Data != PIN_NONE) /* show pin */
{
/* determine position based on pinout data */
/* set default position (top left) */
x = UI.SymbolPos_X - 1; /* left of symbol */
y = UI.SymbolPos_Y; /* top line of symbol */
if (Data & PIN_RIGHT) /* right */
{
x += UI.SymbolSize_X + 1; /* right of symbol */
}
if (Data & PIN_BOTTOM) /* bottom */
{
y += UI.SymbolSize_Y - 1; /* bottom line of symbol */
}
/* show probe number */
LCD_CharPos(x, y); /* set position */
Display_ProbeNumber(Probe); /* display probe number */
}
}
/*
* show fancy pinout for semiconductors
* - display a nice component symbol