Coding guidelines documentation

This commit is contained in:
2026-06-03 14:47:39 +02:00
parent de4b471790
commit 1e8d3b766f
2 changed files with 23 additions and 2 deletions

20
docs/CODING.md Normal file
View File

@@ -0,0 +1,20 @@
# 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.