Skip to content

Commit 6925877

Browse files
henrikbrixandersennashif
authored andcommitted
drivers: pwm: clean up the PWM capture API documentation
Clean up the PWM capture API documentation a bit: - Turn simple comments on PWM_CAPTURE_MODE_* into documentation comments - Callback signature is always available, but note that PWM capture support is optional - Remove double @A - Document return codes from pwm_pin_{enable,disable}_capture() - Change wording to reflect that pwm_pin_capture_*() returns a single result Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent 0281948 commit 6925877

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

include/drivers/pwm.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ extern "C" {
5454
#define PWM_CAPTURE_TYPE_BOTH (PWM_CAPTURE_TYPE_PERIOD | \
5555
PWM_CAPTURE_TYPE_PULSE)
5656

57-
/* PWM pin capture captures a single period/pulse width. */
57+
/** PWM pin capture captures a single period/pulse width. */
5858
#define PWM_CAPTURE_MODE_SINGLE (0U << PWM_CAPTURE_MODE_SHIFT)
5959

60-
/* PWM pin capture captures period/pulse width continuously. */
60+
/** PWM pin capture captures period/pulse width continuously. */
6161
#define PWM_CAPTURE_MODE_CONTINUOUS (1U << PWM_CAPTURE_MODE_SHIFT)
6262

6363
/** @} */
@@ -82,8 +82,8 @@ typedef int (*pwm_pin_set_t)(const struct device *dev, uint32_t pwm,
8282
*
8383
* @note The callback handler will be called in interrupt context.
8484
*
85-
* @note @option{CONFIG_PWM_CAPTURE} must be selected for this function to be
86-
* available.
85+
* @note @option{CONFIG_PWM_CAPTURE} must be selected to enable PWM capture
86+
* support.
8787
*
8888
* @param dev Pointer to the device structure for the driver instance.
8989
* @param pwm PWM pin.
@@ -124,7 +124,7 @@ typedef int (*pwm_pin_enable_capture_t)(const struct device *dev,
124124
/**
125125
* @typedef pwm_pin_disable_capture_t
126126
* @brief Callback API upon disabling PWM pin capture
127-
* See @a @a pwm_pin_disable_capture() for argument description
127+
* See @a pwm_pin_disable_capture() for argument description
128128
*/
129129
typedef int (*pwm_pin_disable_capture_t)(const struct device *dev,
130130
uint32_t pwm);
@@ -238,7 +238,10 @@ static inline int pwm_pin_configure_capture(const struct device *dev,
238238
* @param pwm PWM pin.
239239
*
240240
* @retval 0 If successful.
241-
* @retval Negative errno code if failure.
241+
* @retval -EINVAL if invalid function parameters were given
242+
* @retval -ENOTSUP if PWM capture is not supported
243+
* @retval -EIO if IO error occurred while enabling PWM capture
244+
* @retval -EBUSY if PWM capture is already in progress
242245
*/
243246
__syscall int pwm_pin_enable_capture(const struct device *dev, uint32_t pwm);
244247

@@ -267,7 +270,9 @@ static inline int z_impl_pwm_pin_enable_capture(const struct device *dev,
267270
* @param pwm PWM pin.
268271
*
269272
* @retval 0 If successful.
270-
* @retval Negative errno code if failure.
273+
* @retval -EINVAL if invalid function parameters were given
274+
* @retval -ENOTSUP if PWM capture is not supported
275+
* @retval -EIO if IO error occurred while disabling PWM capture
271276
*/
272277
__syscall int pwm_pin_disable_capture(const struct device *dev, uint32_t pwm);
273278

@@ -291,7 +296,7 @@ static inline int z_impl_pwm_pin_disable_capture(const struct device *dev,
291296
*
292297
* This API function wraps calls to @a pwm_pin_configure_capture(), @a
293298
* pwm_pin_enable_capture(), and @a pwm_pin_disable_capture() and passes the
294-
* capture results to the caller. The function is blocking until either the PWM
299+
* capture result to the caller. The function is blocking until either the PWM
295300
* capture is completed or a timeout occurs.
296301
*
297302
* @note @option{CONFIG_PWM_CAPTURE} must be selected for this function to be
@@ -481,7 +486,7 @@ static inline int pwm_pin_cycles_to_nsec(const struct device *dev, uint32_t pwm,
481486
* PWM input.
482487
*
483488
* This API function wraps calls to @a pwm_pin_capture_cycles() and @a
484-
* pwm_pin_cycles_to_usec() and passes the capture results to the caller. The
489+
* pwm_pin_cycles_to_usec() and passes the capture result to the caller. The
485490
* function is blocking until either the PWM capture is completed or a timeout
486491
* occurs.
487492
*
@@ -537,7 +542,7 @@ static inline int pwm_pin_capture_usec(const struct device *dev, uint32_t pwm,
537542
* PWM input.
538543
*
539544
* This API function wraps calls to @a pwm_pin_capture_cycles() and @a
540-
* pwm_pin_cycles_to_nsec() and passes the capture results to the caller. The
545+
* pwm_pin_cycles_to_nsec() and passes the capture result to the caller. The
541546
* function is blocking until either the PWM capture is completed or a timeout
542547
* occurs.
543548
*

0 commit comments

Comments
 (0)