Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformatting doxygen comment markup (RPI docs team) #1660

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

nelliemckesson
Copy link
Contributor

This PR reformats the doxygen comment markup to make the generated documentation compatible with doxygen versions > 1.8.17, per discussion with @aallan and @mudge . Here's a summary of the changes:

  • Implicit brief descriptions are made explicit, using the \brief tag
  • Implicit detailed descriptions are separated from brief descriptions by a blank line
  • Inline table markup is updated to use ///< delimiters

Going forward, here are some notes to help maintain compatibility with higher doxygen versions:

Brief Descriptions

Brief descriptions must always be preceded by \brief. Here are several examples:

/**
 * \brief I2C slave event types.
 * \ingroup pico_i2c_slave
 */
typedef enum i2c_slave_event_t
...
/**
 * \file pheap.h
 * \defgroup util_pheap pheap
 * \brief Pairing Heap Implementation
 * \ingroup pico_util
 *
 * pheap defines a simple pairing heap. The implementation simply tracks array indexes, it is up to
 * the user to provide storage for heap entries and a comparison function.
 *
 * NOTE: This class is not safe for concurrent usage. It should be externally protected. Furthermore
 * if used concurrently, the caller needs to protect around their use of the returned id.
 * For example, ph_remove_and_free_head returns the id of an element that is no longer in the heap.
 * The user can still use this to look at the data in their companion array, however obviously further operations
 * on the heap may cause them to overwrite that data as the id may be reused on subsequent operations
 *
 */
// PICO_CONFIG: PICO_PHEAP_MAX_ENTRIES, Maximum number of entries in the pheap, min=1, max=65534, default=255, group=pico_util
#ifndef PICO_PHEAP_MAX_ENTRIES
...
/** \file multicore.h
 *  \defgroup pico_multicore pico_multicore
 * \brief Adds support for running code on the second processor core (core 1)
 *
 * \subsection multicore_example Example
 * \addtogroup pico_multicore
 * \include multicore.c
*/

// PICO_CONFIG: PICO_CORE1_STACK_SIZE, Stack size for core 1, min=0x100, max=0x10000, default=PICO_STACK_SIZE (0x800), group=pico_multicore
#ifndef PICO_CORE1_STACK_SIZE
...

Detailed Descriptions

To add a detailed description, add a blank line after the brief description, or use the \details tag.

Here is an example of an implicit detailed description, where the description text is preceded by a blank line:

/** \file pico/divider.h
* \brief High level APIs including combined quotient and remainder functions for 32 and 64 bit accelerated by the hardware divider
* \ingroup pico_divider
*
* These functions all call __aeabi_idiv0 or __aebi_ldiv0 on division by zero
* passing the largest applicably signed value
*
* Functions with unsafe in their name do not save/restore divider state, so are unsafe to call from interrupts. Unsafe functions are slightly faster.
*/

And here is the same text with an explicit detailed description:

/** \file pico/divider.h
* \brief High level APIs including combined quotient and remainder functions for 32 and 64 bit accelerated by the hardware divider
* \ingroup pico_divider
* \details These functions all call __aeabi_idiv0 or __aebi_ldiv0 on division by zero
* passing the largest applicably signed value
*
* Functions with unsafe in their name do not save/restore divider state, so are unsafe to call from interrupts. Unsafe functions are slightly faster.
*/

Inline enum documentation

You can generate a table for enum types using inline comments like this (note the ///< opening delimeter and lack of a closing delimeter):

/**
 * \brief I2C slave event types.
 * \ingroup pico_i2c_slave
 */
typedef enum i2c_slave_event_t
{
    I2C_SLAVE_RECEIVE, ///< Data from master is available for reading. Slave must read from Rx FIFO.
    I2C_SLAVE_REQUEST, ///< Master is requesting data. Slave must write into Tx FIFO.
    I2C_SLAVE_FINISH, ///< Master has sent a Stop or Restart signal. Slave may prepare for the next transfer.
} i2c_slave_event_t;

@aallan aallan requested a review from kilograham March 6, 2024 09:22
@aallan aallan added the documentation Improvements or additions to documentation label Mar 6, 2024
@aallan aallan linked an issue Mar 6, 2024 that may be closed by this pull request
@aallan
Copy link
Contributor

aallan commented Mar 6, 2024

@kilograham Can you take a quick look over?

These changes are generated from a script. So if you want to rebase to another branch — or if you want to flip this into the internal repo rather than merging here — that's not too much extra work.

Also, thinking things through, it might also be possible to add something into the SDK as a test to catch poorly formatted Doxygen if that's something you'd be in favour of?

@kilograham kilograham merged commit b27f13b into raspberrypi:develop Mar 22, 2024
1 check passed
@kilograham
Copy link
Contributor

yes, we could add a github action to test for badly formatted Doxygen

@kilograham kilograham added this to the 1.6.0 milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation issues when upgrading to Doxygen 1.9.8
3 participants