-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.js
More file actions
10003 lines (7245 loc) · 460 KB
/
main.js
File metadata and controls
10003 lines (7245 loc) · 460 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
let mainApp;
const startSimulator = (app) => {
mainApp = app;
sys.timer = setInterval(() => {
mainApp.on_sys_timer();
}, sys.onsystimerperiod * 10);
mainApp.on_sys_init();
}
const TiOS = function() {
this.on_sys_init = function () {
}
this.on_sys_timer = function () {
}
this.on_button_pressed = function () {
}
}
const bt = {}
const wln = {}
const tpram = {}
const fd = {}
const ssi = {}
const kp = {}
const lcd = {}
const rtc = {}
const beep = {}
const io = {}
const pppoe = {}
const net = {}
const sys = {}
const stor = {}
const sock = {}
const ser = {}
const romfile = {}
const ppp = {}
const pat = {}
const button = {}
const PL_BT_FC_ENABLED = 1;
const PL_BT_FC_DISABLED = 0;
const PL_BT_EVENT_DISABLED = 3;
const PL_BT_EVENT_ENABLED = 2;
const PL_BT_EVENT_DISCONNECTED = 1;
const PL_BT_EVENT_CONNECTED = 0;
const PL_WLN_BT_EMULATION_MODE_MICROCHIP = 2;
const PL_WLN_BT_EMULATION_MODE_NORDIC = 1;
const PL_WLN_BT_EMULATION_MODE_TI = 0;
const PL_WLN_MFGTX_RATE_72M = 13;
const PL_WLN_MFGTX_RATE_54M = 12;
const PL_WLN_MFGTX_RATE_48M = 11;
const PL_WLN_MFGTX_RATE_36M = 10;
const PL_WLN_MFGTX_RATE_24M = 9;
const PL_WLN_MFGTX_RATE_18M = 8;
const PL_WLN_MFGTX_RATE_12M = 7;
const PL_WLN_MFGTX_RATE_9M = 6;
const PL_WLN_MFGTX_RATE_6M = 5;
const PL_WLN_MFGTX_RATE_22M = 4;
const PL_WLN_MFGTX_RATE_11M = 3;
const PL_WLN_MFGTX_RATE_5_5M = 2;
const PL_WLN_MFGTX_RATE_2M = 1;
const PL_WLN_MFGTX_RATE_1M = 0;
const PL_WLN_MFGTX_MODE_DATATX = 2;
const PL_WLN_MFGTX_MODE_BURST = 1;
const PL_WLN_MFGTX_MODE_CONTINUOUS = 0;
const PL_WLN_WPA_CAST_MULTICAST = 1;
const PL_WLN_WPA_CAST_UNICAST = 0;
const PL_WLN_WPA_ALGORITHM_AES = 1;
const PL_WLN_WPA_ALGORITHM_TKIP = 0;
const PL_WLN_WPA_WPA2_PSK = 2;
const PL_WLN_WPA_WPA1_PSK = 1;
const PL_WLN_WPA_DISABLED = 0;
const PL_WLN_WEP_MODE_128 = 2;
const PL_WLN_WEP_MODE_64 = 1;
const PL_WLN_WEP_MODE_DISABLED = 0;
const PL_WLN_OWN_ADHOC = 2;
const PL_WLN_ASCAN_INFRASTRUCTURE = 1;
const PL_WLN_SCAN_ALL = 0;
const PL_WLN_TASK_SET_EAP_TTLS = 13;
const PL_WLN_TASK_SET_EAP_PEAP = 12;
const PL_WLN_TASK_SET_EAP_TLS = 11;
const PL_WLN_TASK_UPDATERSSI = 10;
const PL_WLN_TASK_ACTIVESCAN = 9;
const PL_WLN_TASK_SETWPA = 8;
const PL_WLN_TASK_NETWORK_STOP = 7;
const PL_WLN_TASK_NETWORK_START = 6;
const PL_WLN_TASK_DISASSOCIATE = 5;
const PL_WLN_TASK_SETWEP = 4;
const PL_WLN_TASK_SETTXPOWER = 3;
const PL_WLN_TASK_ASSOCIATE = 2;
const PL_WLN_TASK_SCAN = 1;
const PL_WLN_TASK_IDLE = 0;
const PL_WLN_EVENT_DISASSOCIATED = 1;
const PL_WLN_EVENT_DISABLED = 0;
const PL_WLN_UPGRADE_REGION_MONITOR = 1;
const PL_WLN_UPGRADE_REGION_MAIN = 0;
const PL_WLN_MODULE_TYPE_WA2000 = 1;
const PL_WLN_MODULE_TYPE_GA1000 = 0;
const PL_WLN_DOMAIN_JAPAN = 2;
const PL_WLN_DOMAIN_EU = 1;
const PL_WLN_DOMAIN_FCC = 0;
const WIFI_PHY_11N_5G = 11;
const WIFI_PHY_11AGN_MIXED = 10;
const WIFI_PHY_11BGN_MIXED = 9;
const WIFI_PHY_11AN_MIXED = 8;
const WIFI_PHY_11GN_MIXED = 7;
const WIFI_PHY_11N_2_4G = 6;
const WIFI_PHY_11ABGN_MIXED = 5;
const WIFI_PHY_11G = 4;
const WIFI_PHY_11ABG_MIXED = 3;
const WIFI_PHY_11A = 2;
const WIFI_PHY_11B = 1;
const WIFI_PHY_11BG_MIXED = 0;
const PL_WLN_OWN_NETWORK = 2;
const PL_WLN_ASSOCIATED = 1;
const PL_WLN_NOT_ASSOCIATED = 0;
const PL_WLN_BSS_MODE_ADHOC = 1;
const PL_WLN_BSS_MODE_INFRASTRUCTURE = 0;
const FD_ERROR_MOUNT_JOURNAL_COMMITTING_FAILED2 = 110;
const FD_ERROR_MOUNT_JOURNAL_COMMITTING_FAILED = 109;
const FD_ERROR_MOUNT_JOURNAL_DATA_INVALID = 108;
const FD_ERROR_FIND_GNSOFC_CHAIN_ERROR = 107;
const FD_ERROR_FIND_GNSOFC_CS_ERROR_1 = 106;
const FD_ERROR_FIND_GNSOFC_READ_ERROR_1 = 105;
const FD_ERROR_FIND_DATASECTOR_CS_ERROR_3 = 104;
const FD_ERROR_FIND_DATASECTOR_READ_ERROR_3 = 103;
const FD_ERROR_FIND_DATASECTOR_CS_ERROR_2 = 102;
const FD_ERROR_FIND_DATASECTOR_READ_ERROR_2 = 101;
const FD_ERROR_FIND_DATASECTOR_CS_ERROR_1 = 100;
const FD_ERROR_FIND_DATASECTOR_READ_ERROR_1 = 99;
const FD_ERROR_SAVE_FRT_SECTOR_WRITE_ERROR_2 = 98;
const FD_ERROR_SAVE_FRT_SECTOR_WRITE_ERROR_1 = 97;
const FD_ERROR_SAVE_FAT_SECTOR_WRITE_ERROR_2 = 96;
const FD_ERROR_SAVE_FAT_SECTOR_WRITE_ERROR_1 = 95;
const FD_ERROR_GNSOFC_WRITE_ERROR = 94;
const FD_ERROR_GNSOFC_CS_ERROR_4 = 93;
const FD_ERROR_GNSOFC_READ_ERROR_4 = 92;
const FD_ERROR_GNSOFC_CS_ERROR_3 = 91;
const FD_ERROR_GNSOFC_READ_ERROR_3 = 90;
const FD_ERROR_GNSOFC_CS_ERROR_2 = 89;
const FD_ERROR_GNSOFC_READ_ERROR_2 = 88;
const FD_ERROR_GNSOFC_CHAIN_ERROR_2 = 87;
const FD_ERROR_GNSOFC_CHAIN_ERROR_1 = 86;
const FD_ERROR_GNSOFC_CS_ERROR_1 = 85;
const FD_ERROR_GNSOFC_READ_ERROR_1 = 84;
const FD_ERROR_SETDATA_DATASECT_CS_ERROR_4 = 83;
const FD_ERROR_SETDATA_DATASECT_READ_ERROR_4 = 82;
const FD_ERROR_SETDATA_DATASECT_CS_ERROR_3 = 81;
const FD_ERROR_SETDATA_DATASECT_READ_ERROR_3 = 80;
const FD_ERROR_SETDATA_DATASECT_CS_ERROR_2 = 79;
const FD_ERROR_SETDATA_DATASECT_READ_ERROR_2 = 78;
const FD_ERROR_SETDATA_DATASECT_CS_ERROR_1 = 77;
const FD_ERROR_SETDATA_DATASECT_READ_ERROR_1 = 76;
const FD_ERROR_GETDATA_DATASECT_CS_ERROR_3 = 75;
const FD_ERROR_GETDATA_DATASECT_READ_ERROR_3 = 74;
const FD_ERROR_GETDATA_DATASECT_CS_ERROR_2 = 73;
const FD_ERROR_GETDATA_DATASECT_READ_ERROR_2 = 72;
const FD_ERROR_GETDATA_DATASECT_CS_ERROR_1 = 71;
const FD_ERROR_GETDATA_DATASECT_READ_ERROR_1 = 70;
const FD_ERROR_FINDFREESECTOR_FAT_CS_ERROR = 69;
const FD_ERROR_FINDFREESECTOR_FAT_READ_ERROR = 68;
const FD_ERROR_FINDFREESECTOR_FAT_INVALID_DATA = 67;
const FD_ERROR_FREESPACE_FAT_INVALID_DATA = 66;
const FD_ERROR_FREESPACE_FAT_CS_ERROR = 65;
const FD_ERROR_FREESPACE_FAT_READ_ERROR = 64;
const FD_ERROR_GETNEXTDIRMEMBER_FRT_CS_ERROR = 63;
const FD_ERROR_GETNEXTDIRMEMBER_FRT_READ_ERROR = 62;
const FD_ERROR_GETNUMFILES_FRT_CS_ERROR = 61;
const FD_ERROR_GETNUMFILES_FRT_READ_ERROR = 60;
const FD_ERROR_CREATE_FRT_WRITE_ERROR = 59;
const FD_ERROR_CREATE_FRT_CS_ERROR = 58;
const FD_ERROR_CREATE_FRT_READ_ERROR = 57;
const FD_ERROR_CREATE_DATASECTOR_WRITE_ERROR = 56;
const FD_ERROR_CREATE_FAT_WRITE_ERROR = 55;
const FD_ERROR_CREATE_FAT_CS_ERROR = 54;
const FD_ERROR_CREATE_FAT_READ_ERROR = 53;
const FD_ERROR_CREATE_COMMON_PORTION_ERROR = 52;
const FD_ERROR_DELETE_FAT_WRITE_ERROR_2 = 51;
const FD_ERROR_DELETE_INVALID_FAT_CHAIN_2 = 50;
const FD_ERROR_DELETE_INVALID_FAT_CHAIN_1 = 49;
const FD_ERROR_DELETE_FAT_CS_ERROR = 48;
const FD_ERROR_DELETE_FAT_READ_ERROR = 47;
const FD_ERROR_DELETE_FAT_WRITE_ERROR_1 = 46;
const FD_ERROR_DELETE_ENTRY_SECTOR_INVALID = 45;
const FD_ERROR_DELETE_FRT_WRITE_ERROR = 44;
const FD_ERROR_DELETE_FRT_CS_ERROR = 43;
const FD_ERROR_DELETE_FRT_READ_ERROR = 42;
const FD_ERROR_DELETE_COMMON_PORTION_ERROR = 41;
const FD_ERROR_SETATTRIBUTES_FRT_WRITE_ERROR = 40;
const FD_ERROR_SETATTRIBUTES_FRT_CS_ERROR = 39;
const FD_ERROR_SETATTRIBUTES_FRT_READ_ERROR = 38;
const FD_ERROR_SETATTRIBUTES_COMMON_PORTION_ERROR = 37;
const FD_ERROR_FLUSH_DATASECTOR_WRITE_ERROR = 36;
const FD_ERROR_OPEN_FRT_WRITE_ERROR = 35;
const FD_ERROR_OPEN_FRT_CS_ERROR = 34;
const FD_ERROR_OPEN_FRT_READ_ERROR = 33;
const FD_ERROR_OPEN_COMMON_PORTION_ERROR = 32;
const FD_ERROR_RENAME_FRT_WRITE_ERROR = 31;
const FD_ERROR_RENAME_FRT_CS_ERROR = 30;
const FD_ERROR_RENAME_FRT_READ_ERROR = 29;
const FD_ERROR_RENAME_COMMON_PORTION_ERROR = 28;
const FD_ERROR_FORMAT_FAT_WRITE_ERROR = 27;
const FD_ERROR_FORMAT_FRT_WRITE_ERROR = 26;
const FD_ERROR_FORMAT_ENDBOOT_WRITE_ERROR = 25;
const FD_ERROR_FORMAT_BOOT_WRITE_ERROR = 24;
const FD_ERROR_MOUNT_FAT_EMPTY_MAPPING_DETECTED = 23;
const FD_ERROR_MOUNT_FAT_INVALID_ACTIVE_SECTOR_COUNT = 22;
const FD_ERROR_MOUNT_FAT_WRITE_ERROR_2 = 21;
const FD_ERROR_MOUNT_FAT_WRITE_ERROR_1 = 20;
const FD_ERROR_FAT_LOGICAL_NUMBER_DUPLICATION = 19;
const FD_ERROR_MOUNT_FAT_LOGICAL_NUMBER_OOR = 18;
const FD_ERROR_MOUNT_FAT_CS_ERROR = 17;
const FD_ERROR_MOUNT_FAT_READ_ERROR = 16;
const FD_ERROR_MOUNT_FRT_EMPTY_MAPPING_DETECTED = 15;
const FD_ERROR_MOUNT_FRT_INVALID_ACTIVE_SECTOR_COUNT = 14;
const FD_ERROR_MOUNT_FRT_WRITE_ERROR_2 = 13;
const FD_ERROR_MOUNT_FRT_WRITE_ERROR_1 = 12;
const FD_ERROR_MOUNT_FRT_LOGICAL_NUMBER_DUPLICATION = 11;
const FD_ERROR_MOUNT_FRT_LOGICAL_NUMBER_OOR = 10;
const FD_ERROR_MOUNT_FRT_CS_ERROR = 9;
const FD_ERROR_MOUNT_FRT_READ_ERROR = 8;
const FD_ERROR_MOUNT_ENDBOOT_DATA_INVALID = 7;
const FD_ERROR_MOUNT_ENDBOOT_CS_ERROR = 6;
const FD_ERROR_MOUNT_ENDBOOT_READ_ERROR = 5;
const FD_ERROR_MOUNT_BOOT_DATA_INVALID = 4;
const FD_ERROR_MOUNT_BOOT_MARKER_INVALID = 3;
const FD_ERROR_MOUNT_BOOT_CS_ERROR = 2;
const FD_ERROR_MOUNT_BOOT_READ_ERROR = 1;
const FD_ERROR_NO_ADDITIONAL_ERROR_DATA = 0;
const PL_FD_FIND_LESSER_EQUAL = 5;
const PL_FD_FIND_LESSER = 4;
const PL_FD_FIND_GREATER_EQUAL = 3;
const PL_FD_FIND_GREATER = 2;
const PL_FD_FIND_NOT_EQUAL = 1;
const PL_FD_FIND_EQUAL = 0;
const PL_FD_CSUM_MODE_CALCULATE = 1;
const PL_FD_CSUM_MODE_VERIFY = 0;
const PL_FD_STATUS_FLASH_NOT_DETECTED = 16;
const PL_FD_STATUS_TRANSACTIONS_NOT_SUPPORTED = 15;
const PL_FD_STATUS_TRANSACTION_CAPACITY_EXCEEDED = 14;
const PL_FD_STATUS_TRANSACTION_NOT_YET_STARTED = 13;
const PL_FD_STATUS_TRANSACTION_ALREADY_STARTED = 12;
const PL_FD_STATUS_ALREADY_OPENED = 11;
const PL_FD_STATUS_NOT_OPENED = 10;
const PL_FD_STATUS_NOT_FOUND = 9;
const PL_FD_STATUS_NOT_READY = 8;
const PL_FD_STATUS_DATA_FULL = 7;
const PL_FD_STATUS_FILE_TABLE_FULL = 6;
const PL_FD_STATUS_DUPLICATE_NAME = 5;
const PL_FD_STATUS_INV_PARAM = 4;
const PL_FD_STATUS_FORMAT_ERR = 3;
const PL_FD_STATUS_CHECKSUM_ERR = 2;
const PL_FD_STATUS_FAIL = 1;
const PL_FD_STATUS_OK = 0;
const PL_SSI_ZMODE_ENABLED_ON_ZERO = 1;
const PL_SSI_ZMODE_ALWAYS_ENABLED = 0;
const PL_SSI_ACK_ALL_BUT_LAST = 3;
const PL_SSI_ACK_TX_ALL = 2;
const PL_SSI_ACK_RX = 1;
const PL_SSI_ACK_OFF = 0;
const PL_SSI_MODE_3 = 3;
const PL_SSI_MODE_2 = 2;
const PL_SSI_MODE_1 = 1;
const PL_SSI_MODE_0 = 0;
const PL_SSI_DIRECTION_LEFT = 1;
const PL_SSI_DIRECTION_RIGHT = 0;
const PL_KP_EVENT_LOCKEDUP = 5;
const PL_KP_EVENT_REPEATPRESSED = 4;
const PL_KP_EVENT_LONGPRESSED = 3;
const PL_KP_EVENT_PRESSED = 2;
const PL_KP_EVENT_RELEASED = 1;
const PL_KP_EVENT_LONGRELEASED = 0;
const PL_KP_MODE_BINARY = 1;
const PL_KP_MODE_MATRIX = 0;
const PL_LCD_TEXT_ORIENTATION_270 = 3;
const PL_LCD_TEXT_ORIENTATION_180 = 2;
const PL_LCD_TEXT_ORIENTATION_90 = 1;
const PL_LCD_TEXT_ORIENTATION_0 = 0;
const PL_LCD_TEXT_ALIGNMENT_BOTTOM_RIGHT = 8;
const PL_LCD_TEXT_ALIGNMENT_BOTTOM_CENTER = 7;
const PL_LCD_TEXT_ALIGNMENT_BOTTOM_LEFT = 6;
const PL_LCD_TEXT_ALIGNMENT_MIDDLE_RIGHT = 5;
const PL_LCD_TEXT_ALIGNMENT_MIDDLE_CENTER = 4;
const PL_LCD_TEXT_ALIGNMENT_MIDDLE_LEFT = 3;
const PL_LCD_TEXT_ALIGNMENT_TOP_RIGHT = 2;
const PL_LCD_TEXT_ALIGNMENT_TOP_CENTER = 1;
const PL_LCD_TEXT_ALIGNMENT_TOP_LEFT = 0;
const PL_LCD_PANELTYPE_COLOR = 1;
const PL_LCD_PANELTYPE_GRAYSCALE = 0;
const PL_BEEP_CANINT = 1;
const PL_BEEP_NOINT = 0;
const PL_NET_LINKSTAT_100BASET = 2;
const PL_NET_LINKSTAT_10BASET = 1;
const PL_NET_LINKSTAT_NOLINK = 0;
const PL_SYS_SPEED_FULL = 2;
const PL_SYS_SPEED_MEDIUM = 1;
const PL_SYS_SPEED_LOW = 0;
const PL_SYS_EXT_RESET_TYPE_RSTPIN = 4;
const PL_SYS_EXT_RESET_TYPE_BROWNOUT = 3;
const PL_SYS_EXT_RESET_TYPE_POWERUP = 2;
const PL_SYS_EXT_RESET_TYPE_WATCHDOG = 1;
const PL_SYS_EXT_RESET_TYPE_INTERNAL = 0;
const PL_SYS_RESET_TYPE_EXTERNAL = 1;
const PL_SYS_RESET_TYPE_INTERNAL = 0;
const PL_SYS_MODE_DEBUG = 1;
const PL_SYS_MODE_RELEASE = 0;
const PL_SOCK_HTTP_RQ_POST = 1;
const PL_SOCK_HTTP_RQ_GET = 0;
const PL_SOCK_PROTOCOL_RAW = 2;
const PL_SOCK_PROTOCOL_TCP = 1;
const PL_SOCK_PROTOCOL_UDP = 0;
const PL_SOCK_RECONMODE_3 = 3;
const PL_SOCK_RECONMODE_2 = 2;
const PL_SOCK_RECONMODE_1 = 1;
const PL_SOCK_RECONMODE_0 = 0;
const PL_SOCK_INCONMODE_ANY_IP_ANY_PORT = 3;
const PL_SOCK_INCONMODE_SPECIFIC_IP_ANY_PORT = 2;
const PL_SOCK_INCONMODE_SPECIFIC_IPPORT = 1;
const PL_SOCK_INCONMODE_NONE = 0;
const PL_SSTS_AC = 6;
const PL_SSTS_PC = 5;
const PL_SSTS_EST = 4;
const PL_SSTS_AO = 3;
const PL_SSTS_PO = 2;
const PL_SSTS_ARP = 1;
const PL_SSTS_CLOSED = 0;
const PL_SST_AC = NaN;
const PL_SST_PC = NaN;
const PL_SST_EST_AOPENED = NaN;
const PL_SST_EST_POPENED = NaN;
const PL_SST_EST = NaN;
const PL_SST_AO = NaN;
const PL_SST_PO = NaN;
const PL_SST_ARP = NaN;
const PL_SST_CL_DISCARDED_TOUT = 21;
const PL_SST_CL_DISCARDED_ARPFL = 20;
const PL_SST_CL_DISCARDED_AO_WCS = 19;
const PL_SST_CL_DISCARDED_PO_WCS = 18;
const PL_SST_CL_DISCARDED_CMD = 17;
const PL_SST_CL_ARESET_DERR = 16;
const PL_SST_CL_ARESET_TOUT = 15;
const PL_SST_CL_ARESET_RE_AC = 14;
const PL_SST_CL_ARESET_RE_PC = 13;
const PL_SST_CL_ARESET_RE_EST = 12;
const PL_SST_CL_ARESET_RE_AO = 11;
const PL_SST_CL_ARESET_RE_PO = 10;
const PL_SST_CL_ARESET_CMD = 9;
const PL_SST_CL_PRESET_STRANGE = 8;
const PL_SST_CL_PRESET_ACLOSING = 7;
const PL_SST_CL_PRESET_PCLOSING = 6;
const PL_SST_CL_PRESET_EST = 5;
const PL_SST_CL_PRESET_AOPENING = 4;
const PL_SST_CL_PRESET_POPENING = 3;
const PL_SST_CL_ACLOSED = 2;
const PL_SST_CL_PCLOSED = 1;
const PL_SST_CLOSED = 0;
const PL_SER_ET_TYPE2 = 2;
const PL_SER_ET_TYPE1 = 1;
const PL_SER_ET_DISABLED = 0;
const PL_SER_BB_8 = 1;
const PL_SER_BB_7 = 0;
const PL_SER_PR_SPACE = 4;
const PL_SER_PR_MARK = 3;
const PL_SER_PR_ODD = 2;
const PL_SER_PR_EVEN = 1;
const PL_SER_PR_NONE = 0;
const PL_SER_DCP_HIGHFORINPUT = 1;
const PL_SER_DCP_LOWFORINPUT = 0;
const PL_SER_FC_XONOFF = 2;
const PL_SER_FC_RTSCTS = 1;
const PL_SER_FC_DISABLED = 0;
const PL_SER_SI_HALFDUPLEX = 1;
const PL_SER_SI_FULLDUPLEX = 0;
const PL_SER_MODE_CLOCKDATA = 2;
const PL_SER_MODE_WIEGAND = 1;
const PL_SER_MODE_UART = 0;
const PL_PAT_CANINT = 1;
const PL_PAT_NOINT = 0;
const SHA1_FINISH = 1;
const SHA1_UPDATE = 0;
const MD5_FINISH = 1;
const MD5_UPDATE = 0;
const FTOSTR_MODE_PLAIN = 2;
const FTOSTR_MODE_ME = 1;
const FTOSTR_MODE_AUTO = 0;
const PL_MONTH_DECEMBER = 12;
const PL_MONTH_NOVEMBER = 11;
const PL_MONTH_OCTOBER = 10;
const PL_MONTH_SEPTEMBER = 9;
const PL_MONTH_AUGUST = 8;
const PL_MONTH_JULY = 7;
const PL_MONTH_JUNE = 6;
const PL_MONTH_MAY = 5;
const PL_MONTH_APRIL = 4;
const PL_MONTH_MARCH = 3;
const PL_MONTH_FEBRUARY = 2;
const PL_MONTH_JANUARY = 1;
const PL_DOW_SUNDAY = 7;
const PL_DOW_SATURDAY = 6;
const PL_DOW_FRIDAY = 5;
const PL_DOW_THURSDAY = 4;
const PL_DOW_WEDNESDAY = 3;
const PL_DOW_TUESDAY = 2;
const PL_DOW_MONDAY = 1;
const PL_REDIR_SOCK15 = 21;
const PL_REDIR_SOCK14 = 20;
const PL_REDIR_SOCK13 = 19;
const PL_REDIR_SOCK12 = 18;
const PL_REDIR_SOCK11 = 17;
const PL_REDIR_SOCK10 = 16;
const PL_REDIR_SOCK9 = 15;
const PL_REDIR_SOCK8 = 14;
const PL_REDIR_SOCK7 = 13;
const PL_REDIR_SOCK6 = 12;
const PL_REDIR_SOCK5 = 11;
const PL_REDIR_SOCK4 = 10;
const PL_REDIR_SOCK3 = 9;
const PL_REDIR_SOCK2 = 8;
const PL_REDIR_SOCK1 = 7;
const PL_REDIR_SOCK0 = 6;
const PL_REDIR_SER3 = 4;
const PL_REDIR_SER2 = 3;
const PL_REDIR_SER1 = 2;
const PL_REDIR_SER0 = 1;
const PL_REDIR_SER = 1;
const PL_REDIR_NONE = 0;
const FALLING = 1;
const RISING = 0;
const PL_HORIZONTAL = 1;
const PL_VERTICAL = 0;
const BACK = 1;
const FORWARD = 0;
const REJECTED = 1;
const ACCEPTED = 0;
const INVALID = 1;
const VALID = 0;
const WLN_REJ = 2;
const WLN_NG = 1;
const WLN_OK = 0;
const NG = 1;
const OK = 0;
const HIGH = 1;
const LOW = 0;
const ENABLED = 1;
const DISABLED = 0;
const YES = 1;
const NO = 0;
const PL_ON = 1;
const PL_OFF = 0;
const PL_INT_NULL = 8;
const PL_INT_NUM_7 = 7;
const PL_INT_NUM_6 = 6;
const PL_INT_NUM_5 = 5;
const PL_INT_NUM_4 = 4;
const PL_INT_NUM_3 = 3;
const PL_INT_NUM_2 = 2;
const PL_INT_NUM_1 = 1;
const PL_INT_NUM_0 = 0;
const PL_IO_PORT_NUM_0 = 0;
const PL_IO_NULL = 56;
const PL_IO_NUM_55 = 55;
const PL_IO_NUM_54 = 54;
const PL_IO_NUM_53 = 53;
const PL_IO_NUM_52 = 52;
const PL_IO_NUM_51 = 51;
const PL_IO_NUM_50 = 50;
const PL_IO_NUM_49 = 49;
const PL_IO_NUM_48 = 48;
const PL_IO_NUM_47 = 47;
const PL_IO_NUM_46 = 46;
const PL_IO_NUM_45_CO = 45;
const PL_IO_NUM_44 = 44;
const PL_IO_NUM_43 = 43;
const PL_IO_NUM_42 = 42;
const PL_IO_NUM_41 = 41;
const PL_IO_NUM_40 = 40;
const PL_IO_NUM_39 = 39;
const PL_IO_NUM_38 = 38;
const PL_IO_NUM_37 = 37;
const PL_IO_NUM_36 = 36;
const PL_IO_NUM_35 = 35;
const PL_IO_NUM_34 = 34;
const PL_IO_NUM_33 = 33;
const PL_IO_NUM_32 = 32;
const PL_IO_NUM_31 = 31;
const PL_IO_NUM_30 = 30;
const PL_IO_NUM_29 = 29;
const PL_IO_NUM_28 = 28;
const PL_IO_NUM_27 = 27;
const PL_IO_NUM_26 = 26;
const PL_IO_NUM_25 = 25;
const PL_IO_NUM_24 = 24;
const PL_IO_NUM_23_INT7 = 23;
const PL_IO_NUM_22_INT6 = 22;
const PL_IO_NUM_21_INT5 = 21;
const PL_IO_NUM_20_INT4 = 20;
const PL_IO_NUM_19_INT3 = 19;
const PL_IO_NUM_18_INT2 = 18;
const PL_IO_NUM_17_INT1 = 17;
const PL_IO_NUM_16_INT0 = 16;
const PL_IO_NUM_15_TX3 = 15;
const PL_IO_NUM_14_RX3 = 14;
const PL_IO_NUM_13_TX2 = 13;
const PL_IO_NUM_12_RX2 = 12;
const PL_IO_NUM_11_TX1 = 11;
const PL_IO_NUM_10_RX1 = 10;
const PL_IO_NUM_9_TX0 = 9;
const PL_IO_NUM_8_RX0 = 8;
const PL_IO_NUM_7 = 7;
const PL_IO_NUM_6 = 6;
const PL_IO_NUM_5 = 5;
const PL_IO_NUM_4 = 4;
const PL_IO_NUM_3 = 3;
const PL_IO_NUM_2 = 2;
const PL_IO_NUM_1 = 1;
const PL_IO_NUM_0 = 0;
const PL_SOCK_INTERFACE_PPPOE = 4;
const PL_SOCK_INTERFACE_PPP = 3;
const PL_SOCK_INTERFACE_WLN = 2;
const PL_SOCK_INTERFACE_NET = 1;
const PL_SOCK_INTERFACE_NULL = 0;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// TPP2W-G2 WITH WI-FI INTERFACE
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//<b>PLATFORM CONSTANT.</b><br><br>Null interface (no connection possible).
//<b>PLATFORM CONSTANT.</b><br><br>Ethernet interface.
//<b>PLATFORM CONSTANT.</b><br><br>Wi-Fi interface.
//<b>PLATFORM CONSTANT.</b><br><br>PPP interface on a serial port.
//<b>PLATFORM CONSTANT.</b><br><br>PPPoE interface.
//--------------------------------------------------------------------
//<b>PLATFORM CONSTANT. </b><br><br>
//Socket 1, control line C.
//<b>PLATFORM CONSTANT. </b><br><br>
//Socket 3, control line C.
//<b>PLATFORM CONSTANT. </b><br><br>
//Socket 5, control line C.
//<b>PLATFORM CONSTANT. </b><br><br>
//Socket 7, control line C.
//<b>PLATFORM CONSTANT. </b><br><br>
//Socket 9, control line C.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 11, control line C.
//<b>PLATFORM CONSTANT.</b><br><br>
//Not connected.
//<b>PLATFORM CONSTANT.</b><br><br>
//Not connected.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 1, control line B. This line is also the RX/W1in/din input of the serial port 0.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an input. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 1, control line A. This line is also the TX/W1out/dout output of the serial port 0.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an output. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 3, control line B. This line is also the RX/W0&1in/din input of the serial port 1.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an input. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 3, control line A. This line is also the TX/W1out/dout output of the serial port 1.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an output. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 5, control line B. This line is also the RX/W0&1in/din input of the serial port 2.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an input. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 5, control line A. This line is also the TX/W1out/dout output of the serial port 2.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an output. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 7, control line B. This line is also the RX/W0&1in/din input of the serial port 3.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an input. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 7, control line A. This line is also the TX/W1out/dout output of the serial port 3.<br><br>
//When this serial port is in the UART mode
//(<font color="maroon"><b>ser.mode</b></font>= <font color="olive"><b>0- PL_SER_MODE_UART </b></font>)
//and is enabled
//(<font color="maroon"><b>ser.enabled</b></font>= <font color="olive"><b>1- YES</b></font>)
//the line is automatically configured to be an output. Line configuration is still "manual" in all other cases.<br><br>
//Closing the serial port or changing its mode to some other mode restores original configuration of the output buffer.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 1, control line D. This is also the interrupt line 0.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 3, control line D. This is also the interrupt line 1.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 5, control line D. This is also the interrupt line 2.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 7, control line D. This is also the interrupt line 3.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 9, control line D. This is also the interrupt line 4.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 11, control line D. This is also the interrupt line 5.
//<b>PLATFORM CONSTANT.</b><br><br>
//Not connected.
//<b>PLATFORM CONSTANT.</b><br><br>
//Not connected.
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 0 (P0.0).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 1 (P0.1).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 2 (P0.2).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 3 (P0.3).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 4 (P0.4).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 5 (P0.5).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 6 (P0.6).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, data bus, line 7 (P0.7).
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 9, control line A.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 9, control line B.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 11, control line A.
//<b>PLATFORM CONSTANT.</b><br><br>
//Socket 11, control line B.
//<b>PLATFORM CONSTANT.</b><br><br>
//Keypad connector, return line 1 (for the leftmost button, active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//Keypad connector, return line 2 (active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//Keypad connector, return line 3 (active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//Keypad connector, return line 4 (for the rightmost button, active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, CS line (active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, RD line (active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, WR line (active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//LCD connector, DC line.
//<b>PLATFORM CONSTANT.</b><br><br>
//Keypad connector, reset line (for the sensor IC of the keypad, active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//A square wave output controlled by the beep object. This output is driving a buzzer.<br><br>
//When the beeper pattern starts playing, the line is configured as output automatically. When the beeper pattern
//stops playing, the output returns to the input/output and high/low state that it had before the pattern started playing.
//<b>PLATFORM CONSTANT.</b><br><br>
//Signal strength LED bar control circuit, reset line.
//<b>PLATFORM CONSTANT.</b><br><br>
//Signal strength LED bar control circuit, clock line.
//<b>PLATFORM CONSTANT.</b><br><br>
//Signal strength LED bar control circuit, data line.
//<b>PLATFORM CONSTANT.</b><br><br>
//Wireless add-on socket, CS line.
//PLATFORM CONSTANT.</b><br><br>
//Wireless add-on socket, DO line.
//PLATFORM CONSTANT.</b><br><br>
//Wireless add-on socket, RST line.
//PLATFORM CONSTANT.</b><br><br>
//Wireless add-on socket, DI line.
//PLATFORM CONSTANT.</b><br><br>
//Wireless add-on socket, CLK line.
//PLATFORM CONSTANT.</b><br><br>
//LCD connector, backlight control line (active low).
//PLATFORM CONSTANT.</b><br><br>
//LCD connector, RST line (active low).
//<b>PLATFORM CONSTANT.</b><br><br>
//This is a NULL line that does not physically exist.
//The state of this line is always detected as LOW. Setting this line has no effect.
//--------------------------------------------------------------------
//<b>PLATFORM CONSTANT.</b><br><br>
//8-bit port 0, contains I/O lines 24-31 (LCD data lines D0-7).
//--------------------------------------------------------------------
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 0 (mapped to I/O line 16).
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 1 (mapped to I/O line 17).
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 2 (mapped to I/O line 18).
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 3 (mapped to I/O line 19).
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 4 (mapped to I/O line 20).
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 5 (mapped to I/O line 21).
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 6 (mapped to I/O line 22).
//<b>PLATFORM CONSTANT.</b><br><br>
//Interrupt line 7 (mapped to I/O line 23).
//<b>PLATFORM CONSTANT.</b><br><br>
//This is a NULL interrupt line that does not physically exist.
//--------------------------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// COMMON PLATFORM STUFF
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// COMMON PLATFORM DEFINES
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//#define EM500 8 NOT USED
//#define TPP2N 21 NOT USED
//55x -- "driver" TDL (low-level stuff like setpixel, etc. but without getpixel)
//56x -- "info" TDL (LCD dimensions, colors, etc.)
//75x -- initialization (except LCD_TYPE=SAMSUNG_S6B0108 where it is combined with 55.TDL)
//79x -- getpixel