-
Notifications
You must be signed in to change notification settings - Fork 7k
/
mcpwm_types.h
145 lines (123 loc) · 4.05 KB
/
mcpwm_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "hal/mcpwm_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Type of MCPWM timer handle
*/
typedef struct mcpwm_timer_t *mcpwm_timer_handle_t;
/**
* @brief Type of MCPWM operator handle
*/
typedef struct mcpwm_oper_t *mcpwm_oper_handle_t;
/**
* @brief Type of MCPWM comparator handle
*/
typedef struct mcpwm_cmpr_t *mcpwm_cmpr_handle_t;
/**
* @brief Type of MCPWM generator handle
*/
typedef struct mcpwm_gen_t *mcpwm_gen_handle_t;
/**
* @brief Type of MCPWM fault handle
*/
typedef struct mcpwm_fault_t *mcpwm_fault_handle_t;
/**
* @brief Type of MCPWM sync handle
*/
typedef struct mcpwm_sync_t *mcpwm_sync_handle_t;
/**
* @brief Type of MCPWM capture timer handle
*/
typedef struct mcpwm_cap_timer_t *mcpwm_cap_timer_handle_t;
/**
* @brief Type of MCPWM capture channel handle
*/
typedef struct mcpwm_cap_channel_t *mcpwm_cap_channel_handle_t;
/**
* @brief MCPWM timer event data
*/
typedef struct {
uint32_t count_value; /*!< MCPWM timer count value */
mcpwm_timer_direction_t direction; /*!< MCPWM timer count direction */
} mcpwm_timer_event_data_t;
/**
* @brief MCPWM timer event callback function
*
* @param[in] timer MCPWM timer handle
* @param[in] edata MCPWM timer event data, fed by driver
* @param[in] user_ctx User data, set in `mcpwm_timer_register_event_callbacks()`
* @return Whether a high priority task has been waken up by this function
*/
typedef bool (*mcpwm_timer_event_cb_t)(mcpwm_timer_handle_t timer, const mcpwm_timer_event_data_t *edata, void *user_ctx);
/**
* @brief MCPWM brake event data
*/
typedef struct {
} mcpwm_brake_event_data_t;
/**
* @brief MCPWM operator brake event callback function
*
* @param[in] oper MCPWM operator handle
* @param[in] edata MCPWM brake event data, fed by driver
* @param[in] user_ctx User data, set in `mcpwm_operator_register_event_callbacks()`
* @return Whether a high priority task has been waken up by this function
*/
typedef bool (*mcpwm_brake_event_cb_t)(mcpwm_oper_handle_t oper, const mcpwm_brake_event_data_t *edata, void *user_ctx);
/**
* @brief MCPWM fault event data
*/
typedef struct {
} mcpwm_fault_event_data_t;
/**
* @brief MCPWM fault event callback function
*
* @param fault MCPWM fault handle
* @param edata MCPWM fault event data, fed by driver
* @param user_ctx User data, set in `mcpwm_fault_register_event_callbacks()`
* @return whether a task switch is needed after the callback returns
*/
typedef bool (*mcpwm_fault_event_cb_t)(mcpwm_fault_handle_t fault, const mcpwm_fault_event_data_t *edata, void *user_ctx);
/**
* @brief MCPWM compare event data
*/
typedef struct {
uint32_t compare_ticks; /*!< Compare value */
mcpwm_timer_direction_t direction; /*!< Count direction */
} mcpwm_compare_event_data_t;
/**
* @brief MCPWM comparator event callback function
*
* @param comparator MCPWM comparator handle
* @param edata MCPWM comparator event data, fed by driver
* @param user_ctx User data, set in `mcpwm_comparator_register_event_callbacks()`
* @return Whether a high priority task has been waken up by this function
*/
typedef bool (*mcpwm_compare_event_cb_t)(mcpwm_cmpr_handle_t comparator, const mcpwm_compare_event_data_t *edata, void *user_ctx);
/**
* @brief MCPWM capture event data
*/
typedef struct {
uint32_t cap_value; /*!< Captured value */
mcpwm_capture_edge_t cap_edge; /*!< Capture edge */
} mcpwm_capture_event_data_t;
/**
* @brief MCPWM capture event callback function
*
* @param cap_channel MCPWM capture channel handle
* @param edata MCPWM capture event data, fed by driver
* @param user_ctx User data, set in `mcpwm_capture_channel_register_event_callbacks()`
* @return Whether a high priority task has been waken up by this function
*/
typedef bool (*mcpwm_capture_event_cb_t)(mcpwm_cap_channel_handle_t cap_channel, const mcpwm_capture_event_data_t *edata, void *user_ctx);
#ifdef __cplusplus
}
#endif