@mchp-mcc/scf-pic8-osc-v1 4.3.2 → 4.3.3

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/src/PinsLogic.ts DELETED
@@ -1,297 +0,0 @@
1
- import { pin_row, pin_state } from "@microchip/pin-standard";
2
- import { PCPHelper } from "../generated_module/src/pins/PCPHelper";
3
- import { AppModel } from "../generated_module/src/types/AutoModuleTypes";
4
-
5
- // provide complete dynamic data for all pin rows. It overrides static pindata.json
6
- export const getCompletePinData = (appModel: AppModel): any => {
7
- // way to programatically override the json data
8
- return {};
9
- };
10
-
11
- // overrides pin data for a particular row based on model.
12
- export function getRowData(appModel: AppModel, rowData: pin_row): pin_row | undefined {
13
- let retRowJSONdata: pin_row | undefined = rowData;
14
- let rowActions: any = [];
15
- const clockOutEnable = appModel.getImportValue("config_request")?.["CLKOUTEN"];
16
-
17
- if (clockOutEnable) {
18
- delete clockOutEnable["setting"];
19
- delete clockOutEnable["displayOptionSetting"];
20
- const selectedOption: string = clockOutEnable["defaultValue"]["value"];
21
-
22
- if (selectedOption.indexOf("CLKOUT function is enabled") != -1) {
23
- if (rowData.name === "clockout") {
24
- retRowJSONdata = {
25
- ...retRowJSONdata,
26
- behaviourMeta: { lockPinRegEx: "CLKOUT" },
27
- };
28
- }
29
- }
30
-
31
- const isPic18ClkOut: boolean =
32
- selectedOption === "CLKOUT function is enabled" ||
33
- selectedOption === "CLKOUT function is disabled"
34
- ? true
35
- : false;
36
- const actionArr = PCPHelper.stateActionBuilder(rowData)
37
- .rowWithName("clockout")
38
- .forComponent(clockOutEnable)
39
- .addIfLockedSetValue(
40
- "CLKOUT",
41
- isPic18ClkOut
42
- ? "CLKOUT function is enabled"
43
- : "CLKOUT function is enabled; FOSC/4 clock appears at OSC2",
44
- )
45
- .addIfUnLockedSetValue(
46
- ".*",
47
- isPic18ClkOut
48
- ? "CLKOUT function is disabled"
49
- : "CLKOUT function is disabled; i/o or oscillator function on OSC2",
50
- )
51
- .build();
52
- // Provide the module reference(scriptID) of remote config bits module
53
- for (const eachAction of actionArr) {
54
- const lockedState = eachAction.state[pin_state.LOCKED];
55
- if (lockedState) {
56
- lockedState.meta = {
57
- to: appModel.getAssignedImport("config_request")?.handle?.providerId,
58
- };
59
- }
60
- const unlockedState = eachAction.state[pin_state.UNLOCK];
61
- if (unlockedState) {
62
- unlockedState.meta = {
63
- to: appModel.getAssignedImport("config_request")?.handle?.providerId,
64
- };
65
- }
66
- rowActions.push(eachAction);
67
- }
68
- }
69
-
70
- const extClkSelect = appModel.getImportValue("config_request")?.["FEXTOSC"];
71
-
72
- if (extClkSelect) {
73
- delete extClkSelect["setting"];
74
- delete extClkSelect["displayOptionSetting"];
75
-
76
- const selectedOption: string = extClkSelect["defaultValue"]["value"];
77
-
78
- if (
79
- selectedOption.indexOf("(external clock)") != -1 ||
80
- selectedOption.indexOf("EC") != -1
81
- ) {
82
- if (rowData.name === "osc1" || rowData.name === "osc2") {
83
- retRowJSONdata = undefined;
84
- }
85
- }
86
-
87
- if (selectedOption.indexOf("(crystal oscillator)") != -1) {
88
- if (rowData.name === "clockin") {
89
- retRowJSONdata = undefined;
90
- }
91
- }
92
-
93
- if (
94
- selectedOption.indexOf("Oscillator not enabled") != -1 ||
95
- selectedOption.indexOf("Reserved") != -1
96
- ) {
97
- if (
98
- rowData.name === "clockin" ||
99
- rowData.name === "osc1" ||
100
- rowData.name === "osc2"
101
- ) {
102
- retRowJSONdata = undefined;
103
- }
104
- }
105
- // Restricting pin actions for clockin, osc1 and osc2 pin rows
106
- const mclrKey = appModel.getComponent("mclrUnusedKey")?.component;
107
- if (mclrKey) {
108
- rowActions = rowActions.concat(
109
- PCPHelper.stateActionBuilder(rowData)
110
- .rowWithName("clockin")
111
- .forComponent(mclrKey)
112
- .addIfLockedSetValue(".*", "")
113
- .addIfUnLockedSetValue(".*", "")
114
- .build(),
115
- );
116
-
117
- rowActions = rowActions.concat(
118
- PCPHelper.stateActionBuilder(rowData)
119
- .rowWithName("osc1")
120
- .forComponent(mclrKey)
121
- .addIfLockedSetValue(".*", "")
122
- .addIfUnLockedSetValue(".*", "")
123
- .build(),
124
- );
125
-
126
- rowActions = rowActions.concat(
127
- PCPHelper.stateActionBuilder(rowData)
128
- .rowWithName("osc2")
129
- .forComponent(mclrKey)
130
- .addIfLockedSetValue(".*", "")
131
- .addIfUnLockedSetValue(".*", "")
132
- .build(),
133
- );
134
- }
135
- }
136
-
137
- const mclrEnable = appModel.getImportValue("config_request")?.["MCLRE"];
138
- const lvpEnable = appModel.getImportValue("config_request")?.["LVP"];
139
-
140
- if (mclrEnable && lvpEnable) {
141
- delete mclrEnable["setting"];
142
- delete mclrEnable["displayOptionSetting"];
143
- const selectedMclrOption: string = mclrEnable["defaultValue"]["value"];
144
-
145
- delete lvpEnable["setting"];
146
- delete lvpEnable["displayOptionSetting"];
147
- const selectedLvpOption: string = lvpEnable["defaultValue"]["value"];
148
-
149
- if (
150
- selectedLvpOption.indexOf("HV on MCLR/VPP must be used for programming") !=
151
- -1 ||
152
- selectedLvpOption.indexOf(
153
- "High Voltage on MCLR/Vpp must be used for programming",
154
- ) != -1
155
- ) {
156
- if (
157
- selectedMclrOption.indexOf("MCLR pin is MCLR") != -1 ||
158
- selectedMclrOption.indexOf("MCLR pin is Master Clear function") != -1 ||
159
- selectedMclrOption === "MCLR pin (RE3) is MCLR"
160
- ) {
161
- if (rowData.name === "reset" && retRowJSONdata) {
162
- retRowJSONdata = {
163
- ...retRowJSONdata,
164
- behaviourMeta: { lockPinRegEx: "MCLR" },
165
- };
166
- }
167
- }
168
- const isPic18Mclr: boolean =
169
- selectedMclrOption ===
170
- "If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR " ||
171
- selectedMclrOption ===
172
- "If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR"
173
- ? true
174
- : false;
175
- const isQ10Mclr: boolean =
176
- selectedMclrOption === "MCLR pin (RE3) is MCLR" ||
177
- selectedMclrOption ===
178
- "If LVP = 0, MCLR pin (RE3) is an input; If LVP =1, MCLR pin (RE3) is MCLR"
179
- ? true
180
- : false;
181
- let actionArr: any = [];
182
-
183
- // For handling Q10 devices
184
- if (isQ10Mclr) {
185
- actionArr = PCPHelper.stateActionBuilder(rowData)
186
- .rowWithName("reset")
187
- .forComponent(mclrEnable)
188
- .addIfLockedSetValue("MCLR", "MCLR pin (RE3) is MCLR")
189
- .addIfUnLockedSetValue(
190
- ".*",
191
- "If LVP = 0, MCLR pin (RE3) is an input; If LVP =1, MCLR pin (RE3) is MCLR",
192
- )
193
- .build();
194
- } else {
195
- actionArr = PCPHelper.stateActionBuilder(rowData)
196
- .rowWithName("reset")
197
- .forComponent(mclrEnable)
198
- .addIfLockedSetValue(
199
- "MCLR",
200
- isPic18Mclr
201
- ? "If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR "
202
- : "MCLR pin is Master Clear function",
203
- )
204
- .addIfUnLockedSetValue(
205
- ".*",
206
- isPic18Mclr
207
- ? "If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR"
208
- : "MCLR pin function is port defined function",
209
- )
210
- .build();
211
- }
212
-
213
- // Provide the module reference(scriptID) of remote config bits module
214
- for (const eachAction of actionArr) {
215
- const lockedState = eachAction.state[pin_state.LOCKED];
216
- if (lockedState) {
217
- lockedState.meta = {
218
- to: appModel.getAssignedImport("config_request")?.handle
219
- ?.providerId,
220
- };
221
- }
222
- const unlockedState = eachAction.state[pin_state.UNLOCK];
223
- if (unlockedState) {
224
- unlockedState.meta = {
225
- to: appModel.getAssignedImport("config_request")?.handle
226
- ?.providerId,
227
- };
228
- }
229
- rowActions.push(eachAction);
230
- }
231
- } else {
232
- if (selectedMclrOption) {
233
- if (rowData.name === "reset" && retRowJSONdata) {
234
- retRowJSONdata = {
235
- ...retRowJSONdata,
236
- behaviourMeta: { lockPinRegEx: "MCLR" },
237
- };
238
- }
239
- }
240
- const mclrKey = appModel.getComponent("mclrUnusedKey")?.component;
241
- if (mclrKey) {
242
- rowActions = rowActions.concat(
243
- PCPHelper.stateActionBuilder(rowData)
244
- .rowWithName("reset")
245
- .forComponent(mclrKey)
246
- .addIfLockedSetValue(".*", "")
247
- .addIfUnLockedSetValue(".*", "")
248
- .build(),
249
- );
250
- }
251
- }
252
- }
253
-
254
- const noscOsccon1 = appModel.getComponentValue("noscOsccon1");
255
- if (
256
- noscOsccon1 === "HFINTOSC" ||
257
- noscOsccon1 === "LFINTOSC" ||
258
- noscOsccon1 === "SOSC" ||
259
- noscOsccon1 === "HFINTOSC with 2x PLL"
260
- ) {
261
- if (rowData.name === "clockin") {
262
- retRowJSONdata = undefined;
263
- }
264
- if (rowData.name === "osc1") {
265
- retRowJSONdata = undefined;
266
- }
267
- if (rowData.name === "osc2") {
268
- retRowJSONdata = undefined;
269
- }
270
- }
271
-
272
- if (rowData.name === "sosci") {
273
- if (noscOsccon1 === "SOSC" && retRowJSONdata) {
274
- retRowJSONdata = {
275
- ...retRowJSONdata,
276
- behaviourMeta: { lockPinRegEx: "SOSCI" },
277
- };
278
- } else {
279
- retRowJSONdata = undefined;
280
- }
281
- }
282
-
283
- if (rowData.name === "sosco") {
284
- if (noscOsccon1 === "SOSC" && retRowJSONdata) {
285
- retRowJSONdata = {
286
- ...retRowJSONdata,
287
- behaviourMeta: { lockPinRegEx: "SOSCO" },
288
- };
289
- } else {
290
- retRowJSONdata = undefined;
291
- }
292
- }
293
-
294
- if (retRowJSONdata) retRowJSONdata = { ...retRowJSONdata, actions: rowActions };
295
-
296
- return retRowJSONdata;
297
- }
@@ -1,13 +0,0 @@
1
- export class StringConstants {
2
- static readonly SOSC = "SOSC";
3
- static readonly LFINTOSC = "LFINTOSC";
4
- static readonly HFINTOSC = "HFINTOSC";
5
- static readonly HFINTOSC_2xPLL = "HFINTOSC with 2x PLL";
6
- static readonly EXTOSC = "EXTOSC";
7
- static readonly EXTOSC_4xPLL = "EXTOSC with 4x PLL";
8
- static readonly OSC_NOT_NEEDED = "Oscillator not needed";
9
- static readonly ON = "ON";
10
- static readonly ExtClkFreq_64MHz = 64000000;
11
- static readonly ExtClkFreq_20MHz = 20000000;
12
- static readonly ExtClkFreq_32MHz = 32000000;
13
- }