@mchp-mcc/scf-pic8-opamp-v2 1.0.0
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 +8 -0
- package/LICENSE.txt +21 -0
- package/Readme.md +15 -0
- package/lib/generated_module/src/index.js +11 -0
- package/output/autoCreator.js +1995 -0
- package/output/autoCreator.js.map +1 -0
- package/output/autoProcessor.js +1997 -0
- package/output/autoProcessor.js.map +1 -0
- package/output/creator.js +6851 -0
- package/output/creator.js.map +1 -0
- package/output/header-template.h.ftl +353 -0
- package/output/nullPrototype.json +43 -0
- package/output/processor.js +6851 -0
- package/output/processor.js.map +1 -0
- package/output/reducer.js +29783 -0
- package/output/reducer.js.map +1 -0
- package/output/source-template.c.ftl +149 -0
- package/package.json +172 -0
- package/src/Calculations.test.tsx +83 -0
- package/src/Calculations.tsx +20 -0
- package/src/CreatorFunctions.test.ts +214 -0
- package/src/CreatorFunctions.ts +48 -0
- package/src/DerivedData.test.tsx +1601 -0
- package/src/DerivedData.ts +507 -0
- package/src/GeneratorModel.ts +80 -0
- package/src/ImageDataURLs.ts +8 -0
- package/src/PinsLogic.test.ts +983 -0
- package/src/PinsLogic.ts +293 -0
- package/src/catalog.json +24 -0
- package/src/moduleConfig.json +650 -0
- package/src/opa-output-parameters.test.tsx +22 -0
- package/src/opa-output-parameters.tsx +95 -0
- package/src/pinsdata.json +81 -0
- package/src/reducer.test.ts +177 -0
- package/src/reducer.ts +29 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { InterfaceId } from "@microchip/scf-common/lib/InterfaceId";
|
|
2
|
+
import * as Creator from "@microchip/scf-common/lib/Creator";
|
|
3
|
+
import * as Processor from "@microchip/scf-common/lib/Processor";
|
|
4
|
+
import * as InterfaceTypes from "@microchip/scf-interface";
|
|
5
|
+
|
|
6
|
+
/** The arguments to be provided to the implementation. */
|
|
7
|
+
export interface Arguments extends InterfaceTypes.Arguments {
|
|
8
|
+
//Standard Interface
|
|
9
|
+
customName?: string;
|
|
10
|
+
enableOpa?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** The payload to be passed back to the dependent module after the BasicUART has been processed. */
|
|
14
|
+
export interface ProcessedPayload extends InterfaceTypes.ProcessedPayload {
|
|
15
|
+
//Standard Interface
|
|
16
|
+
moduleName?: string;
|
|
17
|
+
customName?: string;
|
|
18
|
+
|
|
19
|
+
//Interrupt Handling Extension
|
|
20
|
+
hasInterrupts?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface API extends InterfaceTypes.CFunctions {
|
|
24
|
+
Initialize: InterfaceTypes.CFunction;
|
|
25
|
+
EnableChargePump: InterfaceTypes.CFunction;
|
|
26
|
+
DisableChargePump: InterfaceTypes.CFunction;
|
|
27
|
+
EnableSoftwareUnityGain: InterfaceTypes.CFunction;
|
|
28
|
+
DisableSoftwareUnityGain: InterfaceTypes.CFunction;
|
|
29
|
+
SetPositiveChannel: InterfaceTypes.CFunction;
|
|
30
|
+
SetPositiveSource: InterfaceTypes.CFunction;
|
|
31
|
+
SetNegativeChannel: InterfaceTypes.CFunction;
|
|
32
|
+
SetNegativeSource: InterfaceTypes.CFunction;
|
|
33
|
+
SetResistorLadder: InterfaceTypes.CFunction;
|
|
34
|
+
EnableHardwareOverride: InterfaceTypes.CFunction;
|
|
35
|
+
SetHardwareOverrideSource: InterfaceTypes.CFunction;
|
|
36
|
+
DisableHardwareOverride: InterfaceTypes.CFunction;
|
|
37
|
+
SetSoftwareOverride: InterfaceTypes.CFunction;
|
|
38
|
+
ManualInputOffsetCalibration: InterfaceTypes.CFunction;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The type of the processed export interface */
|
|
42
|
+
export type ProcessedExportInterface = Processor.ProcessedInterface<
|
|
43
|
+
ProcessedPayload,
|
|
44
|
+
Arguments
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
/** Used by implementations of this interface in their module's creator. */
|
|
48
|
+
type CreatorExportInterface = Creator.Interface<ProcessedPayload>;
|
|
49
|
+
|
|
50
|
+
const getInterfaceId = (): InterfaceId => {
|
|
51
|
+
return {
|
|
52
|
+
name: "opamp-output-parameters",
|
|
53
|
+
version: "1.0.0",
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const createPrototypeImport = (): Creator.Import => {
|
|
58
|
+
return {
|
|
59
|
+
interfaceId: getInterfaceId(),
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const createPrototypeExport = (): Creator.Export<CreatorExportInterface[]> => {
|
|
64
|
+
return {
|
|
65
|
+
interfaces: [{ interfaceId: getInterfaceId() }],
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const createMock = (): ProcessedExportInterface => {
|
|
70
|
+
return {
|
|
71
|
+
interfaceId: getInterfaceId(),
|
|
72
|
+
payload: {
|
|
73
|
+
moduleName: "OPA",
|
|
74
|
+
customName: "OPA",
|
|
75
|
+
},
|
|
76
|
+
args: {
|
|
77
|
+
requestId: {
|
|
78
|
+
customName: "OPA",
|
|
79
|
+
enableOpa: true,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
interface Interface extends InterfaceTypes.Interface {
|
|
86
|
+
createPrototypeImport: () => Creator.Import<Arguments>;
|
|
87
|
+
createMock: () => ProcessedExportInterface;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const Interface: Interface = {
|
|
91
|
+
createPrototypeExport: createPrototypeExport,
|
|
92
|
+
createPrototypeImport: createPrototypeImport,
|
|
93
|
+
getInterfaceId: getInterfaceId,
|
|
94
|
+
createMock: createMock,
|
|
95
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rows": [
|
|
3
|
+
{
|
|
4
|
+
"name" : "posPins",
|
|
5
|
+
"module": "OPA1",
|
|
6
|
+
"function": "OPA1INx+",
|
|
7
|
+
"direction": "input",
|
|
8
|
+
"filter": {
|
|
9
|
+
"module": "OPA1",
|
|
10
|
+
"aliasReEx": "^OPA\\dIN\\d\\+$"
|
|
11
|
+
},
|
|
12
|
+
"behaviour": "SINGLE_PIN_MUX",
|
|
13
|
+
"behaviourMeta":{
|
|
14
|
+
"lockPinRegEx":"OPA1IN0+"
|
|
15
|
+
},
|
|
16
|
+
"attribs": [
|
|
17
|
+
{
|
|
18
|
+
"aliasReEx": "^OPA\\dIN\\d\\+$",
|
|
19
|
+
"analog": true,
|
|
20
|
+
"cname": "IN"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name" : "negPins",
|
|
27
|
+
"module": "OPA1",
|
|
28
|
+
"function": "OPA1INx-",
|
|
29
|
+
"direction": "input",
|
|
30
|
+
"filter": {
|
|
31
|
+
"module": "OPA1",
|
|
32
|
+
"aliasReEx": "^OPA\\dIN\\d-$"
|
|
33
|
+
},
|
|
34
|
+
"behaviour": "OPTIONAL_PIN_MUX",
|
|
35
|
+
"behaviourMeta":{
|
|
36
|
+
"lockPinRegEx":"OPA1IN0-"
|
|
37
|
+
},
|
|
38
|
+
"attribs": [
|
|
39
|
+
{
|
|
40
|
+
"aliasReEx": "^OPA\\dIN\\d\\-$",
|
|
41
|
+
"analog": true,
|
|
42
|
+
"cname": "IN"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name" : "outputPin",
|
|
48
|
+
"module": "OPA1",
|
|
49
|
+
"function": "OPA1OUT",
|
|
50
|
+
"direction": "output",
|
|
51
|
+
"filter": {
|
|
52
|
+
"module": "OPA1",
|
|
53
|
+
"aliasReEx": "^OPA\\dOUT$"
|
|
54
|
+
},
|
|
55
|
+
"behaviour": "ALWAYS_LOCKED",
|
|
56
|
+
"attribs": [
|
|
57
|
+
{
|
|
58
|
+
"aliasReEx": ".*",
|
|
59
|
+
"analog": true
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name" : "ppsPin",
|
|
65
|
+
"module": "OPA1",
|
|
66
|
+
"function": "OPA1ORPPS",
|
|
67
|
+
"direction": "input",
|
|
68
|
+
"filter": {
|
|
69
|
+
"module": "OPA1",
|
|
70
|
+
"aliasReEx": "^OPA\\dOR$"
|
|
71
|
+
},
|
|
72
|
+
"behaviour": "PPS",
|
|
73
|
+
"attribs": [
|
|
74
|
+
{
|
|
75
|
+
"aliasReEx": ".*",
|
|
76
|
+
"analog": true
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { State } from "../generated_module/src/types/State";
|
|
2
|
+
import { reduce, setDefaultConfigValues } from "./reducer";
|
|
3
|
+
|
|
4
|
+
describe("reduce() for Default Values", () => {
|
|
5
|
+
it("Change in Op Amp Configuration ", () => {
|
|
6
|
+
const state: State = {
|
|
7
|
+
main: {
|
|
8
|
+
hardware: {
|
|
9
|
+
customConfig: "Direct Connection to Pins",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const action = {
|
|
14
|
+
type: "[FORM] SUBMIT",
|
|
15
|
+
payload: {
|
|
16
|
+
tabId: "main",
|
|
17
|
+
path: "hardware.customConfig",
|
|
18
|
+
value: "Unity Gain Buffer",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const nextState: State = {
|
|
22
|
+
main: {
|
|
23
|
+
hardware: {
|
|
24
|
+
customConfig: "Unity Gain Buffer",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
expect(reduce(state, action)).toStrictEqual(nextState);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("Overriding UI edits for required components", () => {
|
|
32
|
+
const state: State = {
|
|
33
|
+
main: {
|
|
34
|
+
hardware: {
|
|
35
|
+
customConfig: "Non-Inverting Programmable Gain Amplifier",
|
|
36
|
+
},
|
|
37
|
+
channelSel: {
|
|
38
|
+
pchOpacon2: "DAC1_OUT",
|
|
39
|
+
nchOpacon2: "OPA1IN-",
|
|
40
|
+
},
|
|
41
|
+
feedbackSel: {
|
|
42
|
+
gselOpacon1: "R1 = 1R and R2 = 15R, R2/R1 = 15",
|
|
43
|
+
fmsOpacon3: "Vdd",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const action = {
|
|
48
|
+
type: "[FORM] SUBMIT",
|
|
49
|
+
payload: {
|
|
50
|
+
tabId: "main",
|
|
51
|
+
path: "hardware.customConfig",
|
|
52
|
+
value: "Inverting Programmable Gain Amplifier",
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const nextState: State = {
|
|
56
|
+
main: {
|
|
57
|
+
hardware: {
|
|
58
|
+
customConfig: "Inverting Programmable Gain Amplifier",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
expect(reduce(state, action)).toStrictEqual(nextState);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("Retaining UI edits for Configuration independent components", () => {
|
|
66
|
+
const state: State = {
|
|
67
|
+
main: {
|
|
68
|
+
hardware: {
|
|
69
|
+
customConfig: "Inverting Programmable Gain Amplifier",
|
|
70
|
+
},
|
|
71
|
+
channelSel: {
|
|
72
|
+
pssOpacon3: "GSEL",
|
|
73
|
+
nssOpacon1: "Vss",
|
|
74
|
+
},
|
|
75
|
+
feedbackSel: {
|
|
76
|
+
gselOpacon1: "R1 = 1R and R2 = 15R, R2/R1 = 15",
|
|
77
|
+
fmsOpacon3: "No Connection",
|
|
78
|
+
},
|
|
79
|
+
overrideSel: {
|
|
80
|
+
orenOpahwc: true,
|
|
81
|
+
hwchOpahwc: "Rail Drive to Vdd",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const action = {
|
|
86
|
+
type: "[FORM] SUBMIT",
|
|
87
|
+
payload: {
|
|
88
|
+
tabId: "main",
|
|
89
|
+
path: "hardware.customConfig",
|
|
90
|
+
value: "Direct Connection to Pins",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
const nextState: State = {
|
|
94
|
+
main: {
|
|
95
|
+
hardware: {
|
|
96
|
+
customConfig: "Direct Connection to Pins",
|
|
97
|
+
},
|
|
98
|
+
overrideSel: {
|
|
99
|
+
orenOpahwc: true,
|
|
100
|
+
hwchOpahwc: "Rail Drive to Vdd",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
expect(reduce(state, action)).toStrictEqual(nextState);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("Test for default switch case", () => {
|
|
108
|
+
const state: State = {
|
|
109
|
+
main: {
|
|
110
|
+
hardware: {
|
|
111
|
+
customConfig: "Direct Connection to Pins",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
const action = {
|
|
116
|
+
type: "",
|
|
117
|
+
payload: {
|
|
118
|
+
tabId: "main",
|
|
119
|
+
path: "hardware.customConfig",
|
|
120
|
+
value: "Unity Gain Buffer",
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
const nextState: State = {
|
|
124
|
+
main: {
|
|
125
|
+
hardware: {
|
|
126
|
+
customConfig: "Direct Connection to Pins",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
expect(reduce(state, action)).toStrictEqual(nextState);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("Test for boolean component", () => {
|
|
134
|
+
const state: State = {
|
|
135
|
+
main: {
|
|
136
|
+
hardware: {
|
|
137
|
+
cponOpacon0: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
const action = {
|
|
142
|
+
type: "[FORM] SUBMIT",
|
|
143
|
+
payload: {
|
|
144
|
+
tabId: "main",
|
|
145
|
+
path: "hardware.cponOpacon0",
|
|
146
|
+
value: false,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
const nextState: State = {
|
|
150
|
+
main: {
|
|
151
|
+
hardware: {
|
|
152
|
+
cponOpacon0: false,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
expect(reduce(state, action)).toStrictEqual(nextState);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("Test for undefined main", () => {
|
|
160
|
+
const state: State = {
|
|
161
|
+
main: undefined,
|
|
162
|
+
};
|
|
163
|
+
const action = {
|
|
164
|
+
type: "[FORM] SUBMIT",
|
|
165
|
+
payload: {
|
|
166
|
+
tabId: "main",
|
|
167
|
+
path: "hardware.customConfig",
|
|
168
|
+
value: "Unity Gain Buffer",
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const nextState: State = {
|
|
173
|
+
main: undefined,
|
|
174
|
+
};
|
|
175
|
+
expect(setDefaultConfigValues(state, action.payload)).toStrictEqual(nextState);
|
|
176
|
+
});
|
|
177
|
+
});
|
package/src/reducer.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Auto from "@microchip/scf-autoview-impl/src/lib/reducer/reducer";
|
|
2
|
+
import { Actions } from "@microchip/scf-autoview/lib/simpleForm/actions";
|
|
3
|
+
import { Action } from "@microchip/scf-common";
|
|
4
|
+
import { State } from "../generated_module/src/types/State";
|
|
5
|
+
import { FormActionPayload } from "@microchip/scf-autoview/lib/simpleForm/action-types/actionTypes";
|
|
6
|
+
|
|
7
|
+
export const reduce = (state: State, action: Action<any, any>): State => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case Actions.SUBMIT_FORM:
|
|
10
|
+
return opampReduce(Auto.reduce(state, action), action);
|
|
11
|
+
default:
|
|
12
|
+
return state;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const opampReduce = (state: State, action: Action<any, any>): State => {
|
|
17
|
+
return setDefaultConfigValues(state, action.payload);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const setDefaultConfigValues = (
|
|
21
|
+
state: State,
|
|
22
|
+
payload: FormActionPayload,
|
|
23
|
+
): State => {
|
|
24
|
+
if (payload.path.endsWith(".customConfig")) {
|
|
25
|
+
delete state.main?.["channelSel"];
|
|
26
|
+
delete state.main?.["feedbackSel"];
|
|
27
|
+
}
|
|
28
|
+
return state;
|
|
29
|
+
};
|