You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The UW Orbital Docs are a great source of codebase documentation. The site includes many detailed setup guides as well as the style guides below. We highly recommend following these guides if you are new to the team or software development in general.
13
+
The UW Orbital Docs are a great source of codebase documentation. The site includes many detailed setup guides as well as code style guides. **We highly recommend following these guides if you are new to the team or software development in general.**
14
+
15
+
You will find it most helpful to check out the setup guides, build tutorials, and style guides.
18
16
19
17
Check out the site here: https://uworbital.github.io/OBC-firmware/
20
18
19
+
The documentation site now contains most of the information previously found in this README.
20
+
21
21
## Firmware Dependencies
22
22
23
23
#### HALCoGen
@@ -40,308 +40,9 @@ Download UniFlash here: https://www.ti.com/tool/UNIFLASH#downloads. This will be
- For the PR description, make sure to fill in all the required details in the generated template.
43
-
- Add at least 3 PR reviewers, including 1 software lead. When a PR is created, PR stats are added as a comment. You can use these stats to choose reviewers. Send a message in the #pr channel on Discord to notify the reviewers of your PR.
43
+
- Add at least two PR reviewers, including one software lead. When a PR is created, PR stats are added as a comment. You can use these stats to choose reviewers. Send a message in the #pr channel on Discord to notify the reviewers of your PR.
44
44
4. Make any requested changes and merge your branch onto main once the PR is approved.
45
45
46
-
## C Style Guide
47
-
48
-
### Comments
49
-
50
-
#### Single line comments
51
-
52
-
Variable and function names should be descriptive enough to understand even without comments. Comments are needed to describe any complicated logic. You may use `//` or `/* */` for single line comments.
53
-
54
-
#### Function comments
55
-
56
-
Function comments should exist in the .h file. For static functions, they should exist in the .c file. Function comments should follow the format shown below:
57
-
58
-
```c
59
-
/**
60
-
* @brief Adds two numbers together
61
-
*
62
-
* @param num1 - The first number to add.
63
-
* @param num2 - The second number to add.
64
-
* @return Returns the sum of the two numbers.
65
-
*/
66
-
uint8_taddNumbers(uint8_t num1, uint8_t num2);
67
-
```
68
-
69
-
#### File header comments
70
-
71
-
File comments are not required.
72
-
73
-
#### Header guards
74
-
75
-
We use `#pragma once` instead of include guards.
76
-
77
-
### Naming and typing conventions
78
-
79
-
- `variableNames` in camelCase
80
-
- `functionNames()` in camelCase
81
-
- `#define MACRO_NAME` in CAPITAL_SNAKE_CASE
82
-
- `file_names` in snake_case
83
-
- `type_defs` in snake_case with \_t suffix
84
-
- Ex:
85
-
```c
86
-
typedef struct {
87
-
uint32_t a;
88
-
uint32_t b;
89
-
} struct_name_t
90
-
```
91
-
- Import statements should be grouped in the following order:
92
-
1. Local imports (e.g. `#include "cc1120_driver.h"`)
3. Standard library imports (e.g. `#include <stdint.h>`)
95
-
96
-
### General rules
97
-
98
-
Some of these rules don't apply in certain cases. Use your better judgement. To learn more about these rules, research NASA's Power of 10.
99
-
100
-
1. Avoid complex flow constructs, such as [goto](https://en.wikipedia.org/wiki/Goto) and [recursion](<https://en.wikipedia.org/wiki/Recursion_(computer_science)>).
101
-
2. All loops must have fixed bounds. This prevents runaway code.
4. Use an average of two [runtime assertions](<https://en.wikipedia.org/wiki/Assertion_(software_development)#Assertions_for_run-time_checking>) per function.
104
-
5. Restrict the scope of data to the smallest possible.
105
-
6. Check the return value of all non-void functions, or cast to void to indicate the return value is useless.
106
-
7. Limit pointer use to a single [dereference](https://en.wikipedia.org/wiki/Dereference_operator), and do not use [function pointers](https://en.wikipedia.org/wiki/Function_pointer).
107
-
8. Compile with all possible warnings active; all warnings should then be addressed before release of the software.
108
-
9. Use the preprocessor sparingly.
109
-
10. Restrict functions to a single printed page.
110
-
111
-
## Python Style Guide
112
-
113
-
- We will be following the Python language style guide [PEP8](https://peps.python.org/pep-0008/)
114
-
- If there are any discrepancies between this style guide and PEP8, this style guide takes precedence.
115
-
116
-
### Type hinting convention
117
-
118
-
All function and method parameters (except for the `self` and `cls` parameters) and return signatures should be type hinted.
119
-
120
-
```python
121
-
def my_add(num1: int, num2: int) -> int:
122
-
"""
123
-
Adds two numbers together
124
-
125
-
:warning: Add a warning if your function requires
126
-
:note: Add a note that other developers might find helpful
127
-
128
-
:param num1: The first number to add.
129
-
:param num2: The second number to add.
130
-
:return: Returns the sum of the two numbers.
131
-
"""
132
-
return num1 + num2
133
-
```
134
-
135
-
### Comments
136
-
137
-
#### Single line comments
138
-
139
-
Variable and function names should be descriptive enough to understand even without comments. Comments are needed to describe any complicated logic. Use `#` for single-line comments.
140
-
141
-
#### Function and method comments
142
-
143
-
Function and method comments using `""" """` should exist below the function declaration. For methods, the `self` or `cls` parameter does not require a description.
144
-
145
-
```python
146
-
defmy_add(num1: int, num2: int) -> int:
147
-
"""
148
-
Adds two numbers together
149
-
150
-
:warning: Add a warning if your function requires
151
-
:note: Add a note that other developers might find helpful
152
-
153
-
:param num1: The first number to add.
154
-
:param num2: The second number to add.
155
-
:return: Returns the sum of the two numbers.
156
-
"""
157
-
return num1 + num2
158
-
```
159
-
160
-
Notice that the docstring is formatted using reST (reStructuredText) with two outliers: `:warning:` and `:note:`. The outliers will need to be changed to their proper, `..note::` and `..warning::` counterparts if doc-generation using sphinx is implemented.
161
-
162
-
```python
163
-
defincrease_x(self, count: int) -> None:
164
-
"""
165
-
Increases the x attribute by the count.
166
-
167
-
:param count: Count to increase the x attribute by.
168
-
"""
169
-
self.x += count
170
-
```
171
-
172
-
#### File header comments
173
-
174
-
File comments are not required.
175
-
176
-
#### Class comments
177
-
178
-
- Class comments should exist after the class definition
179
-
- Provide a brief description given class purpose
180
-
- Provide a section in the class comment listing the attributes, their type and purpose
181
-
- Enum class comments do not require listing the attributes
182
-
183
-
```python
184
-
classPointTwoDimension:
185
-
"""
186
-
Class for storing a 2D point
187
-
188
-
:param x: x coordinate of the point
189
-
:type x: int
190
-
:param y: y coordinate of the point
191
-
:type y: int
192
-
"""
193
-
194
-
def__init__(x: int, y: int):
195
-
self.x = x
196
-
self.y = y
197
-
198
-
@dataclass
199
-
classPointTwoDimension:
200
-
"""
201
-
Class for storing a 2D point
202
-
203
-
:param x: x coordinate of the point
204
-
:type x: int
205
-
:param y: y coordinate of the point
206
-
:type y: int
207
-
"""
208
-
209
-
x: int
210
-
y: int
211
-
```
212
-
213
-
```python
214
-
from enum import Enum
215
-
216
-
# No comments required
217
-
classErrorCode(Enum):
218
-
"""
219
-
Enum for the error codes
220
-
"""
221
-
222
-
SUCCESS=0
223
-
INVALID_ARG=1
224
-
```
225
-
226
-
### Naming conventions
227
-
228
-
-`variable_names`, `field_names` and `function_constants` in snake_case
229
-
-`_private_field_names`, and `_private_method_names()` in \_snake_case
230
-
-`function_names()` and `method_names()` in snake_case
231
-
-`CONSTANT_NAMES: Final` and `ENUM_OPTIONS` in CAPITAL_SNAKE_CASE for module and class constants (not for local constant)
232
-
-`file_names` in snake_case
233
-
-`ClassName` in PascalCase
234
-
235
-
```python
236
-
# For brevity, the class comments were removed but they should be in real code
237
-
from dataclasses import dataclass
238
-
239
-
@dataclass
240
-
classPointTwoDimension:
241
-
x: int
242
-
y: int
243
-
244
-
classPointTwoDimension:
245
-
def__init__(x: int, y: int):
246
-
self.x = x
247
-
self.y = y
248
-
```
249
-
250
-
-`EnumName` in PascalCase
251
-
252
-
```python
253
-
from enum import Enum
254
-
255
-
classErrorCode(Enum):
256
-
SUCCESS=0
257
-
INVALID_ARG=1
258
-
259
-
# Accessing:
260
-
ErrorCode.SUCCESS# <ErrorCode.SUCCESS: 0>
261
-
ErrorCode.INVALID_ARG# <ErrorCode.INVALID_ARG: 1>
262
-
```
263
-
264
-
### Imports
265
-
266
-
#### Grouping imports
267
-
268
-
This is handled by pre-commit.
269
-
270
-
#### Notes about imports
271
-
272
-
- Imports should only be used at the top of the file (no function or scoped imports)
273
-
- Modules should not be imported
274
-
275
-
```python
276
-
# module1 contains very_long_module_name and function foo and variable var.
277
-
# very_long_module_name contains bar
278
-
279
-
# No:
280
-
from module1 import very_long_module_name as module2
281
-
import module1
282
-
283
-
module1.foo()
284
-
module1.var
285
-
module2.bar()
286
-
287
-
# Yes:
288
-
from module1.very_long_module_name import bar
289
-
from module1 import foo, var
290
-
291
-
foo()
292
-
var
293
-
bar()
294
-
```
295
-
296
-
### Other style guide points
297
-
298
-
- Only imports, function, class, and constants declarations and the `if __name__ == '__main__'` should be in module scope
299
-
- Entry point to a script or program should be through the `main` function
300
-
- Add a trailing comma after elements of a list, if you wish to make/preserve each element on a separate line
301
-
302
-
## Pytest Style Guide
303
-
304
-
- All functions that are to be tested should go into a Python file starting with `test_`
305
-
- All functions that are to be tested **must** start with `test_` (This is a Pytest requirement)
306
-
- Type hints are optional for Pytest functions (functions that start with `test_` in a Pytest file)
307
-
308
-
## TypeScript/React Style Guide
309
-
310
-
### Comments
311
-
312
-
#### Single line comments
313
-
314
-
Variable and function names should be descriptive enough to understand even without comments. Comments are needed to describe any complicated logic. You may use `//` or `/* */` for single line comments.
315
-
316
-
#### Function comments
317
-
318
-
Function comments should follow the format shown below:
319
-
320
-
```typescript
321
-
/**
322
-
* @brief Adds two numbers together
323
-
*
324
-
* @paramnum1 - The first number to add.
325
-
* @paramnum2 - The second number to add.
326
-
* @return Returns the sum of the two numbers.
327
-
*/
328
-
function addNumbers(num1:number, num2:number):number {
329
-
returnnum1+num2;
330
-
}
331
-
```
332
-
333
-
#### File comments
334
-
335
-
File comments are not required.
336
-
337
-
### Naming and typing conventions
338
-
339
-
-`variableNames` in camelCase
340
-
-`functionNames()` in camelCase
341
-
-`CONSTANT_NAME` in SCREAMING_SNAKE_CASE
342
-
-`file-names` in kebab-case
343
-
-`ClassName` and `ComponentName` in PascalCase
344
-
345
46
## Authors
346
47
347
48
This codebase was developed by the members of UW Orbital, the University of Waterloo's CubeSat design team.
0 commit comments