21 lines
904 B
Markdown
21 lines
904 B
Markdown
# NeoECU Firmware Coding Guidelines
|
|
|
|
## Naming Conventions
|
|
Functions : camelCase
|
|
Variables : python_case
|
|
Constants : UPPER_CASE
|
|
Macros : UPPER_CASE
|
|
Types : python_case_t
|
|
|
|
## Performance Standard
|
|
Don't use heap at all if possible avoid mallocs at all cost.
|
|
Don't make heavy computation in ISR delegate everything to a task that you'll wake.
|
|
Don't copy big chunks of memory, use pointers if you need to read a buffer, even if simply passing the buffer as a parameter compiles it will have huge overhead.
|
|
|
|
## Readability Standard
|
|
Avoid more than one layer of pointer indirection if possible.
|
|
Don't use void* they are unclear and make mistakes more likely.
|
|
Avoid magic numbers and indexes, use macros and constants to define them clearly.
|
|
Define all macros in macros.h and all global variables and constants in glocal_state.h.
|
|
Use one c file per feature, avoid big monoliths that become hard to jump around.
|