|
iLLD_TC27xD
1.0
|
[link: enum convention in microcontroller /Std drivers]
In case an enum represents a register bitfield value, then the following rules apply:
- The enum type shall have an explicit name. The name shall not include register or bitfield short names. This is to abstract the setting when passed as a parameter to a function in the same way the function APIs names does.
- Each enum member shall define explicitly an enum value with '='.
- The enum documentation shall state for which register bitfield the enum has been defined with "Definition for <ModuleType>.<REGISTER NAME>.B.<BITFIELDNAME>", this to avoid misuse of the enum.
- Each of the member shall have a documentation, that explain to users what is the enum for without reading the user manual.
- Only enum defined in the current Std or base drivers shall be used.
Correct:
Wrong:
[link: Usage of enums in microcontroller interface drivers]
The code dependencies shall be limited to the microcontroller HAL and service software interface /1_SrvSw/If, therefore only enums from this files can be used.
[link: Enum name with index]
Do not use left zero padding for enum names, because the highest index number can not be assumed to be fixed.
Correct:
Wrong:
[link:
]
Correct:
Wrong(IfxDma_ChannelId):