1 |
/** |
---|
2 |
PWM2 Generated Driver API Header File |
---|
3 |
|
---|
4 |
@Company |
---|
5 |
Microchip Technology Inc. |
---|
6 |
|
---|
7 |
@File Name |
---|
8 |
pwm2.h |
---|
9 |
|
---|
10 |
@Summary |
---|
11 |
This is the generated header file for the PWM2 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs |
---|
12 |
|
---|
13 |
@Description |
---|
14 |
This header file provides APIs for driver for PWM2. |
---|
15 |
Generation Information : |
---|
16 |
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 |
---|
17 |
Device : PIC16F1579 |
---|
18 |
Driver Version : 2.01 |
---|
19 |
The generated drivers are tested against the following: |
---|
20 |
Compiler : XC8 1.45 or later |
---|
21 |
MPLAB : MPLAB X 4.15 |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
/* |
---|
25 |
(c) 2018 Microchip Technology Inc. and its subsidiaries. |
---|
26 |
|
---|
27 |
Subject to your compliance with these terms, you may use Microchip software and any |
---|
28 |
derivatives exclusively with Microchip products. It is your responsibility to comply with third party |
---|
29 |
license terms applicable to your use of third party software (including open source software) that |
---|
30 |
may accompany Microchip software. |
---|
31 |
|
---|
32 |
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER |
---|
33 |
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY |
---|
34 |
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS |
---|
35 |
FOR A PARTICULAR PURPOSE. |
---|
36 |
|
---|
37 |
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, |
---|
38 |
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND |
---|
39 |
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP |
---|
40 |
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO |
---|
41 |
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL |
---|
42 |
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT |
---|
43 |
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS |
---|
44 |
SOFTWARE. |
---|
45 |
*/ |
---|
46 |
|
---|
47 |
#ifndef PWM2_H |
---|
48 |
#define PWM2_H |
---|
49 |
|
---|
50 |
/** |
---|
51 |
Section: Included Files |
---|
52 |
*/ |
---|
53 |
|
---|
54 |
#include <xc.h> |
---|
55 |
#include <stdint.h> |
---|
56 |
#include <stdbool.h> |
---|
57 |
|
---|
58 |
#ifdef __cplusplus // Provide C++ Compatibility |
---|
59 |
|
---|
60 |
extern "C" { |
---|
61 |
|
---|
62 |
#endif |
---|
63 |
|
---|
64 |
/** |
---|
65 |
Section: PWM Module APIs |
---|
66 |
*/ |
---|
67 |
|
---|
68 |
/** |
---|
69 |
@Summary |
---|
70 |
Initializes the PWM2 |
---|
71 |
|
---|
72 |
@Description |
---|
73 |
This routine initializes the Initializes the PWM2. |
---|
74 |
This routine must be called before any other PWM routine is called. |
---|
75 |
This routine should only be called once during system initialization. |
---|
76 |
|
---|
77 |
@Preconditions |
---|
78 |
None |
---|
79 |
|
---|
80 |
@Param |
---|
81 |
None |
---|
82 |
|
---|
83 |
@Returns |
---|
84 |
None |
---|
85 |
|
---|
86 |
@Comment |
---|
87 |
|
---|
88 |
|
---|
89 |
@Example |
---|
90 |
<code> |
---|
91 |
|
---|
92 |
</code> |
---|
93 |
*/ |
---|
94 |
void PWM2_Initialize(void); |
---|
95 |
|
---|
96 |
/** |
---|
97 |
@Summary |
---|
98 |
This function starts the PWM2. |
---|
99 |
|
---|
100 |
@Description |
---|
101 |
This function starts the PWM2 operation. |
---|
102 |
This function must be called after the initialization of PWM2. |
---|
103 |
|
---|
104 |
@Preconditions |
---|
105 |
Initialize the PWM2 before calling this function. |
---|
106 |
|
---|
107 |
@Param |
---|
108 |
None |
---|
109 |
|
---|
110 |
@Returns |
---|
111 |
None |
---|
112 |
|
---|
113 |
@Example |
---|
114 |
<code> |
---|
115 |
// Initialize PWM2 module |
---|
116 |
|
---|
117 |
// Start PWM2 |
---|
118 |
PWM2_Start(); |
---|
119 |
|
---|
120 |
// Do something else... |
---|
121 |
</code> |
---|
122 |
*/ |
---|
123 |
void PWM2_Start(void); |
---|
124 |
|
---|
125 |
/** |
---|
126 |
@Summary |
---|
127 |
This function stops the PWM2. |
---|
128 |
|
---|
129 |
@Description |
---|
130 |
This function stops the PWM2 operation. |
---|
131 |
This function must be called after the start of PWM2. |
---|
132 |
|
---|
133 |
@Preconditions |
---|
134 |
Initialize the PWM2 before calling this function. |
---|
135 |
|
---|
136 |
@Param |
---|
137 |
None |
---|
138 |
|
---|
139 |
@Returns |
---|
140 |
None |
---|
141 |
|
---|
142 |
@Example |
---|
143 |
<code> |
---|
144 |
// Initialize PWM2 module |
---|
145 |
|
---|
146 |
// Start PWM2 |
---|
147 |
PWM2_StartTimer(); |
---|
148 |
|
---|
149 |
// Do something else... |
---|
150 |
|
---|
151 |
// Stop PWM2; |
---|
152 |
PWM2_Stop(); |
---|
153 |
</code> |
---|
154 |
*/ |
---|
155 |
void PWM2_Stop(void); |
---|
156 |
|
---|
157 |
|
---|
158 |
/** |
---|
159 |
@Summary |
---|
160 |
This function used to check output status of PWM2. |
---|
161 |
|
---|
162 |
@Description |
---|
163 |
Check output status of PWM2 as High or Low. |
---|
164 |
|
---|
165 |
@Preconditions |
---|
166 |
Start the PWM2 before calling this function. |
---|
167 |
|
---|
168 |
@Param |
---|
169 |
None |
---|
170 |
|
---|
171 |
@Returns |
---|
172 |
true - Output High. |
---|
173 |
false - Output Low. |
---|
174 |
|
---|
175 |
@Example |
---|
176 |
<code> |
---|
177 |
|
---|
178 |
</code> |
---|
179 |
*/ |
---|
180 |
bool PWM2_CheckOutputStatus(void); |
---|
181 |
|
---|
182 |
/** |
---|
183 |
@Summary |
---|
184 |
This function is used to load buffer of PWM2 at the end of period. |
---|
185 |
|
---|
186 |
@Description |
---|
187 |
load buffer of PWM2 at the end of period. |
---|
188 |
|
---|
189 |
@Preconditions |
---|
190 |
Initialize the PWM2 before calling this function. |
---|
191 |
|
---|
192 |
@Param |
---|
193 |
None |
---|
194 |
|
---|
195 |
@Returns |
---|
196 |
None |
---|
197 |
|
---|
198 |
@Example |
---|
199 |
<code> |
---|
200 |
|
---|
201 |
</code> |
---|
202 |
*/ |
---|
203 |
void PWM2_LoadBufferSet(void); |
---|
204 |
|
---|
205 |
/** |
---|
206 |
@Summary |
---|
207 |
Load required 16 bit phase count |
---|
208 |
|
---|
209 |
@Description |
---|
210 |
Set the expected phase count |
---|
211 |
|
---|
212 |
@Preconditions |
---|
213 |
None |
---|
214 |
|
---|
215 |
@Param |
---|
216 |
Pass 16 bit phase count |
---|
217 |
|
---|
218 |
@Returns |
---|
219 |
None |
---|
220 |
|
---|
221 |
@Example |
---|
222 |
<code> |
---|
223 |
|
---|
224 |
</code> |
---|
225 |
*/ |
---|
226 |
void PWM2_PhaseSet(uint16_t phaseCount); |
---|
227 |
|
---|
228 |
/** |
---|
229 |
@Summary |
---|
230 |
Load required 16 bit Duty Cycle |
---|
231 |
|
---|
232 |
@Description |
---|
233 |
Set the expected Duty Cycle |
---|
234 |
|
---|
235 |
@Preconditions |
---|
236 |
None |
---|
237 |
|
---|
238 |
@Param |
---|
239 |
Pass 16 bit Duty Cycle |
---|
240 |
|
---|
241 |
@Returns |
---|
242 |
None |
---|
243 |
|
---|
244 |
@Example |
---|
245 |
<code> |
---|
246 |
|
---|
247 |
</code> |
---|
248 |
*/ |
---|
249 |
void PWM2_DutyCycleSet(uint16_t dutyCycleCount); |
---|
250 |
|
---|
251 |
/** |
---|
252 |
@Summary |
---|
253 |
Load required 16 bit Period |
---|
254 |
|
---|
255 |
@Description |
---|
256 |
Set the expected Period |
---|
257 |
|
---|
258 |
@Preconditions |
---|
259 |
None |
---|
260 |
|
---|
261 |
@Param |
---|
262 |
Pass 16 bit Period |
---|
263 |
|
---|
264 |
@Returns |
---|
265 |
None |
---|
266 |
|
---|
267 |
@Example |
---|
268 |
<code> |
---|
269 |
|
---|
270 |
</code> |
---|
271 |
*/ |
---|
272 |
void PWM2_PeriodSet(uint16_t periodCount); |
---|
273 |
|
---|
274 |
/** |
---|
275 |
@Summary |
---|
276 |
Load required 16 bit Offset |
---|
277 |
|
---|
278 |
@Description |
---|
279 |
Set the expected Offset |
---|
280 |
|
---|
281 |
@Preconditions |
---|
282 |
None |
---|
283 |
|
---|
284 |
@Param |
---|
285 |
Pass 16 bit Offset |
---|
286 |
|
---|
287 |
@Returns |
---|
288 |
None |
---|
289 |
|
---|
290 |
@Example |
---|
291 |
<code> |
---|
292 |
|
---|
293 |
</code> |
---|
294 |
*/ |
---|
295 |
void PWM2_OffsetSet(uint16_t offsetCount); |
---|
296 |
|
---|
297 |
/** |
---|
298 |
@Summary |
---|
299 |
Read measured Timer count |
---|
300 |
|
---|
301 |
@Description |
---|
302 |
Read the measured Timer count |
---|
303 |
* |
---|
304 |
@Preconditions |
---|
305 |
None |
---|
306 |
|
---|
307 |
@Param |
---|
308 |
None |
---|
309 |
|
---|
310 |
@Returns |
---|
311 |
Return 16 bit Timer count |
---|
312 |
|
---|
313 |
@Example |
---|
314 |
<code> |
---|
315 |
|
---|
316 |
</code> |
---|
317 |
*/ |
---|
318 |
uint16_t PWM2_TimerCountGet(void); |
---|
319 |
|
---|
320 |
/** |
---|
321 |
@Summary |
---|
322 |
Returns status of Offset interrupt flag bit (OFIF ). |
---|
323 |
|
---|
324 |
@Description |
---|
325 |
When PWMTMR = PWMOF value offset flag sets. |
---|
326 |
|
---|
327 |
@Preconditions |
---|
328 |
None |
---|
329 |
|
---|
330 |
@Param |
---|
331 |
None |
---|
332 |
|
---|
333 |
@Returns |
---|
334 |
true - PWMTMR >= PWMOF value |
---|
335 |
false - PWMTMR < PWMOF value |
---|
336 |
|
---|
337 |
@Example |
---|
338 |
<code> |
---|
339 |
|
---|
340 |
</code> |
---|
341 |
*/ |
---|
342 |
bool PWM2_IsOffsetMatchOccured(void); |
---|
343 |
|
---|
344 |
/** |
---|
345 |
@Summary |
---|
346 |
Returns status of Phase interrupt flag bit (PHIF ). |
---|
347 |
|
---|
348 |
@Description |
---|
349 |
When PWMTMR = PWMPH value, Phase flag sets. |
---|
350 |
|
---|
351 |
@Preconditions |
---|
352 |
None |
---|
353 |
|
---|
354 |
@Param |
---|
355 |
None |
---|
356 |
|
---|
357 |
@Returns |
---|
358 |
true - PWMTMR count is >= PWMPH value |
---|
359 |
false - PWMTMR count is < PWMPH value |
---|
360 |
|
---|
361 |
@Example |
---|
362 |
<code> |
---|
363 |
|
---|
364 |
</code> |
---|
365 |
*/ |
---|
366 |
bool PWM2_IsPhaseMatchOccured(void); |
---|
367 |
|
---|
368 |
/** |
---|
369 |
@Summary |
---|
370 |
Returns status of DutyCycle interrupt flag bit (DCIF ). |
---|
371 |
|
---|
372 |
@Description |
---|
373 |
When PWMTMR = PWMDC value DutyCycle flag sets. |
---|
374 |
|
---|
375 |
@Preconditions |
---|
376 |
None |
---|
377 |
|
---|
378 |
@Param |
---|
379 |
None |
---|
380 |
|
---|
381 |
@Returns |
---|
382 |
true - PWMTMR count is >= PWMDC value |
---|
383 |
false - PWMTMR count is < PWMDC value |
---|
384 |
|
---|
385 |
@Example |
---|
386 |
<code> |
---|
387 |
|
---|
388 |
</code> |
---|
389 |
*/ |
---|
390 |
bool PWM2_IsDutyCycleMatchOccured(void); |
---|
391 |
|
---|
392 |
/** |
---|
393 |
@Summary |
---|
394 |
Returns status of Period interrupt flag bit (PRIF ). |
---|
395 |
|
---|
396 |
@Description |
---|
397 |
When PWMTMR = PWMPR value offset flag sets. |
---|
398 |
|
---|
399 |
@Preconditions |
---|
400 |
None |
---|
401 |
|
---|
402 |
@Param |
---|
403 |
None |
---|
404 |
|
---|
405 |
@Returns |
---|
406 |
true - PWMTMR count is >= PWMPR value |
---|
407 |
false - PWMTMR count is < PWMPR value |
---|
408 |
|
---|
409 |
@Example |
---|
410 |
<code> |
---|
411 |
|
---|
412 |
</code> |
---|
413 |
*/ |
---|
414 |
bool PWM2_IsPeriodMatchOccured(void); |
---|
415 |
|
---|
416 |
#endif /* PWM2_H */ |
---|
417 |
/** |
---|
418 |
End of File |
---|
419 |
*/ |
---|