@mchp-mcc/clock-16bit-driver 1.1.0 → 1.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mchp-mcc/clock-16bit-driver",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "scf": {
5
5
  "reducer": "output/reducer.js",
6
6
  "creator": "output/creator.js",
@@ -81,7 +81,7 @@
81
81
  "@mchp-mcc/pic-8bit-types": "^5.4.1",
82
82
  "@microchip/api-prefix-registration": "^0.1.0",
83
83
  "@microchip/canfd-clock-interface": "^1.0.0",
84
- "@microchip/clock-16bit-config-interface": "^1.1.2",
84
+ "@microchip/clock-16bit-config-interface": "^1.1.5",
85
85
  "@microchip/clock-16bit-interface": "^1.1.0",
86
86
  "@microchip/fosc-hz": "^0.1.2",
87
87
  "@microchip/pin-standard": "^0.4.1",
@@ -175,4 +175,4 @@
175
175
  "description": "- Download & Install [nodejs](https://nodejs.org/en/download/)\r - Download & Install npm\r - Setup node & npm in enviroment path",
176
176
  "main": "lib/generated_module/src/index.js",
177
177
  "author": ""
178
- }
178
+ }
@@ -20,9 +20,13 @@ const CLOCK_16BIT_CONFIG_INTERFACE = "clock_16bit_config_interface";
20
20
  const DIGITS_AFTER_DECIMAL_POINT = 2;
21
21
  const COMPONENT_AUX_CLOCK_SOURCE = "auxClockSource";
22
22
  const COMPONENT_MAIN_CLOCK_SOURCE = "mainClockSource";
23
+ const COMPONENT_CAN_FD_CLOCK_SOURCE_FREQ = "canfdClkSrcFreq";
23
24
  export const COMPONENT_AUX_CLOCK_INPUT_FREQUENCY = "auxClockInputFrequency_Hz";
24
25
  export const COMPONENT_MAIN_CLOCK_INPUT_FREQUENCY = "mainClockInputFrequency_Hz";
25
26
  const COMPONENT_REF_CLOCK_SOURCE = "refClockSource";
27
+ const COMPONENT_REF_CLOCK_ENABLE = "refClockEnable";
28
+ export const COMPONENT_CALCULATED_REF_OUTPUT_FREQUENCY =
29
+ "calculatedRefOutputFrequency_Hz";
26
30
  const COMPONENT_CANFD_CLOCK_SOURCE = "canfdClockSource";
27
31
  export const COMPONENT_REQUESTED_SYSTEM_FREQUENCY = "requestedSystemFrequency_Hz";
28
32
  const COMPONENT_FVCO_DIVIDER = "fvcoDivider";
@@ -102,6 +106,7 @@ class MyDerivedData implements DerivedData {
102
106
  requestedCanfdClockOutputFrequency_Hz: this
103
107
  .getRequestedCanfdClockOutputFrequency_Hz,
104
108
  getUiBehavior: this.getUiBehavior,
109
+ isEnabled: this.isComponentEnabled,
105
110
  mainClockInputFrequency_HzValidator: this.mainClockInputFrequency_HzValidator,
106
111
  auxClockInputFrequency_HzValidator: this.auxClockInputFrequency_HzValidator,
107
112
  requestedAuxClockOutputFrequency_HzValidator: this
@@ -118,6 +123,38 @@ class MyDerivedData implements DerivedData {
118
123
  };
119
124
  };
120
125
 
126
+ private isComponentEnabled = (componentName: string): boolean => {
127
+ let isComponentEnabled = false;
128
+ if (
129
+ componentName === COMPONENT_REF_CLOCK_SOURCE ||
130
+ componentName === COMPONENT_REQUESTED_REF_CLOCK_OUTPUT_FREQUENCY
131
+ ) {
132
+ if (this.dataModel?.getComponentValue(COMPONENT_REF_CLOCK_ENABLE) === true) {
133
+ isComponentEnabled = true;
134
+ }
135
+ } else if (
136
+ componentName === COMPONENT_REF_CLOCK_ENABLE ||
137
+ componentName === COMPONENT_MAIN_CLOCK_SOURCE ||
138
+ componentName === COMPONENT_MAIN_CLOCK_INPUT_FREQUENCY ||
139
+ componentName === COMPONENT_SET_MAX_FREQUENCY ||
140
+ componentName === COMPONENT_FVCO_DIVIDER ||
141
+ componentName === COMPONENT_AUX_CLOCK_SOURCE ||
142
+ componentName === COMPONENT_CANFD_CLOCK_SOURCE ||
143
+ componentName === COMPONENT_AFVCO_DIVIDER ||
144
+ componentName === COMPONENT_AUX_CLOCK_INPUT_FREQUENCY ||
145
+ componentName === COMPONENT_REQUESTED_AUX_CLOCK_OUTPUT_FREQUENCY
146
+ ) {
147
+ isComponentEnabled = true;
148
+ } else if (componentName === COMPONENT_REQUESTED_SYSTEM_FREQUENCY) {
149
+ if (
150
+ this.dataModel?.getComponentValue(COMPONENT_SET_MAX_FREQUENCY) === false
151
+ ) {
152
+ isComponentEnabled = true;
153
+ }
154
+ }
155
+ return isComponentEnabled;
156
+ };
157
+
121
158
  private getCustomUiErrors = (componentName: string): Error[] | undefined => {
122
159
  let customErrors: Error[];
123
160
  switch (componentName) {
@@ -207,6 +244,17 @@ class MyDerivedData implements DerivedData {
207
244
  return minClockFrequency;
208
245
  };
209
246
 
247
+ private getClockPropertiesFromPayLoad = (): any => {
248
+ let clockProperties: unknown;
249
+ const interfaceData: clock_16bit_config_interface.ProcessedPayload = this.dataModel.getImportValue(
250
+ CLOCK_16BIT_CONFIG_INTERFACE,
251
+ );
252
+ if (interfaceData != undefined) {
253
+ clockProperties = interfaceData?.clockProperties;
254
+ }
255
+ return clockProperties;
256
+ };
257
+
210
258
  private getMaxClockFrequency = (): number => {
211
259
  let maxClockFrequency = 0;
212
260
  const interfaceData: clock_16bit_config_interface.ProcessedPayload = this.dataModel.getImportValue(
@@ -224,10 +272,24 @@ class MyDerivedData implements DerivedData {
224
272
  const interfaceData: clock_16bit_config_interface.ProcessedPayload = this.dataModel.getImportValue(
225
273
  CLOCK_16BIT_CONFIG_INTERFACE,
226
274
  );
227
- if (interfaceData != undefined) {
275
+ if (
276
+ interfaceData != undefined &&
277
+ this.dataModel?.getComponentValue("mainClockSource") !=
278
+ "FRC Oscillator with Postscaler"
279
+ ) {
228
280
  maxSystemClockFrequency =
229
281
  interfaceData?.mainClockPayload?.maxSystemClockFrequency ?? 0;
230
282
  }
283
+ if (
284
+ this.dataModel?.getComponentValue("mainClockSource") ==
285
+ "FRC Oscillator with Postscaler"
286
+ ) {
287
+ if (this.getClockPropertiesFromPayLoad()["FRC_CLOCK"] != undefined) {
288
+ maxSystemClockFrequency = Number(
289
+ this.getClockPropertiesFromPayLoad()["FRC_CLOCK"]?.value,
290
+ );
291
+ }
292
+ }
231
293
  return maxSystemClockFrequency;
232
294
  };
233
295
 
@@ -240,7 +302,7 @@ class MyDerivedData implements DerivedData {
240
302
  "Requested FCAN frequency can be configured from CAN 2.0/CAN-FD modules in Drivers category",
241
303
  };
242
304
  break;
243
- case "canfdClkSrcFreq":
305
+ case COMPONENT_CAN_FD_CLOCK_SOURCE_FREQ:
244
306
  uiBehavior = {
245
307
  ["ui:help"]:
246
308
  "CAN FD clock source frequency should be less than or equal to 640 MHz",
@@ -296,17 +358,15 @@ class MyDerivedData implements DerivedData {
296
358
 
297
359
  private isMainClockInputFrequencyVisible = (): boolean => {
298
360
  let visible = false;
299
- if (!this.dataModel.getComponentValue(COMPONENT_SET_MAX_FREQUENCY)) {
300
- const mainClockSource = this.dataModel.getComponentValue(
301
- COMPONENT_MAIN_CLOCK_SOURCE,
302
- );
303
- if (mainClockSource != undefined) {
304
- if (
305
- mainClockSource?.indexOf(PRIMARY) >= 0 ||
306
- mainClockSource?.indexOf(EXTERNAL) >= 0
307
- ) {
308
- visible = true;
309
- }
361
+ const mainClockSource = this.dataModel.getComponentValue(
362
+ COMPONENT_MAIN_CLOCK_SOURCE,
363
+ );
364
+ if (mainClockSource != undefined) {
365
+ if (
366
+ mainClockSource?.indexOf(PRIMARY) >= 0 ||
367
+ mainClockSource?.indexOf(EXTERNAL) >= 0
368
+ ) {
369
+ visible = true;
310
370
  }
311
371
  }
312
372
  return visible;
@@ -314,7 +374,7 @@ class MyDerivedData implements DerivedData {
314
374
 
315
375
  private isRequestedSystemFrequencyVisible = (): boolean => {
316
376
  let visible = false;
317
- if (!this.dataModel.getComponentValue(COMPONENT_SET_MAX_FREQUENCY)) {
377
+ if (this.dataModel?.getComponentValue(COMPONENT_SET_MAX_FREQUENCY) === false) {
318
378
  const mainClockSource = this.dataModel.getComponentValue(
319
379
  COMPONENT_MAIN_CLOCK_SOURCE,
320
380
  );
@@ -390,20 +450,17 @@ class MyDerivedData implements DerivedData {
390
450
  } else if (
391
451
  componentName === COMPONENT_REF_CLOCK_SOURCE ||
392
452
  componentName === COMPONENT_REQUESTED_REF_CLOCK_OUTPUT_FREQUENCY ||
393
- componentName === "calculatedRefOutputFrequency_Hz"
453
+ componentName === COMPONENT_CALCULATED_REF_OUTPUT_FREQUENCY ||
454
+ componentName === COMPONENT_REF_CLOCK_ENABLE
394
455
  ) {
395
456
  return this.isRefClockSupported();
396
457
  } else if (
397
458
  componentName === COMPONENT_CANFD_CLOCK_SOURCE ||
398
459
  componentName === COMPONENT_REQUESTED_CANFD_CLOCK_OUTPUT_FREQUENCY ||
399
460
  componentName === "calculatedCanfdOutputFrequency_Hz" ||
400
- componentName === "canfdClkSrcFreq"
461
+ componentName === COMPONENT_CAN_FD_CLOCK_SOURCE_FREQ
401
462
  ) {
402
463
  return this.isCanfdClockSupported();
403
- } else if (componentName === COMPONENT_MAIN_CLOCK_SOURCE) {
404
- if (this.dataModel.getComponentValue(COMPONENT_SET_MAX_FREQUENCY)) {
405
- return false;
406
- }
407
464
  }
408
465
  return true;
409
466
  };
@@ -472,6 +529,17 @@ class MyDerivedData implements DerivedData {
472
529
  });
473
530
  }
474
531
  }
532
+ if (this.dataModel?.getComponentValue(COMPONENT_SET_MAX_FREQUENCY)) {
533
+ const mainClockSource = this.dataModel?.getComponentValue(
534
+ COMPONENT_MAIN_CLOCK_SOURCE,
535
+ );
536
+ if (mainClockSource != undefined && mainClockSource?.indexOf(PLL) < 0) {
537
+ alerts.push({
538
+ type: Processor.AlertTypes.Warning,
539
+ text: "Please select PLL as clock source.",
540
+ });
541
+ }
542
+ }
475
543
 
476
544
  return alerts;
477
545
  };
@@ -940,27 +1008,38 @@ class MyDerivedData implements DerivedData {
940
1008
  };
941
1009
 
942
1010
  private auxClockArg = (): any => {
943
- return {
944
- auxClockSource: this.dataModel.getComponentValue(COMPONENT_AUX_CLOCK_SOURCE),
945
- auxClockInputFrequency_Hz: this.dataModel.getComponentValue(
946
- COMPONENT_AUX_CLOCK_INPUT_FREQUENCY,
947
- ),
948
- requestedAuxClockOutputFrequency_Hz: this.dataModel.getComponentValue(
949
- COMPONENT_REQUESTED_AUX_CLOCK_OUTPUT_FREQUENCY,
950
- ),
951
- afvcoDivider: Number(
952
- this.dataModel.getComponentValue(COMPONENT_AFVCO_DIVIDER),
953
- ),
954
- };
1011
+ if (
1012
+ this.dataModel.getComponentValue(COMPONENT_AUX_CLOCK_SOURCE) !=
1013
+ "FRC Oscillator"
1014
+ ) {
1015
+ return {
1016
+ auxClockSource: this.dataModel.getComponentValue(
1017
+ COMPONENT_AUX_CLOCK_SOURCE,
1018
+ ),
1019
+ auxClockInputFrequency_Hz: this.dataModel.getComponentValue(
1020
+ COMPONENT_AUX_CLOCK_INPUT_FREQUENCY,
1021
+ ),
1022
+ requestedAuxClockOutputFrequency_Hz: this.dataModel.getComponentValue(
1023
+ COMPONENT_REQUESTED_AUX_CLOCK_OUTPUT_FREQUENCY,
1024
+ ),
1025
+ afvcoDivider: Number(
1026
+ this.dataModel.getComponentValue(COMPONENT_AFVCO_DIVIDER),
1027
+ ),
1028
+ };
1029
+ }
955
1030
  };
956
1031
 
957
1032
  private refClockArg = (): any => {
958
- return {
959
- refClockSource: this.dataModel.getComponentValue(COMPONENT_REF_CLOCK_SOURCE),
960
- requestedRefClockOutputFrequency_Hz: this.dataModel.getComponentValue(
961
- COMPONENT_REQUESTED_REF_CLOCK_OUTPUT_FREQUENCY,
962
- ),
963
- };
1033
+ if (this.dataModel.getComponentValue(COMPONENT_REF_CLOCK_ENABLE) === true) {
1034
+ return {
1035
+ refClockSource: this.dataModel.getComponentValue(
1036
+ COMPONENT_REF_CLOCK_SOURCE,
1037
+ ),
1038
+ requestedRefClockOutputFrequency_Hz: this.dataModel.getComponentValue(
1039
+ COMPONENT_REQUESTED_REF_CLOCK_OUTPUT_FREQUENCY,
1040
+ ),
1041
+ };
1042
+ }
964
1043
  };
965
1044
 
966
1045
  private canfdClockArg = (): any => {
package/src/catalog.json CHANGED
@@ -10,6 +10,8 @@
10
10
  "avr",
11
11
  "pic8",
12
12
  "driver",
13
+ "pic24",
14
+ "dspic",
13
15
  ""
14
16
  ],
15
17
  "name": "Clock",
@@ -6,7 +6,7 @@
6
6
  "false": "disabled"
7
7
  },
8
8
  "help": {
9
- "url": "v2/keyword-lookup?keyword=SYSTEM_16BIT_MELODY_DRIVER&version=latest&redirect=true",
9
+ "url": "v2/keyword-lookup?keyword=CLOCK_16BIT_MELODY_DRIVER&version=latest&redirect=true",
10
10
  "tooltip": "Click here to open documentation"
11
11
  },
12
12
  "UIGroups": {
@@ -41,7 +41,7 @@
41
41
  "import": {
42
42
  "interfaceId": {
43
43
  "name": "clock-16bit-config-interface",
44
- "version": "^1.1.2"
44
+ "version": "^1.1.5"
45
45
  },
46
46
  "isRequired": true
47
47
  }
@@ -335,6 +335,17 @@
335
335
  "readonly": true
336
336
  }
337
337
  },
338
+ "refClockEnable": {
339
+ "name": "refClockEnable",
340
+ "description": "Reference Clock Enable",
341
+ "type": "boolean",
342
+ "defaultValue": false,
343
+ "group": "refClock",
344
+ "tabs": [
345
+ "main"
346
+ ],
347
+ "category": "software"
348
+ },
338
349
  "refClockSource": {
339
350
  "name": "refClockSource",
340
351
  "description": "REFO Clock Source",