doc: Added enum and typedef conventions
@@ -16,6 +16,17 @@ When doing modifications to third-party code used in ESP-IDF, follow the way tha
C Code Formatting
-----------------
+.. _style-guide-naming:
+
+Naming
+^^^^^^
+
+* Any variable or function which is only used in a single source file should be declared ``static``.
+* Public names (non-static variables and functions) should be namespaced with a per-component or per-unit prefix, to avoid naming collisions. ie ``esp_vfs_register()`` or ``esp_console_run()``. Starting the prefix with ``esp_`` for Espressif-specific names is optional, but should be consistent with any other names in the same component.
+* Static variables should be prefixed with ``s_`` for easy identification. For example, ``static bool s_invert``.
+* Avoid unnecessary abbreviations (ie shortening ``data`` to ``dat``), unless the resulting name would otherwise be very long.
+
+
Indentation
^^^^^^^^^^^
@@ -187,6 +198,25 @@ To re-format a file, run::
tools/format.sh components/my_component/file.c
+Type Definitions
+^^^^^^^^^^^^^^^^
+
+Should be snake_case, ending with _t suffix::
+
+ typedef int signed_32_bit_t;
+
+Enum
+^^^^
+
+Enums should be defined through the `typedef` and be namespaced::
+
+ typedef enum
+ {
+ MODULE_FOO_ONE,
+ MODULE_FOO_TWO,
+ MODULE_FOO_THREE
+ } module_foo_t;
+
C++ Code Formatting
-------------------
@@ -341,19 +371,6 @@ Documenting Code
Please see the guide here: :doc:`documenting-code`.
-.. _style-guide-naming:
-
-Naming
-------
-
-- Any variable or function which is only used in a single source file should be declared ``static``.
-
-- Public names (non-static variables and functions) should be namespaced with a per-component or per-unit prefix, to avoid naming collisions. ie ``esp_vfs_register()`` or ``esp_console_run()``. Starting the prefix with ``esp_`` for Espressif-specific names is optional, but should be consistent with any other names in the same component.
-
-- Static variables should be prefixed with ``s_`` for easy identification. For example, ``static bool s_invert``.
-
-- Avoid unnecessary abbreviations (ie shortening ``data`` to ``dat``), unless the resulting name would otherwise be very long.
-
Structure
---------
