Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
90ac8220
Commit
90ac8220
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
Add Python code conventions to CODECONVENTIONS.
parent
5b65f0c7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CODECONVENTIONS.md
+21
-5
21 additions, 5 deletions
CODECONVENTIONS.md
with
21 additions
and
5 deletions
CODECONVENTIONS.md
+
21
−
5
View file @
90ac8220
C
ode conventions
Python c
ode conventions
================
================
=======
When writing new code, please adhere to the following conventions.
Python code follows
[
PEP 8
](
http://legacy.python.org/dev/peps/pep-0008/
)
.
Naming conventions:
-
Module names are short and all lowercase; eg pyb, stm.
-
Class names are CamelCase, with abreviations all uppercase; eg I2C, not
I2c.
-
Function and method names are all lowercase with words separated by
a single underscore as necessary to improve readability; eg mem_read.
-
Constants are all uppercase with words separated by a single underscore;
eg GPIO_IDR.
C code conventions
==================
When writing new C code, please adhere to the following conventions.
White space:
White space:
-
Expand tabs to 4 spaces.
-
Expand tabs to 4 spaces.
...
@@ -18,8 +32,10 @@ Braces:
...
@@ -18,8 +32,10 @@ Braces:
-
For else-statements, put the else on the same line as the previous
-
For else-statements, put the else on the same line as the previous
closing brace.
closing brace.
Include directives:
Header files:
-
Don't include within a header file.
-
Try to stick to the Plan 9 header style, where header files do not
include other header files.
-
Don't protect a header file from multiple inclusion with #if directives.
Type names and declarations:
Type names and declarations:
-
When defining a type, put '_t' after it.
-
When defining a type, put '_t' after it.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment