File: LOGICS

package info (click to toggle)
ledcontrol 0.5.2-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 796 kB
  • ctags: 259
  • sloc: ansic: 3,264; sh: 848; makefile: 180; perl: 49
file content (88 lines) | stat: -rw-r--r-- 1,651 bytes parent folder | download | duplicates (5)
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

This file requires at least 120 columns to view properly.


This file contains the logics required for the combination of the
and-flags and or-flags of the leds and animations, used in led.c.

----

We do a process of ((xxx AND af) OR of). Thus we get a table of

af	of	Final
0	0	0	= OFF
0	1	1	= ON
1	0	xxx	= NORM
1	1	1	= ON


REQUIREMENTS:


	Normal	Normal-AND	Normal-OR	Anim	Anim-AND	Anim-OR		Final	Final-AND	Final-OR
 1	OFF	0		0		OFF	0		0		OFF	0		0
 2	OFF	0		0		ON	0		1		ON	0/1		1
 3	OFF	0		0		NORM	1		0		OFF	0		0
 4	OFF	0		0		ON	1		1		ON	0/1		1
 5	ON	0		1		OFF	0		0		OFF	0		0
 6	ON	0		1		ON	0		1		ON	0/1		1
 7	ON	0		1		NORM	1		0		ON	0/1		1
 8	ON	0		1		ON	1		1		ON	0/1		1
 9	NORM	1		0		OFF	0		0		OFF	0		0
10	NORM	1		0		ON	0		1		ON	0/1		1
11	NORM	1		0		NORM	1		0		NORM	1		0
12	NORM	1		0		ON	1		1		ON	0/1		1
13	ON	1		1		OFF	0		0		OFF	0		0
14	ON	1		1		ON	0		1		ON	0/1		1
15	ON	1		1		NORM	1		0		ON	0/1		1
16	ON	1		1		ON	1		1		ON	0/1		1

0/1 - makes no difference.

When we remove the 0/1 lines of Final-AND we get that it has to be:

N-A	N-O	A-A	A-O	F-A
0	0	0	0	0
0	0	1	0	0
0	1	0	0	0
1	0	0	0	0
1	0	1	0	1
1	1	0	0	0

We notice that we get Final-AND by (Normal-AND AND Anim-AND).




The Final-OR is a bit trickier...
If we take (xxx OR Anim-OR) we get the right answer every time Anim-OR is 1, so let's do it.

That leaves us:

N-A	N-O	A-A		F-O
0	0	0		0
0	0	1		0
0	1	0		0
0	1	1		1
1	0	0		0
1	0	1		0
1	1	0		0
1	1	1		1

N-A doesn't have anything to do with it. We have left:


N-O	A-A	F-O
0	0	0
0	1	0
1	0	0
1	1	1

This is also an AND operation, so the total operation is ((Normal-OR AND Anim-AND) OR Anim-OR).


Result:

FA = NA & AA
FO = (NO & AA) | AO