Bluenet is the in-house firmware on Crownstone hardware. Functions: switching, dimming, energy monitoring, presence detection, indoor localization, switchcraft.
Beyond style guide etc. there might be some other issues we would like to address as a team. Ideally, they will become some guidelines for coding on a more abstract level.
Should putting things on the stack be preferred above putting things on the heap? In which circumstances?
Should the singleton pattern for classes be discouraged? There's e.g. the implemented Component class to reduce visibility of classes to one another.
Identify good hygiene
Use 0 for success (and positive values for errors). Almost always an uint8_t is sufficient.
In an enum reserve the very first value 0 for X_NONE, or X_UNINITIALIZED. This means we don't have to write anything explicitly to set something to "uninitialized". :-)
Return early and return multiple times. This prevents excessive nesting.
Use static_assert rather than comments to make sure structs etc. have proper sizes. This protects the future developer from making mistakes.
Tools
Encourage tools that lead to cleaner code or that gives insight. For example about memory use. Make it easier to profile new code.
Guidelines
Beyond style guide etc. there might be some other issues we would like to address as a team. Ideally, they will become some guidelines for coding on a more abstract level.
Component
class to reduce visibility of classes to one another.Identify good hygiene
0
for success (and positive values for errors). Almost always anuint8_t
is sufficient.0
forX_NONE
, orX_UNINITIALIZED
. This means we don't have to write anything explicitly to set something to "uninitialized". :-)static_assert
rather than comments to make sure structs etc. have proper sizes. This protects the future developer from making mistakes.Tools
Encourage tools that lead to cleaner code or that gives insight. For example about memory use. Make it easier to profile new code.