iLLD_TC29x  1.0
TPwm.h
Go to the documentation of this file.
1 /**
2  * \file TPwm.h
3  * \brief TPWM interface
4  *
5  * \version iLLD_1_0_0_11_0
6  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
7  *
8  *
9  * IMPORTANT NOTICE
10  *
11  *
12  * Infineon Technologies AG (Infineon) is supplying this file for use
13  * exclusively with Infineon's microcontroller products. This file can be freely
14  * distributed within development tools that are supporting such microcontroller
15  * products.
16  *
17  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
18  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
20  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
21  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
22  *
23  * \defgroup library_srvsw_if_tpwm TPWM interface
24  * \ingroup library_srvsw_if
25  *
26  */
27 
28 #ifndef TPWM_H_
29 #define TPWM_H_ 1
30 
31 #include "Cpu/Std/Ifx_Types.h"
32 
33 typedef struct TPwm_s TPwm;
34 typedef void (*TPwm_Start)(TPwm *handle);
35 typedef void (*TPwm_Pause)(TPwm *handle);
36 typedef void (*TPwm_Resume)(TPwm *handle);
37 typedef void (*TPwm_Stop)(TPwm *handle);
38 
39 typedef struct
40 {
46 
47 /** \brief Structure of the TPwm interface */
48 struct TPwm_s
49 {
50  float32 frequency; /**< \brief Actual frequency */
51  Ifx_TimerValue period; /**< \brief Actual timer period */
52 #if IFX_CFG_USE_STANDARD_INTERFACE
53  TPwm_Functions functions; /**< \brief Actual timer period */
54 #endif
55 };
56 
57 /** \brief Configuration structure of the TPwm interface */
58 typedef struct
59 {
60  float32 frequency; /**< \brief Specify expected PWM frequency in Hertz */
61  Ifx_TimerValue waitingTime; /**< \brief Specify the expected ticks before timer starts (TWAIT) */
62  Ifx_TimerValue activeCount; /**< \brief Specify active PWM period (TCOUNT) */
63  Ifx_TimerValue period; /**< \brief Specify expected PWM period in ticks. */
64  Ifx_ActiveState activeState; /**< \brief Active state select for PWM output. Active high means that the PWM edge is rising at the elapsed of waitingTicks */
65 } TPwm_Config;
66 
67 #if IFX_CFG_USE_STANDARD_INTERFACE
68 IFX_INLINE void TPwm_start(TPwm *handle) {handle->functions.start(handle); }
69 IFX_INLINE void TPwm_pause(TPwm *handle) {handle->functions.pause(handle); }
70 IFX_INLINE void TPwm_resume(TPwm *handle) {handle->functions.resume(handle); }
71 IFX_INLINE void TPwm_stop(TPwm *handle) {handle->functions.stop(handle); }
72 #endif
73 
74 #endif /* TPWM_H_ */