Skip to content

Commit bb3774b

Browse files
committed
Merge pull request #8 in MCU16CE/dspic33ck-power-pwm-complementary from develop to master
* commit 'b9cd6605ed92d54fae2992de27280ca467c2eb3b': (106 commits) Updated microchip.png with the original logo file Fixed typo 'Develpoment' to 'Development' Revert "Updated Microchip logo to solve display issues with previous version" Fixing typo "Intial' to 'initial' fixed typo 'Configuraiton' -> 'Configuration' Updated the project description Updated Microchip logo to solve display issues with previous version PR-11 contents Added function p33c_PwmModule_GetHandle to stay consistent with abstracted SFRs for module and generator registers added device protection for dsPIC33C MPLAB X configuraiton change after having renamed files pwm.c/h to pwm_init.c/h Minor format edits - no content change Moved PWM mode configuration to the top of configuration settings to make it clearly visible for users where/how the PWM mode is adjusted changed PWM configuration template pgConfigClear hafter having been renamed from pgConfigDispose to pgConfigClear Fixed header inclusions after having renamed pwm.h header file to pwm_init.h Minor format edits - no content change Grouped fuction prototype declarations into "essential" and "higher level" groups to make it easier for users to find and understand them Renamed guarding condition of header file Added NULL-pointer protection to functions Bugfix: fixed type conflict between pointer and integer ...
2 parents 3983714 + b9cd660 commit bb3774b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+27332
-113
lines changed

.citd/Jenkinsfilek8s

Lines changed: 105 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ pipeline {
1010

1111
environment {
1212
NOTIFICATION_EMAIL = '1f1319de.microchip.com@amer.teams.ms'
13-
//Update this URL based on where(which organization) it needs to be deployed
14-
GITHUB_URL ='https://github.com/mchpTestArea'
15-
//This is the BitBucket repo URL which we want to deploy
16-
BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/mcu16ce/dspic33c-power-pwm-complementary.git'
17-
//Branch to be deployed, if multiple branches use comma separated string
18-
DEPLOY_BRANCH = 'master'
19-
GITHUB_CREDENTIAL_ID = 'GITHUB_PIC_AVR_TEST_TOKEN'
20-
CHANGE_LOG_PATH = 'deploy_sandbox/changelog.md'
13+
//This is the BitBucket source repo URL to be deployed
14+
BITBUCKET_SOURCE_URL = 'https://bitbucket.microchip.com/scm/mcu16ce/dspic33ck-power-pwm-complementary.git'
15+
BITBUCKET_CREDENTIAL_ID = 'BITBUCKET_INTERNAL_TOKEN'
16+
GITHUB_PRODUCTION_DEPLOY_URL ='https://github.com/microchip-pic-avr-examples'
17+
GITHUB_TEST_DEPLOY_URL ='https://github.com/mchpTestArea'
18+
//Selects the deployment URL(production or test) based on the merge target branch, selects "microchip-pic-avr-examples" if target branch is "master" , if target branch is "test_deploy" selects "mchpTestArea" else null
19+
GITHUB_URL = getGitHubUrl("${GITHUB_PRODUCTION_DEPLOY_URL}","${GITHUB_TEST_DEPLOY_URL}")
20+
GITHUB_PRODUCTION_DEPLOY_CREDENTIAL_ID ='GITHUB_MICROCHIP_PIC_AVR_EXAMPLES_TOKEN'
21+
GITHUB_TEST_DEPLOY_CREDENTIAL_ID ='GITHUB_PIC_AVR_TEST_TOKEN'
22+
//Gets the Github credential id based on the deployment organization
23+
GITHUB_CREDENTIAL_ID = getGitHubCredentialId("${GITHUB_URL}","${GITHUB_PRODUCTION_DEPLOY_URL}","${GITHUB_TEST_DEPLOY_URL}","${GITHUB_PRODUCTION_DEPLOY_CREDENTIAL_ID}","${GITHUB_TEST_DEPLOY_CREDENTIAL_ID}")
24+
//Files or folders to be excluded from deployment, if multiple files or folders use comma separator
25+
DEPLOY_EXCLUDE_FOLDER_FILE_LIST = 'mchp_private'
26+
//Branch(s) to be deployed, if multiple branches use comma separator. ${env.BRANCH_NAME} is the target branch of the PR.
27+
DEPLOY_BRANCH_LIST = "${env.BRANCH_NAME}"
28+
CHANGE_LOG_PATH = 'changelog.md'
2129
SOURCE_PROJECT_META_DATA = '.main-meta/main.json'
2230
DEPLOY_TOOL_URL = 'https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
2331
}
@@ -34,7 +42,7 @@ pipeline {
3442
checkout scm
3543
}
3644
}
37-
45+
3846
stage('Build') {
3947
steps {
4048
script {
@@ -43,9 +51,17 @@ pipeline {
4351
}
4452
}
4553
}
46-
54+
4755
// Cloning the tool used for GitHub deployment
4856
stage('GitHub tool clone'){
57+
when {
58+
anyOf {
59+
allOf {
60+
not { changeRequest() }
61+
anyOf {branch 'master'; branch 'test_deploy';}
62+
}
63+
}
64+
}
4965
steps{
5066
script{
5167
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git")
@@ -54,14 +70,34 @@ pipeline {
5470
}
5571
}
5672

73+
// Creating tag in Bitbucket repo
74+
stage('Bitbucket Tag Creation'){
75+
when {
76+
anyOf {
77+
allOf {
78+
not { changeRequest() }
79+
anyOf {branch 'master';}
80+
}
81+
}
82+
}
83+
steps{
84+
script{
85+
def jsonObj = readJsonObject();
86+
87+
withCredentials([usernamePassword(credentialsId: "${env.BITBUCKET_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
88+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -bto=true -rpn=\"${jsonObj.content.projectName}\" -bid=$USER_NAME -bpat=$PASS -bpn=MCU16CE -btv=\"${jsonObj.content.version}\" -bch=${env.GIT_COMMIT} -btd=\"${jsonObj.content.version}\"")
89+
}
90+
}
91+
}
92+
}
93+
5794
// GitHub repo creation
5895
stage('GitHub Repo Creation'){
5996
when {
6097
anyOf {
61-
expression { !env.GITHUB_URL.contains('microchip-pic-avr-examples') }
6298
allOf {
6399
not { changeRequest() }
64-
branch 'master'
100+
anyOf {branch 'master'; branch 'test_deploy';}
65101
}
66102
}
67103
}
@@ -71,15 +107,14 @@ pipeline {
71107

72108
String [] topics = jsonObj.content.keywords
73109
def asString = topics.join(", ")
74-
asString = asString.replace("\n", "").replace(" ", "").replace("\t", "").replace("\r", "")
75110
Boolean visibility = true
76-
if(env.GITHUB_URL.contains('microchip-pic-avr-examples'))
111+
if(env.GITHUB_URL == env.GITHUB_PRODUCTION_DEPLOY_URL)
77112
{
78113
visibility = false
79114
}
80115

81116
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
82-
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpo=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpd=\"${jsonObj.content.shortDescription}\" -rpt=${asString} -rpp=${visibility}")
117+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpo=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpd=\"${jsonObj.content.shortDescription}\" -rpt=\"${asString}\" -rpp=${visibility}")
83118
}
84119
}
85120
}
@@ -89,10 +124,9 @@ pipeline {
89124
stage('GitHub Deploy Source'){
90125
when {
91126
anyOf {
92-
expression { !env.GITHUB_URL.contains('microchip-pic-avr-examples') }
93127
allOf {
94128
not { changeRequest() }
95-
branch 'master'
129+
anyOf {branch 'master'; branch 'test_deploy';}
96130
}
97131
}
98132
}
@@ -101,26 +135,9 @@ pipeline {
101135
def jsonObj = readJsonObject();
102136
def gitHubUrl = "${env.GITHUB_URL}" + "/" + jsonObj.content.projectName
103137
gitHubUrl = gitHubUrl.replace(" ", "").replace("\n", "")
104-
Boolean visibility = true
105-
if(env.GITHUB_URL.contains('microchip-pic-avr-examples'))
106-
{
107-
visibility = false
108-
}
109138

110139
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
111-
// If the organization is "mchpTestArea" change the visibility to public before deploy
112-
if(visibility == true)
113-
{
114-
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpu=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpp=false")
115-
}
116-
117-
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -deploy=true -gpat=$PASS -dgid=$USER_NAME -dburl=${env.BITBUCKET_URL} -dgurl=${gitHubUrl} -dbranch=${env.DEPLOY_BRANCH}")
118-
119-
// If the organization is "mchpTestArea" change the visibility to private after deploy
120-
if(visibility == true)
121-
{
122-
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpu=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpp=true")
123-
}
140+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -deploy=true -gpat=$PASS -dgid=$USER_NAME -dburl=${env.BITBUCKET_SOURCE_URL} -dgurl=${gitHubUrl} -dbranch=${env.DEPLOY_BRANCH_LIST} -def=${env.DEPLOY_EXCLUDE_FOLDER_FILE_LIST}")
124141
}
125142
}
126143
}
@@ -130,10 +147,9 @@ pipeline {
130147
stage('GitHub release'){
131148
when {
132149
anyOf {
133-
expression { !env.GITHUB_URL.contains('microchip-pic-avr-examples') }
134150
allOf {
135151
not { changeRequest() }
136-
branch 'master'
152+
anyOf {branch 'master'; branch 'test_deploy';}
137153
}
138154
}
139155
}
@@ -142,11 +158,39 @@ pipeline {
142158
def jsonObj = readJsonObject();
143159

144160
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
145-
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rlo=true -gpat=$PASS -rpn=\"${jsonObj.content.projectName}\" -rltv=\"v${jsonObj.content.version}\" -rltt=\"${jsonObj.content.version}\" -rlnp=${env.CHANGE_LOG_PATH}")
161+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rlo=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=\"${jsonObj.content.projectName}\" -rltv=\"${jsonObj.content.version}\" -rltt=\"${jsonObj.content.version}\" -rlnp=${env.CHANGE_LOG_PATH}")
146162
}
147163
}
148164
}
149165
}
166+
167+
//Deploying the Github content to portal
168+
stage('Portal-Deploy') {
169+
when {
170+
allOf {
171+
not { changeRequest() }
172+
anyOf {branch 'master';}
173+
}
174+
}
175+
steps {
176+
script {
177+
def jsonObj = readJsonObject();
178+
def version = jsonObj.content.version
179+
def project = jsonObj.content.projectName
180+
181+
String[] splitPreTag = "${env.GITHUB_URL}".split("/")
182+
def gitHubOrg = (splitPreTag[splitPreTag.size() - 1])
183+
184+
def cmdArgs = "'{\"repoOwnerName\":\"$gitHubOrg\",\"repoName\":\"$project\",\"tagName\":\"$version\"}'"
185+
cmdArgs = cmdArgs.replaceAll("\"","\\\\\"")
186+
187+
execute("git clone https://bitbucket.microchip.com/scm/portal/bundles.git")
188+
execute("cd bundles && chmod 755 ./portal-client-cli-linux")
189+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-portal-client-launcher.git")
190+
execute("cd tool-portal-client-launcher && node portalLauncher.js -app=../bundles/portal-client-cli-linux -cmd=\"uploadGitHub ${cmdArgs}\"")
191+
}
192+
}
193+
}
150194

151195
}
152196

@@ -169,12 +213,12 @@ pipeline {
169213
failure {
170214
script {
171215
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
172-
//archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
216+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
173217
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${env.NOTIFICATION_EMAIL}",
174218
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
175219
body: "Pipeline failure. ${env.BUILD_URL}"
176220
} else {
177-
//archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
221+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
178222
mail to: "${env.NOTIFICATION_EMAIL}",
179223
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
180224
body: "Pipeline failure. ${env.BUILD_URL}"
@@ -196,3 +240,24 @@ String readJsonObject() {
196240
def jsonObj = readJSON interpolate: true, file: "${env.SOURCE_PROJECT_META_DATA}"
197241
return jsonObj
198242
}
243+
244+
def getGitHubUrl(String productionUrl, String testDeployUrl) {
245+
String branchName = "${env.BRANCH_NAME}";
246+
if(branchName == 'master') {
247+
return productionUrl;
248+
} else if(branchName == 'test_deploy') {
249+
return testDeployUrl;
250+
} else {
251+
return null
252+
}
253+
}
254+
255+
def getGitHubCredentialId(String deployUrl, String productionDeployUrl, String testDeployUrl, String githubProductionDeployCredential, String githubTestDeployCredential) {
256+
if(deployUrl == productionDeployUrl) {
257+
return githubProductionDeployCredential;
258+
} else if(deployUrl == testDeployUrl) {
259+
return githubTestDeployCredential;
260+
} else {
261+
return null
262+
}
263+
}

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# .gitignore file
2+
#
3+
# Set up for Microchip/MPLAB X development
4+
#
5+
# Default gitignore files for code examples, only removing/ignoring usual MPLAB X clutter
6+
7+
# Object files
8+
*.o
9+
*.ko
10+
*.obj
11+
*.elf
12+
13+
# Executables
14+
*.exe
15+
16+
# Netbeans specific
17+
~*.*
18+
nbproject/build/
19+
nbproject/dist/
20+
nbproject/private/
21+
nbproject/disassembly/
22+
build/
23+
dist/
24+
private/
25+
disassembly/
26+
*.zip
27+
*.mk
28+
*.bash
29+
Makefile-genesis.properties
30+
31+
# MPLAB X Trace specific
32+
*.log
33+
*.inx
34+
35+
# KDE specific
36+
.directory
37+
38+
# Misc
39+
.svn
40+
*.bak
41+
*.doc
42+
*.docx
43+
44+
45+

.main-meta/main.json

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"category": "com.microchip.ide.project",
44
"content": {
55
"metaDataVersion": "1.0.0",
6-
"name": "com.microchip.mplabx.project.dspic33c-power-pwm-complementary",
6+
"name": "com.microchip.mplabx.project.dspic33ck-power-pwm-complementary",
77
"version": "1.0.0",
8-
"displayName": "xxxxxxxxxxxxxxx",
9-
"projectName": "dspic33c-power-pwm-complementary",
10-
"shortDescription": "xxxxxxxxxxxxxxx",
8+
"displayName": "dsPIC33CK/CH-MP PWM Configuration: Complementary PWM Output",
9+
"projectName": "dspic33ck-power-pwm-complementary",
10+
"shortDescription": "Complementary PWM Output Configuration Example for dsPIC33CK-MP devices",
1111
"ide": {
1212
"name": "MPLABX",
1313
"semverRange": ">=5.40.0"
@@ -17,34 +17,31 @@
1717
"semverRange": "^1.50.0"
1818
},
1919
"dfp": {
20-
"name": "PIC24F-GA-GB_DFP",
21-
"semverRange": "^1.0.41"
20+
"name": "dsPIC33CK-MP_DFP",
21+
"semverRange": "^1.4.102"
2222
},
2323
"device": {
2424
"metaDataVersion": "1.0.0",
2525
"category": "com.microchip.portal.contentRef",
2626
"content": {
2727
"metaDataVersion": "1.0.0",
2828
"category": "com.microchip.device",
29-
"name": "xxxxxxxxxxxxxxx",
29+
"name": "dsPIC33CK",
3030
"versionRange": "*"
3131
}
3232
},
33-
"subcategories":[
34-
"Hello World",
35-
[
36-
"Peripherals",
37-
"GPIO",
38-
"UART"
39-
]
40-
],
4133
"peripherals": [
4234
"GPIO",
43-
"UART"
35+
"PWM",
36+
"Timer"
4437
],
4538
"keywords": [
46-
"GPIO",
47-
"UART"
39+
"dsc",
40+
"dspic",
41+
"power",
42+
"power-conversion",
43+
"power-supply",
44+
"smps"
4845
]
4946
}
5047
}

LICENSE.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
� [2020] Microchip Technology Inc. and its subsidiaries
2+
3+
Subject to your compliance with these terms, you may use this Microchip software and any derivatives exclusively with Microchip products. You are responsible
4+
for complying with third party license terms applicable to your use of third party software (including open source software) that may accompany this Microchip
5+
software. SOFTWARE IS �AS IS.� NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
6+
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS,
7+
DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
8+
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP�S TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT EXCEED AMOUNT OF FEES, IF ANY, YOU
9+
PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.

0 commit comments

Comments
 (0)