• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 /// Interrupts for MCPWM
18 typedef enum {
19     MCPWM_LL_INTR_CAP0 = BIT(27), ///< Capture 0 happened
20     MCPWM_LL_INTR_CAP1 = BIT(28), ///< Capture 1 happened
21     MCPWM_LL_INTR_CAP2 = BIT(29), ///< Capture 2 happened
22 } mcpwm_intr_t;
23 
24 /**
25  * @brief Select type of MCPWM counter
26  */
27 typedef enum {
28     MCPWM_UP_COUNTER = 1,   /*!<For asymmetric MCPWM*/
29     MCPWM_DOWN_COUNTER,     /*!<For asymmetric MCPWM*/
30     MCPWM_UP_DOWN_COUNTER,  /*!<For symmetric MCPWM, frequency is half of MCPWM frequency set*/
31     MCPWM_COUNTER_MAX,      /*!<Maximum counter mode*/
32 } mcpwm_counter_type_t;
33 
34 /**
35  * @brief Select type of MCPWM duty cycle mode
36  */
37 typedef enum {
38     MCPWM_DUTY_MODE_0 = 0, /*!<Active high duty, i.e. duty cycle proportional to high time for asymmetric MCPWM*/
39     MCPWM_DUTY_MODE_1,     /*!<Active low duty,  i.e. duty cycle proportional to low  time for asymmetric MCPWM, out of phase(inverted) MCPWM*/
40     MCPWM_HAL_GENERATOR_MODE_FORCE_LOW,
41     MCPWM_HAL_GENERATOR_MODE_FORCE_HIGH,
42     MCPWM_DUTY_MODE_MAX,   /*!<Num of duty cycle modes*/
43 } mcpwm_duty_type_t;
44 
45 /**
46  * @brief MCPWM select action to be taken on the output when event happens
47  */
48 typedef enum {
49     MCPWM_ACTION_NO_CHANGE = 0,  /*!<No change in the output*/
50     MCPWM_ACTION_FORCE_LOW,      /*!<Make output low*/
51     MCPWM_ACTION_FORCE_HIGH,     /*!<Make output high*/
52     MCPWM_ACTION_TOGGLE,         /*!<Make output toggle*/
53 } mcpwm_output_action_t;
54 
55 /**
56  * @brief MCPWM deadtime types, used to generate deadtime, RED refers to rising edge delay and FED refers to falling edge delay
57  */
58 typedef enum {
59     MCPWM_DEADTIME_BYPASS = 0,          /*!<Bypass the deadtime*/
60     MCPWM_BYPASS_RED,                   /*!<MCPWMXA = no change, MCPWMXB = falling edge delay*/
61     MCPWM_BYPASS_FED,                   /*!<MCPWMXA = rising edge delay, MCPWMXB = no change*/
62     MCPWM_ACTIVE_HIGH_MODE,             /*!<MCPWMXA = rising edge delay,  MCPWMXB = falling edge delay*/
63     MCPWM_ACTIVE_LOW_MODE,              /*!<MCPWMXA = compliment of rising edge delay,  MCPWMXB = compliment of falling edge delay*/
64     MCPWM_ACTIVE_HIGH_COMPLIMENT_MODE,  /*!<MCPWMXA = rising edge delay,  MCPWMXB = compliment of falling edge delay*/
65     MCPWM_ACTIVE_LOW_COMPLIMENT_MODE,   /*!<MCPWMXA = compliment of rising edge delay,  MCPWMXB = falling edge delay*/
66     MCPWM_ACTIVE_RED_FED_FROM_PWMXA,    /*!<MCPWMXA = MCPWMXB = rising edge delay as well as falling edge delay, generated from MCPWMXA*/
67     MCPWM_ACTIVE_RED_FED_FROM_PWMXB,    /*!<MCPWMXA = MCPWMXB = rising edge delay as well as falling edge delay, generated from MCPWMXB*/
68     MCPWM_DEADTIME_TYPE_MAX,
69 } mcpwm_deadtime_type_t;
70 
71 /**
72  * @brief MCPWM select sync signal input
73  */
74 typedef enum {
75     MCPWM_SELECT_SYNC0 = 4,  /*!<Select SYNC0 as input*/
76     MCPWM_SELECT_SYNC1,      /*!<Select SYNC1 as input*/
77     MCPWM_SELECT_SYNC2,      /*!<Select SYNC2 as input*/
78 } mcpwm_sync_signal_t;
79 
80 /**
81  * @brief MCPWM select capture starts from which edge
82  */
83 typedef enum {
84     MCPWM_NEG_EDGE = BIT(0),          /*!<Capture the negative edge*/
85     MCPWM_POS_EDGE = BIT(1),          /*!<Capture the positive edge*/
86     MCPWM_BOTH_EDGE = BIT(1)|BIT(0),  /*!<Capture both edges*/
87 } mcpwm_capture_on_edge_t;
88