@mchp-mcc/scf-pic8-clc-v1 4.0.13 → 4.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +9 -0
- package/Readme.md +9 -0
- package/output/autoCreator.js +167 -3
- package/output/autoCreator.js.map +1 -1
- package/output/autoProcessor.js +167 -3
- package/output/autoProcessor.js.map +1 -1
- package/output/creator.js +167 -3
- package/output/creator.js.map +1 -1
- package/output/processor.js +167 -3
- package/output/processor.js.map +1 -1
- package/output/reducer.js +1 -1
- package/output/view.js +1 -1
- package/package.json +6 -8
- package/src/App.tsx +0 -101
- package/src/Constants.ts +0 -181
- package/src/CreatorFunctions.ts +0 -44
- package/src/DerivedData.test.tsx +0 -285
- package/src/DerivedData.ts +0 -444
- package/src/GeneratorModel.test.ts +0 -57
- package/src/GeneratorModel.ts +0 -60
- package/src/InputStateCalculator.test.ts +0 -64
- package/src/InputStateCalculator.ts +0 -50
- package/src/PinsLogic.test.ts +0 -514
- package/src/PinsLogic.ts +0 -164
- package/src/SettingNameCalculator.test.ts +0 -21
- package/src/SettingNameCalculator.ts +0 -28
- package/src/actions.ts +0 -22
- package/src/catalog.json +0 -24
- package/src/components/CLCView.tsx +0 -141
- package/src/components/Canvas.tsx +0 -757
- package/src/components/InputSource.tsx +0 -24
- package/src/components/InputStage.tsx +0 -55
- package/src/components/MX.ts +0 -12
- package/src/gates/ALogicGate.ts +0 -221
- package/src/gates/AndGate.ts +0 -36
- package/src/gates/GateInputState.ts +0 -1
- package/src/gates/Latch.ts +0 -93
- package/src/gates/NotGate.ts +0 -37
- package/src/gates/OrGate.ts +0 -134
- package/src/gates/XorGate.ts +0 -12
- package/src/index.tsx +0 -51
- package/src/interfaces/cla-clc-stacked.test.ts +0 -61
- package/src/interfaces/cla-clc-stacked.ts +0 -181
- package/src/interfaces/clc-connections.tsx +0 -62
- package/src/interfaces/signal-source.ts +0 -78
- package/src/interfaces/trigger-source.ts +0 -78
- package/src/moduleConfig.json +0 -882
- package/src/pinsdata.json +0 -151
- package/src/reducer.test.tsx +0 -118
- package/src/reducer.tsx +0 -80
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { assertNotNull } from "../generated_module/src/Utils";
|
|
2
|
-
|
|
3
|
-
type InputType = number | string;
|
|
4
|
-
|
|
5
|
-
export const getGatePolaritySetting = (gate: InputType): string => {
|
|
6
|
-
assertNotNull(gate, "Gate cannot be null");
|
|
7
|
-
return `lcg${gate}polClcpol`;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const getGateSourceSetting = (gate: InputType): string => {
|
|
11
|
-
assertNotNull(gate, "Gate cannot be null");
|
|
12
|
-
const gateNum = typeof gate === "string" ? Number(gate) : gate;
|
|
13
|
-
return `lcd${gate}sClcsel${gateNum - 1}`;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const getGateInvertedSetting = (gate: InputType, input: InputType): string => {
|
|
17
|
-
assertNotNull(gate, "Gate cannot be null");
|
|
18
|
-
assertNotNull(input, "Gate input cannot be null");
|
|
19
|
-
const gateNum = typeof gate === "string" ? Number(gate) : gate;
|
|
20
|
-
return `lcg${gate}d${input}nClcgls${gateNum - 1}`;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const getGateNonInvertedSetting = (gate: InputType, input: InputType): string => {
|
|
24
|
-
assertNotNull(gate, "Gate cannot be null");
|
|
25
|
-
assertNotNull(input, "Gate input cannot be null");
|
|
26
|
-
const gateNum = typeof gate === "string" ? Number(gate) : gate;
|
|
27
|
-
return `lcg${gate}d${input}tClcgls${gateNum - 1}`;
|
|
28
|
-
};
|
package/src/actions.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Action } from "@microchip/scf-common";
|
|
2
|
-
|
|
3
|
-
export const CLCActions = {
|
|
4
|
-
UPDATE_GATE_POLARITY: "UPDATE_GATE_POLARITY",
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type CLCAction = Action<string, CLCActionPayload>;
|
|
8
|
-
|
|
9
|
-
export type CLCActionPayload = {
|
|
10
|
-
gate: number;
|
|
11
|
-
input: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const updateGatePolarity = (gate: number, input: number): CLCAction => {
|
|
15
|
-
return {
|
|
16
|
-
type: CLCActions.UPDATE_GATE_POLARITY,
|
|
17
|
-
payload: {
|
|
18
|
-
gate,
|
|
19
|
-
input,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
};
|
package/src/catalog.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mchp-mcc/local-catalog",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"content": [
|
|
5
|
-
{
|
|
6
|
-
"name": "@mchp-mcc/scf-pic8-clc-v1",
|
|
7
|
-
"version": "*",
|
|
8
|
-
"meta": {
|
|
9
|
-
"keywords": [
|
|
10
|
-
"pic8",
|
|
11
|
-
"driver",
|
|
12
|
-
""
|
|
13
|
-
],
|
|
14
|
-
"name": "CLC",
|
|
15
|
-
"category": "Drivers/CLC",
|
|
16
|
-
"description": "<Write description here>",
|
|
17
|
-
"deviceFilterRegEx": ".*",
|
|
18
|
-
"defaultSelection": true,
|
|
19
|
-
"releaseNotesLink": "https://onlinedocs.microchip.com/v2/keyword-lookup?keyword\u003dMCC.MELODY.8BITAVR.RELEASENOTES\u0026version\u003dlatest\u0026redirect\u003dtrue"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"catalogs": []
|
|
24
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect } from "react";
|
|
2
|
-
import { InputStage } from "./InputStage";
|
|
3
|
-
import { Canvas } from "./Canvas";
|
|
4
|
-
import { Dispatch } from "redux";
|
|
5
|
-
import domToImage from "dom-to-image-more";
|
|
6
|
-
import { MyState } from "../../generated_module/src/types/AutoModuleTypes";
|
|
7
|
-
import { createSubmitAction } from "@microchip/scf-autoview/lib/simpleForm/actions";
|
|
8
|
-
import { updateGatePolarity } from "../actions";
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
gate1Sources: string[];
|
|
12
|
-
gate2Sources: string[];
|
|
13
|
-
gate3Sources: string[];
|
|
14
|
-
gate4Sources: string[];
|
|
15
|
-
hardware: Required<MyState>["main"]["hardware"];
|
|
16
|
-
dispatch: Dispatch;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const CLCView: React.FC<Props> = (props: Props) => {
|
|
20
|
-
const viewRef = useRef<HTMLDivElement>(null);
|
|
21
|
-
const scale = useRef(0.8);
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const node = viewRef.current;
|
|
25
|
-
node?.addEventListener("wheel", handleWheel);
|
|
26
|
-
return (): void => node?.removeEventListener("wheel", handleWheel);
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
const handleWheel = (e: any): void => {
|
|
30
|
-
e.preventDefault();
|
|
31
|
-
|
|
32
|
-
const zoomFactor = e.deltaY < 0 ? 1.05 : 0.95;
|
|
33
|
-
scale.current *= zoomFactor;
|
|
34
|
-
|
|
35
|
-
if (scale.current < 0.5) {
|
|
36
|
-
scale.current = 0.5;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (scale.current > 2) {
|
|
40
|
-
scale.current = 2;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (viewRef.current) {
|
|
44
|
-
viewRef.current.style.transform = `scale(${scale.current})`;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const saveImage = (): void => {
|
|
49
|
-
if (viewRef.current) {
|
|
50
|
-
domToImage
|
|
51
|
-
.toPng(viewRef.current, {
|
|
52
|
-
bgcolor: "white",
|
|
53
|
-
style: {
|
|
54
|
-
transform: `scale(1)`,
|
|
55
|
-
},
|
|
56
|
-
// https://github.com/tsayen/dom-to-image/issues/117
|
|
57
|
-
filter: function (node) {
|
|
58
|
-
if (node.nodeType === 1 && node.tagName === "SELECT") {
|
|
59
|
-
const options = node.childNodes;
|
|
60
|
-
let optionCount = 0;
|
|
61
|
-
const selectedIdx = node.selectedIndex;
|
|
62
|
-
for (let i = 0; i < options.length; i++) {
|
|
63
|
-
const option = options[i];
|
|
64
|
-
if (option.tagName === "OPTION") {
|
|
65
|
-
if (optionCount === selectedIdx) {
|
|
66
|
-
options[i].setAttribute("selected", true);
|
|
67
|
-
} else {
|
|
68
|
-
options[i].removeAttribute("selected");
|
|
69
|
-
}
|
|
70
|
-
optionCount++;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
},
|
|
76
|
-
})
|
|
77
|
-
.then((dataUrl) => {
|
|
78
|
-
saveAs(dataUrl, "clc");
|
|
79
|
-
})
|
|
80
|
-
.catch((error) => {
|
|
81
|
-
console.error(error);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const saveAs = (uri, filename): void => {
|
|
87
|
-
const link = document.createElement("a");
|
|
88
|
-
|
|
89
|
-
if (typeof link.download === "string") {
|
|
90
|
-
link.href = uri;
|
|
91
|
-
link.download = filename;
|
|
92
|
-
|
|
93
|
-
//Firefox requires the link to be in the body
|
|
94
|
-
document.body.appendChild(link);
|
|
95
|
-
|
|
96
|
-
//simulate click
|
|
97
|
-
link.click();
|
|
98
|
-
|
|
99
|
-
//remove the link when done
|
|
100
|
-
document.body.removeChild(link);
|
|
101
|
-
} else {
|
|
102
|
-
window.open(uri);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const handleGateOutputClick = (gate: string): void => {
|
|
107
|
-
const setting = gate === "5" ? "lcpolClcpol" : `lcg${gate}polClcpol`;
|
|
108
|
-
const val = props.hardware?.[setting];
|
|
109
|
-
const newVal = val === "inverted" ? "not_inverted" : "inverted";
|
|
110
|
-
|
|
111
|
-
props.dispatch(createSubmitAction("main", `hardware.${setting}`, newVal));
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const handleGateInputClick = (gate: string, input: string): void => {
|
|
115
|
-
props.dispatch(updateGatePolarity(Number(gate), Number(input)));
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<>
|
|
120
|
-
<button className="save-image-button" onClick={saveImage}>
|
|
121
|
-
Export CLC image
|
|
122
|
-
</button>
|
|
123
|
-
<div
|
|
124
|
-
className="grid-container-parent"
|
|
125
|
-
ref={viewRef}
|
|
126
|
-
style={{ transform: `scale(${scale.current})` }}
|
|
127
|
-
>
|
|
128
|
-
<div className="grid-container">
|
|
129
|
-
<Canvas
|
|
130
|
-
dispatch={props.dispatch}
|
|
131
|
-
hardware={props.hardware}
|
|
132
|
-
onGateOutputClick={handleGateOutputClick}
|
|
133
|
-
onGateInputClick={handleGateInputClick}
|
|
134
|
-
/>
|
|
135
|
-
|
|
136
|
-
<InputStage {...props} />
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
</>
|
|
140
|
-
);
|
|
141
|
-
};
|