@mchp-mcc/scf-pic8-pwm-v2 4.2.4 → 4.2.5
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 +23 -44
- package/output/autoCreator.js +140 -15
- package/output/autoCreator.js.map +1 -1
- package/output/autoProcessor.js +140 -15
- package/output/autoProcessor.js.map +1 -1
- package/output/creator.js +140 -15
- package/output/creator.js.map +1 -1
- package/output/processor.js +140 -15
- package/output/processor.js.map +1 -1
- package/package.json +13 -5
- package/src/DerivedData.test.ts +616 -0
- package/src/DerivedData.ts +60 -6
- package/src/GeneratorModel.test.tsx +69 -0
- package/src/PinsLogic.test.ts +155 -0
- package/src/PwmCalculator.test.tsx +56 -0
- package/src/interfaces/pwm_general_parameters.test.tsx +40 -0
- package/src/moduleConfig.json +28 -0
package/src/DerivedData.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { Interface, Arguments } from "@microchip/scf-interface";
|
|
|
11
11
|
import { getGeneratorModel, getHeaderFiles } from "./GeneratorModel";
|
|
12
12
|
import { MyComponentNames, MyExportNames } from "../generated_module/src/types";
|
|
13
13
|
import { getAutoSdlHelp } from "@microchip/scf-automodule-impl/lib/autoModule/ContextualHelp";
|
|
14
|
+
import { getPinsLogic } from "../generated_module/src/pins/PCPHelper";
|
|
15
|
+
import { MyImports } from "../generated_module/src/types";
|
|
14
16
|
|
|
15
17
|
export const getDerivedData = (dataModel: AppModel): DerivedData => {
|
|
16
18
|
if (dataModel) {
|
|
@@ -69,7 +71,8 @@ class MyDerivedData implements DerivedData {
|
|
|
69
71
|
pwmFrequency: (): number => this.getPwmCalculator().getPwmFrequency(),
|
|
70
72
|
pwmResolution: (): number => this.getPwmCalculator().getPwmResolution(),
|
|
71
73
|
|
|
72
|
-
ctselCcptmrs1: this.
|
|
74
|
+
ctselCcptmrs1: this.ctselTimerSetting,
|
|
75
|
+
ctselPwmtmrs: this.ctselTimerSetting,
|
|
73
76
|
pwmdchPwmdch: (): number =>
|
|
74
77
|
Number(this.dataModel.getComponentValue("pwmdcValue")) >> 2,
|
|
75
78
|
pwmdclPwmdcl: (): number =>
|
|
@@ -77,9 +80,20 @@ class MyDerivedData implements DerivedData {
|
|
|
77
80
|
|
|
78
81
|
templateData: (): any => getGeneratorModel(this.dataModel),
|
|
79
82
|
getHelpUrl: this.getSdlHelpOverride,
|
|
83
|
+
filterImports: this.filterImports,
|
|
84
|
+
getPinsLogic: getPinsLogic,
|
|
85
|
+
importName: this.friendlyImportName,
|
|
80
86
|
};
|
|
81
87
|
};
|
|
82
88
|
|
|
89
|
+
private friendlyImportName = (importKey: string): string => {
|
|
90
|
+
if (importKey === "scf_pic8_pwm_v2") return "PWM Hardware";
|
|
91
|
+
if (importKey === "osc_clocks") return "Oscillator Clock";
|
|
92
|
+
if (importKey === "initializer_system") return "system.c Initialize()";
|
|
93
|
+
if (importKey === "pin_standard") return "Pins";
|
|
94
|
+
return importKey;
|
|
95
|
+
};
|
|
96
|
+
|
|
83
97
|
private overrideDefaultValues = (componentName: string): any => {
|
|
84
98
|
switch (componentName) {
|
|
85
99
|
case "componentName":
|
|
@@ -95,6 +109,8 @@ class MyDerivedData implements DerivedData {
|
|
|
95
109
|
const result: any[] = [];
|
|
96
110
|
const CCPTMRSREG = this.dataModel.getPeripheralDescription()?.registers
|
|
97
111
|
?.CCPTMRS1;
|
|
112
|
+
const PWMTMRSREG = this.dataModel.getPeripheralDescription()?.registers
|
|
113
|
+
?.PWMTMRS;
|
|
98
114
|
if (CCPTMRSREG) {
|
|
99
115
|
const CTSELSETT = CCPTMRSREG.settings?.CTSEL;
|
|
100
116
|
for (const eachoptn of CTSELSETT?.options ?? []) {
|
|
@@ -104,7 +120,18 @@ class MyDerivedData implements DerivedData {
|
|
|
104
120
|
(optnmatch?.length ?? 0) > 1 ? "TMR" + optnmatch?.[1] : "";
|
|
105
121
|
result.push(correctOptnName);
|
|
106
122
|
}
|
|
107
|
-
}
|
|
123
|
+
}
|
|
124
|
+
if (PWMTMRSREG) {
|
|
125
|
+
const CTSELSETT = PWMTMRSREG.settings?.CTSEL;
|
|
126
|
+
for (const eachoptn of CTSELSETT?.options ?? []) {
|
|
127
|
+
const timeroptnregex = /^pwm[0-9]timer([0-9])$/i;
|
|
128
|
+
const optnmatch = eachoptn.alias.match(timeroptnregex);
|
|
129
|
+
const correctOptnName =
|
|
130
|
+
(optnmatch?.length ?? 0) > 1 ? "TMR" + optnmatch?.[1] : "";
|
|
131
|
+
result.push(correctOptnName);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!CCPTMRSREG && !PWMTMRSREG) {
|
|
108
135
|
result.push("TMR2");
|
|
109
136
|
}
|
|
110
137
|
return result;
|
|
@@ -122,6 +149,31 @@ class MyDerivedData implements DerivedData {
|
|
|
122
149
|
return {};
|
|
123
150
|
};
|
|
124
151
|
|
|
152
|
+
private filterImports = (imports: MyImports): MyImports => {
|
|
153
|
+
let filteredImports: MyImports = imports;
|
|
154
|
+
const ImportKeys = ["Timer"];
|
|
155
|
+
|
|
156
|
+
ImportKeys.forEach((importKey) => {
|
|
157
|
+
filteredImports = this.getModel().filterImportBySetting(
|
|
158
|
+
filteredImports,
|
|
159
|
+
importKey,
|
|
160
|
+
(option: Processor.Option<any>): any => {
|
|
161
|
+
if (option.payload !== undefined) {
|
|
162
|
+
const rstSource =
|
|
163
|
+
this.dataModel.getComponentValue("timerSelection") ??
|
|
164
|
+
"disabled";
|
|
165
|
+
const regexpNumber = /\d/;
|
|
166
|
+
const inst = rstSource.match(regexpNumber);
|
|
167
|
+
if (rstSource.indexOf("TMR") !== -1) {
|
|
168
|
+
return option.payload.moduleName === "TMR" + inst;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
) as MyImports;
|
|
173
|
+
});
|
|
174
|
+
return filteredImports;
|
|
175
|
+
};
|
|
176
|
+
|
|
125
177
|
private getMyAlerts = (): Processor.Alert[] => {
|
|
126
178
|
const alerts: Processor.Alert[] = [];
|
|
127
179
|
|
|
@@ -170,6 +222,8 @@ class MyDerivedData implements DerivedData {
|
|
|
170
222
|
componentName = "ctselCcptmrs1";
|
|
171
223
|
} else if (this.getModel().getPeripheralDescription()?.registers?.CCPTMRS) {
|
|
172
224
|
componentName = "ctselCcptmrs";
|
|
225
|
+
} else if (this.getModel().getPeripheralDescription()?.registers?.PWMTMRS) {
|
|
226
|
+
componentName = "ctselPwmtmrs";
|
|
173
227
|
}
|
|
174
228
|
} else if (componentName === "dutyCycle" || componentName === "pwmdcValue") {
|
|
175
229
|
helpUrl = helpUrl?.replace(
|
|
@@ -221,14 +275,14 @@ class MyDerivedData implements DerivedData {
|
|
|
221
275
|
return undefined;
|
|
222
276
|
};
|
|
223
277
|
|
|
224
|
-
private
|
|
278
|
+
private ctselTimerSetting = (): string | undefined => {
|
|
225
279
|
switch (this.dataModel.getComponentValue("timerSelection")) {
|
|
226
280
|
case "TMR2":
|
|
227
|
-
return this.dataModel.getHardware()?.getName() + "
|
|
281
|
+
return this.dataModel.getHardware()?.getName() + "timer2";
|
|
228
282
|
case "TMR4":
|
|
229
|
-
return this.dataModel.getHardware()?.getName() + "
|
|
283
|
+
return this.dataModel.getHardware()?.getName() + "timer4";
|
|
230
284
|
case "TMR6":
|
|
231
|
-
return this.dataModel.getHardware()?.getName() + "
|
|
285
|
+
return this.dataModel.getHardware()?.getName() + "timer6";
|
|
232
286
|
default:
|
|
233
287
|
return undefined;
|
|
234
288
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//import { getModel } from "../generated_module/src/App/AppModel";
|
|
2
|
+
import { AppModel } from "../generated_module/src/types/AutoModuleTypes";
|
|
3
|
+
import { getModel, mockState } from "../generated_module/tests/AppModel.test";
|
|
4
|
+
import { mockAssignedModule } from "../generated_module/tests/processor.test";
|
|
5
|
+
import * as MyDerivedData from "./DerivedData";
|
|
6
|
+
import * as GenertorModel from "./GeneratorModel";
|
|
7
|
+
|
|
8
|
+
describe("GeneratorModel", () => {
|
|
9
|
+
describe("getGeneratorModel", () => {
|
|
10
|
+
test("componentName is undefined", () => {
|
|
11
|
+
const mockModule = mockAssignedModule(mockState());
|
|
12
|
+
const model = getModel(mockModule, MyDerivedData.getDerivedData);
|
|
13
|
+
if (model) {
|
|
14
|
+
model.getComponentValue = (comp_name: string): any => {
|
|
15
|
+
const compData = {
|
|
16
|
+
componentName: undefined,
|
|
17
|
+
};
|
|
18
|
+
return compData[comp_name];
|
|
19
|
+
};
|
|
20
|
+
expect(
|
|
21
|
+
GenertorModel.getGeneratorModel(model as any).customName,
|
|
22
|
+
).toBeUndefined();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("PeripheralDescription is undefined", () => {
|
|
27
|
+
const mockModule = mockAssignedModule(mockState());
|
|
28
|
+
const model = getModel(mockModule, MyDerivedData.getDerivedData);
|
|
29
|
+
if (model) {
|
|
30
|
+
model.getPeripheralDescription = (): any => {
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
expect(
|
|
34
|
+
GenertorModel.getGeneratorModel(model as AppModel).hardwareSettings,
|
|
35
|
+
).toBeDefined;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
// describe("convertToTemplate", () => {
|
|
40
|
+
// test("Hardware is undefined", () => {
|
|
41
|
+
// const mockModule = mockAssignedModule(mockState());
|
|
42
|
+
// const model = getModel(mockModule, MyDerivedData.getDerivedData);
|
|
43
|
+
|
|
44
|
+
// if (model) {
|
|
45
|
+
// model.getHardware = (): any => {
|
|
46
|
+
// return undefined;
|
|
47
|
+
// };
|
|
48
|
+
// const result1 = GenertorModel.convertToTemplate(
|
|
49
|
+
// model as AppModel,
|
|
50
|
+
// "positive",
|
|
51
|
+
// [],
|
|
52
|
+
// );
|
|
53
|
+
// expect(result1.length).toBe(0);
|
|
54
|
+
// const result2 = GenertorModel.convertToTemplate(
|
|
55
|
+
// model as AppModel,
|
|
56
|
+
// "negative",
|
|
57
|
+
// [],
|
|
58
|
+
// );
|
|
59
|
+
// expect(result2.length).toBe(0);
|
|
60
|
+
// const result3 = GenertorModel.convertToTemplate(
|
|
61
|
+
// model as AppModel,
|
|
62
|
+
// "none",
|
|
63
|
+
// [],
|
|
64
|
+
// );
|
|
65
|
+
// expect(result3.length).toBe(0);
|
|
66
|
+
// }
|
|
67
|
+
// });
|
|
68
|
+
// });
|
|
69
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { behaviour, direction, pin_row } from "@microchip/pin-standard";
|
|
2
|
+
//import { getModel } from "../generated_module/src/App/AppModel";
|
|
3
|
+
import { MyState } from "../generated_module/src/types/AutoModuleTypes";
|
|
4
|
+
import { getModel, mockState } from "../generated_module/tests/AppModel.test";
|
|
5
|
+
import { mockAssignedModule } from "../generated_module/tests/processor.test";
|
|
6
|
+
import { getDerivedData } from "./DerivedData";
|
|
7
|
+
import { getRowData } from "./PinsLogic";
|
|
8
|
+
|
|
9
|
+
// export const getMockState = (ccpMode: string | undefined): MyState => {
|
|
10
|
+
// return {
|
|
11
|
+
// main: {
|
|
12
|
+
// software: {
|
|
13
|
+
// componentName: "CCP1",
|
|
14
|
+
// scf_pic8_ccp_v1: "CCP1",
|
|
15
|
+
// },
|
|
16
|
+
// interrupt: {
|
|
17
|
+
// interruptEnable: false,
|
|
18
|
+
// },
|
|
19
|
+
// hardware: {
|
|
20
|
+
// ccpMode: ccpMode,
|
|
21
|
+
// captureMode: "Every edge",
|
|
22
|
+
// compareMode: "Toggle_cleartmr",
|
|
23
|
+
// dutyCycle: 0,
|
|
24
|
+
// ccprValue: "0",
|
|
25
|
+
// pwmPeriod: "0",
|
|
26
|
+
// pwmFrequency: "0",
|
|
27
|
+
// pwmResolution: "0",
|
|
28
|
+
// ccpTimer: "Timer 1",
|
|
29
|
+
// pwmTimer: "Timer 2",
|
|
30
|
+
// enCcpcon: true,
|
|
31
|
+
// fmtCcpcon: "right_aligned",
|
|
32
|
+
// ctsCcpcap: "CCP1 pin",
|
|
33
|
+
// },
|
|
34
|
+
// },
|
|
35
|
+
// };
|
|
36
|
+
// };
|
|
37
|
+
|
|
38
|
+
export const getMockState = (): MyState => {
|
|
39
|
+
return {
|
|
40
|
+
main: {
|
|
41
|
+
software: {
|
|
42
|
+
componentName: "PWM4",
|
|
43
|
+
tmr2Dependency: "TMR2",
|
|
44
|
+
},
|
|
45
|
+
hardware: {
|
|
46
|
+
timerSelection: "TMR2",
|
|
47
|
+
dutyCycle: 50,
|
|
48
|
+
pwmdcValue: 511,
|
|
49
|
+
pwmPeriod: 0.001024,
|
|
50
|
+
pwmFrequency: 976.56,
|
|
51
|
+
pwmResolution: 10,
|
|
52
|
+
pwmpolPwmcon: "active_hi",
|
|
53
|
+
pwmenPwmcon: true,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
describe("PinsLogic --> Test Cases ", () => {
|
|
60
|
+
describe("getRowData() test case ", () => {
|
|
61
|
+
const mockModule = mockAssignedModule(getMockState());
|
|
62
|
+
const model = getModel(mockModule, getDerivedData);
|
|
63
|
+
|
|
64
|
+
const pwmPpsData: pin_row = {
|
|
65
|
+
name: "pwmPps",
|
|
66
|
+
module: "PWM6",
|
|
67
|
+
function: "PWM6OUT",
|
|
68
|
+
direction: direction.output,
|
|
69
|
+
filter: {
|
|
70
|
+
module: "PWM6",
|
|
71
|
+
aliasReEx: "PWM[0-9]",
|
|
72
|
+
},
|
|
73
|
+
behaviour: behaviour.PPS,
|
|
74
|
+
};
|
|
75
|
+
it("Test for pwmPpsData pin data: PWM mode", () => {
|
|
76
|
+
if (model) {
|
|
77
|
+
expect(getRowData(model as any, pwmPpsData)).toMatchObject(pwmPpsData);
|
|
78
|
+
expect(getRowData(model as any, pwmPpsData)?.actions).toBeUndefined();
|
|
79
|
+
} else {
|
|
80
|
+
throw "Model not configured for testcase";
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
// describe("getRowData() test case : CCP in no mode", () => {
|
|
85
|
+
// const mockModule = mockAssignedModule(getMockState(""));
|
|
86
|
+
// const model = getModel(mockModule, getDerivedData);
|
|
87
|
+
|
|
88
|
+
// const ccpPpsData: pin_row = {
|
|
89
|
+
// name: "ccpPps",
|
|
90
|
+
// module: "CCP3",
|
|
91
|
+
// function: "CCP3",
|
|
92
|
+
// direction: direction.output,
|
|
93
|
+
// filter: {
|
|
94
|
+
// module: "CCP3",
|
|
95
|
+
// aliasReEx: "CCP[0-9]",
|
|
96
|
+
// },
|
|
97
|
+
// behaviour: behaviour.PPS,
|
|
98
|
+
// };
|
|
99
|
+
// it("Test for ccpPpsData pin data: no mode", () => {
|
|
100
|
+
// if (model) {
|
|
101
|
+
// expect(getRowData(model, ccpPpsData)).toMatchObject(ccpPpsData);
|
|
102
|
+
// expect(getRowData(model, ccpPpsData)?.actions).toBeUndefined();
|
|
103
|
+
// } else {
|
|
104
|
+
// throw "Model not configured for testcase";
|
|
105
|
+
// }
|
|
106
|
+
// });
|
|
107
|
+
// });
|
|
108
|
+
describe("getRowData() test case : invalid", () => {
|
|
109
|
+
const mockModule = mockAssignedModule(mockState());
|
|
110
|
+
const model = getModel(mockModule, getDerivedData);
|
|
111
|
+
|
|
112
|
+
const pwmPpsData: pin_row = {
|
|
113
|
+
name: "dummy",
|
|
114
|
+
module: "PWM6",
|
|
115
|
+
function: "PWM6OUT",
|
|
116
|
+
direction: direction.output,
|
|
117
|
+
filter: {
|
|
118
|
+
module: "PWM6",
|
|
119
|
+
aliasReEx: "PWM[0-9]",
|
|
120
|
+
},
|
|
121
|
+
behaviour: behaviour.PPS,
|
|
122
|
+
};
|
|
123
|
+
it("Test for pwmPpsData pin data: invalid", () => {
|
|
124
|
+
if (model) {
|
|
125
|
+
expect(getRowData(model as any, pwmPpsData)).toMatchObject(pwmPpsData);
|
|
126
|
+
expect(getRowData(model as any, pwmPpsData)?.actions).toBeUndefined();
|
|
127
|
+
} else {
|
|
128
|
+
throw "Model not configured for testcase";
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
it("Test for ccpPpsData pin data, undefined registers", () => {
|
|
132
|
+
let mockAssignedMod = mockAssignedModule(mockState());
|
|
133
|
+
mockAssignedMod = {
|
|
134
|
+
...(mockAssignedMod ?? {}),
|
|
135
|
+
imports: {
|
|
136
|
+
...(mockAssignedMod?.imports ?? {}),
|
|
137
|
+
scf_pic8_pwm_v2: {
|
|
138
|
+
...(mockAssignedMod?.imports?.scf_pic8_pwm_v2 ?? {}),
|
|
139
|
+
handle: undefined,
|
|
140
|
+
payload: undefined,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
const mockModel = getModel(mockAssignedMod, getDerivedData);
|
|
145
|
+
if (mockModel) {
|
|
146
|
+
expect(getRowData(mockModel as any, pwmPpsData)).toMatchObject(
|
|
147
|
+
pwmPpsData,
|
|
148
|
+
); // check if the same data is returned
|
|
149
|
+
expect(getRowData(mockModel as any, pwmPpsData)?.actions).toBeUndefined();
|
|
150
|
+
} else {
|
|
151
|
+
throw "Model not configured for testcase";
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
@@ -55,3 +55,59 @@ describe("Pwm Calculations: PR = 0x4d, Prescaler = 0x5, fosc = 1M, DC = 60", ()
|
|
|
55
55
|
expect(pwmCalculator2.getActualPulseWidth()).toBe(0.005952);
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
+
|
|
59
|
+
describe("Pwm Calculations: PR = 0x0, Prescaler = 0x0, fosc = 1M, DC = 0", () => {
|
|
60
|
+
const pwmCalculator2 = new PwmCalculator(0x0, 0, 1000000, 0);
|
|
61
|
+
|
|
62
|
+
test("getPwmPeriod", () => {
|
|
63
|
+
expect(pwmCalculator2.getPwmPeriod()).toBe(0);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("getPwmFrequency", () => {
|
|
67
|
+
expect(pwmCalculator2.getPwmFrequency()).toBe(0);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("getPwmResolution", () => {
|
|
71
|
+
expect(pwmCalculator2.getPwmResolution()).toBe(2);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("getCCPRValue", () => {
|
|
75
|
+
expect(pwmCalculator2.getCCPRValue()).toBe(0);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("getActualDutyCycle", () => {
|
|
79
|
+
expect(pwmCalculator2.getActualDutyCycle()).toBe(0);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("getActualPulseWidth", () => {
|
|
83
|
+
expect(pwmCalculator2.getActualPulseWidth()).toBe(0);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe("Pwm Calculations: PR = 0x0, Prescaler = 0x0, fosc = 0, DC = 0", () => {
|
|
88
|
+
const pwmCalculator2 = new PwmCalculator(0x0, 0, 0, 0);
|
|
89
|
+
|
|
90
|
+
test("getPwmPeriod", () => {
|
|
91
|
+
expect(pwmCalculator2.getPwmPeriod()).toBe(0);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("getPwmFrequency", () => {
|
|
95
|
+
expect(pwmCalculator2.getPwmFrequency()).toBe(0);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("getPwmResolution", () => {
|
|
99
|
+
expect(pwmCalculator2.getPwmResolution()).toBe(2);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test("getCCPRValue", () => {
|
|
103
|
+
expect(pwmCalculator2.getCCPRValue()).toBe(0);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("getActualDutyCycle", () => {
|
|
107
|
+
expect(pwmCalculator2.getActualDutyCycle()).toBe(0);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test("getActualPulseWidth", () => {
|
|
111
|
+
expect(pwmCalculator2.getActualPulseWidth()).toBe(0);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ProcessedExportInterface, Interface } from "./pwm_general_parameters";
|
|
2
|
+
|
|
3
|
+
describe("The pwm_general_parameters interface", () => {
|
|
4
|
+
it("doesn't explode", () => {
|
|
5
|
+
expect(Interface.getInterfaceId()).toBeDefined();
|
|
6
|
+
expect(Interface.createPrototypeImport()).toBeDefined();
|
|
7
|
+
expect(Interface.createPrototypeExport()).toBeDefined();
|
|
8
|
+
expect(
|
|
9
|
+
Interface.createFirmwareApi("MyModule", [
|
|
10
|
+
{ name: "mymodule.h", path: "include/" },
|
|
11
|
+
]),
|
|
12
|
+
).toBeDefined();
|
|
13
|
+
expect(Interface.createMock()).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("Checks Interface ID", () => {
|
|
17
|
+
expect(Interface.getInterfaceId().name).toBe("pwm_general_parameters");
|
|
18
|
+
expect(Interface.getInterfaceId().version).toBe("0.1.0");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("Create's api with name, headers, or custom API undefined", () => {
|
|
22
|
+
expect(Interface.createFirmwareApi("", [{ name: "", path: "" }])).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const createMock = (): ProcessedExportInterface => {
|
|
27
|
+
return {
|
|
28
|
+
interfaceId: Interface.getInterfaceId(),
|
|
29
|
+
payload: {
|
|
30
|
+
interfaceApi: Interface.createFirmwareApi("MyModule", [
|
|
31
|
+
{ name: "mymodule.h", path: "include/" },
|
|
32
|
+
]),
|
|
33
|
+
},
|
|
34
|
+
args: {
|
|
35
|
+
requestId: {
|
|
36
|
+
customName: "MyModule",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
};
|
package/src/moduleConfig.json
CHANGED
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"main": "Easy View",
|
|
31
31
|
"register": "Register Initialization"
|
|
32
32
|
},
|
|
33
|
+
"help": {
|
|
34
|
+
"url": "v2/keyword-lookup?keyword=scf-pic8-pwm-v2&redirect=true",
|
|
35
|
+
"tooltip": "Click here to open documentation."
|
|
36
|
+
},
|
|
33
37
|
"analytics": {
|
|
34
38
|
"logAlwaysComps": [
|
|
35
39
|
"pwmenPwmcon",
|
|
@@ -134,6 +138,17 @@
|
|
|
134
138
|
],
|
|
135
139
|
"category": "software"
|
|
136
140
|
},
|
|
141
|
+
"tmr2Dependency": {
|
|
142
|
+
"name": "tmr2Dependency",
|
|
143
|
+
"description": "Timer Dependency Selector",
|
|
144
|
+
"category": "import",
|
|
145
|
+
"type": "ComboBox",
|
|
146
|
+
"group": "software",
|
|
147
|
+
"tabs": [
|
|
148
|
+
"main"
|
|
149
|
+
],
|
|
150
|
+
"importId": "Timer"
|
|
151
|
+
},
|
|
137
152
|
"timerSelection": {
|
|
138
153
|
"name": "timerSelection",
|
|
139
154
|
"description": "Select a Timer",
|
|
@@ -240,6 +255,19 @@
|
|
|
240
255
|
"version": "1.0.0"
|
|
241
256
|
},
|
|
242
257
|
"registers": {
|
|
258
|
+
"PWMTMRS": [
|
|
259
|
+
{
|
|
260
|
+
"setting": "CTSEL",
|
|
261
|
+
"name": "ctselPwmtmrs",
|
|
262
|
+
"category": "hardware",
|
|
263
|
+
"description": "Insert Description Here",
|
|
264
|
+
"type": "ComboBox",
|
|
265
|
+
"group": "hardware",
|
|
266
|
+
"tabs": [
|
|
267
|
+
"register"
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
],
|
|
243
271
|
"CCPTMRS1": [
|
|
244
272
|
{
|
|
245
273
|
"setting": "CTSEL",
|