LCOV - code coverage report
Current view: top level - zephyr/dt-bindings/pwm - pwm.h Coverage Total Hit
Test: new.info Lines: 88.9 % 9 8
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2019 Vestas Wind Systems A/S
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PWM_PWM_H_
       7              : #define ZEPHYR_INCLUDE_DT_BINDINGS_PWM_PWM_H_
       8              : 
       9              : /**
      10              :  * @brief PWM Interface
      11              :  * @defgroup pwm_interface PWM Interface
      12              :  * @ingroup io_interfaces
      13              :  * @{
      14              :  */
      15              : 
      16              : /**
      17              :  * @name PWM period set helpers
      18              :  * The period cell in the PWM specifier needs to be provided in nanoseconds.
      19              :  * However, in some applications it is more convenient to use another scale.
      20              :  * @{
      21              :  */
      22              : 
      23              : /** Specify PWM period in nanoseconds */
      24            1 : #define PWM_NSEC(x)     (x)
      25              : /** Specify PWM period in microseconds */
      26            1 : #define PWM_USEC(x)     (PWM_NSEC(x) * 1000UL)
      27              : /** Specify PWM period in milliseconds */
      28            1 : #define PWM_MSEC(x)     (PWM_USEC(x) * 1000UL)
      29              : /** Specify PWM period in seconds */
      30            1 : #define PWM_SEC(x)      (PWM_MSEC(x) * 1000UL)
      31              : /** Specify PWM frequency in hertz */
      32            1 : #define PWM_HZ(x)       (PWM_SEC(1UL) / (x))
      33              : /** Specify PWM frequency in kilohertz */
      34            1 : #define PWM_KHZ(x)      (PWM_HZ((x) * 1000UL))
      35              : 
      36              : /** @} */
      37              : 
      38              : /**
      39              :  * @name PWM polarity flags
      40              :  * The `PWM_POLARITY_*` flags are used with pwm_set_cycles(), pwm_set()
      41              :  * or pwm_configure_capture() to specify the polarity of a PWM channel.
      42              :  *
      43              :  * The flags are on the lower 8bits of the pwm_flags_t
      44              :  * @{
      45              :  */
      46              : /** PWM pin normal polarity (active-high pulse). */
      47            1 : #define PWM_POLARITY_NORMAL     (0 << 0)
      48              : 
      49              : /** PWM pin inverted polarity (active-low pulse). */
      50            1 : #define PWM_POLARITY_INVERTED   (1 << 0)
      51              : 
      52              : /** @cond INTERNAL_HIDDEN */
      53              : #define PWM_POLARITY_MASK       0x1
      54              : /** @endcond */
      55              : /** @} */
      56              : 
      57              : /** @} */
      58              : 
      59              : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PWM_PWM_H_ */
        

Generated by: LCOV version 2.0-1