macro.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _DOXYGEN_EXAMPLE_MACRO_H_
  2. #define _DOXYGEN_EXAMPLE_MACRO_H_
  3. /**
  4. * @page page_howto_macro How to write doxygen documentation for macro.
  5. *
  6. * There are two typical types of macro definitions.
  7. *
  8. * - One is to define constant macros. For this type of macro, we
  9. * recommend putting documentation after members. See `DOXYGEN_EXAMPLE_CONST_A`
  10. * and `DOXYGEN_EXAMPLE_CONST_B` in
  11. * <a href="https://github.com/RT-Thread/rt-thread/blob/master/documentation/0.doxygen/example/include/macro.h">documentation/0.doxygen/example/include/macro.h</a>
  12. * for code exmaple.
  13. *
  14. * - The other is to define macros with parameters. For this type of
  15. * macro, we recommend using a method similar to documenting for
  16. * functions, that is, writing comment block before the macro definition.
  17. * More details please see @ref page_howto_function
  18. * See `DOXYGEN_EXAMPLE_ABS` in
  19. * <a href="https://github.com/RT-Thread/rt-thread/blob/master/documentation/0.doxygen/example/include/macro.h">documentation/0.doxygen/example/include/macro.h</a>
  20. * for code example.
  21. *
  22. * We often categorize macros in our code. Similarly, when writing doxygen
  23. * comments for these categorized macros, we can also group them. See
  24. * `DOXYGEN_EXAMPLE_GROUP_A_X`/`DOXYGEN_EXAMPLE_GROUP_A_Y` and
  25. * `DOXYGEN_EXAMPLE_GROUP_B_X`/`DOXYGEN_EXAMPLE_GROUP_B_Y` in
  26. * <a href="https://github.com/RT-Thread/rt-thread/blob/master/documentation/0.doxygen/example/include/macro.h">documentation/0.doxygen/example/include/macro.h</a>
  27. * for code example.
  28. *
  29. * See @ref group_doxygen_example_macro for html output.
  30. */
  31. /**
  32. * @defgroup group_doxygen_example_macro Doxygen Example of Macro
  33. *
  34. * @ingroup group_doxygen_example
  35. *
  36. * @brief Doxygen Example of Macro.
  37. *
  38. * @{
  39. */
  40. #define DOXYGEN_EXAMPLE_CONST_A 100 /**< Description of macro const A */
  41. #define DOXYGEN_EXAMPLE_CONST_B 200 /**< Description of macro const B */
  42. /**
  43. * @brief Computes the absolute value of its argument @a x.
  44. *
  45. * @param[in] x input value.
  46. *
  47. * @return absolute value of @a x.
  48. */
  49. #define DOXYGEN_EXAMPLE_ABS(x) (((x)>0)?(x):-(x))
  50. /**
  51. * @defgroup group_doxygen_example_macro_group_a Group A of Macros
  52. *
  53. * @brief Doxygen Example of Macros grouped in A.
  54. *
  55. * @{
  56. */
  57. #define DOXYGEN_EXAMPLE_GROUP_A_X 0x0000 /**< Description of X in group A */
  58. #define DOXYGEN_EXAMPLE_GROUP_A_Y 0x0001 /**< Description of Y in group A */
  59. /** @} */
  60. /**
  61. * @defgroup group_doxygen_example_macro_group_b Group B of Macros
  62. *
  63. * @brief Doxygen Example of Macros grouped in B
  64. *
  65. * @{
  66. */
  67. #define DOXYGEN_EXAMPLE_GROUP_B_X 0x0000 /**< Description of X in group B */
  68. #define DOXYGEN_EXAMPLE_GROUP_B_Y 0x0001 /**< Description of Y in group B */
  69. /** @} */
  70. /** @} */
  71. #endif