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-25 19:22:35

            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              :  * @addtogroup pwm_interface
      11              :  * @{
      12              :  */
      13              : 
      14              : /**
      15              :  * @name PWM period set helpers
      16              :  * The period cell in the PWM specifier needs to be provided in nanoseconds.
      17              :  * However, in some applications it is more convenient to use another scale.
      18              :  * @{
      19              :  */
      20              : 
      21              : /** Specify PWM period in nanoseconds */
      22            1 : #define PWM_NSEC(x)     (x)
      23              : /** Specify PWM period in microseconds */
      24            1 : #define PWM_USEC(x)     (PWM_NSEC(x) * 1000UL)
      25              : /** Specify PWM period in milliseconds */
      26            1 : #define PWM_MSEC(x)     (PWM_USEC(x) * 1000UL)
      27              : /** Specify PWM period in seconds */
      28            1 : #define PWM_SEC(x)      (PWM_MSEC(x) * 1000UL)
      29              : /** Specify PWM frequency in hertz */
      30            1 : #define PWM_HZ(x)       (PWM_SEC(1UL) / (x))
      31              : /** Specify PWM frequency in kilohertz */
      32            1 : #define PWM_KHZ(x)      (PWM_HZ((x) * 1000UL))
      33              : 
      34              : /** @} */
      35              : 
      36              : /**
      37              :  * @name PWM polarity flags
      38              :  * The `PWM_POLARITY_*` flags are used with pwm_set_cycles(), pwm_set()
      39              :  * or pwm_configure_capture() to specify the polarity of a PWM channel.
      40              :  *
      41              :  * The flags are on the lower 8bits of the pwm_flags_t
      42              :  * @{
      43              :  */
      44              : /** PWM pin normal polarity (active-high pulse). */
      45            1 : #define PWM_POLARITY_NORMAL     (0 << 0)
      46              : 
      47              : /** PWM pin inverted polarity (active-low pulse). */
      48            1 : #define PWM_POLARITY_INVERTED   (1 << 0)
      49              : 
      50              : /** @cond INTERNAL_HIDDEN */
      51              : #define PWM_POLARITY_MASK       0x1
      52              : /** @endcond */
      53              : /** @} */
      54              : 
      55              : /** @} */
      56              : 
      57              : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PWM_PWM_H_ */
        

Generated by: LCOV version 2.0-1