@mchp-mcc/scf-pic8-pwm-v2 4.2.6 → 4.2.7

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.
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @brief This file contains the API implementations for the ${moduleNameUpperCase} module.
9
9
  *
10
- * @version ${moduleNameUpperCase} Driver Version 2.0.2
10
+ * @version ${moduleNameUpperCase} Driver Version 2.0.3
11
11
  */
12
12
 
13
13
  ${disclaimer}
@@ -28,7 +28,15 @@
28
28
  // Set the PWM to the options selected in the ${productName}.
29
29
  <#list initRegisters as reg>
30
30
  // ${reg.comment}
31
- ${reg.name} = ${reg.valueAsHex};
31
+ <#if reg.name == "CCPTMRS1">
32
+ ${CCPTMRS1.settings.CTSEL.bitName} = ${CCPTMRS1.settings.CTSEL.valueAsHex};
33
+ <#elseif reg.name == "CCPTMRS">
34
+ ${CCPTMRS.settings.CTSEL.bitName} = ${CCPTMRS.settings.CTSEL.valueAsHex};
35
+ <#elseif reg.name == "PWMTMRS0">
36
+ ${PWMTMRS.settings.CTSEL.bitName} = ${PWMTMRS.settings.CTSEL.valueAsHex};
37
+ <#else>
38
+ ${reg.name} = ${reg.valueAsHex};
39
+ </#if>
32
40
 
33
41
  </#list>
34
42
  <#if timerselpresence == "timerselpresent">
@@ -56,8 +64,8 @@
56
64
  void ${api.LoadDutyValue.name}(uint16_t dutyValue)
57
65
  {
58
66
  // Writing to 8 MSBs of PWM duty cycle in PWMDCH register
59
- ${PWMDCH} = (uint8_t) ((dutyValue & 0x03FCu) >> 2);
67
+ ${PWMDCH.name} = (uint8_t) ((dutyValue & 0x03FCu) >> 2);
60
68
 
61
69
  // Writing to 2 LSBs of PWM duty cycle in PWMDCL register
62
- ${PWMDCL} = (uint8_t) ((dutyValue & 0x0003u) << 6);
70
+ ${PWMDCL.name} = (uint8_t) ((dutyValue & 0x0003u) << 6);
63
71
  }
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @brief This file contains the API prototypes for the ${moduleNameUpperCase} driver.
9
9
  *
10
- * @version ${moduleNameUpperCase} Driver Version 2.0.2
10
+ * @version ${moduleNameUpperCase} Driver Version 2.0.3
11
11
  */
12
12
 
13
13
  ${disclaimer}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mchp-mcc/scf-pic8-pwm-v2",
3
- "version": "4.2.6",
3
+ "version": "4.2.7",
4
4
  "scf": {
5
5
  "reducer": "auto",
6
6
  "creator": "output/creator.js",
@@ -175,7 +175,7 @@
175
175
  "@microchip/initializer-system": "^0.5.3",
176
176
  "@microchip/melody-automodule-interface": "^1.5.1",
177
177
  "@microchip/pic-8bit-types": "^5.0.1",
178
- "@microchip/run-directory": "^3.3.0",
178
+ "@microchip/run-directory": "^4.2.3",
179
179
  "@microchip/scf-automodule": "^5.5.1",
180
180
  "@microchip/scf-automodule-impl": "^1.7.1",
181
181
  "@microchip/scf-autoview": "^3.26.1",
@@ -230,4 +230,4 @@
230
230
  "description": "- Download & Install [nodejs](https://nodejs.org/en/download/)\r - Download & Install npm\r - Setup node & npm in enviroment path",
231
231
  "main": "lib/generated_module/src/index.js",
232
232
  "author": ""
233
- }
233
+ }
@@ -299,8 +299,8 @@ describe("DerivedData for APIs: Timer selection -- >", () => {
299
299
  expect(derivedFunctions?.ctselPwmtmrs?.()).toEqual("PWM4timer2");
300
300
  });
301
301
  });
302
- describe("Invalid Timer 7 -->", () => {
303
- const mockModule = mockAssignedModule(getMockState(true, "TMR7", "TMR7"));
302
+ describe("Invalid Timer -->", () => {
303
+ const mockModule = mockAssignedModule(getMockState(true, "TMR", "TMR"));
304
304
  const model = getModel(mockModule, MyDerivedData.getDerivedData);
305
305
  const derivedData = model?.getDerivedData() as DerivedData;
306
306
  const derivedFunctions = derivedData?.getMyFunctions();
@@ -74,6 +74,7 @@ class MyDerivedData implements DerivedData {
74
74
  pwmResolution: (): number => this.getPwmCalculator().getPwmResolution(),
75
75
 
76
76
  ctselCcptmrs1: this.ctselTimerSetting,
77
+ ctselCcptmrs: this.ctselTimerSetting,
77
78
  ctselPwmtmrs: this.ctselTimerSetting,
78
79
  pwmdchPwmdch: (): number =>
79
80
  Number(this.dataModel.getComponentValue("pwmdcValue")) >> 2,
@@ -131,8 +132,9 @@ class MyDerivedData implements DerivedData {
131
132
  switch (componentName) {
132
133
  case "timerSelection": {
133
134
  const result: any[] = [];
134
- const CCPTMRSREG = this.dataModel.getPeripheralDescription()?.registers
135
- ?.CCPTMRS1;
135
+ const CCPTMRSREG =
136
+ this.dataModel.getPeripheralDescription()?.registers?.CCPTMRS1 ??
137
+ this.dataModel.getPeripheralDescription()?.registers?.CCPTMRS;
136
138
  const PWMTMRSREG = this.dataModel.getPeripheralDescription()?.registers
137
139
  ?.PWMTMRS;
138
140
  if (CCPTMRSREG) {
@@ -300,15 +302,14 @@ class MyDerivedData implements DerivedData {
300
302
  };
301
303
 
302
304
  private ctselTimerSetting = (): string | undefined => {
303
- switch (this.dataModel.getComponentValue("timerSelection")) {
304
- case "TMR2":
305
- return this.dataModel.getHardware()?.getName() + "timer2";
306
- case "TMR4":
307
- return this.dataModel.getHardware()?.getName() + "timer4";
308
- case "TMR6":
309
- return this.dataModel.getHardware()?.getName() + "timer6";
310
- default:
311
- return undefined;
305
+ const timerSelection: string =
306
+ this.dataModel.getComponentValue("timerSelection") ?? "";
307
+ const groupmatch = timerSelection.match(/^TMR([0-9])$/) ?? "";
308
+ if (groupmatch.length > 1) {
309
+ const timersuffix = groupmatch?.length > 1 ? groupmatch[1] : "";
310
+ return this.dataModel.getHardware()?.getName() + "timer" + timersuffix;
311
+ } else {
312
+ return undefined;
312
313
  }
313
314
  };
314
315
 
@@ -41,8 +41,8 @@ export const getGeneratorModel = (model: AppModel): any => {
41
41
 
42
42
  //Registers and Settings
43
43
  initRegisters: initRegisters,
44
- PWMDCH: templateSettings?.registers?.PWMDCH.name ?? "",
45
- PWMDCL: templateSettings?.registers?.PWMDCL?.name ?? "",
44
+ // PWMDCH: templateSettings?.registers?.PWMDCH.name ?? "",
45
+ // PWMDCL: templateSettings?.registers?.PWMDCL?.name ?? "",
46
46
  CCPTMRSregname: templateSettings?.registers?.CCPTMRS1?.name ?? "",
47
47
  CTSELsettingname:
48
48
  templateSettings?.registers?.CCPTMRS1?.settings?.CTSEL.name ?? "",
@@ -51,6 +51,7 @@ export const getGeneratorModel = (model: AppModel): any => {
51
51
  (ctsel?.options?.length ?? 0) > 0 ? "timerselpresent" : "timerselabsent",
52
52
 
53
53
  pwmdcValue: model.getComponentValue("pwmdcValue"),
54
+ ...registerValues,
54
55
  };
55
56
  };
56
57
 
package/src/catalog.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "name": "PWM",
15
15
  "category": "Drivers/PWM",
16
16
  "description": "This module is a 16-bit Pulse-Width Modulator (PWM) with a compare feature and multiple outputs.",
17
- "deviceFilterRegEx": "^PIC18F.*Q10$|^PIC16[L]{0,1}F188.*$|^PIC16F152.*$|^PIC16F180[57][45]$",
17
+ "deviceFilterRegEx": "^PIC18F.*Q10$|^PIC16[L]{0,1}F188.*$|^PIC16F152.*$|^PIC16F180[57][45]$|^PIC18F.*K40$",
18
18
  "releaseNotesLink": "https://onlinedocs.microchip.com/v2/keyword-lookup?keyword=MCC.MELODY.8BITPIC.RELEASENOTES&version=latest&redirect=true"
19
19
  }
20
20
  }