-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHP12c_KeyBoardInput.elm
716 lines (541 loc) · 14.5 KB
/
HP12c_KeyBoardInput.elm
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
module HP12c_KeyBoardInput exposing (..)
-- TODO: read manual to figure out what to do with STO etc keys in orange mode
import Keyboard
import HP12c_KeyTypes exposing (..)
import HP12c_Model exposing (..)
keyCodeToMsg : InputMode -> Keyboard.KeyCode -> Msg
keyCodeToMsg inputMode code =
case code of
-------------------------------- First Row of Keys
78 ->
case inputMode of
White ->
N_Key
-- "N"
Blue ->
Times_12_Key
Orange ->
AMORT_Key
110 ->
case inputMode of
White ->
N_Key
-- "N"
Blue ->
Times_12_Key
Orange ->
AMORT_Key
73 ->
case inputMode of
White ->
I_Key
-- "I"
Blue ->
DIVIDE_BY_12_Key
Orange ->
INT_Key
105 ->
case inputMode of
White ->
I_Key
-- "i"
Blue ->
DIVIDE_BY_12_Key
Orange ->
INT_Key
80 ->
case inputMode of
White ->
PV_Key
-- "P"
Blue ->
CF_0_Key
Orange ->
NPV_Key
112 ->
case inputMode of
White ->
PV_Key
-- "p"
Blue ->
CF_0_Key
Orange ->
NPV_Key
77 ->
case inputMode of
White ->
PMT_Key
-- "M"
Blue ->
CF_j_Key
Orange ->
RND_Key
109 ->
case inputMode of
White ->
PMT_Key
-- "m"
Blue ->
CF_j_Key
Orange ->
RND_Key
86 ->
case inputMode of
White ->
FV_Key
-- "V"
Blue ->
N_j_Key
Orange ->
IRR_Key
118 ->
case inputMode of
White ->
FV_Key
-- "v"
Blue ->
N_j_Key
Orange ->
IRR_Key
72 ->
case inputMode of
White ->
CHS_Key
-- "H"
Blue ->
DATE_Key
Orange ->
RPN_Key
104 ->
case inputMode of
White ->
CHS_Key
-- "H"
Blue ->
DATE_Key
Orange ->
RPN_Key
55 ->
case inputMode of
White ->
Number_7_Key
-- "7"
Blue ->
BEG_Key
Orange ->
SetPrecision_7_Key
-- KeyMsg code
56 ->
case inputMode of
White ->
Number_8_Key
-- "8"
Blue ->
END_Key
Orange ->
SetPrecision_8_Key
-- KeyMsg code
57 ->
case inputMode of
White ->
Number_9_Key
-- "9"
Blue ->
MEM_Key
Orange ->
SetPrecision_9_Key
-- KeyMsg code
47 ->
case inputMode of
White ->
Divide_Key
-- "/"
Blue ->
Undo_Key
Orange ->
Divide_Key
-- KeyMsg code
-------------------------------- Second Row of Keys
33 ->
case inputMode of
White ->
Y_toThe_X_Key
-- "!"
Blue ->
Square_Root_Key
Orange ->
PRICE_Key
92 ->
case inputMode of
White ->
Reciprocal_Key
-- "\\"
Blue ->
E_to_the_x_Key
Orange ->
YTM_Key
84 ->
case inputMode of
White ->
Percentage_T_Key
-- % of Total -- "T"
Blue ->
LN_Key
Orange ->
SL_Key
116 ->
case inputMode of
White ->
Percentage_T_Key
-- % of Total -- "T"
Blue ->
LN_Key
Orange ->
SL_Key
--35 -> "#" -- %T
36 ->
case inputMode of
White ->
Delta_Percentage_Key
-- delta% -- "$"
Blue ->
FRAC_Key
Orange ->
SOYD_Key
37 ->
case inputMode of
White ->
Percent_Key
-- "%"
Blue ->
INTG_Key
Orange ->
DB_Key
69 ->
case inputMode of
White ->
EEX_Key
-- "E"
Blue ->
Delta_Days_Key
Orange ->
ALG_Key
101 ->
case inputMode of
White ->
EEX_Key
-- "E"
Blue ->
Delta_Days_Key
Orange ->
ALG_Key
52 ->
case inputMode of
White ->
Number_4_Key
-- "4"
Blue ->
D_MY_Key
Orange ->
SetPrecision_4_Key
-- KeyMsg code
53 ->
case inputMode of
White ->
Number_5_Key
-- "5"
Blue ->
M_DY_Key
Orange ->
SetPrecision_5_Key
-- KeyMsg code
54 ->
case inputMode of
White ->
Number_6_Key
-- "6"
Blue ->
Weighted_Mean_Key
Orange ->
SetPrecision_6_Key
-- KeyMsg code
42 ->
case inputMode of
White ->
Multiply_Key
-- "*"
Blue ->
X_Squared_Key
Orange ->
Multiply_Key
-- KeyMsg code
-------------------------------- Third Row of Keys
91 ->
case inputMode of
White ->
RunMode_Key
-- "[" -- R/S
Blue ->
PSE_Key
Orange ->
Program_Mode_Key
93 ->
case inputMode of
White ->
SST_Key
-- "]" -- SST
Blue ->
BST_Key
Orange ->
CLEAR_Σ_Key
82 ->
case inputMode of
White ->
Roll_Down_Key
--"R"
Blue ->
GTO_Key
Orange ->
CLEAR_PRGM_Key
114 ->
case inputMode of
White ->
Roll_Down_Key
-- "r" -- R_downarrow roll down stack
Blue ->
GTO_Key
Orange ->
CLEAR_PRGM_Key
89 ->
case inputMode of
White ->
Exchange_X_Y_Key
-- "Y"
Blue ->
X_lte_Y_Key
Orange ->
CLEAR_FIN_Key
121 ->
case inputMode of
White ->
Exchange_X_Y_Key
-- "y" -- Exchange x and y in the stack
Blue ->
X_lte_Y_Key
Orange ->
CLEAR_FIN_Key
67 ->
case inputMode of
White ->
CL_x_Key
-- "C" -- CLx
Blue ->
X_eq_0_Key
Orange ->
CLEAR_REG_Key
99 ->
case inputMode of
White ->
CL_x_Key
-- "c" -- CLx
Blue ->
X_eq_0_Key
Orange ->
CLEAR_REG_Key
13 ->
case inputMode of
White ->
Enter_Key
-- Enter key
Blue ->
Equals_Key
Orange ->
CLEAR_PREFIX_Key
49 ->
case inputMode of
White ->
Number_1_Key
-- "1"
Blue ->
Linear_Estimate_X_Key
Orange ->
SetPrecision_1_Key
-- KeyMsg code
50 ->
case inputMode of
White ->
Number_2_Key
-- "2"
Blue ->
Linear_Estimate_Y_Key
Orange ->
SetPrecision_2_Key
-- KeyMsg code
51 ->
case inputMode of
White ->
Number_3_Key
-- "3"
Blue ->
N_Factorial_Key
Orange ->
SetPrecision_3_Key
-- KeyMsg code
45 ->
case inputMode of
White ->
Subtract_Key
-- "-"
Blue ->
BackSpace_Key
Orange ->
Subtract_Key
-------------------------------- Fourth Row of Keys
79 ->
case inputMode of
White ->
ON_Key
-- "O" -- Upper case O
Blue ->
KeyMsg code
Orange ->
OFF_Key
11 ->
case inputMode of
White ->
ON_Key
-- "o" -- lower case O -- ON
Blue ->
KeyMsg code
Orange ->
OFF_Key
70 ->
case inputMode of
White ->
Orange_F_Key
-- "F"
Blue ->
Orange_F_Key
Orange ->
Orange_F_Key
102 ->
case inputMode of
White ->
Orange_F_Key
-- "f" -- orange f key
Blue ->
Orange_F_Key
Orange ->
Orange_F_Key
71 ->
case inputMode of
White ->
Blue_G_Key
-- "G"
Blue ->
Blue_G_Key
Orange ->
Blue_G_Key
103 ->
case inputMode of
White ->
Blue_G_Key
-- "g" -- blue g key
Blue ->
Blue_G_Key
Orange ->
Blue_G_Key
83 ->
case inputMode of
White ->
STO_Key
-- "S"
Blue ->
Left_Paren_Key
Orange ->
STO_Key
--KeyMsg code
115 ->
case inputMode of
White ->
STO_Key
-- "s" -- STO
Blue ->
Left_Paren_Key
Orange ->
STO_Key
-- KeyMsg code
76 ->
case inputMode of
White ->
RCL_Key
-- "L"
Blue ->
Right_Paren_Key
Orange ->
RCL_Key
--KeyMsg code
108 ->
case inputMode of
White ->
RCL_Key
-- "l" -- RCL
Blue ->
Right_Paren_Key
Orange ->
RCL_Key
-- KeyMsg code
-- 61 -> Equals -- "="
48 ->
case inputMode of
White ->
Number_0_Key
-- "0" -- zero
Blue ->
Mean_of_X_Key
Orange ->
SetPrecision_0_Key
-- KeyMsg code
46 ->
case inputMode of
White ->
Decimal_Point_Key
-- ".""
Blue ->
Std_Dev_Key
Orange ->
SetDisplayScientific_Key
87 ->
case inputMode of
White ->
Sigma_Plus_Key
-- "W"
Blue ->
Sigma_Minus_Key
Orange ->
Sigma_Plus_Key
-- KeyMsg code
119 ->
case inputMode of
White ->
Sigma_Plus_Key
-- "w" -- Sigma+
Blue ->
Sigma_Minus_Key
Orange ->
Sigma_Plus_Key
-- KeyMsg code
43 ->
case inputMode of
White ->
Sum_Key
-- "+"
Blue ->
Last_X_Key
Orange ->
Sum_Key
-- KeyMsg code
------------------------------
_ ->
KeyMsg code
-- for any key not on the calc